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