src/ZF/Constructible/Reflection.thy
author wenzelm
Mon Jul 29 00:57:16 2002 +0200 (2002-07-29)
changeset 13428 99e52e78eb65
parent 13382 b37764a46b16
child 13434 78b93a667c01
permissions -rw-r--r--
eliminate open locales and special ML code;
     1 header {* The Reflection Theorem*}
     2 
     3 theory Reflection = Normal:
     4 
     5 lemma all_iff_not_ex_not: "(\<forall>x. P(x)) <-> (~ (\<exists>x. ~ P(x)))";
     6 by blast
     7 
     8 lemma ball_iff_not_bex_not: "(\<forall>x\<in>A. P(x)) <-> (~ (\<exists>x\<in>A. ~ P(x)))";
     9 by blast
    10 
    11 text{*From the notes of A. S. Kechris, page 6, and from 
    12       Andrzej Mostowski, \emph{Constructible Sets with Applications},
    13       North-Holland, 1969, page 23.*}
    14 
    15 
    16 subsection{*Basic Definitions*}
    17 
    18 text{*First part: the cumulative hierarchy defining the class @{text M}.  
    19 To avoid handling multiple arguments, we assume that @{text "Mset(l)"} is
    20 closed under ordered pairing provided @{text l} is limit.  Possibly this
    21 could be avoided: the induction hypothesis @{term Cl_reflects} 
    22 (in locale @{text ex_reflection}) could be weakened to
    23 @{term "\<forall>y\<in>Mset(a). \<forall>z\<in>Mset(a). P(<y,z>) <-> Q(a,<y,z>)"}, removing most
    24 uses of @{term Pair_in_Mset}.  But there isn't much point in doing so, since 
    25 ultimately the @{text ex_reflection} proof is packaged up using the
    26 predicate @{text Reflects}.
    27 *}
    28 locale reflection =
    29   fixes Mset and M and Reflects
    30   assumes Mset_mono_le : "mono_le_subset(Mset)"
    31       and Mset_cont    : "cont_Ord(Mset)"
    32       and Pair_in_Mset : "[| x \<in> Mset(a); y \<in> Mset(a); Limit(a) |] 
    33                           ==> <x,y> \<in> Mset(a)"
    34   defines "M(x) == \<exists>a. Ord(a) \<and> x \<in> Mset(a)"
    35       and "Reflects(Cl,P,Q) == Closed_Unbounded(Cl) \<and>
    36                               (\<forall>a. Cl(a) --> (\<forall>x\<in>Mset(a). P(x) <-> Q(a,x)))"
    37   fixes F0 --{*ordinal for a specific value @{term y}*}
    38   fixes FF --{*sup over the whole level, @{term "y\<in>Mset(a)"}*}
    39   fixes ClEx --{*Reflecting ordinals for the formula @{term "\<exists>z. P"}*}
    40   defines "F0(P,y) == \<mu>b. (\<exists>z. M(z) \<and> P(<y,z>)) --> 
    41                                (\<exists>z\<in>Mset(b). P(<y,z>))"
    42       and "FF(P)   == \<lambda>a. \<Union>y\<in>Mset(a). F0(P,y)"
    43       and "ClEx(P) == \<lambda>a. Limit(a) \<and> normalize(FF(P),a) = a"
    44 
    45 lemma (in reflection) Mset_mono: "i\<le>j ==> Mset(i) <= Mset(j)"
    46 apply (insert Mset_mono_le) 
    47 apply (simp add: mono_le_subset_def leI) 
    48 done
    49 
    50 subsection{*Easy Cases of the Reflection Theorem*}
    51 
    52 theorem (in reflection) Triv_reflection [intro]:
    53      "Reflects(Ord, P, \<lambda>a x. P(x))"
    54 by (simp add: Reflects_def)
    55 
    56 theorem (in reflection) Not_reflection [intro]:
    57      "Reflects(Cl,P,Q) ==> Reflects(Cl, \<lambda>x. ~P(x), \<lambda>a x. ~Q(a,x))"
    58 by (simp add: Reflects_def) 
    59 
    60 theorem (in reflection) And_reflection [intro]:
    61      "[| Reflects(Cl,P,Q); Reflects(C',P',Q') |] 
    62       ==> Reflects(\<lambda>a. Cl(a) \<and> C'(a), \<lambda>x. P(x) \<and> P'(x), 
    63                                       \<lambda>a x. Q(a,x) \<and> Q'(a,x))"
    64 by (simp add: Reflects_def Closed_Unbounded_Int, blast)
    65 
    66 theorem (in reflection) Or_reflection [intro]:
    67      "[| Reflects(Cl,P,Q); Reflects(C',P',Q') |] 
    68       ==> Reflects(\<lambda>a. Cl(a) \<and> C'(a), \<lambda>x. P(x) \<or> P'(x), 
    69                                       \<lambda>a x. Q(a,x) \<or> Q'(a,x))"
    70 by (simp add: Reflects_def Closed_Unbounded_Int, blast)
    71 
    72 theorem (in reflection) Imp_reflection [intro]:
    73      "[| Reflects(Cl,P,Q); Reflects(C',P',Q') |] 
    74       ==> Reflects(\<lambda>a. Cl(a) \<and> C'(a), 
    75                    \<lambda>x. P(x) --> P'(x), 
    76                    \<lambda>a x. Q(a,x) --> Q'(a,x))"
    77 by (simp add: Reflects_def Closed_Unbounded_Int, blast)
    78 
    79 theorem (in reflection) Iff_reflection [intro]:
    80      "[| Reflects(Cl,P,Q); Reflects(C',P',Q') |] 
    81       ==> Reflects(\<lambda>a. Cl(a) \<and> C'(a), 
    82                    \<lambda>x. P(x) <-> P'(x), 
    83                    \<lambda>a x. Q(a,x) <-> Q'(a,x))"
    84 by (simp add: Reflects_def Closed_Unbounded_Int, blast) 
    85 
    86 subsection{*Reflection for Existential Quantifiers*}
    87 
    88 lemma (in reflection) F0_works:
    89      "[| y\<in>Mset(a); Ord(a); M(z); P(<y,z>) |] ==> \<exists>z\<in>Mset(F0(P,y)). P(<y,z>)"
    90 apply (unfold F0_def M_def, clarify)
    91 apply (rule LeastI2)
    92   apply (blast intro: Mset_mono [THEN subsetD])
    93  apply (blast intro: lt_Ord2, blast)
    94 done
    95 
    96 lemma (in reflection) Ord_F0 [intro,simp]: "Ord(F0(P,y))"
    97 by (simp add: F0_def)
    98 
    99 lemma (in reflection) Ord_FF [intro,simp]: "Ord(FF(P,y))"
   100 by (simp add: FF_def)
   101 
   102 lemma (in reflection) cont_Ord_FF: "cont_Ord(FF(P))"
   103 apply (insert Mset_cont)
   104 apply (simp add: cont_Ord_def FF_def, blast)
   105 done
   106 
   107 text{*Recall that @{term F0} depends upon @{term "y\<in>Mset(a)"}, 
   108 while @{term FF} depends only upon @{term a}. *}
   109 lemma (in reflection) FF_works:
   110      "[| M(z); y\<in>Mset(a); P(<y,z>); Ord(a) |] ==> \<exists>z\<in>Mset(FF(P,a)). P(<y,z>)"
   111 apply (simp add: FF_def)
   112 apply (simp_all add: cont_Ord_Union [of concl: Mset] 
   113                      Mset_cont Mset_mono_le not_emptyI Ord_F0)
   114 apply (blast intro: F0_works)  
   115 done
   116 
   117 lemma (in reflection) FFN_works:
   118      "[| M(z); y\<in>Mset(a); P(<y,z>); Ord(a) |] 
   119       ==> \<exists>z\<in>Mset(normalize(FF(P),a)). P(<y,z>)"
   120 apply (drule FF_works [of concl: P], assumption+) 
   121 apply (blast intro: cont_Ord_FF le_normalize [THEN Mset_mono, THEN subsetD])
   122 done
   123 
   124 
   125 text{*Locale for the induction hypothesis*}
   126 
   127 locale ex_reflection = reflection +
   128   fixes P  --"the original formula"
   129   fixes Q  --"the reflected formula"
   130   fixes Cl --"the class of reflecting ordinals"
   131   assumes Cl_reflects: "[| Cl(a); Ord(a) |] ==> \<forall>x\<in>Mset(a). P(x) <-> Q(a,x)"
   132 
   133 lemma (in ex_reflection) ClEx_downward:
   134      "[| M(z); y\<in>Mset(a); P(<y,z>); Cl(a); ClEx(P,a) |] 
   135       ==> \<exists>z\<in>Mset(a). Q(a,<y,z>)"
   136 apply (simp add: ClEx_def, clarify) 
   137 apply (frule Limit_is_Ord) 
   138 apply (frule FFN_works [of concl: P], assumption+) 
   139 apply (drule Cl_reflects, assumption+) 
   140 apply (auto simp add: Limit_is_Ord Pair_in_Mset)
   141 done
   142 
   143 lemma (in ex_reflection) ClEx_upward:
   144      "[| z\<in>Mset(a); y\<in>Mset(a); Q(a,<y,z>); Cl(a); ClEx(P,a) |] 
   145       ==> \<exists>z. M(z) \<and> P(<y,z>)"
   146 apply (simp add: ClEx_def M_def)
   147 apply (blast dest: Cl_reflects
   148 	     intro: Limit_is_Ord Pair_in_Mset)
   149 done
   150 
   151 text{*Class @{text ClEx} indeed consists of reflecting ordinals...*}
   152 lemma (in ex_reflection) ZF_ClEx_iff:
   153      "[| y\<in>Mset(a); Cl(a); ClEx(P,a) |] 
   154       ==> (\<exists>z. M(z) \<and> P(<y,z>)) <-> (\<exists>z\<in>Mset(a). Q(a,<y,z>))"
   155 by (blast intro: dest: ClEx_downward ClEx_upward) 
   156 
   157 text{*...and it is closed and unbounded*}
   158 lemma (in ex_reflection) ZF_Closed_Unbounded_ClEx:
   159      "Closed_Unbounded(ClEx(P))"
   160 apply (simp add: ClEx_def)
   161 apply (fast intro: Closed_Unbounded_Int Normal_imp_fp_Closed_Unbounded
   162                    Closed_Unbounded_Limit Normal_normalize)
   163 done
   164 
   165 text{*The same two theorems, exported to locale @{text reflection}.*}
   166 
   167 text{*Class @{text ClEx} indeed consists of reflecting ordinals...*}
   168 lemma (in reflection) ClEx_iff:
   169      "[| y\<in>Mset(a); Cl(a); ClEx(P,a);
   170         !!a. [| Cl(a); Ord(a) |] ==> \<forall>x\<in>Mset(a). P(x) <-> Q(a,x) |] 
   171       ==> (\<exists>z. M(z) \<and> P(<y,z>)) <-> (\<exists>z\<in>Mset(a). Q(a,<y,z>))"
   172 apply (unfold ClEx_def FF_def F0_def M_def)
   173 apply (rule ex_reflection.ZF_ClEx_iff
   174   [OF ex_reflection.intro, OF reflection.intro ex_reflection_axioms.intro,
   175     of Mset Cl])
   176 apply (simp_all add: Mset_mono_le Mset_cont Pair_in_Mset)
   177 done
   178 
   179 lemma (in reflection) Closed_Unbounded_ClEx:
   180      "(!!a. [| Cl(a); Ord(a) |] ==> \<forall>x\<in>Mset(a). P(x) <-> Q(a,x))
   181       ==> Closed_Unbounded(ClEx(P))"
   182 apply (unfold ClEx_def FF_def F0_def M_def)
   183 apply (rule ex_reflection.ZF_Closed_Unbounded_ClEx
   184   [OF ex_reflection.intro, OF reflection.intro ex_reflection_axioms.intro])
   185 apply (simp_all add: Mset_mono_le Mset_cont Pair_in_Mset) 
   186 done
   187 
   188 subsection{*Packaging the Quantifier Reflection Rules*}
   189 
   190 lemma (in reflection) Ex_reflection_0:
   191      "Reflects(Cl,P0,Q0) 
   192       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(P0,a), 
   193                    \<lambda>x. \<exists>z. M(z) \<and> P0(<x,z>), 
   194                    \<lambda>a x. \<exists>z\<in>Mset(a). Q0(a,<x,z>))" 
   195 apply (simp add: Reflects_def) 
   196 apply (intro conjI Closed_Unbounded_Int)
   197   apply blast 
   198  apply (rule Closed_Unbounded_ClEx [of Cl P0 Q0], blast, clarify) 
   199 apply (rule_tac Cl=Cl in  ClEx_iff, assumption+, blast) 
   200 done
   201 
   202 lemma (in reflection) All_reflection_0:
   203      "Reflects(Cl,P0,Q0) 
   204       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(\<lambda>x.~P0(x), a), 
   205                    \<lambda>x. \<forall>z. M(z) --> P0(<x,z>), 
   206                    \<lambda>a x. \<forall>z\<in>Mset(a). Q0(a,<x,z>))" 
   207 apply (simp only: all_iff_not_ex_not ball_iff_not_bex_not) 
   208 apply (rule Not_reflection, drule Not_reflection, simp) 
   209 apply (erule Ex_reflection_0)
   210 done
   211 
   212 theorem (in reflection) Ex_reflection [intro]:
   213      "Reflects(Cl, \<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x))) 
   214       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(\<lambda>x. P(fst(x),snd(x)), a), 
   215                    \<lambda>x. \<exists>z. M(z) \<and> P(x,z), 
   216                    \<lambda>a x. \<exists>z\<in>Mset(a). Q(a,x,z))"
   217 by (rule Ex_reflection_0 [of _ " \<lambda>x. P(fst(x),snd(x))" 
   218                                "\<lambda>a x. Q(a,fst(x),snd(x))", simplified])
   219 
   220 theorem (in reflection) All_reflection [intro]:
   221      "Reflects(Cl,  \<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x)))
   222       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(\<lambda>x. ~P(fst(x),snd(x)), a), 
   223                    \<lambda>x. \<forall>z. M(z) --> P(x,z), 
   224                    \<lambda>a x. \<forall>z\<in>Mset(a). Q(a,x,z))" 
   225 by (rule All_reflection_0 [of _ "\<lambda>x. P(fst(x),snd(x))" 
   226                                 "\<lambda>a x. Q(a,fst(x),snd(x))", simplified])
   227 
   228 text{*And again, this time using class-bounded quantifiers*}
   229 
   230 theorem (in reflection) Rex_reflection [intro]:
   231      "Reflects(Cl, \<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x))) 
   232       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(\<lambda>x. P(fst(x),snd(x)), a), 
   233                    \<lambda>x. \<exists>z[M]. P(x,z), 
   234                    \<lambda>a x. \<exists>z\<in>Mset(a). Q(a,x,z))"
   235 by (unfold rex_def, blast) 
   236 
   237 theorem (in reflection) Rall_reflection [intro]:
   238      "Reflects(Cl,  \<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x)))
   239       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(\<lambda>x. ~P(fst(x),snd(x)), a), 
   240                    \<lambda>x. \<forall>z[M]. P(x,z), 
   241                    \<lambda>a x. \<forall>z\<in>Mset(a). Q(a,x,z))" 
   242 by (unfold rall_def, blast) 
   243 
   244 
   245 text{*No point considering bounded quantifiers, where reflection is trivial.*}
   246 
   247 
   248 subsection{*Simple Examples of Reflection*}
   249 
   250 text{*Example 1: reflecting a simple formula.  The reflecting class is first
   251 given as the variable @{text ?Cl} and later retrieved from the final 
   252 proof state.*}
   253 lemma (in reflection) 
   254      "Reflects(?Cl,
   255                \<lambda>x. \<exists>y. M(y) \<and> x \<in> y, 
   256                \<lambda>a x. \<exists>y\<in>Mset(a). x \<in> y)"
   257 by fast
   258 
   259 text{*Problem here: there needs to be a conjunction (class intersection)
   260 in the class of reflecting ordinals.  The @{term "Ord(a)"} is redundant,
   261 though harmless.*}
   262 lemma (in reflection) 
   263      "Reflects(\<lambda>a. Ord(a) \<and> ClEx(\<lambda>x. fst(x) \<in> snd(x), a),   
   264                \<lambda>x. \<exists>y. M(y) \<and> x \<in> y, 
   265                \<lambda>a x. \<exists>y\<in>Mset(a). x \<in> y)" 
   266 by fast
   267 
   268 
   269 text{*Example 2*}
   270 lemma (in reflection) 
   271      "Reflects(?Cl,
   272                \<lambda>x. \<exists>y. M(y) \<and> (\<forall>z. M(z) --> z \<subseteq> x --> z \<in> y), 
   273                \<lambda>a x. \<exists>y\<in>Mset(a). \<forall>z\<in>Mset(a). z \<subseteq> x --> z \<in> y)" 
   274 by fast
   275 
   276 text{*Example 2'.  We give the reflecting class explicitly. *}
   277 lemma (in reflection) 
   278   "Reflects
   279     (\<lambda>a. (Ord(a) \<and>
   280           ClEx(\<lambda>x. ~ (snd(x) \<subseteq> fst(fst(x)) --> snd(x) \<in> snd(fst(x))), a)) \<and>
   281           ClEx(\<lambda>x. \<forall>z. M(z) --> z \<subseteq> fst(x) --> z \<in> snd(x), a),
   282 	    \<lambda>x. \<exists>y. M(y) \<and> (\<forall>z. M(z) --> z \<subseteq> x --> z \<in> y), 
   283 	    \<lambda>a x. \<exists>y\<in>Mset(a). \<forall>z\<in>Mset(a). z \<subseteq> x --> z \<in> y)" 
   284 by fast
   285 
   286 text{*Example 2''.  We expand the subset relation.*}
   287 lemma (in reflection) 
   288   "Reflects(?Cl,
   289         \<lambda>x. \<exists>y. M(y) \<and> (\<forall>z. M(z) --> (\<forall>w. M(w) --> w\<in>z --> w\<in>x) --> z\<in>y),
   290         \<lambda>a x. \<exists>y\<in>Mset(a). \<forall>z\<in>Mset(a). (\<forall>w\<in>Mset(a). w\<in>z --> w\<in>x) --> z\<in>y)"
   291 by fast
   292 
   293 text{*Example 2'''.  Single-step version, to reveal the reflecting class.*}
   294 lemma (in reflection) 
   295      "Reflects(?Cl,
   296                \<lambda>x. \<exists>y. M(y) \<and> (\<forall>z. M(z) --> z \<subseteq> x --> z \<in> y), 
   297                \<lambda>a x. \<exists>y\<in>Mset(a). \<forall>z\<in>Mset(a). z \<subseteq> x --> z \<in> y)" 
   298 apply (rule Ex_reflection) 
   299 txt{*
   300 @{goals[display,indent=0,margin=60]}
   301 *}
   302 apply (rule All_reflection) 
   303 txt{*
   304 @{goals[display,indent=0,margin=60]}
   305 *}
   306 apply (rule Triv_reflection) 
   307 txt{*
   308 @{goals[display,indent=0,margin=60]}
   309 *}
   310 done
   311 
   312 text{*Example 3.  Warning: the following examples make sense only
   313 if @{term P} is quantifier-free, since it is not being relativized.*}
   314 lemma (in reflection) 
   315      "Reflects(?Cl,
   316                \<lambda>x. \<exists>y. M(y) \<and> (\<forall>z. M(z) --> z \<in> y <-> z \<in> x \<and> P(z)), 
   317                \<lambda>a x. \<exists>y\<in>Mset(a). \<forall>z\<in>Mset(a). z \<in> y <-> z \<in> x \<and> P(z))"
   318 by fast
   319 
   320 text{*Example 3'*}
   321 lemma (in reflection) 
   322      "Reflects(?Cl,
   323                \<lambda>x. \<exists>y. M(y) \<and> y = Collect(x,P),
   324                \<lambda>a x. \<exists>y\<in>Mset(a). y = Collect(x,P))";
   325 by fast
   326 
   327 text{*Example 3''*}
   328 lemma (in reflection) 
   329      "Reflects(?Cl,
   330                \<lambda>x. \<exists>y. M(y) \<and> y = Replace(x,P),
   331                \<lambda>a x. \<exists>y\<in>Mset(a). y = Replace(x,P))";
   332 by fast
   333 
   334 text{*Example 4: Axiom of Choice.  Possibly wrong, since @{text \<Pi>} needs
   335 to be relativized.*}
   336 lemma (in reflection) 
   337      "Reflects(?Cl,
   338                \<lambda>A. 0\<notin>A --> (\<exists>f. M(f) \<and> f \<in> (\<Pi>X \<in> A. X)),
   339                \<lambda>a A. 0\<notin>A --> (\<exists>f\<in>Mset(a). f \<in> (\<Pi>X \<in> A. X)))"
   340 by fast
   341 
   342 end
   343