src/ZF/Constructible/Reflection.thy
author paulson
Wed Jul 31 18:30:25 2002 +0200 (2002-07-31)
changeset 13440 cdde97e1db1c
parent 13434 78b93a667c01
child 13505 52a16cb7fefb
permissions -rw-r--r--
some progress towards "satisfies"
     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,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 text{*Awkward: we need a version of @{text ClEx_def} as an equality
    51       at the level of classes, which do not really exist*}
    52 lemma (in reflection) ClEx_eq:
    53      "ClEx(P) == \<lambda>a. Limit(a) \<and> normalize(FF(P),a) = a"
    54 by (simp add: ClEx_def [symmetric]) 
    55 
    56 
    57 subsection{*Easy Cases of the Reflection Theorem*}
    58 
    59 theorem (in reflection) Triv_reflection [intro]:
    60      "Reflects(Ord, P, \<lambda>a x. P(x))"
    61 by (simp add: Reflects_def)
    62 
    63 theorem (in reflection) Not_reflection [intro]:
    64      "Reflects(Cl,P,Q) ==> Reflects(Cl, \<lambda>x. ~P(x), \<lambda>a x. ~Q(a,x))"
    65 by (simp add: Reflects_def) 
    66 
    67 theorem (in reflection) And_reflection [intro]:
    68      "[| Reflects(Cl,P,Q); Reflects(C',P',Q') |] 
    69       ==> Reflects(\<lambda>a. Cl(a) \<and> C'(a), \<lambda>x. P(x) \<and> P'(x), 
    70                                       \<lambda>a x. Q(a,x) \<and> Q'(a,x))"
    71 by (simp add: Reflects_def Closed_Unbounded_Int, blast)
    72 
    73 theorem (in reflection) Or_reflection [intro]:
    74      "[| Reflects(Cl,P,Q); Reflects(C',P',Q') |] 
    75       ==> Reflects(\<lambda>a. Cl(a) \<and> C'(a), \<lambda>x. P(x) \<or> P'(x), 
    76                                       \<lambda>a x. Q(a,x) \<or> Q'(a,x))"
    77 by (simp add: Reflects_def Closed_Unbounded_Int, blast)
    78 
    79 theorem (in reflection) Imp_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 theorem (in reflection) Iff_reflection [intro]:
    87      "[| Reflects(Cl,P,Q); Reflects(C',P',Q') |] 
    88       ==> Reflects(\<lambda>a. Cl(a) \<and> C'(a), 
    89                    \<lambda>x. P(x) <-> P'(x), 
    90                    \<lambda>a x. Q(a,x) <-> Q'(a,x))"
    91 by (simp add: Reflects_def Closed_Unbounded_Int, blast) 
    92 
    93 subsection{*Reflection for Existential Quantifiers*}
    94 
    95 lemma (in reflection) F0_works:
    96      "[| y\<in>Mset(a); Ord(a); M(z); P(<y,z>) |] ==> \<exists>z\<in>Mset(F0(P,y)). P(<y,z>)"
    97 apply (unfold F0_def M_def, clarify)
    98 apply (rule LeastI2)
    99   apply (blast intro: Mset_mono [THEN subsetD])
   100  apply (blast intro: lt_Ord2, blast)
   101 done
   102 
   103 lemma (in reflection) Ord_F0 [intro,simp]: "Ord(F0(P,y))"
   104 by (simp add: F0_def)
   105 
   106 lemma (in reflection) Ord_FF [intro,simp]: "Ord(FF(P,y))"
   107 by (simp add: FF_def)
   108 
   109 lemma (in reflection) cont_Ord_FF: "cont_Ord(FF(P))"
   110 apply (insert Mset_cont)
   111 apply (simp add: cont_Ord_def FF_def, blast)
   112 done
   113 
   114 text{*Recall that @{term F0} depends upon @{term "y\<in>Mset(a)"}, 
   115 while @{term FF} depends only upon @{term a}. *}
   116 lemma (in reflection) FF_works:
   117      "[| M(z); y\<in>Mset(a); P(<y,z>); Ord(a) |] ==> \<exists>z\<in>Mset(FF(P,a)). P(<y,z>)"
   118 apply (simp add: FF_def)
   119 apply (simp_all add: cont_Ord_Union [of concl: Mset] 
   120                      Mset_cont Mset_mono_le not_emptyI Ord_F0)
   121 apply (blast intro: F0_works)  
   122 done
   123 
   124 lemma (in reflection) FFN_works:
   125      "[| M(z); y\<in>Mset(a); P(<y,z>); Ord(a) |] 
   126       ==> \<exists>z\<in>Mset(normalize(FF(P),a)). P(<y,z>)"
   127 apply (drule FF_works [of concl: P], assumption+) 
   128 apply (blast intro: cont_Ord_FF le_normalize [THEN Mset_mono, THEN subsetD])
   129 done
   130 
   131 
   132 text{*Locale for the induction hypothesis*}
   133 
   134 locale ex_reflection = reflection +
   135   fixes P  --"the original formula"
   136   fixes Q  --"the reflected formula"
   137   fixes Cl --"the class of reflecting ordinals"
   138   assumes Cl_reflects: "[| Cl(a); Ord(a) |] ==> \<forall>x\<in>Mset(a). P(x) <-> Q(a,x)"
   139 
   140 lemma (in ex_reflection) ClEx_downward:
   141      "[| M(z); y\<in>Mset(a); P(<y,z>); Cl(a); ClEx(P,a) |] 
   142       ==> \<exists>z\<in>Mset(a). Q(a,<y,z>)"
   143 apply (simp add: ClEx_def, clarify) 
   144 apply (frule Limit_is_Ord) 
   145 apply (frule FFN_works [of concl: P], assumption+) 
   146 apply (drule Cl_reflects, assumption+) 
   147 apply (auto simp add: Limit_is_Ord Pair_in_Mset)
   148 done
   149 
   150 lemma (in ex_reflection) ClEx_upward:
   151      "[| z\<in>Mset(a); y\<in>Mset(a); Q(a,<y,z>); Cl(a); ClEx(P,a) |] 
   152       ==> \<exists>z. M(z) \<and> P(<y,z>)"
   153 apply (simp add: ClEx_def M_def)
   154 apply (blast dest: Cl_reflects
   155 	     intro: Limit_is_Ord Pair_in_Mset)
   156 done
   157 
   158 text{*Class @{text ClEx} indeed consists of reflecting ordinals...*}
   159 lemma (in ex_reflection) ZF_ClEx_iff:
   160      "[| y\<in>Mset(a); Cl(a); ClEx(P,a) |] 
   161       ==> (\<exists>z. M(z) \<and> P(<y,z>)) <-> (\<exists>z\<in>Mset(a). Q(a,<y,z>))"
   162 by (blast intro: dest: ClEx_downward ClEx_upward) 
   163 
   164 text{*...and it is closed and unbounded*}
   165 lemma (in ex_reflection) ZF_Closed_Unbounded_ClEx:
   166      "Closed_Unbounded(ClEx(P))"
   167 apply (simp add: ClEx_eq)
   168 apply (fast intro: Closed_Unbounded_Int Normal_imp_fp_Closed_Unbounded
   169                    Closed_Unbounded_Limit Normal_normalize)
   170 done
   171 
   172 text{*The same two theorems, exported to locale @{text reflection}.*}
   173 
   174 text{*Class @{text ClEx} indeed consists of reflecting ordinals...*}
   175 lemma (in reflection) ClEx_iff:
   176      "[| y\<in>Mset(a); Cl(a); ClEx(P,a);
   177         !!a. [| Cl(a); Ord(a) |] ==> \<forall>x\<in>Mset(a). P(x) <-> Q(a,x) |] 
   178       ==> (\<exists>z. M(z) \<and> P(<y,z>)) <-> (\<exists>z\<in>Mset(a). Q(a,<y,z>))"
   179 apply (unfold ClEx_def FF_def F0_def M_def)
   180 apply (rule ex_reflection.ZF_ClEx_iff
   181   [OF ex_reflection.intro, OF reflection.intro ex_reflection_axioms.intro,
   182     of Mset Cl])
   183 apply (simp_all add: Mset_mono_le Mset_cont Pair_in_Mset)
   184 done
   185 
   186 (*Alternative proof, less unfolding:
   187 apply (rule Reflection.ZF_ClEx_iff [of Mset _ _ Cl, folded M_def])
   188 apply (fold ClEx_def FF_def F0_def)
   189 apply (rule ex_reflection.intro, assumption)
   190 apply (simp add: ex_reflection_axioms.intro, assumption+)
   191 *)
   192 
   193 lemma (in reflection) Closed_Unbounded_ClEx:
   194      "(!!a. [| Cl(a); Ord(a) |] ==> \<forall>x\<in>Mset(a). P(x) <-> Q(a,x))
   195       ==> Closed_Unbounded(ClEx(P))"
   196 apply (unfold ClEx_eq FF_def F0_def M_def) 
   197 apply (rule Reflection.ZF_Closed_Unbounded_ClEx [of Mset _ _ Cl])
   198 apply (rule ex_reflection.intro, assumption)
   199 apply (blast intro: ex_reflection_axioms.intro)
   200 done
   201 
   202 subsection{*Packaging the Quantifier Reflection Rules*}
   203 
   204 lemma (in reflection) Ex_reflection_0:
   205      "Reflects(Cl,P0,Q0) 
   206       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(P0,a), 
   207                    \<lambda>x. \<exists>z. M(z) \<and> P0(<x,z>), 
   208                    \<lambda>a x. \<exists>z\<in>Mset(a). Q0(a,<x,z>))" 
   209 apply (simp add: Reflects_def) 
   210 apply (intro conjI Closed_Unbounded_Int)
   211   apply blast 
   212  apply (rule Closed_Unbounded_ClEx [of Cl P0 Q0], blast, clarify) 
   213 apply (rule_tac Cl=Cl in  ClEx_iff, assumption+, blast) 
   214 done
   215 
   216 lemma (in reflection) All_reflection_0:
   217      "Reflects(Cl,P0,Q0) 
   218       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(\<lambda>x.~P0(x), a), 
   219                    \<lambda>x. \<forall>z. M(z) --> P0(<x,z>), 
   220                    \<lambda>a x. \<forall>z\<in>Mset(a). Q0(a,<x,z>))" 
   221 apply (simp only: all_iff_not_ex_not ball_iff_not_bex_not) 
   222 apply (rule Not_reflection, drule Not_reflection, simp) 
   223 apply (erule Ex_reflection_0)
   224 done
   225 
   226 theorem (in reflection) Ex_reflection [intro]:
   227      "Reflects(Cl, \<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x))) 
   228       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(\<lambda>x. P(fst(x),snd(x)), a), 
   229                    \<lambda>x. \<exists>z. M(z) \<and> P(x,z), 
   230                    \<lambda>a x. \<exists>z\<in>Mset(a). Q(a,x,z))"
   231 by (rule Ex_reflection_0 [of _ " \<lambda>x. P(fst(x),snd(x))" 
   232                                "\<lambda>a x. Q(a,fst(x),snd(x))", simplified])
   233 
   234 theorem (in reflection) All_reflection [intro]:
   235      "Reflects(Cl,  \<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x)))
   236       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(\<lambda>x. ~P(fst(x),snd(x)), a), 
   237                    \<lambda>x. \<forall>z. M(z) --> P(x,z), 
   238                    \<lambda>a x. \<forall>z\<in>Mset(a). Q(a,x,z))" 
   239 by (rule All_reflection_0 [of _ "\<lambda>x. P(fst(x),snd(x))" 
   240                                 "\<lambda>a x. Q(a,fst(x),snd(x))", simplified])
   241 
   242 text{*And again, this time using class-bounded quantifiers*}
   243 
   244 theorem (in reflection) Rex_reflection [intro]:
   245      "Reflects(Cl, \<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x))) 
   246       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(\<lambda>x. P(fst(x),snd(x)), a), 
   247                    \<lambda>x. \<exists>z[M]. P(x,z), 
   248                    \<lambda>a x. \<exists>z\<in>Mset(a). Q(a,x,z))"
   249 by (unfold rex_def, blast) 
   250 
   251 theorem (in reflection) Rall_reflection [intro]:
   252      "Reflects(Cl,  \<lambda>x. P(fst(x),snd(x)), \<lambda>a x. Q(a,fst(x),snd(x)))
   253       ==> Reflects(\<lambda>a. Cl(a) \<and> ClEx(\<lambda>x. ~P(fst(x),snd(x)), a), 
   254                    \<lambda>x. \<forall>z[M]. P(x,z), 
   255                    \<lambda>a x. \<forall>z\<in>Mset(a). Q(a,x,z))" 
   256 by (unfold rall_def, blast) 
   257 
   258 
   259 text{*No point considering bounded quantifiers, where reflection is trivial.*}
   260 
   261 
   262 subsection{*Simple Examples of Reflection*}
   263 
   264 text{*Example 1: reflecting a simple formula.  The reflecting class is first
   265 given as the variable @{text ?Cl} and later retrieved from the final 
   266 proof state.*}
   267 lemma (in reflection) 
   268      "Reflects(?Cl,
   269                \<lambda>x. \<exists>y. M(y) \<and> x \<in> y, 
   270                \<lambda>a x. \<exists>y\<in>Mset(a). x \<in> y)"
   271 by fast
   272 
   273 text{*Problem here: there needs to be a conjunction (class intersection)
   274 in the class of reflecting ordinals.  The @{term "Ord(a)"} is redundant,
   275 though harmless.*}
   276 lemma (in reflection) 
   277      "Reflects(\<lambda>a. Ord(a) \<and> ClEx(\<lambda>x. fst(x) \<in> snd(x), a),   
   278                \<lambda>x. \<exists>y. M(y) \<and> x \<in> y, 
   279                \<lambda>a x. \<exists>y\<in>Mset(a). x \<in> y)" 
   280 by fast
   281 
   282 
   283 text{*Example 2*}
   284 lemma (in reflection) 
   285      "Reflects(?Cl,
   286                \<lambda>x. \<exists>y. M(y) \<and> (\<forall>z. M(z) --> z \<subseteq> x --> z \<in> y), 
   287                \<lambda>a x. \<exists>y\<in>Mset(a). \<forall>z\<in>Mset(a). z \<subseteq> x --> z \<in> y)" 
   288 by fast
   289 
   290 text{*Example 2'.  We give the reflecting class explicitly. *}
   291 lemma (in reflection) 
   292   "Reflects
   293     (\<lambda>a. (Ord(a) \<and>
   294           ClEx(\<lambda>x. ~ (snd(x) \<subseteq> fst(fst(x)) --> snd(x) \<in> snd(fst(x))), a)) \<and>
   295           ClEx(\<lambda>x. \<forall>z. M(z) --> z \<subseteq> fst(x) --> z \<in> snd(x), a),
   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 by fast
   299 
   300 text{*Example 2''.  We expand the subset relation.*}
   301 lemma (in reflection) 
   302   "Reflects(?Cl,
   303         \<lambda>x. \<exists>y. M(y) \<and> (\<forall>z. M(z) --> (\<forall>w. M(w) --> w\<in>z --> w\<in>x) --> z\<in>y),
   304         \<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)"
   305 by fast
   306 
   307 text{*Example 2'''.  Single-step version, to reveal the reflecting class.*}
   308 lemma (in reflection) 
   309      "Reflects(?Cl,
   310                \<lambda>x. \<exists>y. M(y) \<and> (\<forall>z. M(z) --> z \<subseteq> x --> z \<in> y), 
   311                \<lambda>a x. \<exists>y\<in>Mset(a). \<forall>z\<in>Mset(a). z \<subseteq> x --> z \<in> y)" 
   312 apply (rule Ex_reflection) 
   313 txt{*
   314 @{goals[display,indent=0,margin=60]}
   315 *}
   316 apply (rule All_reflection) 
   317 txt{*
   318 @{goals[display,indent=0,margin=60]}
   319 *}
   320 apply (rule Triv_reflection) 
   321 txt{*
   322 @{goals[display,indent=0,margin=60]}
   323 *}
   324 done
   325 
   326 text{*Example 3.  Warning: the following examples make sense only
   327 if @{term P} is quantifier-free, since it is not being relativized.*}
   328 lemma (in reflection) 
   329      "Reflects(?Cl,
   330                \<lambda>x. \<exists>y. M(y) \<and> (\<forall>z. M(z) --> z \<in> y <-> z \<in> x \<and> P(z)), 
   331                \<lambda>a x. \<exists>y\<in>Mset(a). \<forall>z\<in>Mset(a). z \<in> y <-> z \<in> x \<and> P(z))"
   332 by fast
   333 
   334 text{*Example 3'*}
   335 lemma (in reflection) 
   336      "Reflects(?Cl,
   337                \<lambda>x. \<exists>y. M(y) \<and> y = Collect(x,P),
   338                \<lambda>a x. \<exists>y\<in>Mset(a). y = Collect(x,P))";
   339 by fast
   340 
   341 text{*Example 3''*}
   342 lemma (in reflection) 
   343      "Reflects(?Cl,
   344                \<lambda>x. \<exists>y. M(y) \<and> y = Replace(x,P),
   345                \<lambda>a x. \<exists>y\<in>Mset(a). y = Replace(x,P))";
   346 by fast
   347 
   348 text{*Example 4: Axiom of Choice.  Possibly wrong, since @{text \<Pi>} needs
   349 to be relativized.*}
   350 lemma (in reflection) 
   351      "Reflects(?Cl,
   352                \<lambda>A. 0\<notin>A --> (\<exists>f. M(f) \<and> f \<in> (\<Pi>X \<in> A. X)),
   353                \<lambda>a A. 0\<notin>A --> (\<exists>f\<in>Mset(a). f \<in> (\<Pi>X \<in> A. X)))"
   354 by fast
   355 
   356 end
   357