Theory Forcing_Data

section‹Transitive set models of ZF›
text‹This theory defines locales for countable transitive models of $\ZF$,
and on top of that, one that includes a forcing notion. Weakened versions
of both locales are included, that only assume finitely many replacement
instances.›

theory Forcing_Data
  imports
    Forcing_Notions
    Cohen_Posets_Relative
    ZF_Trans_Interpretations
begin

no_notation Aleph (_› [90] 90)

subsection‹A forcing locale and generic filters›

text‹Ideally, countability should be separated from the assumption of this locale.
The fact is that our present proofs of the ``definition of forces'' (and many
consequences) and of the lemma for ``forcing a value'' of function
unnecessarily depend on the countability of the ground model. ›

locale forcing_data1 = forcing_notion + M_ctm1 +
  assumes P_in_M:           "  M"
    and leq_in_M:         "leq  M"

locale forcing_data2 = forcing_data1 + M_ctm2_AC

locale forcing_data3 = forcing_data2 + M_ctm3_AC

context forcing_data1
begin

lemma P_sub_M : "  M"
  using transitivity P_in_M by auto

definition
  M_generic :: "io" where
  "M_generic(G)  filter(G)  (DM. D  dense(D)DG0)"

declare iff_trans [trans]

lemma M_generic_imp_filter[dest]: "M_generic(G)  filter(G)"
  unfolding M_generic_def by blast

lemma generic_filter_existence:
  "p  G. pG  M_generic(G)"
proof -
  assume "p"
  let ?D="λnnat. (if (enum`n  dense(enum`n))  then enum`n else )"
  have "nnat. ?D`n  Pow()"
    by auto
  then
  have "?D:natPow()"
    using lam_type by auto
  have "nnat. dense(?D`n)"
  proof(intro ballI)
    fix n
    assume "nnat"
    then
    have "dense(?D`n)  dense(if enum`n    dense(enum`n) then enum`n else )"
      by simp
    also
    have "...   (¬(enum`n    dense(enum`n))  dense()) "
      using split_if by simp
    finally
    show "dense(?D`n)"
      using P_dense nnat by auto
  qed
  with ?D_
  interpret cg: countable_generic  leq 𝟭 ?D
    by (unfold_locales, auto)
  from p
  obtain G where 1: "pG  filter(G)  (nnat.(?D`n)G0)"
    using cg.countable_rasiowa_sikorski[where M="λ_. M"]  P_sub_M
      M_countable[THEN bij_is_fun] M_countable[THEN bij_is_surj, THEN surj_range]
    unfolding cg.D_generic_def by blast
  then
  have "(DM. D  dense(D)DG0)"
  proof (intro ballI impI)
    fix D
    assume "DM" and 2: "D    dense(D) "
    moreover
    have "yM. xnat. enum`x= y"
      using M_countable and  bij_is_surj unfolding surj_def by (simp)
    moreover from calculation
    obtain n where Eq10: "nnat  enum`n = D"
      by auto
    moreover from calculation if_P
    have "?D`n = D"
      by simp
    moreover
    note 1
    ultimately
    show "DG0"
      by auto
  qed
  with 1
  show ?thesis
    unfolding M_generic_def by auto
qed

lemma one_in_M: "𝟭  M"
  using one_in_P P_in_M transitivity
  by simp

declare P_in_M [simp,intro]
declare one_in_M [simp,intro]
declare leq_in_M [simp,intro]
declare one_in_P [intro]

end ― ‹localeforcing_data1

locale G_generic1 = forcing_data1 +
  fixes G :: "i"
  assumes generic : "M_generic(G)"
begin

lemma G_nonempty: "G0"
  using generic subset_refl[of ] P_dense
  unfolding M_generic_def
  by auto

lemma M_genericD [dest]: "xG  x"
  using generic
  by (blast dest:filterD)

lemma M_generic_leqD [dest]: "pG  q  pq  qG"
  using generic
  by (blast dest:filter_leqD)

lemma M_generic_compatD [dest]: "pG  rG  qG. qp  qr"
  using generic
  by (blast dest:low_bound_filter)

lemma M_generic_denseD [dest]: "dense(D)  D  DM  qG. qD"
  using generic
  unfolding M_generic_def by blast

lemma G_subset_P: "G"
  using generic by auto

lemma one_in_G : "𝟭  G"
proof -
  have "increasing(G)"
    using generic
    unfolding M_generic_def filter_def by simp
  then
  show ?thesis
    using G_nonempty one_max
    unfolding increasing_def by blast
qed

lemma G_subset_M: "G  M"
  using generic transitivity[OF _ P_in_M] by auto

end ― ‹localeG_generic1

locale G_generic1_AC = G_generic1 + M_ctm1_AC

end