| author | wenzelm | 
| Sun, 21 Aug 2011 13:36:23 +0200 | |
| changeset 44351 | b7f9e764532a | 
| parent 39159 | 0dec18004e75 | 
| child 45602 | 2a858377c3d2 | 
| permissions | -rw-r--r-- | 
| 35762 | 1 | (* Title: ZF/Epsilon.thy | 
| 1478 | 2 | Author: Lawrence C Paulson, Cambridge University Computer Laboratory | 
| 0 | 3 | Copyright 1993 University of Cambridge | 
| 4 | *) | |
| 5 | ||
| 13328 | 6 | header{*Epsilon Induction and Recursion*}
 | 
| 7 | ||
| 26056 
6a0801279f4c
Made theory names in ZF disjoint from HOL theory names to allow loading both developments
 krauss parents: 
24893diff
changeset | 8 | theory Epsilon imports Nat_ZF begin | 
| 13164 | 9 | |
| 24893 | 10 | definition | 
| 11 | eclose :: "i=>i" where | |
| 13615 
449a70d88b38
Numerous cosmetic changes, prompted by the new simplifier
 paulson parents: 
13524diff
changeset | 12 | "eclose(A) == \<Union>n\<in>nat. nat_rec(n, A, %m r. Union(r))" | 
| 0 | 13 | |
| 24893 | 14 | definition | 
| 15 | transrec :: "[i, [i,i]=>i] =>i" where | |
| 2469 | 16 |     "transrec(a,H) == wfrec(Memrel(eclose({a})), a, H)"
 | 
| 17 | ||
| 24893 | 18 | definition | 
| 19 | rank :: "i=>i" where | |
| 13615 
449a70d88b38
Numerous cosmetic changes, prompted by the new simplifier
 paulson parents: 
13524diff
changeset | 20 | "rank(a) == transrec(a, %x f. \<Union>y\<in>x. succ(f`y))" | 
| 2469 | 21 | |
| 24893 | 22 | definition | 
| 23 | transrec2 :: "[i, i, [i,i]=>i] =>i" where | |
| 2469 | 24 | "transrec2(k, a, b) == | 
| 25 | transrec(k, | |
| 26 | %i r. if(i=0, a, | |
| 27 | if(EX j. i=succ(j), | |
| 28 | b(THE j. i=succ(j), r`(THE j. i=succ(j))), | |
| 13615 
449a70d88b38
Numerous cosmetic changes, prompted by the new simplifier
 paulson parents: 
13524diff
changeset | 29 | \<Union>j<i. r`j)))" | 
| 2469 | 30 | |
| 24893 | 31 | definition | 
| 32 | recursor :: "[i, [i,i]=>i, i]=>i" where | |
| 13164 | 33 | "recursor(a,b,k) == transrec(k, %n f. nat_case(a, %m. b(m, f`m), n))" | 
| 34 | ||
| 24893 | 35 | definition | 
| 36 | rec :: "[i, i, [i,i]=>i]=>i" where | |
| 13164 | 37 | "rec(k,a,b) == recursor(a,b,k)" | 
| 38 | ||
| 39 | ||
| 13356 | 40 | subsection{*Basic Closure Properties*}
 | 
| 13164 | 41 | |
| 42 | lemma arg_subset_eclose: "A <= eclose(A)" | |
| 43 | apply (unfold eclose_def) | |
| 44 | apply (rule nat_rec_0 [THEN equalityD2, THEN subset_trans]) | |
| 45 | apply (rule nat_0I [THEN UN_upper]) | |
| 46 | done | |
| 47 | ||
| 48 | lemmas arg_into_eclose = arg_subset_eclose [THEN subsetD, standard] | |
| 49 | ||
| 50 | lemma Transset_eclose: "Transset(eclose(A))" | |
| 51 | apply (unfold eclose_def Transset_def) | |
| 52 | apply (rule subsetI [THEN ballI]) | |
| 53 | apply (erule UN_E) | |
| 54 | apply (rule nat_succI [THEN UN_I], assumption) | |
| 55 | apply (erule nat_rec_succ [THEN ssubst]) | |
| 56 | apply (erule UnionI, assumption) | |
| 57 | done | |
| 58 | ||
| 59 | (* x : eclose(A) ==> x <= eclose(A) *) | |
| 60 | lemmas eclose_subset = | |
| 61 | Transset_eclose [unfolded Transset_def, THEN bspec, standard] | |
| 62 | ||
| 63 | (* [| A : eclose(B); c : A |] ==> c : eclose(B) *) | |
| 64 | lemmas ecloseD = eclose_subset [THEN subsetD, standard] | |
| 65 | ||
| 66 | lemmas arg_in_eclose_sing = arg_subset_eclose [THEN singleton_subsetD] | |
| 67 | lemmas arg_into_eclose_sing = arg_in_eclose_sing [THEN ecloseD, standard] | |
| 68 | ||
| 69 | (* This is epsilon-induction for eclose(A); see also eclose_induct_down... | |
| 70 | [| a: eclose(A); !!x. [| x: eclose(A); ALL y:x. P(y) |] ==> P(x) | |
| 71 | |] ==> P(a) | |
| 72 | *) | |
| 13203 
fac77a839aa2
Tidying up.  Mainly moving proofs from Main.thy to other (Isar) theory files.
 paulson parents: 
13185diff
changeset | 73 | lemmas eclose_induct = | 
| 
fac77a839aa2
Tidying up.  Mainly moving proofs from Main.thy to other (Isar) theory files.
 paulson parents: 
13185diff
changeset | 74 | Transset_induct [OF _ Transset_eclose, induct set: eclose] | 
| 
fac77a839aa2
Tidying up.  Mainly moving proofs from Main.thy to other (Isar) theory files.
 paulson parents: 
13185diff
changeset | 75 | |
| 13164 | 76 | |
| 77 | (*Epsilon induction*) | |
| 78 | lemma eps_induct: | |
| 79 | "[| !!x. ALL y:x. P(y) ==> P(x) |] ==> P(a)" | |
| 80 | by (rule arg_in_eclose_sing [THEN eclose_induct], blast) | |
| 81 | ||
| 82 | ||
| 13356 | 83 | subsection{*Leastness of @{term eclose}*}
 | 
| 13164 | 84 | |
| 85 | (** eclose(A) is the least transitive set including A as a subset. **) | |
| 86 | ||
| 87 | lemma eclose_least_lemma: | |
| 88 | "[| Transset(X); A<=X; n: nat |] ==> nat_rec(n, A, %m r. Union(r)) <= X" | |
| 89 | apply (unfold Transset_def) | |
| 90 | apply (erule nat_induct) | |
| 91 | apply (simp add: nat_rec_0) | |
| 92 | apply (simp add: nat_rec_succ, blast) | |
| 93 | done | |
| 94 | ||
| 95 | lemma eclose_least: | |
| 96 | "[| Transset(X); A<=X |] ==> eclose(A) <= X" | |
| 97 | apply (unfold eclose_def) | |
| 98 | apply (rule eclose_least_lemma [THEN UN_least], assumption+) | |
| 99 | done | |
| 100 | ||
| 101 | (*COMPLETELY DIFFERENT induction principle from eclose_induct!!*) | |
| 13524 | 102 | lemma eclose_induct_down [consumes 1]: | 
| 13164 | 103 | "[| a: eclose(b); | 
| 104 | !!y. [| y: b |] ==> P(y); | |
| 105 | !!y z. [| y: eclose(b); P(y); z: y |] ==> P(z) | |
| 106 | |] ==> P(a)" | |
| 107 | apply (rule eclose_least [THEN subsetD, THEN CollectD2, of "eclose(b)"]) | |
| 108 | prefer 3 apply assumption | |
| 109 | apply (unfold Transset_def) | |
| 110 | apply (blast intro: ecloseD) | |
| 111 | apply (blast intro: arg_subset_eclose [THEN subsetD]) | |
| 112 | done | |
| 113 | ||
| 114 | lemma Transset_eclose_eq_arg: "Transset(X) ==> eclose(X) = X" | |
| 115 | apply (erule equalityI [OF eclose_least arg_subset_eclose]) | |
| 116 | apply (rule subset_refl) | |
| 117 | done | |
| 118 | ||
| 13387 | 119 | text{*A transitive set either is empty or contains the empty set.*}
 | 
| 120 | lemma Transset_0_lemma [rule_format]: "Transset(A) ==> x\<in>A --> 0\<in>A"; | |
| 121 | apply (simp add: Transset_def) | |
| 122 | apply (rule_tac a=x in eps_induct, clarify) | |
| 123 | apply (drule bspec, assumption) | |
| 14153 | 124 | apply (case_tac "x=0", auto) | 
| 13387 | 125 | done | 
| 126 | ||
| 127 | lemma Transset_0_disj: "Transset(A) ==> A=0 | 0\<in>A"; | |
| 128 | by (blast dest: Transset_0_lemma) | |
| 129 | ||
| 13164 | 130 | |
| 13356 | 131 | subsection{*Epsilon Recursion*}
 | 
| 13164 | 132 | |
| 133 | (*Unused...*) | |
| 134 | lemma mem_eclose_trans: "[| A: eclose(B); B: eclose(C) |] ==> A: eclose(C)" | |
| 135 | by (rule eclose_least [OF Transset_eclose eclose_subset, THEN subsetD], | |
| 136 | assumption+) | |
| 137 | ||
| 138 | (*Variant of the previous lemma in a useable form for the sequel*) | |
| 139 | lemma mem_eclose_sing_trans: | |
| 140 |      "[| A: eclose({B});  B: eclose({C}) |] ==> A: eclose({C})"
 | |
| 141 | by (rule eclose_least [OF Transset_eclose singleton_subsetI, THEN subsetD], | |
| 142 | assumption+) | |
| 143 | ||
| 144 | lemma under_Memrel: "[| Transset(i);  j:i |] ==> Memrel(i)-``{j} = j"
 | |
| 145 | by (unfold Transset_def, blast) | |
| 146 | ||
| 13217 | 147 | lemma lt_Memrel: "j < i ==> Memrel(i) -`` {j} = j"
 | 
| 148 | by (simp add: lt_def Ord_def under_Memrel) | |
| 149 | ||
| 13164 | 150 | (* j : eclose(A) ==> Memrel(eclose(A)) -`` j = j *) | 
| 151 | lemmas under_Memrel_eclose = Transset_eclose [THEN under_Memrel, standard] | |
| 152 | ||
| 153 | lemmas wfrec_ssubst = wf_Memrel [THEN wfrec, THEN ssubst] | |
| 154 | ||
| 155 | lemma wfrec_eclose_eq: | |
| 156 |     "[| k:eclose({j});  j:eclose({i}) |] ==>  
 | |
| 157 |      wfrec(Memrel(eclose({i})), k, H) = wfrec(Memrel(eclose({j})), k, H)"
 | |
| 158 | apply (erule eclose_induct) | |
| 159 | apply (rule wfrec_ssubst) | |
| 160 | apply (rule wfrec_ssubst) | |
| 161 | apply (simp add: under_Memrel_eclose mem_eclose_sing_trans [of _ j i]) | |
| 162 | done | |
| 163 | ||
| 164 | lemma wfrec_eclose_eq2: | |
| 165 |     "k: i ==> wfrec(Memrel(eclose({i})),k,H) = wfrec(Memrel(eclose({k})),k,H)"
 | |
| 166 | apply (rule arg_in_eclose_sing [THEN wfrec_eclose_eq]) | |
| 167 | apply (erule arg_into_eclose_sing) | |
| 168 | done | |
| 169 | ||
| 170 | lemma transrec: "transrec(a,H) = H(a, lam x:a. transrec(x,H))" | |
| 171 | apply (unfold transrec_def) | |
| 172 | apply (rule wfrec_ssubst) | |
| 173 | apply (simp add: wfrec_eclose_eq2 arg_in_eclose_sing under_Memrel_eclose) | |
| 174 | done | |
| 175 | ||
| 176 | (*Avoids explosions in proofs; resolve it with a meta-level definition.*) | |
| 177 | lemma def_transrec: | |
| 178 | "[| !!x. f(x)==transrec(x,H) |] ==> f(a) = H(a, lam x:a. f(x))" | |
| 179 | apply simp | |
| 180 | apply (rule transrec) | |
| 181 | done | |
| 182 | ||
| 183 | lemma transrec_type: | |
| 184 |     "[| !!x u. [| x:eclose({a});  u: Pi(x,B) |] ==> H(x,u) : B(x) |]
 | |
| 185 | ==> transrec(a,H) : B(a)" | |
| 13784 | 186 | apply (rule_tac i = a in arg_in_eclose_sing [THEN eclose_induct]) | 
| 13164 | 187 | apply (subst transrec) | 
| 188 | apply (simp add: lam_type) | |
| 189 | done | |
| 190 | ||
| 191 | lemma eclose_sing_Ord: "Ord(i) ==> eclose({i}) <= succ(i)"
 | |
| 192 | apply (erule Ord_is_Transset [THEN Transset_succ, THEN eclose_least]) | |
| 193 | apply (rule succI1 [THEN singleton_subsetI]) | |
| 194 | done | |
| 195 | ||
| 13269 | 196 | lemma succ_subset_eclose_sing: "succ(i) <= eclose({i})"
 | 
| 197 | apply (insert arg_subset_eclose [of "{i}"], simp) 
 | |
| 198 | apply (frule eclose_subset, blast) | |
| 199 | done | |
| 200 | ||
| 201 | lemma eclose_sing_Ord_eq: "Ord(i) ==> eclose({i}) = succ(i)"
 | |
| 202 | apply (rule equalityI) | |
| 203 | apply (erule eclose_sing_Ord) | |
| 204 | apply (rule succ_subset_eclose_sing) | |
| 205 | done | |
| 206 | ||
| 13164 | 207 | lemma Ord_transrec_type: | 
| 208 | assumes jini: "j: i" | |
| 209 | and ordi: "Ord(i)" | |
| 210 | and minor: " !!x u. [| x: i; u: Pi(x,B) |] ==> H(x,u) : B(x)" | |
| 211 | shows "transrec(j,H) : B(j)" | |
| 212 | apply (rule transrec_type) | |
| 213 | apply (insert jini ordi) | |
| 214 | apply (blast intro!: minor | |
| 215 | intro: Ord_trans | |
| 216 | dest: Ord_in_Ord [THEN eclose_sing_Ord, THEN subsetD]) | |
| 217 | done | |
| 218 | ||
| 13356 | 219 | subsection{*Rank*}
 | 
| 13164 | 220 | |
| 221 | (*NOT SUITABLE FOR REWRITING -- RECURSIVE!*) | |
| 13615 
449a70d88b38
Numerous cosmetic changes, prompted by the new simplifier
 paulson parents: 
13524diff
changeset | 222 | lemma rank: "rank(a) = (\<Union>y\<in>a. succ(rank(y)))" | 
| 13164 | 223 | by (subst rank_def [THEN def_transrec], simp) | 
| 224 | ||
| 225 | lemma Ord_rank [simp]: "Ord(rank(a))" | |
| 13784 | 226 | apply (rule_tac a=a in eps_induct) | 
| 13164 | 227 | apply (subst rank) | 
| 228 | apply (rule Ord_succ [THEN Ord_UN]) | |
| 229 | apply (erule bspec, assumption) | |
| 230 | done | |
| 231 | ||
| 232 | lemma rank_of_Ord: "Ord(i) ==> rank(i) = i" | |
| 233 | apply (erule trans_induct) | |
| 234 | apply (subst rank) | |
| 235 | apply (simp add: Ord_equality) | |
| 236 | done | |
| 237 | ||
| 238 | lemma rank_lt: "a:b ==> rank(a) < rank(b)" | |
| 13784 | 239 | apply (rule_tac a1 = b in rank [THEN ssubst]) | 
| 13164 | 240 | apply (erule UN_I [THEN ltI]) | 
| 241 | apply (rule_tac [2] Ord_UN, auto) | |
| 242 | done | |
| 243 | ||
| 244 | lemma eclose_rank_lt: "a: eclose(b) ==> rank(a) < rank(b)" | |
| 245 | apply (erule eclose_induct_down) | |
| 246 | apply (erule rank_lt) | |
| 247 | apply (erule rank_lt [THEN lt_trans], assumption) | |
| 248 | done | |
| 6070 | 249 | |
| 13164 | 250 | lemma rank_mono: "a<=b ==> rank(a) le rank(b)" | 
| 251 | apply (rule subset_imp_le) | |
| 15481 | 252 | apply (auto simp add: rank [of a] rank [of b]) | 
| 13164 | 253 | done | 
| 254 | ||
| 255 | lemma rank_Pow: "rank(Pow(a)) = succ(rank(a))" | |
| 256 | apply (rule rank [THEN trans]) | |
| 257 | apply (rule le_anti_sym) | |
| 258 | apply (rule_tac [2] UN_upper_le) | |
| 259 | apply (rule UN_least_le) | |
| 260 | apply (auto intro: rank_mono simp add: Ord_UN) | |
| 261 | done | |
| 262 | ||
| 263 | lemma rank_0 [simp]: "rank(0) = 0" | |
| 264 | by (rule rank [THEN trans], blast) | |
| 265 | ||
| 266 | lemma rank_succ [simp]: "rank(succ(x)) = succ(rank(x))" | |
| 267 | apply (rule rank [THEN trans]) | |
| 268 | apply (rule equalityI [OF UN_least succI1 [THEN UN_upper]]) | |
| 269 | apply (erule succE, blast) | |
| 270 | apply (erule rank_lt [THEN leI, THEN succ_leI, THEN le_imp_subset]) | |
| 271 | done | |
| 272 | ||
| 13615 
449a70d88b38
Numerous cosmetic changes, prompted by the new simplifier
 paulson parents: 
13524diff
changeset | 273 | lemma rank_Union: "rank(Union(A)) = (\<Union>x\<in>A. rank(x))" | 
| 13164 | 274 | apply (rule equalityI) | 
| 275 | apply (rule_tac [2] rank_mono [THEN le_imp_subset, THEN UN_least]) | |
| 276 | apply (erule_tac [2] Union_upper) | |
| 277 | apply (subst rank) | |
| 278 | apply (rule UN_least) | |
| 279 | apply (erule UnionE) | |
| 280 | apply (rule subset_trans) | |
| 281 | apply (erule_tac [2] RepFunI [THEN Union_upper]) | |
| 282 | apply (erule rank_lt [THEN succ_leI, THEN le_imp_subset]) | |
| 283 | done | |
| 284 | ||
| 285 | lemma rank_eclose: "rank(eclose(a)) = rank(a)" | |
| 286 | apply (rule le_anti_sym) | |
| 287 | apply (rule_tac [2] arg_subset_eclose [THEN rank_mono]) | |
| 288 | apply (rule_tac a1 = "eclose (a) " in rank [THEN ssubst]) | |
| 289 | apply (rule Ord_rank [THEN UN_least_le]) | |
| 290 | apply (erule eclose_rank_lt [THEN succ_leI]) | |
| 291 | done | |
| 292 | ||
| 293 | lemma rank_pair1: "rank(a) < rank(<a,b>)" | |
| 294 | apply (unfold Pair_def) | |
| 295 | apply (rule consI1 [THEN rank_lt, THEN lt_trans]) | |
| 296 | apply (rule consI1 [THEN consI2, THEN rank_lt]) | |
| 297 | done | |
| 298 | ||
| 299 | lemma rank_pair2: "rank(b) < rank(<a,b>)" | |
| 300 | apply (unfold Pair_def) | |
| 301 | apply (rule consI1 [THEN consI2, THEN rank_lt, THEN lt_trans]) | |
| 302 | apply (rule consI1 [THEN consI2, THEN rank_lt]) | |
| 303 | done | |
| 304 | ||
| 305 | (*Not clear how to remove the P(a) condition, since the "then" part | |
| 306 | must refer to "a"*) | |
| 307 | lemma the_equality_if: | |
| 308 | "P(a) ==> (THE x. P(x)) = (if (EX!x. P(x)) then a else 0)" | |
| 309 | by (simp add: the_0 the_equality2) | |
| 310 | ||
| 13175 
81082cfa5618
new definition of "apply" and new simprule "beta_if"
 paulson parents: 
13164diff
changeset | 311 | (*The first premise not only fixs i but ensures f~=0. | 
| 
81082cfa5618
new definition of "apply" and new simprule "beta_if"
 paulson parents: 
13164diff
changeset | 312 | The second premise is now essential. Consider otherwise the relation | 
| 
81082cfa5618
new definition of "apply" and new simprule "beta_if"
 paulson parents: 
13164diff
changeset | 313 |   r = {<0,0>,<0,1>,<0,2>,...}.  Then f`0 = Union(f``{0}) = Union(nat) = nat,
 | 
| 
81082cfa5618
new definition of "apply" and new simprule "beta_if"
 paulson parents: 
13164diff
changeset | 314 | whose rank equals that of r.*) | 
| 
81082cfa5618
new definition of "apply" and new simprule "beta_if"
 paulson parents: 
13164diff
changeset | 315 | lemma rank_apply: "[|i : domain(f); function(f)|] ==> rank(f`i) < rank(f)" | 
| 13269 | 316 | apply clarify | 
| 317 | apply (simp add: function_apply_equality) | |
| 13175 
81082cfa5618
new definition of "apply" and new simprule "beta_if"
 paulson parents: 
13164diff
changeset | 318 | apply (blast intro: lt_trans rank_lt rank_pair2) | 
| 13164 | 319 | done | 
| 320 | ||
| 321 | ||
| 13356 | 322 | subsection{*Corollaries of Leastness*}
 | 
| 13164 | 323 | |
| 324 | lemma mem_eclose_subset: "A:B ==> eclose(A)<=eclose(B)" | |
| 325 | apply (rule Transset_eclose [THEN eclose_least]) | |
| 326 | apply (erule arg_into_eclose [THEN eclose_subset]) | |
| 327 | done | |
| 328 | ||
| 329 | lemma eclose_mono: "A<=B ==> eclose(A) <= eclose(B)" | |
| 330 | apply (rule Transset_eclose [THEN eclose_least]) | |
| 331 | apply (erule subset_trans) | |
| 332 | apply (rule arg_subset_eclose) | |
| 333 | done | |
| 334 | ||
| 335 | (** Idempotence of eclose **) | |
| 336 | ||
| 337 | lemma eclose_idem: "eclose(eclose(A)) = eclose(A)" | |
| 338 | apply (rule equalityI) | |
| 339 | apply (rule eclose_least [OF Transset_eclose subset_refl]) | |
| 340 | apply (rule arg_subset_eclose) | |
| 341 | done | |
| 342 | ||
| 343 | (** Transfinite recursion for definitions based on the | |
| 344 | three cases of ordinals **) | |
| 345 | ||
| 346 | lemma transrec2_0 [simp]: "transrec2(0,a,b) = a" | |
| 347 | by (rule transrec2_def [THEN def_transrec, THEN trans], simp) | |
| 348 | ||
| 349 | lemma transrec2_succ [simp]: "transrec2(succ(i),a,b) = b(i, transrec2(i,a,b))" | |
| 350 | apply (rule transrec2_def [THEN def_transrec, THEN trans]) | |
| 351 | apply (simp add: the_equality if_P) | |
| 352 | done | |
| 353 | ||
| 354 | lemma transrec2_Limit: | |
| 13615 
449a70d88b38
Numerous cosmetic changes, prompted by the new simplifier
 paulson parents: 
13524diff
changeset | 355 | "Limit(i) ==> transrec2(i,a,b) = (\<Union>j<i. transrec2(j,a,b))" | 
| 13175 
81082cfa5618
new definition of "apply" and new simprule "beta_if"
 paulson parents: 
13164diff
changeset | 356 | apply (rule transrec2_def [THEN def_transrec, THEN trans]) | 
| 13269 | 357 | apply (auto simp add: OUnion_def) | 
| 13164 | 358 | done | 
| 359 | ||
| 13203 
fac77a839aa2
Tidying up.  Mainly moving proofs from Main.thy to other (Isar) theory files.
 paulson parents: 
13185diff
changeset | 360 | lemma def_transrec2: | 
| 
fac77a839aa2
Tidying up.  Mainly moving proofs from Main.thy to other (Isar) theory files.
 paulson parents: 
13185diff
changeset | 361 | "(!!x. f(x)==transrec2(x,a,b)) | 
| 
fac77a839aa2
Tidying up.  Mainly moving proofs from Main.thy to other (Isar) theory files.
 paulson parents: 
13185diff
changeset | 362 | ==> f(0) = a & | 
| 
fac77a839aa2
Tidying up.  Mainly moving proofs from Main.thy to other (Isar) theory files.
 paulson parents: 
13185diff
changeset | 363 | f(succ(i)) = b(i, f(i)) & | 
| 13615 
449a70d88b38
Numerous cosmetic changes, prompted by the new simplifier
 paulson parents: 
13524diff
changeset | 364 | (Limit(K) --> f(K) = (\<Union>j<K. f(j)))" | 
| 13203 
fac77a839aa2
Tidying up.  Mainly moving proofs from Main.thy to other (Isar) theory files.
 paulson parents: 
13185diff
changeset | 365 | by (simp add: transrec2_Limit) | 
| 
fac77a839aa2
Tidying up.  Mainly moving proofs from Main.thy to other (Isar) theory files.
 paulson parents: 
13185diff
changeset | 366 | |
| 13164 | 367 | |
| 368 | (** recursor -- better than nat_rec; the succ case has no type requirement! **) | |
| 369 | ||
| 370 | (*NOT suitable for rewriting*) | |
| 371 | lemmas recursor_lemma = recursor_def [THEN def_transrec, THEN trans] | |
| 372 | ||
| 373 | lemma recursor_0: "recursor(a,b,0) = a" | |
| 374 | by (rule nat_case_0 [THEN recursor_lemma]) | |
| 375 | ||
| 376 | lemma recursor_succ: "recursor(a,b,succ(m)) = b(m, recursor(a,b,m))" | |
| 377 | by (rule recursor_lemma, simp) | |
| 378 | ||
| 379 | ||
| 380 | (** rec: old version for compatibility **) | |
| 381 | ||
| 382 | lemma rec_0 [simp]: "rec(0,a,b) = a" | |
| 383 | apply (unfold rec_def) | |
| 384 | apply (rule recursor_0) | |
| 385 | done | |
| 386 | ||
| 387 | lemma rec_succ [simp]: "rec(succ(m),a,b) = b(m, rec(m,a,b))" | |
| 388 | apply (unfold rec_def) | |
| 389 | apply (rule recursor_succ) | |
| 390 | done | |
| 391 | ||
| 392 | lemma rec_type: | |
| 393 | "[| n: nat; | |
| 394 | a: C(0); | |
| 395 | !!m z. [| m: nat; z: C(m) |] ==> b(m,z): C(succ(m)) |] | |
| 396 | ==> rec(n,a,b) : C(n)" | |
| 13185 | 397 | by (erule nat_induct, auto) | 
| 13164 | 398 | |
| 399 | ML | |
| 400 | {*
 | |
| 39159 | 401 | val arg_subset_eclose = @{thm arg_subset_eclose};
 | 
| 402 | val arg_into_eclose = @{thm arg_into_eclose};
 | |
| 403 | val Transset_eclose = @{thm Transset_eclose};
 | |
| 404 | val eclose_subset = @{thm eclose_subset};
 | |
| 405 | val ecloseD = @{thm ecloseD};
 | |
| 406 | val arg_in_eclose_sing = @{thm arg_in_eclose_sing};
 | |
| 407 | val arg_into_eclose_sing = @{thm arg_into_eclose_sing};
 | |
| 408 | val eclose_induct = @{thm eclose_induct};
 | |
| 409 | val eps_induct = @{thm eps_induct};
 | |
| 410 | val eclose_least = @{thm eclose_least};
 | |
| 411 | val eclose_induct_down = @{thm eclose_induct_down};
 | |
| 412 | val Transset_eclose_eq_arg = @{thm Transset_eclose_eq_arg};
 | |
| 413 | val mem_eclose_trans = @{thm mem_eclose_trans};
 | |
| 414 | val mem_eclose_sing_trans = @{thm mem_eclose_sing_trans};
 | |
| 415 | val under_Memrel = @{thm under_Memrel};
 | |
| 416 | val under_Memrel_eclose = @{thm under_Memrel_eclose};
 | |
| 417 | val wfrec_ssubst = @{thm wfrec_ssubst};
 | |
| 418 | val wfrec_eclose_eq = @{thm wfrec_eclose_eq};
 | |
| 419 | val wfrec_eclose_eq2 = @{thm wfrec_eclose_eq2};
 | |
| 420 | val transrec = @{thm transrec};
 | |
| 421 | val def_transrec = @{thm def_transrec};
 | |
| 422 | val transrec_type = @{thm transrec_type};
 | |
| 423 | val eclose_sing_Ord = @{thm eclose_sing_Ord};
 | |
| 424 | val Ord_transrec_type = @{thm Ord_transrec_type};
 | |
| 425 | val rank = @{thm rank};
 | |
| 426 | val Ord_rank = @{thm Ord_rank};
 | |
| 427 | val rank_of_Ord = @{thm rank_of_Ord};
 | |
| 428 | val rank_lt = @{thm rank_lt};
 | |
| 429 | val eclose_rank_lt = @{thm eclose_rank_lt};
 | |
| 430 | val rank_mono = @{thm rank_mono};
 | |
| 431 | val rank_Pow = @{thm rank_Pow};
 | |
| 432 | val rank_0 = @{thm rank_0};
 | |
| 433 | val rank_succ = @{thm rank_succ};
 | |
| 434 | val rank_Union = @{thm rank_Union};
 | |
| 435 | val rank_eclose = @{thm rank_eclose};
 | |
| 436 | val rank_pair1 = @{thm rank_pair1};
 | |
| 437 | val rank_pair2 = @{thm rank_pair2};
 | |
| 438 | val the_equality_if = @{thm the_equality_if};
 | |
| 439 | val rank_apply = @{thm rank_apply};
 | |
| 440 | val mem_eclose_subset = @{thm mem_eclose_subset};
 | |
| 441 | val eclose_mono = @{thm eclose_mono};
 | |
| 442 | val eclose_idem = @{thm eclose_idem};
 | |
| 443 | val transrec2_0 = @{thm transrec2_0};
 | |
| 444 | val transrec2_succ = @{thm transrec2_succ};
 | |
| 445 | val transrec2_Limit = @{thm transrec2_Limit};
 | |
| 446 | val recursor_0 = @{thm recursor_0};
 | |
| 447 | val recursor_succ = @{thm recursor_succ};
 | |
| 448 | val rec_0 = @{thm rec_0};
 | |
| 449 | val rec_succ = @{thm rec_succ};
 | |
| 450 | val rec_type = @{thm rec_type};
 | |
| 13164 | 451 | *} | 
| 6070 | 452 | |
| 0 | 453 | end |