| author | haftmann | 
| Tue, 26 Sep 2006 13:34:17 +0200 | |
| changeset 20714 | 6a122dba034c | 
| parent 19931 | fb32b43e7f80 | 
| child 21233 | 5a5c8ea5f66a | 
| permissions | -rw-r--r-- | 
| 13503 | 1 | (* Title: ZF/Constructible/DPow_absolute.thy | 
| 2 | ID: $Id$ | |
| 3 | Author: Lawrence C Paulson, Cambridge University Computer Laboratory | |
| 4 | *) | |
| 5 | ||
| 6 | header {*Absoluteness for the Definable Powerset Function*}
 | |
| 7 | ||
| 8 | ||
| 16417 | 9 | theory DPow_absolute imports Satisfies_absolute begin | 
| 13503 | 10 | |
| 11 | ||
| 12 | subsection{*Preliminary Internalizations*}
 | |
| 13 | ||
| 14 | subsubsection{*The Operator @{term is_formula_rec}*}
 | |
| 15 | ||
| 16 | text{*The three arguments of @{term p} are always 2, 1, 0.  It is buried
 | |
| 17 | within 11 quantifiers!!*} | |
| 18 | ||
| 19 | (* is_formula_rec :: "[i=>o, [i,i,i]=>o, i, i] => o" | |
| 20 | "is_formula_rec(M,MH,p,z) == | |
| 21 | \<exists>dp[M]. \<exists>i[M]. \<exists>f[M]. finite_ordinal(M,dp) & is_depth(M,p,dp) & | |
| 22 | 2 1 0 | |
| 23 | successor(M,dp,i) & fun_apply(M,f,p,z) & is_transrec(M,MH,i,f)" | |
| 24 | *) | |
| 25 | ||
| 26 | constdefs formula_rec_fm :: "[i, i, i]=>i" | |
| 27 | "formula_rec_fm(mh,p,z) == | |
| 28 | Exists(Exists(Exists( | |
| 29 | And(finite_ordinal_fm(2), | |
| 30 | And(depth_fm(p#+3,2), | |
| 31 | And(succ_fm(2,1), | |
| 32 | And(fun_apply_fm(0,p#+3,z#+3), is_transrec_fm(mh,1,0))))))))" | |
| 33 | ||
| 34 | lemma is_formula_rec_type [TC]: | |
| 35 | "[| p \<in> formula; x \<in> nat; z \<in> nat |] | |
| 36 | ==> formula_rec_fm(p,x,z) \<in> formula" | |
| 37 | by (simp add: formula_rec_fm_def) | |
| 38 | ||
| 39 | lemma sats_formula_rec_fm: | |
| 40 | assumes MH_iff_sats: | |
| 41 | "!!a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10. | |
| 42 | [|a0\<in>A; a1\<in>A; a2\<in>A; a3\<in>A; a4\<in>A; a5\<in>A; a6\<in>A; a7\<in>A; a8\<in>A; a9\<in>A; a10\<in>A|] | |
| 43 | ==> MH(a2, a1, a0) <-> | |
| 44 | sats(A, p, Cons(a0,Cons(a1,Cons(a2,Cons(a3, | |
| 45 | Cons(a4,Cons(a5,Cons(a6,Cons(a7, | |
| 46 | Cons(a8,Cons(a9,Cons(a10,env))))))))))))" | |
| 47 | shows | |
| 48 | "[|x \<in> nat; z \<in> nat; env \<in> list(A)|] | |
| 49 | ==> sats(A, formula_rec_fm(p,x,z), env) <-> | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 50 | is_formula_rec(##A, MH, nth(x,env), nth(z,env))" | 
| 13503 | 51 | by (simp add: formula_rec_fm_def sats_is_transrec_fm is_formula_rec_def | 
| 52 | MH_iff_sats [THEN iff_sym]) | |
| 53 | ||
| 54 | lemma formula_rec_iff_sats: | |
| 55 | assumes MH_iff_sats: | |
| 56 | "!!a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10. | |
| 57 | [|a0\<in>A; a1\<in>A; a2\<in>A; a3\<in>A; a4\<in>A; a5\<in>A; a6\<in>A; a7\<in>A; a8\<in>A; a9\<in>A; a10\<in>A|] | |
| 58 | ==> MH(a2, a1, a0) <-> | |
| 59 | sats(A, p, Cons(a0,Cons(a1,Cons(a2,Cons(a3, | |
| 60 | Cons(a4,Cons(a5,Cons(a6,Cons(a7, | |
| 61 | Cons(a8,Cons(a9,Cons(a10,env))))))))))))" | |
| 62 | shows | |
| 63 | "[|nth(i,env) = x; nth(k,env) = z; | |
| 64 | i \<in> nat; k \<in> nat; env \<in> list(A)|] | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 65 | ==> is_formula_rec(##A, MH, x, z) <-> sats(A, formula_rec_fm(p,i,k), env)" | 
| 13503 | 66 | by (simp add: sats_formula_rec_fm [OF MH_iff_sats]) | 
| 67 | ||
| 68 | theorem formula_rec_reflection: | |
| 69 | assumes MH_reflection: | |
| 70 | "!!f' f g h. REFLECTS[\<lambda>x. MH(L, f'(x), f(x), g(x), h(x)), | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 71 | \<lambda>i x. MH(##Lset(i), f'(x), f(x), g(x), h(x))]" | 
| 13503 | 72 | shows "REFLECTS[\<lambda>x. is_formula_rec(L, MH(L,x), f(x), h(x)), | 
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 73 | \<lambda>i x. is_formula_rec(##Lset(i), MH(##Lset(i),x), f(x), h(x))]" | 
| 13655 
95b95cdb4704
Tidying up.  New primitives is_iterates and is_iterates_fm.
 paulson parents: 
13634diff
changeset | 74 | apply (simp (no_asm_use) only: is_formula_rec_def) | 
| 13503 | 75 | apply (intro FOL_reflections function_reflections fun_plus_reflections | 
| 76 | depth_reflection is_transrec_reflection MH_reflection) | |
| 77 | done | |
| 78 | ||
| 79 | ||
| 80 | subsubsection{*The Operator @{term is_satisfies}*}
 | |
| 81 | ||
| 82 | (* is_satisfies(M,A,p,z) == is_formula_rec (M, satisfies_MH(M,A), p, z) *) | |
| 83 | constdefs satisfies_fm :: "[i,i,i]=>i" | |
| 84 | "satisfies_fm(x) == formula_rec_fm (satisfies_MH_fm(x#+5#+6, 2, 1, 0))" | |
| 85 | ||
| 86 | lemma is_satisfies_type [TC]: | |
| 87 | "[| x \<in> nat; y \<in> nat; z \<in> nat |] ==> satisfies_fm(x,y,z) \<in> formula" | |
| 88 | by (simp add: satisfies_fm_def) | |
| 89 | ||
| 90 | lemma sats_satisfies_fm [simp]: | |
| 91 | "[| x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|] | |
| 92 | ==> sats(A, satisfies_fm(x,y,z), env) <-> | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 93 | is_satisfies(##A, nth(x,env), nth(y,env), nth(z,env))" | 
| 13503 | 94 | by (simp add: satisfies_fm_def is_satisfies_def sats_satisfies_MH_fm | 
| 95 | sats_formula_rec_fm) | |
| 96 | ||
| 97 | lemma satisfies_iff_sats: | |
| 98 | "[| nth(i,env) = x; nth(j,env) = y; nth(k,env) = z; | |
| 99 | i \<in> nat; j \<in> nat; k \<in> nat; env \<in> list(A)|] | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 100 | ==> is_satisfies(##A, x, y, z) <-> sats(A, satisfies_fm(i,j,k), env)" | 
| 13503 | 101 | by (simp add: sats_satisfies_fm) | 
| 102 | ||
| 103 | theorem satisfies_reflection: | |
| 104 | "REFLECTS[\<lambda>x. is_satisfies(L,f(x),g(x),h(x)), | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 105 | \<lambda>i x. is_satisfies(##Lset(i),f(x),g(x),h(x))]" | 
| 13655 
95b95cdb4704
Tidying up.  New primitives is_iterates and is_iterates_fm.
 paulson parents: 
13634diff
changeset | 106 | apply (simp only: is_satisfies_def) | 
| 13503 | 107 | apply (intro formula_rec_reflection satisfies_MH_reflection) | 
| 108 | done | |
| 109 | ||
| 110 | ||
| 111 | subsection {*Relativization of the Operator @{term DPow'}*}
 | |
| 112 | ||
| 113 | lemma DPow'_eq: | |
| 13692 | 114 |   "DPow'(A) = {z . ep \<in> list(A) * formula, 
 | 
| 115 | \<exists>env \<in> list(A). \<exists>p \<in> formula. | |
| 116 |                        ep = <env,p> & z = {x\<in>A. sats(A, p, Cons(x,env))}}"
 | |
| 117 | by (simp add: DPow'_def, blast) | |
| 13503 | 118 | |
| 119 | ||
| 13692 | 120 | text{*Relativize the use of @{term sats} within @{term DPow'}
 | 
| 121 | (the comprehension).*} | |
| 13503 | 122 | constdefs | 
| 13692 | 123 | is_DPow_sats :: "[i=>o,i,i,i,i] => o" | 
| 124 | "is_DPow_sats(M,A,env,p,x) == | |
| 13503 | 125 | \<forall>n1[M]. \<forall>e[M]. \<forall>sp[M]. | 
| 126 | is_satisfies(M,A,p,sp) --> is_Cons(M,x,env,e) --> | |
| 127 | fun_apply(M, sp, e, n1) --> number1(M, n1)" | |
| 128 | ||
| 13692 | 129 | lemma (in M_satisfies) DPow_sats_abs: | 
| 13503 | 130 | "[| M(A); env \<in> list(A); p \<in> formula; M(x) |] | 
| 13692 | 131 | ==> is_DPow_sats(M,A,env,p,x) <-> sats(A, p, Cons(x,env))" | 
| 13503 | 132 | apply (subgoal_tac "M(env)") | 
| 13692 | 133 | apply (simp add: is_DPow_sats_def satisfies_closed satisfies_abs) | 
| 13503 | 134 | apply (blast dest: transM) | 
| 135 | done | |
| 136 | ||
| 13692 | 137 | lemma (in M_satisfies) Collect_DPow_sats_abs: | 
| 13503 | 138 | "[| M(A); env \<in> list(A); p \<in> formula |] | 
| 13692 | 139 | ==> Collect(A, is_DPow_sats(M,A,env,p)) = | 
| 13503 | 140 |         {x \<in> A. sats(A, p, Cons(x,env))}"
 | 
| 13692 | 141 | by (simp add: DPow_sats_abs transM [of _ A]) | 
| 13503 | 142 | |
| 143 | ||
| 13692 | 144 | subsubsection{*The Operator @{term is_DPow_sats}, Internalized*}
 | 
| 13503 | 145 | |
| 13692 | 146 | (* is_DPow_sats(M,A,env,p,x) == | 
| 13503 | 147 | \<forall>n1[M]. \<forall>e[M]. \<forall>sp[M]. | 
| 148 | is_satisfies(M,A,p,sp) --> is_Cons(M,x,env,e) --> | |
| 149 | fun_apply(M, sp, e, n1) --> number1(M, n1) *) | |
| 150 | ||
| 13692 | 151 | constdefs DPow_sats_fm :: "[i,i,i,i]=>i" | 
| 152 | "DPow_sats_fm(A,env,p,x) == | |
| 13503 | 153 | Forall(Forall(Forall( | 
| 154 | Implies(satisfies_fm(A#+3,p#+3,0), | |
| 155 | Implies(Cons_fm(x#+3,env#+3,1), | |
| 156 | Implies(fun_apply_fm(0,1,2), number1_fm(2)))))))" | |
| 157 | ||
| 13692 | 158 | lemma is_DPow_sats_type [TC]: | 
| 13503 | 159 | "[| A \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat |] | 
| 13692 | 160 | ==> DPow_sats_fm(A,x,y,z) \<in> formula" | 
| 161 | by (simp add: DPow_sats_fm_def) | |
| 13503 | 162 | |
| 13692 | 163 | lemma sats_DPow_sats_fm [simp]: | 
| 13503 | 164 | "[| u \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|] | 
| 13692 | 165 | ==> sats(A, DPow_sats_fm(u,x,y,z), env) <-> | 
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 166 | is_DPow_sats(##A, nth(u,env), nth(x,env), nth(y,env), nth(z,env))" | 
| 13692 | 167 | by (simp add: DPow_sats_fm_def is_DPow_sats_def) | 
| 13503 | 168 | |
| 13692 | 169 | lemma DPow_sats_iff_sats: | 
| 13503 | 170 | "[| nth(u,env) = nu; nth(x,env) = nx; nth(y,env) = ny; nth(z,env) = nz; | 
| 171 | u \<in> nat; x \<in> nat; y \<in> nat; z \<in> nat; env \<in> list(A)|] | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 172 | ==> is_DPow_sats(##A,nu,nx,ny,nz) <-> | 
| 13692 | 173 | sats(A, DPow_sats_fm(u,x,y,z), env)" | 
| 13503 | 174 | by simp | 
| 175 | ||
| 13692 | 176 | theorem DPow_sats_reflection: | 
| 177 | "REFLECTS[\<lambda>x. is_DPow_sats(L,f(x),g(x),h(x),g'(x)), | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 178 | \<lambda>i x. is_DPow_sats(##Lset(i),f(x),g(x),h(x),g'(x))]" | 
| 13692 | 179 | apply (unfold is_DPow_sats_def) | 
| 13503 | 180 | apply (intro FOL_reflections function_reflections extra_reflections | 
| 181 | satisfies_reflection) | |
| 182 | done | |
| 183 | ||
| 184 | ||
| 13687 | 185 | subsection{*A Locale for Relativizing the Operator @{term DPow'}*}
 | 
| 13503 | 186 | |
| 187 | locale M_DPow = M_satisfies + | |
| 188 | assumes sep: | |
| 189 | "[| M(A); env \<in> list(A); p \<in> formula |] | |
| 13692 | 190 | ==> separation(M, \<lambda>x. is_DPow_sats(M,A,env,p,x))" | 
| 13503 | 191 | and rep: | 
| 192 | "M(A) | |
| 193 | ==> strong_replacement (M, | |
| 194 | \<lambda>ep z. \<exists>env[M]. \<exists>p[M]. mem_formula(M,p) & mem_list(M,A,env) & | |
| 195 | pair(M,env,p,ep) & | |
| 13692 | 196 | is_Collect(M, A, \<lambda>x. is_DPow_sats(M,A,env,p,x), z))" | 
| 13503 | 197 | |
| 198 | lemma (in M_DPow) sep': | |
| 199 | "[| M(A); env \<in> list(A); p \<in> formula |] | |
| 200 | ==> separation(M, \<lambda>x. sats(A, p, Cons(x,env)))" | |
| 13692 | 201 | by (insert sep [of A env p], simp add: DPow_sats_abs) | 
| 13503 | 202 | |
| 203 | lemma (in M_DPow) rep': | |
| 204 | "M(A) | |
| 205 | ==> strong_replacement (M, | |
| 206 | \<lambda>ep z. \<exists>env\<in>list(A). \<exists>p\<in>formula. | |
| 13504 | 207 |                   ep = <env,p> & z = {x \<in> A . sats(A, p, Cons(x, env))})" 
 | 
| 13692 | 208 | by (insert rep [of A], simp add: Collect_DPow_sats_abs) | 
| 13503 | 209 | |
| 210 | ||
| 211 | lemma univalent_pair_eq: | |
| 212 | "univalent (M, A, \<lambda>xy z. \<exists>x\<in>B. \<exists>y\<in>C. xy = \<langle>x,y\<rangle> \<and> z = f(x,y))" | |
| 213 | by (simp add: univalent_def, blast) | |
| 214 | ||
| 215 | lemma (in M_DPow) DPow'_closed: "M(A) ==> M(DPow'(A))" | |
| 216 | apply (simp add: DPow'_eq) | |
| 217 | apply (fast intro: rep' sep' univalent_pair_eq) | |
| 218 | done | |
| 219 | ||
| 220 | text{*Relativization of the Operator @{term DPow'}*}
 | |
| 221 | constdefs | |
| 222 | is_DPow' :: "[i=>o,i,i] => o" | |
| 223 | "is_DPow'(M,A,Z) == | |
| 224 | \<forall>X[M]. X \<in> Z <-> | |
| 225 | subset(M,X,A) & | |
| 226 | (\<exists>env[M]. \<exists>p[M]. mem_formula(M,p) & mem_list(M,A,env) & | |
| 13692 | 227 | is_Collect(M, A, is_DPow_sats(M,A,env,p), X))" | 
| 13503 | 228 | |
| 229 | lemma (in M_DPow) DPow'_abs: | |
| 230 | "[|M(A); M(Z)|] ==> is_DPow'(M,A,Z) <-> Z = DPow'(A)" | |
| 231 | apply (rule iffI) | |
| 13692 | 232 | prefer 2 apply (simp add: is_DPow'_def DPow'_def Collect_DPow_sats_abs) | 
| 13503 | 233 | apply (rule M_equalityI) | 
| 13692 | 234 | apply (simp add: is_DPow'_def DPow'_def Collect_DPow_sats_abs, assumption) | 
| 13503 | 235 | apply (erule DPow'_closed) | 
| 236 | done | |
| 237 | ||
| 238 | ||
| 239 | subsection{*Instantiating the Locale @{text M_DPow}*}
 | |
| 240 | ||
| 241 | subsubsection{*The Instance of Separation*}
 | |
| 242 | ||
| 243 | lemma DPow_separation: | |
| 244 | "[| L(A); env \<in> list(A); p \<in> formula |] | |
| 13692 | 245 | ==> separation(L, \<lambda>x. is_DPow_sats(L,A,env,p,x))" | 
| 246 | apply (rule gen_separation_multi [OF DPow_sats_reflection, of "{A,env,p}"], 
 | |
| 13687 | 247 | auto intro: transL) | 
| 248 | apply (rule_tac env="[A,env,p]" in DPow_LsetI) | |
| 13692 | 249 | apply (rule DPow_sats_iff_sats sep_rules | simp)+ | 
| 13503 | 250 | done | 
| 251 | ||
| 252 | ||
| 253 | ||
| 254 | subsubsection{*The Instance of Replacement*}
 | |
| 255 | ||
| 256 | lemma DPow_replacement_Reflects: | |
| 257 | "REFLECTS [\<lambda>x. \<exists>u[L]. u \<in> B & | |
| 258 | (\<exists>env[L]. \<exists>p[L]. | |
| 259 | mem_formula(L,p) & mem_list(L,A,env) & pair(L,env,p,u) & | |
| 13692 | 260 | is_Collect (L, A, is_DPow_sats(L,A,env,p), x)), | 
| 13503 | 261 | \<lambda>i x. \<exists>u \<in> Lset(i). u \<in> B & | 
| 262 | (\<exists>env \<in> Lset(i). \<exists>p \<in> Lset(i). | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 263 | mem_formula(##Lset(i),p) & mem_list(##Lset(i),A,env) & | 
| 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 264 | pair(##Lset(i),env,p,u) & | 
| 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 265 | is_Collect (##Lset(i), A, is_DPow_sats(##Lset(i),A,env,p), x))]" | 
| 13503 | 266 | apply (unfold is_Collect_def) | 
| 267 | apply (intro FOL_reflections function_reflections mem_formula_reflection | |
| 13692 | 268 | mem_list_reflection DPow_sats_reflection) | 
| 13503 | 269 | done | 
| 270 | ||
| 271 | lemma DPow_replacement: | |
| 272 | "L(A) | |
| 273 | ==> strong_replacement (L, | |
| 274 | \<lambda>ep z. \<exists>env[L]. \<exists>p[L]. mem_formula(L,p) & mem_list(L,A,env) & | |
| 275 | pair(L,env,p,ep) & | |
| 13692 | 276 | is_Collect(L, A, \<lambda>x. is_DPow_sats(L,A,env,p,x), z))" | 
| 13503 | 277 | apply (rule strong_replacementI) | 
| 13687 | 278 | apply (rule_tac u="{A,B}" 
 | 
| 279 | in gen_separation_multi [OF DPow_replacement_Reflects], | |
| 280 | auto) | |
| 13566 | 281 | apply (unfold is_Collect_def) | 
| 13687 | 282 | apply (rule_tac env="[A,B]" in DPow_LsetI) | 
| 13503 | 283 | apply (rule sep_rules mem_formula_iff_sats mem_list_iff_sats | 
| 13692 | 284 | DPow_sats_iff_sats | simp)+ | 
| 13503 | 285 | done | 
| 286 | ||
| 287 | ||
| 288 | subsubsection{*Actually Instantiating the Locale*}
 | |
| 289 | ||
| 290 | lemma M_DPow_axioms_L: "M_DPow_axioms(L)" | |
| 291 | apply (rule M_DPow_axioms.intro) | |
| 292 | apply (assumption | rule DPow_separation DPow_replacement)+ | |
| 293 | done | |
| 294 | ||
| 295 | theorem M_DPow_L: "PROP M_DPow(L)" | |
| 296 | apply (rule M_DPow.intro) | |
| 19931 
fb32b43e7f80
Restructured locales with predicates: import is now an interpretation.
 ballarin parents: 
16417diff
changeset | 297 | apply (rule M_satisfies_L) | 
| 13503 | 298 | apply (rule M_DPow_axioms_L) | 
| 299 | done | |
| 300 | ||
| 301 | lemmas DPow'_closed [intro, simp] = M_DPow.DPow'_closed [OF M_DPow_L] | |
| 302 | and DPow'_abs [intro, simp] = M_DPow.DPow'_abs [OF M_DPow_L] | |
| 303 | ||
| 13505 | 304 | |
| 305 | subsubsection{*The Operator @{term is_Collect}*}
 | |
| 306 | ||
| 307 | text{*The formula @{term is_P} has one free variable, 0, and it is
 | |
| 308 | enclosed within a single quantifier.*} | |
| 309 | ||
| 310 | (* is_Collect :: "[i=>o,i,i=>o,i] => o" | |
| 311 | "is_Collect(M,A,P,z) == \<forall>x[M]. x \<in> z <-> x \<in> A & P(x)" *) | |
| 312 | ||
| 313 | constdefs Collect_fm :: "[i, i, i]=>i" | |
| 314 | "Collect_fm(A,is_P,z) == | |
| 315 | Forall(Iff(Member(0,succ(z)), | |
| 316 | And(Member(0,succ(A)), is_P)))" | |
| 317 | ||
| 318 | lemma is_Collect_type [TC]: | |
| 319 | "[| is_P \<in> formula; x \<in> nat; y \<in> nat |] | |
| 320 | ==> Collect_fm(x,is_P,y) \<in> formula" | |
| 321 | by (simp add: Collect_fm_def) | |
| 322 | ||
| 323 | lemma sats_Collect_fm: | |
| 324 | assumes is_P_iff_sats: | |
| 325 | "!!a. a \<in> A ==> is_P(a) <-> sats(A, p, Cons(a, env))" | |
| 326 | shows | |
| 327 | "[|x \<in> nat; y \<in> nat; env \<in> list(A)|] | |
| 328 | ==> sats(A, Collect_fm(x,p,y), env) <-> | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 329 | is_Collect(##A, nth(x,env), is_P, nth(y,env))" | 
| 13505 | 330 | by (simp add: Collect_fm_def is_Collect_def is_P_iff_sats [THEN iff_sym]) | 
| 331 | ||
| 332 | lemma Collect_iff_sats: | |
| 333 | assumes is_P_iff_sats: | |
| 334 | "!!a. a \<in> A ==> is_P(a) <-> sats(A, p, Cons(a, env))" | |
| 335 | shows | |
| 336 | "[| nth(i,env) = x; nth(j,env) = y; | |
| 337 | i \<in> nat; j \<in> nat; env \<in> list(A)|] | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 338 | ==> is_Collect(##A, x, is_P, y) <-> sats(A, Collect_fm(i,p,j), env)" | 
| 13505 | 339 | by (simp add: sats_Collect_fm [OF is_P_iff_sats]) | 
| 340 | ||
| 341 | ||
| 342 | text{*The second argument of @{term is_P} gives it direct access to @{term x},
 | |
| 343 | which is essential for handling free variable references.*} | |
| 344 | theorem Collect_reflection: | |
| 345 | assumes is_P_reflection: | |
| 346 | "!!h f g. REFLECTS[\<lambda>x. is_P(L, f(x), g(x)), | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 347 | \<lambda>i x. is_P(##Lset(i), f(x), g(x))]" | 
| 13505 | 348 | shows "REFLECTS[\<lambda>x. is_Collect(L, f(x), is_P(L,x), g(x)), | 
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 349 | \<lambda>i x. is_Collect(##Lset(i), f(x), is_P(##Lset(i), x), g(x))]" | 
| 13655 
95b95cdb4704
Tidying up.  New primitives is_iterates and is_iterates_fm.
 paulson parents: 
13634diff
changeset | 350 | apply (simp (no_asm_use) only: is_Collect_def) | 
| 13505 | 351 | apply (intro FOL_reflections is_P_reflection) | 
| 352 | done | |
| 353 | ||
| 354 | ||
| 355 | subsubsection{*The Operator @{term is_Replace}*}
 | |
| 356 | ||
| 357 | text{*BEWARE!  The formula @{term is_P} has free variables 0, 1
 | |
| 358 | and not the usual 1, 0! It is enclosed within two quantifiers.*} | |
| 359 | ||
| 360 | (* is_Replace :: "[i=>o,i,[i,i]=>o,i] => o" | |
| 361 | "is_Replace(M,A,P,z) == \<forall>u[M]. u \<in> z <-> (\<exists>x[M]. x\<in>A & P(x,u))" *) | |
| 362 | ||
| 363 | constdefs Replace_fm :: "[i, i, i]=>i" | |
| 364 | "Replace_fm(A,is_P,z) == | |
| 365 | Forall(Iff(Member(0,succ(z)), | |
| 366 | Exists(And(Member(0,A#+2), is_P))))" | |
| 367 | ||
| 368 | lemma is_Replace_type [TC]: | |
| 369 | "[| is_P \<in> formula; x \<in> nat; y \<in> nat |] | |
| 370 | ==> Replace_fm(x,is_P,y) \<in> formula" | |
| 371 | by (simp add: Replace_fm_def) | |
| 372 | ||
| 373 | lemma sats_Replace_fm: | |
| 374 | assumes is_P_iff_sats: | |
| 375 | "!!a b. [|a \<in> A; b \<in> A|] | |
| 376 | ==> is_P(a,b) <-> sats(A, p, Cons(a,Cons(b,env)))" | |
| 377 | shows | |
| 378 | "[|x \<in> nat; y \<in> nat; env \<in> list(A)|] | |
| 379 | ==> sats(A, Replace_fm(x,p,y), env) <-> | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 380 | is_Replace(##A, nth(x,env), is_P, nth(y,env))" | 
| 13505 | 381 | by (simp add: Replace_fm_def is_Replace_def is_P_iff_sats [THEN iff_sym]) | 
| 382 | ||
| 383 | lemma Replace_iff_sats: | |
| 384 | assumes is_P_iff_sats: | |
| 385 | "!!a b. [|a \<in> A; b \<in> A|] | |
| 386 | ==> is_P(a,b) <-> sats(A, p, Cons(a,Cons(b,env)))" | |
| 387 | shows | |
| 388 | "[| nth(i,env) = x; nth(j,env) = y; | |
| 389 | i \<in> nat; j \<in> nat; env \<in> list(A)|] | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 390 | ==> is_Replace(##A, x, is_P, y) <-> sats(A, Replace_fm(i,p,j), env)" | 
| 13505 | 391 | by (simp add: sats_Replace_fm [OF is_P_iff_sats]) | 
| 392 | ||
| 393 | ||
| 394 | text{*The second argument of @{term is_P} gives it direct access to @{term x},
 | |
| 395 | which is essential for handling free variable references.*} | |
| 396 | theorem Replace_reflection: | |
| 397 | assumes is_P_reflection: | |
| 398 | "!!h f g. REFLECTS[\<lambda>x. is_P(L, f(x), g(x), h(x)), | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 399 | \<lambda>i x. is_P(##Lset(i), f(x), g(x), h(x))]" | 
| 13505 | 400 | shows "REFLECTS[\<lambda>x. is_Replace(L, f(x), is_P(L,x), g(x)), | 
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 401 | \<lambda>i x. is_Replace(##Lset(i), f(x), is_P(##Lset(i), x), g(x))]" | 
| 13655 
95b95cdb4704
Tidying up.  New primitives is_iterates and is_iterates_fm.
 paulson parents: 
13634diff
changeset | 402 | apply (simp (no_asm_use) only: is_Replace_def) | 
| 13505 | 403 | apply (intro FOL_reflections is_P_reflection) | 
| 404 | done | |
| 405 | ||
| 406 | ||
| 407 | ||
| 408 | subsubsection{*The Operator @{term is_DPow'}, Internalized*}
 | |
| 409 | ||
| 410 | (* "is_DPow'(M,A,Z) == | |
| 411 | \<forall>X[M]. X \<in> Z <-> | |
| 412 | subset(M,X,A) & | |
| 413 | (\<exists>env[M]. \<exists>p[M]. mem_formula(M,p) & mem_list(M,A,env) & | |
| 13692 | 414 | is_Collect(M, A, is_DPow_sats(M,A,env,p), X))" *) | 
| 13505 | 415 | |
| 416 | constdefs DPow'_fm :: "[i,i]=>i" | |
| 417 | "DPow'_fm(A,Z) == | |
| 418 | Forall( | |
| 419 | Iff(Member(0,succ(Z)), | |
| 420 | And(subset_fm(0,succ(A)), | |
| 421 | Exists(Exists( | |
| 422 | And(mem_formula_fm(0), | |
| 423 | And(mem_list_fm(A#+3,1), | |
| 424 | Collect_fm(A#+3, | |
| 13692 | 425 | DPow_sats_fm(A#+4, 2, 1, 0), 2))))))))" | 
| 13505 | 426 | |
| 427 | lemma is_DPow'_type [TC]: | |
| 428 | "[| x \<in> nat; y \<in> nat |] ==> DPow'_fm(x,y) \<in> formula" | |
| 429 | by (simp add: DPow'_fm_def) | |
| 430 | ||
| 431 | lemma sats_DPow'_fm [simp]: | |
| 432 | "[| x \<in> nat; y \<in> nat; env \<in> list(A)|] | |
| 433 | ==> sats(A, DPow'_fm(x,y), env) <-> | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 434 | is_DPow'(##A, nth(x,env), nth(y,env))" | 
| 13505 | 435 | by (simp add: DPow'_fm_def is_DPow'_def sats_subset_fm' sats_Collect_fm) | 
| 436 | ||
| 437 | lemma DPow'_iff_sats: | |
| 438 | "[| nth(i,env) = x; nth(j,env) = y; | |
| 439 | i \<in> nat; j \<in> nat; env \<in> list(A)|] | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 440 | ==> is_DPow'(##A, x, y) <-> sats(A, DPow'_fm(i,j), env)" | 
| 13505 | 441 | by (simp add: sats_DPow'_fm) | 
| 442 | ||
| 443 | theorem DPow'_reflection: | |
| 444 | "REFLECTS[\<lambda>x. is_DPow'(L,f(x),g(x)), | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 445 | \<lambda>i x. is_DPow'(##Lset(i),f(x),g(x))]" | 
| 13655 
95b95cdb4704
Tidying up.  New primitives is_iterates and is_iterates_fm.
 paulson parents: 
13634diff
changeset | 446 | apply (simp only: is_DPow'_def) | 
| 13505 | 447 | apply (intro FOL_reflections function_reflections mem_formula_reflection | 
| 13692 | 448 | mem_list_reflection Collect_reflection DPow_sats_reflection) | 
| 13505 | 449 | done | 
| 450 | ||
| 451 | ||
| 13687 | 452 | subsection{*A Locale for Relativizing the Operator @{term Lset}*}
 | 
| 13505 | 453 | |
| 454 | constdefs | |
| 455 | transrec_body :: "[i=>o,i,i,i,i] => o" | |
| 456 | "transrec_body(M,g,x) == | |
| 457 | \<lambda>y z. \<exists>gy[M]. y \<in> x & fun_apply(M,g,y,gy) & is_DPow'(M,gy,z)" | |
| 458 | ||
| 459 | lemma (in M_DPow) transrec_body_abs: | |
| 460 | "[|M(x); M(g); M(z)|] | |
| 461 | ==> transrec_body(M,g,x,y,z) <-> y \<in> x & z = DPow'(g`y)" | |
| 462 | by (simp add: transrec_body_def DPow'_abs transM [of _ x]) | |
| 463 | ||
| 464 | locale M_Lset = M_DPow + | |
| 465 | assumes strong_rep: | |
| 466 | "[|M(x); M(g)|] ==> strong_replacement(M, \<lambda>y z. transrec_body(M,g,x,y,z))" | |
| 467 | and transrec_rep: | |
| 468 | "M(i) ==> transrec_replacement(M, \<lambda>x f u. | |
| 469 | \<exists>r[M]. is_Replace(M, x, transrec_body(M,f,x), r) & | |
| 470 | big_union(M, r, u), i)" | |
| 471 | ||
| 472 | ||
| 473 | lemma (in M_Lset) strong_rep': | |
| 474 | "[|M(x); M(g)|] | |
| 475 | ==> strong_replacement(M, \<lambda>y z. y \<in> x & z = DPow'(g`y))" | |
| 476 | by (insert strong_rep [of x g], simp add: transrec_body_abs) | |
| 477 | ||
| 478 | lemma (in M_Lset) DPow_apply_closed: | |
| 479 | "[|M(f); M(x); y\<in>x|] ==> M(DPow'(f`y))" | |
| 480 | by (blast intro: DPow'_closed dest: transM) | |
| 481 | ||
| 482 | lemma (in M_Lset) RepFun_DPow_apply_closed: | |
| 483 |    "[|M(f); M(x)|] ==> M({DPow'(f`y). y\<in>x})"
 | |
| 484 | by (blast intro: DPow_apply_closed RepFun_closed2 strong_rep') | |
| 485 | ||
| 486 | lemma (in M_Lset) RepFun_DPow_abs: | |
| 487 | "[|M(x); M(f); M(r) |] | |
| 488 | ==> is_Replace(M, x, \<lambda>y z. transrec_body(M,f,x,y,z), r) <-> | |
| 489 |           r =  {DPow'(f`y). y\<in>x}"
 | |
| 490 | apply (simp add: transrec_body_abs RepFun_def) | |
| 491 | apply (rule iff_trans) | |
| 492 | apply (rule Replace_abs) | |
| 493 | apply (simp_all add: DPow_apply_closed strong_rep') | |
| 494 | done | |
| 495 | ||
| 496 | lemma (in M_Lset) transrec_rep': | |
| 497 | "M(i) ==> transrec_replacement(M, \<lambda>x f u. u = (\<Union>y\<in>x. DPow'(f ` y)), i)" | |
| 498 | apply (insert transrec_rep [of i]) | |
| 499 | apply (simp add: RepFun_DPow_apply_closed RepFun_DPow_abs | |
| 500 | transrec_replacement_def) | |
| 501 | done | |
| 502 | ||
| 503 | ||
| 13687 | 504 | text{*Relativization of the Operator @{term Lset}*}
 | 
| 13692 | 505 | |
| 13505 | 506 | constdefs | 
| 507 | is_Lset :: "[i=>o, i, i] => o" | |
| 13692 | 508 |    --{*We can use the term language below because @{term is_Lset} will
 | 
| 509 | not have to be internalized: it isn't used in any instance of | |
| 510 | separation.*} | |
| 13505 | 511 | "is_Lset(M,a,z) == is_transrec(M, %x f u. u = (\<Union>y\<in>x. DPow'(f`y)), a, z)" | 
| 512 | ||
| 513 | lemma (in M_Lset) Lset_abs: | |
| 514 | "[|Ord(i); M(i); M(z)|] | |
| 515 | ==> is_Lset(M,i,z) <-> z = Lset(i)" | |
| 516 | apply (simp add: is_Lset_def Lset_eq_transrec_DPow') | |
| 517 | apply (rule transrec_abs) | |
| 13634 | 518 | apply (simp_all add: transrec_rep' relation2_def RepFun_DPow_apply_closed) | 
| 13505 | 519 | done | 
| 520 | ||
| 521 | lemma (in M_Lset) Lset_closed: | |
| 522 | "[|Ord(i); M(i)|] ==> M(Lset(i))" | |
| 523 | apply (simp add: Lset_eq_transrec_DPow') | |
| 524 | apply (rule transrec_closed [OF transrec_rep']) | |
| 13634 | 525 | apply (simp_all add: relation2_def RepFun_DPow_apply_closed) | 
| 13505 | 526 | done | 
| 527 | ||
| 528 | ||
| 529 | subsection{*Instantiating the Locale @{text M_Lset}*}
 | |
| 530 | ||
| 531 | subsubsection{*The First Instance of Replacement*}
 | |
| 532 | ||
| 533 | lemma strong_rep_Reflects: | |
| 534 | "REFLECTS [\<lambda>u. \<exists>v[L]. v \<in> B & (\<exists>gy[L]. | |
| 535 | v \<in> x & fun_apply(L,g,v,gy) & is_DPow'(L,gy,u)), | |
| 536 | \<lambda>i u. \<exists>v \<in> Lset(i). v \<in> B & (\<exists>gy \<in> Lset(i). | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 537 | v \<in> x & fun_apply(##Lset(i),g,v,gy) & is_DPow'(##Lset(i),gy,u))]" | 
| 13505 | 538 | by (intro FOL_reflections function_reflections DPow'_reflection) | 
| 539 | ||
| 540 | lemma strong_rep: | |
| 541 | "[|L(x); L(g)|] ==> strong_replacement(L, \<lambda>y z. transrec_body(L,g,x,y,z))" | |
| 542 | apply (unfold transrec_body_def) | |
| 543 | apply (rule strong_replacementI) | |
| 13687 | 544 | apply (rule_tac u="{x,g,B}" 
 | 
| 545 | in gen_separation_multi [OF strong_rep_Reflects], auto) | |
| 546 | apply (rule_tac env="[x,g,B]" in DPow_LsetI) | |
| 13505 | 547 | apply (rule sep_rules DPow'_iff_sats | simp)+ | 
| 548 | done | |
| 549 | ||
| 550 | ||
| 551 | subsubsection{*The Second Instance of Replacement*}
 | |
| 552 | ||
| 553 | lemma transrec_rep_Reflects: | |
| 554 | "REFLECTS [\<lambda>x. \<exists>v[L]. v \<in> B & | |
| 555 | (\<exists>y[L]. pair(L,v,y,x) & | |
| 556 | is_wfrec (L, \<lambda>x f u. \<exists>r[L]. | |
| 557 | is_Replace (L, x, \<lambda>y z. | |
| 558 | \<exists>gy[L]. y \<in> x & fun_apply(L,f,y,gy) & | |
| 559 | is_DPow'(L,gy,z), r) & big_union(L,r,u), mr, v, y)), | |
| 560 | \<lambda>i x. \<exists>v \<in> Lset(i). v \<in> B & | |
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 561 | (\<exists>y \<in> Lset(i). pair(##Lset(i),v,y,x) & | 
| 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 562 | is_wfrec (##Lset(i), \<lambda>x f u. \<exists>r \<in> Lset(i). | 
| 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 563 | is_Replace (##Lset(i), x, \<lambda>y z. | 
| 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 564 | \<exists>gy \<in> Lset(i). y \<in> x & fun_apply(##Lset(i),f,y,gy) & | 
| 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 565 | is_DPow'(##Lset(i),gy,z), r) & | 
| 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 566 | big_union(##Lset(i),r,u), mr, v, y))]" | 
| 13655 
95b95cdb4704
Tidying up.  New primitives is_iterates and is_iterates_fm.
 paulson parents: 
13634diff
changeset | 567 | apply (simp only: rex_setclass_is_bex [symmetric]) | 
| 13807 
a28a8fbc76d4
changed ** to ## to avoid conflict with new comment syntax
 paulson parents: 
13692diff
changeset | 568 |   --{*Convert @{text "\<exists>y\<in>Lset(i)"} to @{text "\<exists>y[##Lset(i)]"} within the body
 | 
| 13505 | 569 |        of the @{term is_wfrec} application. *}
 | 
| 570 | apply (intro FOL_reflections function_reflections | |
| 571 | is_wfrec_reflection Replace_reflection DPow'_reflection) | |
| 572 | done | |
| 573 | ||
| 574 | ||
| 575 | lemma transrec_rep: | |
| 576 | "[|L(j)|] | |
| 577 | ==> transrec_replacement(L, \<lambda>x f u. | |
| 578 | \<exists>r[L]. is_Replace(L, x, transrec_body(L,f,x), r) & | |
| 579 | big_union(L, r, u), j)" | |
| 580 | apply (rule transrec_replacementI, assumption) | |
| 13566 | 581 | apply (unfold transrec_body_def) | 
| 13505 | 582 | apply (rule strong_replacementI) | 
| 13566 | 583 | apply (rule_tac u="{j,B,Memrel(eclose({j}))}" 
 | 
| 13687 | 584 | in gen_separation_multi [OF transrec_rep_Reflects], auto) | 
| 585 | apply (rule_tac env="[j,B,Memrel(eclose({j}))]" in DPow_LsetI)
 | |
| 13505 | 586 | apply (rule sep_rules is_wfrec_iff_sats Replace_iff_sats DPow'_iff_sats | | 
| 587 | simp)+ | |
| 588 | done | |
| 589 | ||
| 590 | ||
| 591 | subsubsection{*Actually Instantiating @{text M_Lset}*}
 | |
| 592 | ||
| 593 | lemma M_Lset_axioms_L: "M_Lset_axioms(L)" | |
| 594 | apply (rule M_Lset_axioms.intro) | |
| 595 | apply (assumption | rule strong_rep transrec_rep)+ | |
| 596 | done | |
| 597 | ||
| 598 | theorem M_Lset_L: "PROP M_Lset(L)" | |
| 19931 
fb32b43e7f80
Restructured locales with predicates: import is now an interpretation.
 ballarin parents: 
16417diff
changeset | 599 | apply (rule M_Lset.intro) | 
| 
fb32b43e7f80
Restructured locales with predicates: import is now an interpretation.
 ballarin parents: 
16417diff
changeset | 600 | apply (rule M_DPow_L) | 
| 
fb32b43e7f80
Restructured locales with predicates: import is now an interpretation.
 ballarin parents: 
16417diff
changeset | 601 | apply (rule M_Lset_axioms_L) | 
| 
fb32b43e7f80
Restructured locales with predicates: import is now an interpretation.
 ballarin parents: 
16417diff
changeset | 602 | done | 
| 13505 | 603 | |
| 604 | text{*Finally: the point of the whole theory!*}
 | |
| 605 | lemmas Lset_closed = M_Lset.Lset_closed [OF M_Lset_L] | |
| 606 | and Lset_abs = M_Lset.Lset_abs [OF M_Lset_L] | |
| 607 | ||
| 608 | ||
| 609 | subsection{*The Notion of Constructible Set*}
 | |
| 610 | ||
| 611 | ||
| 612 | constdefs | |
| 613 | constructible :: "[i=>o,i] => o" | |
| 614 | "constructible(M,x) == | |
| 615 | \<exists>i[M]. \<exists>Li[M]. ordinal(M,i) & is_Lset(M,i,Li) & x \<in> Li" | |
| 616 | ||
| 617 | theorem V_equals_L_in_L: | |
| 618 | "L(x) ==> constructible(L,x)" | |
| 619 | apply (simp add: constructible_def Lset_abs Lset_closed) | |
| 620 | apply (simp add: L_def) | |
| 621 | apply (blast intro: Ord_in_L) | |
| 622 | done | |
| 623 | ||
| 13503 | 624 | end |