src/HOL/ZF/HOLZF.thy
changeset 20565 4440dd392048
parent 20217 25b068a99d2b
child 22690 0b08f218f260
equal deleted inserted replaced
20564:6857bd9f1a79 20565:4440dd392048
   699   by (simp add: implode_def inj_explode)
   699   by (simp add: implode_def inj_explode)
   700 
   700 
   701 constdefs
   701 constdefs
   702   regular :: "(ZF * ZF) set \<Rightarrow> bool"
   702   regular :: "(ZF * ZF) set \<Rightarrow> bool"
   703   "regular R == ! A. A \<noteq> Empty \<longrightarrow> (? x. Elem x A & (! y. (y, x) \<in> R \<longrightarrow> Not (Elem y A)))"
   703   "regular R == ! A. A \<noteq> Empty \<longrightarrow> (? x. Elem x A & (! y. (y, x) \<in> R \<longrightarrow> Not (Elem y A)))"
   704   implodeable_Ext :: "(ZF * ZF) set \<Rightarrow> bool"
   704   set_like :: "(ZF * ZF) set \<Rightarrow> bool"
   705   "implodeable_Ext R == ! y. Ext R y \<in> range explode"
   705   "set_like R == ! y. Ext R y \<in> range explode"
   706   wfzf :: "(ZF * ZF) set \<Rightarrow> bool"
   706   wfzf :: "(ZF * ZF) set \<Rightarrow> bool"
   707   "wfzf R == regular R & implodeable_Ext R"
   707   "wfzf R == regular R & set_like R"
   708 
   708 
   709 lemma regular_Elem: "regular is_Elem_of"
   709 lemma regular_Elem: "regular is_Elem_of"
   710   by (simp add: regular_def is_Elem_of_def Regularity)
   710   by (simp add: regular_def is_Elem_of_def Regularity)
   711 
   711 
   712 lemma implodeable_Elem: "implodeable_Ext is_Elem_of"
   712 lemma set_like_Elem: "set_like is_Elem_of"
   713   by (auto simp add: implodeable_Ext_def image_def Ext_Elem)
   713   by (auto simp add: set_like_def image_def Ext_Elem)
   714 
   714 
   715 lemma wfzf_is_Elem_of: "wfzf is_Elem_of"
   715 lemma wfzf_is_Elem_of: "wfzf is_Elem_of"
   716   by (auto simp add: wfzf_def regular_Elem implodeable_Elem)
   716   by (auto simp add: wfzf_def regular_Elem set_like_Elem)
   717 
   717 
   718 constdefs
   718 constdefs
   719   SeqSum :: "(nat \<Rightarrow> ZF) \<Rightarrow> ZF"
   719   SeqSum :: "(nat \<Rightarrow> ZF) \<Rightarrow> ZF"
   720   "SeqSum f == Sum (Repl Nat (f o Nat2nat))"
   720   "SeqSum f == Sum (Repl Nat (f o Nat2nat))"
   721 
   721 
   732 lemma Elem_implode: "A \<in> range explode \<Longrightarrow> Elem x (implode A) = (x \<in> A)"
   732 lemma Elem_implode: "A \<in> range explode \<Longrightarrow> Elem x (implode A) = (x \<in> A)"
   733   apply (auto)
   733   apply (auto)
   734   apply (simp_all add: explode_def)
   734   apply (simp_all add: explode_def)
   735   done
   735   done
   736 
   736 
   737 lemma Elem_Ext_ZF: "implodeable_Ext R \<Longrightarrow> Elem x (Ext_ZF R s) = ((x,s) \<in> R)"
   737 lemma Elem_Ext_ZF: "set_like R \<Longrightarrow> Elem x (Ext_ZF R s) = ((x,s) \<in> R)"
   738   apply (simp add: Ext_ZF_def)
   738   apply (simp add: Ext_ZF_def)
   739   apply (subst Elem_implode)
   739   apply (subst Elem_implode)
   740   apply (simp add: implodeable_Ext_def)
   740   apply (simp add: set_like_def)
   741   apply (simp add: Ext_def)
   741   apply (simp add: Ext_def)
   742   done
   742   done
   743 
   743 
   744 consts
   744 consts
   745   Ext_ZF_n :: "(ZF * ZF) set \<Rightarrow> ZF \<Rightarrow> nat \<Rightarrow> ZF"
   745   Ext_ZF_n :: "(ZF * ZF) set \<Rightarrow> ZF \<Rightarrow> nat \<Rightarrow> ZF"
   751 constdefs
   751 constdefs
   752   Ext_ZF_hull :: "(ZF * ZF) set \<Rightarrow> ZF \<Rightarrow> ZF"
   752   Ext_ZF_hull :: "(ZF * ZF) set \<Rightarrow> ZF \<Rightarrow> ZF"
   753   "Ext_ZF_hull R s == SeqSum (Ext_ZF_n R s)"
   753   "Ext_ZF_hull R s == SeqSum (Ext_ZF_n R s)"
   754 
   754 
   755 lemma Elem_Ext_ZF_hull:
   755 lemma Elem_Ext_ZF_hull:
   756   assumes implodeable_R: "implodeable_Ext R" 
   756   assumes set_like_R: "set_like R" 
   757   shows "Elem x (Ext_ZF_hull R S) = (? n. Elem x (Ext_ZF_n R S n))"
   757   shows "Elem x (Ext_ZF_hull R S) = (? n. Elem x (Ext_ZF_n R S n))"
   758   by (simp add: Ext_ZF_hull_def SeqSum)
   758   by (simp add: Ext_ZF_hull_def SeqSum)
   759   
   759   
   760 lemma Elem_Elem_Ext_ZF_hull:
   760 lemma Elem_Elem_Ext_ZF_hull:
   761   assumes implodeable_R: "implodeable_Ext R" 
   761   assumes set_like_R: "set_like R" 
   762           and x_hull: "Elem x (Ext_ZF_hull R S)"
   762           and x_hull: "Elem x (Ext_ZF_hull R S)"
   763           and y_R_x: "(y, x) \<in> R"
   763           and y_R_x: "(y, x) \<in> R"
   764   shows "Elem y (Ext_ZF_hull R S)"
   764   shows "Elem y (Ext_ZF_hull R S)"
   765 proof -
   765 proof -
   766   from Elem_Ext_ZF_hull[OF implodeable_R] x_hull 
   766   from Elem_Ext_ZF_hull[OF set_like_R] x_hull 
   767   have "? n. Elem x (Ext_ZF_n R S n)" by auto
   767   have "? n. Elem x (Ext_ZF_n R S n)" by auto
   768   then obtain n where n:"Elem x (Ext_ZF_n R S n)" ..
   768   then obtain n where n:"Elem x (Ext_ZF_n R S n)" ..
   769   with y_R_x have "Elem y (Ext_ZF_n R S (Suc n))"
   769   with y_R_x have "Elem y (Ext_ZF_n R S (Suc n))"
   770     apply (auto simp add: Repl Sum)
   770     apply (auto simp add: Repl Sum)
   771     apply (rule_tac x="Ext_ZF R x" in exI) 
   771     apply (rule_tac x="Ext_ZF R x" in exI) 
   772     apply (auto simp add: Elem_Ext_ZF[OF implodeable_R])
   772     apply (auto simp add: Elem_Ext_ZF[OF set_like_R])
   773     done
   773     done
   774   with Elem_Ext_ZF_hull[OF implodeable_R, where x=y] show ?thesis
   774   with Elem_Ext_ZF_hull[OF set_like_R, where x=y] show ?thesis
   775     by (auto simp del: Ext_ZF_n.simps)
   775     by (auto simp del: Ext_ZF_n.simps)
   776 qed
   776 qed
   777 
   777 
   778 lemma wfzf_minimal:
   778 lemma wfzf_minimal:
   779   assumes hyps: "wfzf R" "C \<noteq> {}"
   779   assumes hyps: "wfzf R" "C \<noteq> {}"
   780   shows "\<exists>x. x \<in> C \<and> (\<forall>y. (y, x) \<in> R \<longrightarrow> y \<notin> C)"
   780   shows "\<exists>x. x \<in> C \<and> (\<forall>y. (y, x) \<in> R \<longrightarrow> y \<notin> C)"
   781 proof -
   781 proof -
   782   from hyps have "\<exists>S. S \<in> C" by auto
   782   from hyps have "\<exists>S. S \<in> C" by auto
   783   then obtain S where S:"S \<in> C" by auto  
   783   then obtain S where S:"S \<in> C" by auto  
   784   let ?T = "Sep (Ext_ZF_hull R S) (\<lambda> s. s \<in> C)"
   784   let ?T = "Sep (Ext_ZF_hull R S) (\<lambda> s. s \<in> C)"
   785   from hyps have implodeable_R: "implodeable_Ext R" by (simp add: wfzf_def)
   785   from hyps have set_like_R: "set_like R" by (simp add: wfzf_def)
   786   show ?thesis
   786   show ?thesis
   787   proof (cases "?T = Empty")
   787   proof (cases "?T = Empty")
   788     case True
   788     case True
   789     then have "\<forall> z. \<not> (Elem z (Sep (Ext_ZF R S) (\<lambda> s. s \<in> C)))"      
   789     then have "\<forall> z. \<not> (Elem z (Sep (Ext_ZF R S) (\<lambda> s. s \<in> C)))"      
   790       apply (auto simp add: Ext Empty Sep Ext_ZF_hull_def SeqSum)
   790       apply (auto simp add: Ext Empty Sep Ext_ZF_hull_def SeqSum)
   793       done
   793       done
   794     then show ?thesis 
   794     then show ?thesis 
   795       apply (rule_tac exI[where x=S])
   795       apply (rule_tac exI[where x=S])
   796       apply (auto simp add: Sep Empty S)
   796       apply (auto simp add: Sep Empty S)
   797       apply (erule_tac x=y in allE)
   797       apply (erule_tac x=y in allE)
   798       apply (simp add: implodeable_R Elem_Ext_ZF)
   798       apply (simp add: set_like_R Elem_Ext_ZF)
   799       done
   799       done
   800   next
   800   next
   801     case False
   801     case False
   802     from hyps have regular_R: "regular R" by (simp add: wfzf_def)
   802     from hyps have regular_R: "regular R" by (simp add: wfzf_def)
   803     from 
   803     from 
   804       regular_R[simplified regular_def, rule_format, OF False, simplified Sep] 
   804       regular_R[simplified regular_def, rule_format, OF False, simplified Sep] 
   805       Elem_Elem_Ext_ZF_hull[OF implodeable_R]
   805       Elem_Elem_Ext_ZF_hull[OF set_like_R]
   806     show ?thesis by blast
   806     show ?thesis by blast
   807   qed
   807   qed
   808 qed
   808 qed
   809 
   809 
   810 lemma wfzf_implies_wf: "wfzf R \<Longrightarrow> wf R"
   810 lemma wfzf_implies_wf: "wfzf R \<Longrightarrow> wf R"
   834 
   834 
   835 lemma wf_is_Elem_of: "wf is_Elem_of"
   835 lemma wf_is_Elem_of: "wf is_Elem_of"
   836   by (auto simp add: wfzf_is_Elem_of wfzf_implies_wf)
   836   by (auto simp add: wfzf_is_Elem_of wfzf_implies_wf)
   837 
   837 
   838 lemma in_Ext_RTrans_implies_Elem_Ext_ZF_hull:  
   838 lemma in_Ext_RTrans_implies_Elem_Ext_ZF_hull:  
   839   "implodeable_Ext R \<Longrightarrow> x \<in> (Ext (R^+) s) \<Longrightarrow> Elem x (Ext_ZF_hull R s)"
   839   "set_like R \<Longrightarrow> x \<in> (Ext (R^+) s) \<Longrightarrow> Elem x (Ext_ZF_hull R s)"
   840   apply (simp add: Ext_def Elem_Ext_ZF_hull)
   840   apply (simp add: Ext_def Elem_Ext_ZF_hull)
   841   apply (erule converse_trancl_induct[where r="R"])
   841   apply (erule converse_trancl_induct[where r="R"])
   842   apply (rule exI[where x=0])
   842   apply (rule exI[where x=0])
   843   apply (simp add: Elem_Ext_ZF)
   843   apply (simp add: Elem_Ext_ZF)
   844   apply auto
   844   apply auto
   846   apply (simp add: Sum Repl)
   846   apply (simp add: Sum Repl)
   847   apply (rule_tac x="Ext_ZF R z" in exI)
   847   apply (rule_tac x="Ext_ZF R z" in exI)
   848   apply (auto simp add: Elem_Ext_ZF)
   848   apply (auto simp add: Elem_Ext_ZF)
   849   done
   849   done
   850 
   850 
   851 lemma implodeable_Ext_trancl: "implodeable_Ext R \<Longrightarrow> implodeable_Ext (R^+)"
   851 lemma implodeable_Ext_trancl: "set_like R \<Longrightarrow> set_like (R^+)"
   852   apply (subst implodeable_Ext_def)
   852   apply (subst set_like_def)
   853   apply (auto simp add: image_def)
   853   apply (auto simp add: image_def)
   854   apply (rule_tac x="Sep (Ext_ZF_hull R y) (\<lambda> z. z \<in> (Ext (R^+) y))" in exI)
   854   apply (rule_tac x="Sep (Ext_ZF_hull R y) (\<lambda> z. z \<in> (Ext (R^+) y))" in exI)
   855   apply (auto simp add: explode_def Sep set_ext 
   855   apply (auto simp add: explode_def Sep set_ext 
   856     in_Ext_RTrans_implies_Elem_Ext_ZF_hull)
   856     in_Ext_RTrans_implies_Elem_Ext_ZF_hull)
   857   done
   857   done
   858  
   858  
   859 lemma Elem_Ext_ZF_hull_implies_in_Ext_RTrans[rule_format]:
   859 lemma Elem_Ext_ZF_hull_implies_in_Ext_RTrans[rule_format]:
   860   "implodeable_Ext R \<Longrightarrow> ! x. Elem x (Ext_ZF_n R s n) \<longrightarrow> x \<in> (Ext (R^+) s)"
   860   "set_like R \<Longrightarrow> ! x. Elem x (Ext_ZF_n R s n) \<longrightarrow> x \<in> (Ext (R^+) s)"
   861   apply (induct_tac n)
   861   apply (induct_tac n)
   862   apply (auto simp add: Elem_Ext_ZF Ext_def Sum Repl)
   862   apply (auto simp add: Elem_Ext_ZF Ext_def Sum Repl)
   863   done
   863   done
   864 
   864 
   865 lemma "implodeable_Ext R \<Longrightarrow> Ext_ZF (R^+) s = Ext_ZF_hull R s"
   865 lemma "set_like R \<Longrightarrow> Ext_ZF (R^+) s = Ext_ZF_hull R s"
   866   apply (frule implodeable_Ext_trancl)
   866   apply (frule implodeable_Ext_trancl)
   867   apply (auto simp add: Ext)
   867   apply (auto simp add: Ext)
   868   apply (erule in_Ext_RTrans_implies_Elem_Ext_ZF_hull)
   868   apply (erule in_Ext_RTrans_implies_Elem_Ext_ZF_hull)
   869   apply (simp add: Elem_Ext_ZF Ext_def)
   869   apply (simp add: Elem_Ext_ZF Ext_def)
   870   apply (auto simp add: Elem_Ext_ZF Elem_Ext_ZF_hull)
   870   apply (auto simp add: Elem_Ext_ZF Elem_Ext_ZF_hull)
   888       apply (simp add: explode_def)
   888       apply (simp add: explode_def)
   889       done
   889       done
   890   qed
   890   qed
   891 qed
   891 qed
   892 
   892 
   893 lemma wf_eq_wfzf: "(wf R \<and> implodeable_Ext R) = wfzf R"
   893 lemma wf_eq_wfzf: "(wf R \<and> set_like R) = wfzf R"
   894   apply (auto simp add: wfzf_implies_wf)
   894   apply (auto simp add: wfzf_implies_wf)
   895   apply (auto simp add: wfzf_def wf_implies_regular)
   895   apply (auto simp add: wfzf_def wf_implies_regular)
   896   done
   896   done
   897 
   897 
   898 lemma wfzf_trancl: "wfzf R \<Longrightarrow> wfzf (R^+)"
   898 lemma wfzf_trancl: "wfzf R \<Longrightarrow> wfzf (R^+)"
   899   by (auto simp add: wf_eq_wfzf[symmetric] implodeable_Ext_trancl wf_trancl)
   899   by (auto simp add: wf_eq_wfzf[symmetric] implodeable_Ext_trancl wf_trancl)
   900 
   900 
   901 lemma Ext_subset_mono: "R \<subseteq> S \<Longrightarrow> Ext R y \<subseteq> Ext S y"
   901 lemma Ext_subset_mono: "R \<subseteq> S \<Longrightarrow> Ext R y \<subseteq> Ext S y"
   902   by (auto simp add: Ext_def)
   902   by (auto simp add: Ext_def)
   903 
   903 
   904 lemma implodeable_Ext_subset: "implodeable_Ext R \<Longrightarrow> S \<subseteq> R \<Longrightarrow> implodeable_Ext S"
   904 lemma set_like_subset: "set_like R \<Longrightarrow> S \<subseteq> R \<Longrightarrow> set_like S"
   905   apply (auto simp add: implodeable_Ext_def)
   905   apply (auto simp add: set_like_def)
   906   apply (erule_tac x=y in allE)
   906   apply (erule_tac x=y in allE)
   907   apply (drule_tac y=y in Ext_subset_mono)
   907   apply (drule_tac y=y in Ext_subset_mono)
   908   apply (auto simp add: image_def)
   908   apply (auto simp add: image_def)
   909   apply (rule_tac x="Sep x (% z. z \<in> (Ext S y))" in exI) 
   909   apply (rule_tac x="Sep x (% z. z \<in> (Ext S y))" in exI) 
   910   apply (auto simp add: explode_def Sep)
   910   apply (auto simp add: explode_def Sep)
   911   done
   911   done
   912 
   912 
   913 lemma wfzf_subset: "wfzf S \<Longrightarrow> R \<subseteq> S \<Longrightarrow> wfzf R"
   913 lemma wfzf_subset: "wfzf S \<Longrightarrow> R \<subseteq> S \<Longrightarrow> wfzf R"
   914   by (auto intro: implodeable_Ext_subset wf_subset simp add: wf_eq_wfzf[symmetric])  
   914   by (auto intro: set_like_subset wf_subset simp add: wf_eq_wfzf[symmetric])  
   915 
   915 
   916 end
   916 end