src/HOL/ZF/HOLZF.thy
changeset 35416 d8d7d1b785af
parent 33057 764547b68538
child 35502 3d105282262e
equal deleted inserted replaced
35342:4dc65845eab3 35416:d8d7d1b785af
    17   Sum :: "ZF \<Rightarrow> ZF" and
    17   Sum :: "ZF \<Rightarrow> ZF" and
    18   Power :: "ZF \<Rightarrow> ZF" and
    18   Power :: "ZF \<Rightarrow> ZF" and
    19   Repl :: "ZF \<Rightarrow> (ZF \<Rightarrow> ZF) \<Rightarrow> ZF" and
    19   Repl :: "ZF \<Rightarrow> (ZF \<Rightarrow> ZF) \<Rightarrow> ZF" and
    20   Inf :: ZF
    20   Inf :: ZF
    21 
    21 
    22 constdefs
    22 definition Upair :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
    23   Upair:: "ZF \<Rightarrow> ZF \<Rightarrow> ZF"
       
    24   "Upair a b == Repl (Power (Power Empty)) (% x. if x = Empty then a else b)"
    23   "Upair a b == Repl (Power (Power Empty)) (% x. if x = Empty then a else b)"
    25   Singleton:: "ZF \<Rightarrow> ZF"
    24 
       
    25 definition Singleton:: "ZF \<Rightarrow> ZF" where
    26   "Singleton x == Upair x x"
    26   "Singleton x == Upair x x"
    27   union :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF"
    27 
       
    28 definition union :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
    28   "union A B == Sum (Upair A B)"
    29   "union A B == Sum (Upair A B)"
    29   SucNat:: "ZF \<Rightarrow> ZF"
    30 
       
    31 definition SucNat:: "ZF \<Rightarrow> ZF" where
    30   "SucNat x == union x (Singleton x)"
    32   "SucNat x == union x (Singleton x)"
    31   subset :: "ZF \<Rightarrow> ZF \<Rightarrow> bool"
    33 
       
    34 definition subset :: "ZF \<Rightarrow> ZF \<Rightarrow> bool" where
    32   "subset A B == ! x. Elem x A \<longrightarrow> Elem x B"
    35   "subset A B == ! x. Elem x A \<longrightarrow> Elem x B"
    33 
    36 
    34 axioms
    37 axioms
    35   Empty: "Not (Elem x Empty)"
    38   Empty: "Not (Elem x Empty)"
    36   Ext: "(x = y) = (! z. Elem z x = Elem z y)"
    39   Ext: "(x = y) = (! z. Elem z x = Elem z y)"
    38   Power: "Elem y (Power x) = (subset y x)"
    41   Power: "Elem y (Power x) = (subset y x)"
    39   Repl: "Elem b (Repl A f) = (? a. Elem a A & b = f a)"
    42   Repl: "Elem b (Repl A f) = (? a. Elem a A & b = f a)"
    40   Regularity: "A \<noteq> Empty \<longrightarrow> (? x. Elem x A & (! y. Elem y x \<longrightarrow> Not (Elem y A)))"
    43   Regularity: "A \<noteq> Empty \<longrightarrow> (? x. Elem x A & (! y. Elem y x \<longrightarrow> Not (Elem y A)))"
    41   Infinity: "Elem Empty Inf & (! x. Elem x Inf \<longrightarrow> Elem (SucNat x) Inf)"
    44   Infinity: "Elem Empty Inf & (! x. Elem x Inf \<longrightarrow> Elem (SucNat x) Inf)"
    42 
    45 
    43 constdefs
    46 definition Sep :: "ZF \<Rightarrow> (ZF \<Rightarrow> bool) \<Rightarrow> ZF" where
    44   Sep:: "ZF \<Rightarrow> (ZF \<Rightarrow> bool) \<Rightarrow> ZF"
       
    45   "Sep A p == (if (!x. Elem x A \<longrightarrow> Not (p x)) then Empty else 
    47   "Sep A p == (if (!x. Elem x A \<longrightarrow> Not (p x)) then Empty else 
    46   (let z = (\<some> x. Elem x A & p x) in
    48   (let z = (\<some> x. Elem x A & p x) in
    47    let f = % x. (if p x then x else z) in Repl A f))" 
    49    let f = % x. (if p x then x else z) in Repl A f))" 
    48 
    50 
    49 thm Power[unfolded subset_def]
    51 thm Power[unfolded subset_def]
    68   done
    70   done
    69 
    71 
    70 lemma Singleton: "Elem x (Singleton y) = (x = y)"
    72 lemma Singleton: "Elem x (Singleton y) = (x = y)"
    71   by (simp add: Singleton_def Upair)
    73   by (simp add: Singleton_def Upair)
    72 
    74 
    73 constdefs 
    75 definition Opair :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
    74   Opair:: "ZF \<Rightarrow> ZF \<Rightarrow> ZF"
       
    75   "Opair a b == Upair (Upair a a) (Upair a b)"
    76   "Opair a b == Upair (Upair a a) (Upair a b)"
    76 
    77 
    77 lemma Upair_singleton: "(Upair a a = Upair c d) = (a = c & a = d)"
    78 lemma Upair_singleton: "(Upair a a = Upair c d) = (a = c & a = d)"
    78   by (auto simp add: Ext[where x="Upair a a"] Upair)
    79   by (auto simp add: Ext[where x="Upair a a"] Upair)
    79 
    80 
    97       apply (frule fst)
    98       apply (frule fst)
    98       apply (auto simp add: Opair_def Upair_fsteq)
    99       apply (auto simp add: Opair_def Upair_fsteq)
    99       done
   100       done
   100   qed
   101   qed
   101 
   102 
   102 constdefs 
   103 definition Replacement :: "ZF \<Rightarrow> (ZF \<Rightarrow> ZF option) \<Rightarrow> ZF" where
   103   Replacement :: "ZF \<Rightarrow> (ZF \<Rightarrow> ZF option) \<Rightarrow> ZF"
       
   104   "Replacement A f == Repl (Sep A (% a. f a \<noteq> None)) (the o f)"
   104   "Replacement A f == Repl (Sep A (% a. f a \<noteq> None)) (the o f)"
   105 
   105 
   106 theorem Replacement: "Elem y (Replacement A f) = (? x. Elem x A & f x = Some y)"
   106 theorem Replacement: "Elem y (Replacement A f) = (? x. Elem x A & f x = Some y)"
   107   by (auto simp add: Replacement_def Repl Sep) 
   107   by (auto simp add: Replacement_def Repl Sep) 
   108 
   108 
   109 constdefs
   109 definition Fst :: "ZF \<Rightarrow> ZF" where
   110   Fst :: "ZF \<Rightarrow> ZF"
       
   111   "Fst q == SOME x. ? y. q = Opair x y"
   110   "Fst q == SOME x. ? y. q = Opair x y"
   112   Snd :: "ZF \<Rightarrow> ZF"
   111 
       
   112 definition Snd :: "ZF \<Rightarrow> ZF" where
   113   "Snd q == SOME y. ? x. q = Opair x y"
   113   "Snd q == SOME y. ? x. q = Opair x y"
   114 
   114 
   115 theorem Fst: "Fst (Opair x y) = x"
   115 theorem Fst: "Fst (Opair x y) = x"
   116   apply (simp add: Fst_def)
   116   apply (simp add: Fst_def)
   117   apply (rule someI2)
   117   apply (rule someI2)
   122   apply (simp add: Snd_def)
   122   apply (simp add: Snd_def)
   123   apply (rule someI2)
   123   apply (rule someI2)
   124   apply (simp_all add: Opair)
   124   apply (simp_all add: Opair)
   125   done
   125   done
   126 
   126 
   127 constdefs 
   127 definition isOpair :: "ZF \<Rightarrow> bool" where
   128   isOpair :: "ZF \<Rightarrow> bool"
       
   129   "isOpair q == ? x y. q = Opair x y"
   128   "isOpair q == ? x y. q = Opair x y"
   130 
   129 
   131 lemma isOpair: "isOpair (Opair x y) = True"
   130 lemma isOpair: "isOpair (Opair x y) = True"
   132   by (auto simp add: isOpair_def)
   131   by (auto simp add: isOpair_def)
   133 
   132 
   134 lemma FstSnd: "isOpair x \<Longrightarrow> Opair (Fst x) (Snd x) = x"
   133 lemma FstSnd: "isOpair x \<Longrightarrow> Opair (Fst x) (Snd x) = x"
   135   by (auto simp add: isOpair_def Fst Snd)
   134   by (auto simp add: isOpair_def Fst Snd)
   136   
   135   
   137 constdefs
   136 definition CartProd :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
   138   CartProd :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF"
       
   139   "CartProd A B == Sum(Repl A (% a. Repl B (% b. Opair a b)))"
   137   "CartProd A B == Sum(Repl A (% a. Repl B (% b. Opair a b)))"
   140 
   138 
   141 lemma CartProd: "Elem x (CartProd A B) = (? a b. Elem a A & Elem b B & x = (Opair a b))"
   139 lemma CartProd: "Elem x (CartProd A B) = (? a b. Elem a A & Elem b B & x = (Opair a b))"
   142   apply (auto simp add: CartProd_def Sum Repl)
   140   apply (auto simp add: CartProd_def Sum Repl)
   143   apply (rule_tac x="Repl B (Opair a)" in exI)
   141   apply (rule_tac x="Repl B (Opair a)" in exI)
   144   apply (auto simp add: Repl)
   142   apply (auto simp add: Repl)
   145   done
   143   done
   146 
   144 
   147 constdefs
   145 definition explode :: "ZF \<Rightarrow> ZF set" where
   148   explode :: "ZF \<Rightarrow> ZF set"
       
   149   "explode z == { x. Elem x z }"
   146   "explode z == { x. Elem x z }"
   150 
   147 
   151 lemma explode_Empty: "(explode x = {}) = (x = Empty)"
   148 lemma explode_Empty: "(explode x = {}) = (x = Empty)"
   152   by (auto simp add: explode_def Ext Empty)
   149   by (auto simp add: explode_def Ext Empty)
   153 
   150 
   161   by (simp add: explode_def expand_set_eq CartProd image_def)
   158   by (simp add: explode_def expand_set_eq CartProd image_def)
   162 
   159 
   163 lemma explode_Repl_eq: "explode (Repl A f) = image f (explode A)"
   160 lemma explode_Repl_eq: "explode (Repl A f) = image f (explode A)"
   164   by (simp add: explode_def Repl image_def)
   161   by (simp add: explode_def Repl image_def)
   165 
   162 
   166 constdefs
   163 definition Domain :: "ZF \<Rightarrow> ZF" where
   167   Domain :: "ZF \<Rightarrow> ZF"
       
   168   "Domain f == Replacement f (% p. if isOpair p then Some (Fst p) else None)"
   164   "Domain f == Replacement f (% p. if isOpair p then Some (Fst p) else None)"
   169   Range :: "ZF \<Rightarrow> ZF"
   165 
       
   166 definition Range :: "ZF \<Rightarrow> ZF" where
   170   "Range f == Replacement f (% p. if isOpair p then Some (Snd p) else None)"
   167   "Range f == Replacement f (% p. if isOpair p then Some (Snd p) else None)"
   171 
   168 
   172 theorem Domain: "Elem x (Domain f) = (? y. Elem (Opair x y) f)"
   169 theorem Domain: "Elem x (Domain f) = (? y. Elem (Opair x y) f)"
   173   apply (auto simp add: Domain_def Replacement)
   170   apply (auto simp add: Domain_def Replacement)
   174   apply (rule_tac x="Snd x" in exI)
   171   apply (rule_tac x="Snd x" in exI)
   186   done
   183   done
   187 
   184 
   188 theorem union: "Elem x (union A B) = (Elem x A | Elem x B)"
   185 theorem union: "Elem x (union A B) = (Elem x A | Elem x B)"
   189   by (auto simp add: union_def Sum Upair)
   186   by (auto simp add: union_def Sum Upair)
   190 
   187 
   191 constdefs
   188 definition Field :: "ZF \<Rightarrow> ZF" where
   192   Field :: "ZF \<Rightarrow> ZF"
       
   193   "Field A == union (Domain A) (Range A)"
   189   "Field A == union (Domain A) (Range A)"
   194 
   190 
   195 constdefs
   191 definition app :: "ZF \<Rightarrow> ZF => ZF" (infixl "\<acute>" 90) --{*function application*} where
   196   app :: "ZF \<Rightarrow> ZF => ZF"    (infixl "\<acute>" 90) --{*function application*} 
       
   197   "f \<acute> x == (THE y. Elem (Opair x y) f)"
   192   "f \<acute> x == (THE y. Elem (Opair x y) f)"
   198 
   193 
   199 constdefs
   194 definition isFun :: "ZF \<Rightarrow> bool" where
   200   isFun :: "ZF \<Rightarrow> bool"
       
   201   "isFun f == (! x y1 y2. Elem (Opair x y1) f & Elem (Opair x y2) f \<longrightarrow> y1 = y2)"
   195   "isFun f == (! x y1 y2. Elem (Opair x y1) f & Elem (Opair x y2) f \<longrightarrow> y1 = y2)"
   202 
   196 
   203 constdefs
   197 definition Lambda :: "ZF \<Rightarrow> (ZF \<Rightarrow> ZF) \<Rightarrow> ZF" where
   204   Lambda :: "ZF \<Rightarrow> (ZF \<Rightarrow> ZF) \<Rightarrow> ZF"
       
   205   "Lambda A f == Repl A (% x. Opair x (f x))"
   198   "Lambda A f == Repl A (% x. Opair x (f x))"
   206 
   199 
   207 lemma Lambda_app: "Elem x A \<Longrightarrow> (Lambda A f)\<acute>x = f x"
   200 lemma Lambda_app: "Elem x A \<Longrightarrow> (Lambda A f)\<acute>x = f x"
   208   by (simp add: app_def Lambda_def Repl Opair)
   201   by (simp add: app_def Lambda_def Repl Opair)
   209 
   202 
   236     apply (auto simp add: Lambda_def Repl Ext)
   229     apply (auto simp add: Lambda_def Repl Ext)
   237     apply (auto simp add: Ext[symmetric])
   230     apply (auto simp add: Ext[symmetric])
   238     done
   231     done
   239 qed
   232 qed
   240 
   233 
   241 constdefs 
   234 definition PFun :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
   242   PFun :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF"
       
   243   "PFun A B == Sep (Power (CartProd A B)) isFun"
   235   "PFun A B == Sep (Power (CartProd A B)) isFun"
   244   Fun :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF"
   236 
       
   237 definition Fun :: "ZF \<Rightarrow> ZF \<Rightarrow> ZF" where
   245   "Fun A B == Sep (PFun A B) (\<lambda> f. Domain f = A)"
   238   "Fun A B == Sep (PFun A B) (\<lambda> f. Domain f = A)"
   246 
   239 
   247 lemma Fun_Range: "Elem f (Fun U V) \<Longrightarrow> subset (Range f) V"
   240 lemma Fun_Range: "Elem f (Fun U V) \<Longrightarrow> subset (Range f) V"
   248   apply (simp add: Fun_def Sep PFun_def Power subset_def CartProd)
   241   apply (simp add: Fun_def Sep PFun_def Power subset_def CartProd)
   249   apply (auto simp add: Domain Range)
   242   apply (auto simp add: Domain Range)
   341     apply (auto simp add: Lambda_def Repl Fst)
   334     apply (auto simp add: Lambda_def Repl Fst)
   342     done
   335     done
   343 qed    
   336 qed    
   344 
   337 
   345 
   338 
   346 constdefs
   339 definition is_Elem_of :: "(ZF * ZF) set" where
   347   is_Elem_of :: "(ZF * ZF) set"
       
   348   "is_Elem_of == { (a,b) | a b. Elem a b }"
   340   "is_Elem_of == { (a,b) | a b. Elem a b }"
   349 
   341 
   350 lemma cond_wf_Elem:
   342 lemma cond_wf_Elem:
   351   assumes hyps:"\<forall>x. (\<forall>y. Elem y x \<longrightarrow> Elem y U \<longrightarrow> P y) \<longrightarrow> Elem x U \<longrightarrow> P x" "Elem a U"
   343   assumes hyps:"\<forall>x. (\<forall>y. Elem y x \<longrightarrow> Elem y U \<longrightarrow> P y) \<longrightarrow> Elem x U \<longrightarrow> P x" "Elem a U"
   352   shows "P a"
   344   shows "P a"
   415 
   407 
   416 primrec
   408 primrec
   417 nat2Nat_0[intro]:  "nat2Nat 0 = Empty"
   409 nat2Nat_0[intro]:  "nat2Nat 0 = Empty"
   418 nat2Nat_Suc[intro]:  "nat2Nat (Suc n) = SucNat (nat2Nat n)"
   410 nat2Nat_Suc[intro]:  "nat2Nat (Suc n) = SucNat (nat2Nat n)"
   419 
   411 
   420 constdefs
   412 definition Nat2nat :: "ZF \<Rightarrow> nat" where
   421   Nat2nat :: "ZF \<Rightarrow> nat"
       
   422   "Nat2nat == inv nat2Nat"
   413   "Nat2nat == inv nat2Nat"
   423 
   414 
   424 lemma Elem_nat2Nat_inf[intro]: "Elem (nat2Nat n) Inf"
   415 lemma Elem_nat2Nat_inf[intro]: "Elem (nat2Nat n) Inf"
   425   apply (induct n)
   416   apply (induct n)
   426   apply (simp_all add: Infinity)
   417   apply (simp_all add: Infinity)
   427   done
   418   done
   428 
   419 
   429 constdefs
   420 definition Nat :: ZF
   430   Nat :: ZF
   421  where  "Nat == Sep Inf (\<lambda> N. ? n. nat2Nat n = N)"
   431   "Nat == Sep Inf (\<lambda> N. ? n. nat2Nat n = N)"
       
   432 
   422 
   433 lemma Elem_nat2Nat_Nat[intro]: "Elem (nat2Nat n) Nat"
   423 lemma Elem_nat2Nat_Nat[intro]: "Elem (nat2Nat n) Nat"
   434   by (auto simp add: Nat_def Sep)
   424   by (auto simp add: Nat_def Sep)
   435 
   425 
   436 lemma Elem_Empty_Nat: "Elem Empty Nat"
   426 lemma Elem_Empty_Nat: "Elem Empty Nat"
   662     then have "Elem R R" by (simp add: russell explode_def)
   652     then have "Elem R R" by (simp add: russell explode_def)
   663     with False show ?thesis by auto
   653     with False show ?thesis by auto
   664   qed
   654   qed
   665 qed
   655 qed
   666 
   656 
   667 constdefs 
   657 definition SpecialR :: "(ZF * ZF) set" where
   668   SpecialR :: "(ZF * ZF) set"
       
   669   "SpecialR \<equiv> { (x, y) . x \<noteq> Empty \<and> y = Empty}"
   658   "SpecialR \<equiv> { (x, y) . x \<noteq> Empty \<and> y = Empty}"
   670 
   659 
   671 lemma "wf SpecialR"
   660 lemma "wf SpecialR"
   672   apply (subst wf_def)
   661   apply (subst wf_def)
   673   apply (auto simp add: SpecialR_def)
   662   apply (auto simp add: SpecialR_def)
   674   done
   663   done
   675 
   664 
   676 constdefs
   665 definition Ext :: "('a * 'b) set \<Rightarrow> 'b \<Rightarrow> 'a set" where
   677   Ext :: "('a * 'b) set \<Rightarrow> 'b \<Rightarrow> 'a set"
       
   678   "Ext R y \<equiv> { x . (x, y) \<in> R }" 
   666   "Ext R y \<equiv> { x . (x, y) \<in> R }" 
   679 
   667 
   680 lemma Ext_Elem: "Ext is_Elem_of = explode"
   668 lemma Ext_Elem: "Ext is_Elem_of = explode"
   681   by (auto intro: ext simp add: Ext_def is_Elem_of_def explode_def)
   669   by (auto intro: ext simp add: Ext_def is_Elem_of_def explode_def)
   682 
   670 
   688   ultimately have "UNIV = explode(union z (Singleton Empty)) "
   676   ultimately have "UNIV = explode(union z (Singleton Empty)) "
   689     by (auto simp add: explode_def union Singleton)
   677     by (auto simp add: explode_def union Singleton)
   690   then show "False" by (simp add: UNIV_is_not_in_ZF)
   678   then show "False" by (simp add: UNIV_is_not_in_ZF)
   691 qed
   679 qed
   692 
   680 
   693 constdefs 
   681 definition implode :: "ZF set \<Rightarrow> ZF" where
   694   implode :: "ZF set \<Rightarrow> ZF"
       
   695   "implode == inv explode"
   682   "implode == inv explode"
   696 
   683 
   697 lemma inj_explode: "inj explode"
   684 lemma inj_explode: "inj explode"
   698   by (auto simp add: inj_on_def explode_def Ext)
   685   by (auto simp add: inj_on_def explode_def Ext)
   699 
   686 
   700 lemma implode_explode[simp]: "implode (explode x) = x"
   687 lemma implode_explode[simp]: "implode (explode x) = x"
   701   by (simp add: implode_def inj_explode)
   688   by (simp add: implode_def inj_explode)
   702 
   689 
   703 constdefs
   690 definition regular :: "(ZF * ZF) set \<Rightarrow> bool" where
   704   regular :: "(ZF * ZF) set \<Rightarrow> bool"
       
   705   "regular R == ! A. A \<noteq> Empty \<longrightarrow> (? x. Elem x A & (! y. (y, x) \<in> R \<longrightarrow> Not (Elem y A)))"
   691   "regular R == ! A. A \<noteq> Empty \<longrightarrow> (? x. Elem x A & (! y. (y, x) \<in> R \<longrightarrow> Not (Elem y A)))"
   706   set_like :: "(ZF * ZF) set \<Rightarrow> bool"
   692 
       
   693 definition set_like :: "(ZF * ZF) set \<Rightarrow> bool" where
   707   "set_like R == ! y. Ext R y \<in> range explode"
   694   "set_like R == ! y. Ext R y \<in> range explode"
   708   wfzf :: "(ZF * ZF) set \<Rightarrow> bool"
   695 
       
   696 definition wfzf :: "(ZF * ZF) set \<Rightarrow> bool" where
   709   "wfzf R == regular R & set_like R"
   697   "wfzf R == regular R & set_like R"
   710 
   698 
   711 lemma regular_Elem: "regular is_Elem_of"
   699 lemma regular_Elem: "regular is_Elem_of"
   712   by (simp add: regular_def is_Elem_of_def Regularity)
   700   by (simp add: regular_def is_Elem_of_def Regularity)
   713 
   701 
   715   by (auto simp add: set_like_def image_def Ext_Elem)
   703   by (auto simp add: set_like_def image_def Ext_Elem)
   716 
   704 
   717 lemma wfzf_is_Elem_of: "wfzf is_Elem_of"
   705 lemma wfzf_is_Elem_of: "wfzf is_Elem_of"
   718   by (auto simp add: wfzf_def regular_Elem set_like_Elem)
   706   by (auto simp add: wfzf_def regular_Elem set_like_Elem)
   719 
   707 
   720 constdefs
   708 definition SeqSum :: "(nat \<Rightarrow> ZF) \<Rightarrow> ZF" where
   721   SeqSum :: "(nat \<Rightarrow> ZF) \<Rightarrow> ZF"
       
   722   "SeqSum f == Sum (Repl Nat (f o Nat2nat))"
   709   "SeqSum f == Sum (Repl Nat (f o Nat2nat))"
   723 
   710 
   724 lemma SeqSum: "Elem x (SeqSum f) = (? n. Elem x (f n))"
   711 lemma SeqSum: "Elem x (SeqSum f) = (? n. Elem x (f n))"
   725   apply (auto simp add: SeqSum_def Sum Repl)
   712   apply (auto simp add: SeqSum_def Sum Repl)
   726   apply (rule_tac x = "f n" in exI)
   713   apply (rule_tac x = "f n" in exI)
   727   apply auto
   714   apply auto
   728   done
   715   done
   729 
   716 
   730 constdefs
   717 definition Ext_ZF :: "(ZF * ZF) set \<Rightarrow> ZF \<Rightarrow> ZF" where
   731   Ext_ZF :: "(ZF * ZF) set \<Rightarrow> ZF \<Rightarrow> ZF"
       
   732   "Ext_ZF R s == implode (Ext R s)"
   718   "Ext_ZF R s == implode (Ext R s)"
   733 
   719 
   734 lemma Elem_implode: "A \<in> range explode \<Longrightarrow> Elem x (implode A) = (x \<in> A)"
   720 lemma Elem_implode: "A \<in> range explode \<Longrightarrow> Elem x (implode A) = (x \<in> A)"
   735   apply (auto)
   721   apply (auto)
   736   apply (simp_all add: explode_def)
   722   apply (simp_all add: explode_def)
   748 
   734 
   749 primrec
   735 primrec
   750   "Ext_ZF_n R s 0 = Ext_ZF R s"
   736   "Ext_ZF_n R s 0 = Ext_ZF R s"
   751   "Ext_ZF_n R s (Suc n) = Sum (Repl (Ext_ZF_n R s n) (Ext_ZF R))"
   737   "Ext_ZF_n R s (Suc n) = Sum (Repl (Ext_ZF_n R s n) (Ext_ZF R))"
   752 
   738 
   753 constdefs
   739 definition Ext_ZF_hull :: "(ZF * ZF) set \<Rightarrow> ZF \<Rightarrow> ZF" where
   754   Ext_ZF_hull :: "(ZF * ZF) set \<Rightarrow> ZF \<Rightarrow> ZF"
       
   755   "Ext_ZF_hull R s == SeqSum (Ext_ZF_n R s)"
   740   "Ext_ZF_hull R s == SeqSum (Ext_ZF_n R s)"
   756 
   741 
   757 lemma Elem_Ext_ZF_hull:
   742 lemma Elem_Ext_ZF_hull:
   758   assumes set_like_R: "set_like R" 
   743   assumes set_like_R: "set_like R" 
   759   shows "Elem x (Ext_ZF_hull R S) = (? n. Elem x (Ext_ZF_n R S n))"
   744   shows "Elem x (Ext_ZF_hull R S) = (? n. Elem x (Ext_ZF_n R S n))"