| author | paulson | 
| Fri, 26 Jun 1998 15:16:14 +0200 | |
| changeset 5089 | f95e0a6eb775 | 
| parent 5067 | 62b6288e6005 | 
| child 5137 | 60205b0de9b9 | 
| permissions | -rw-r--r-- | 
| 1461 | 1 | (* Title: ZF/Univ | 
| 0 | 2 | ID: $Id$ | 
| 1461 | 3 | Author: Lawrence C Paulson, Cambridge University Computer Laboratory | 
| 435 | 4 | Copyright 1994 University of Cambridge | 
| 0 | 5 | |
| 6 | The cumulative hierarchy and a small universe for recursive types | |
| 7 | *) | |
| 8 | ||
| 9 | open Univ; | |
| 10 | ||
| 11 | (*NOT SUITABLE FOR REWRITING -- RECURSIVE!*) | |
| 5067 | 12 | Goal "Vfrom(A,i) = A Un (UN j:i. Pow(Vfrom(A,j)))"; | 
| 2033 | 13 | by (stac (Vfrom_def RS def_transrec) 1); | 
| 2469 | 14 | by (Simp_tac 1); | 
| 760 | 15 | qed "Vfrom"; | 
| 0 | 16 | |
| 17 | (** Monotonicity **) | |
| 18 | ||
| 5067 | 19 | Goal "!!A B. A<=B ==> ALL j. i<=j --> Vfrom(A,i) <= Vfrom(B,j)"; | 
| 0 | 20 | by (eps_ind_tac "i" 1); | 
| 21 | by (rtac (impI RS allI) 1); | |
| 2033 | 22 | by (stac Vfrom 1); | 
| 23 | by (stac Vfrom 1); | |
| 0 | 24 | by (etac Un_mono 1); | 
| 25 | by (rtac UN_mono 1); | |
| 26 | by (assume_tac 1); | |
| 27 | by (rtac Pow_mono 1); | |
| 28 | by (etac (bspec RS spec RS mp) 1); | |
| 29 | by (assume_tac 1); | |
| 30 | by (rtac subset_refl 1); | |
| 3736 
39ee3d31cfbc
Much tidying including step_tac -> clarify_tac or safe_tac; sometimes
 paulson parents: 
3074diff
changeset | 31 | qed_spec_mp "Vfrom_mono"; | 
| 0 | 32 | |
| 33 | ||
| 34 | (** A fundamental equality: Vfrom does not require ordinals! **) | |
| 35 | ||
| 5067 | 36 | Goal "Vfrom(A,x) <= Vfrom(A,rank(x))"; | 
| 0 | 37 | by (eps_ind_tac "x" 1); | 
| 2033 | 38 | by (stac Vfrom 1); | 
| 39 | by (stac Vfrom 1); | |
| 4091 | 40 | by (blast_tac (claset() addSIs [rank_lt RS ltD]) 1); | 
| 760 | 41 | qed "Vfrom_rank_subset1"; | 
| 0 | 42 | |
| 5067 | 43 | Goal "Vfrom(A,rank(x)) <= Vfrom(A,x)"; | 
| 0 | 44 | by (eps_ind_tac "x" 1); | 
| 2033 | 45 | by (stac Vfrom 1); | 
| 46 | by (stac Vfrom 1); | |
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 47 | by (rtac (subset_refl RS Un_mono) 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 48 | by (rtac UN_least 1); | 
| 27 | 49 | (*expand rank(x1) = (UN y:x1. succ(rank(y))) in assumptions*) | 
| 50 | by (etac (rank RS equalityD1 RS subsetD RS UN_E) 1); | |
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 51 | by (rtac subset_trans 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 52 | by (etac UN_upper 2); | 
| 27 | 53 | by (rtac (subset_refl RS Vfrom_mono RS subset_trans RS Pow_mono) 1); | 
| 54 | by (etac (ltI RS le_imp_subset) 1); | |
| 55 | by (rtac (Ord_rank RS Ord_succ) 1); | |
| 0 | 56 | by (etac bspec 1); | 
| 57 | by (assume_tac 1); | |
| 760 | 58 | qed "Vfrom_rank_subset2"; | 
| 0 | 59 | |
| 5067 | 60 | Goal "Vfrom(A,rank(x)) = Vfrom(A,x)"; | 
| 0 | 61 | by (rtac equalityI 1); | 
| 62 | by (rtac Vfrom_rank_subset2 1); | |
| 63 | by (rtac Vfrom_rank_subset1 1); | |
| 760 | 64 | qed "Vfrom_rank_eq"; | 
| 0 | 65 | |
| 66 | ||
| 67 | (*** Basic closure properties ***) | |
| 68 | ||
| 5067 | 69 | Goal "!!x y. y:x ==> 0 : Vfrom(A,x)"; | 
| 2033 | 70 | by (stac Vfrom 1); | 
| 2925 | 71 | by (Blast_tac 1); | 
| 760 | 72 | qed "zero_in_Vfrom"; | 
| 0 | 73 | |
| 5067 | 74 | Goal "i <= Vfrom(A,i)"; | 
| 0 | 75 | by (eps_ind_tac "i" 1); | 
| 2033 | 76 | by (stac Vfrom 1); | 
| 2925 | 77 | by (Blast_tac 1); | 
| 760 | 78 | qed "i_subset_Vfrom"; | 
| 0 | 79 | |
| 5067 | 80 | Goal "A <= Vfrom(A,i)"; | 
| 2033 | 81 | by (stac Vfrom 1); | 
| 0 | 82 | by (rtac Un_upper1 1); | 
| 760 | 83 | qed "A_subset_Vfrom"; | 
| 0 | 84 | |
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 85 | bind_thm ("A_into_Vfrom", A_subset_Vfrom RS subsetD);
 | 
| 488 | 86 | |
| 5067 | 87 | Goal "!!A a i. a <= Vfrom(A,i) ==> a: Vfrom(A,succ(i))"; | 
| 2033 | 88 | by (stac Vfrom 1); | 
| 2925 | 89 | by (Blast_tac 1); | 
| 760 | 90 | qed "subset_mem_Vfrom"; | 
| 0 | 91 | |
| 92 | (** Finite sets and ordered pairs **) | |
| 93 | ||
| 5067 | 94 | Goal "!!a. a: Vfrom(A,i) ==> {a} : Vfrom(A,succ(i))";
 | 
| 0 | 95 | by (rtac subset_mem_Vfrom 1); | 
| 4152 | 96 | by Safe_tac; | 
| 760 | 97 | qed "singleton_in_Vfrom"; | 
| 0 | 98 | |
| 5067 | 99 | Goal | 
| 0 | 100 |     "!!A. [| a: Vfrom(A,i);  b: Vfrom(A,i) |] ==> {a,b} : Vfrom(A,succ(i))";
 | 
| 101 | by (rtac subset_mem_Vfrom 1); | |
| 4152 | 102 | by Safe_tac; | 
| 760 | 103 | qed "doubleton_in_Vfrom"; | 
| 0 | 104 | |
| 5067 | 105 | Goalw [Pair_def] | 
| 0 | 106 | "!!A. [| a: Vfrom(A,i); b: Vfrom(A,i) |] ==> \ | 
| 107 | \ <a,b> : Vfrom(A,succ(succ(i)))"; | |
| 108 | by (REPEAT (ares_tac [doubleton_in_Vfrom] 1)); | |
| 760 | 109 | qed "Pair_in_Vfrom"; | 
| 0 | 110 | |
| 111 | val [prem] = goal Univ.thy | |
| 112 | "a<=Vfrom(A,i) ==> succ(a) : Vfrom(A,succ(succ(i)))"; | |
| 113 | by (REPEAT (resolve_tac [subset_mem_Vfrom, succ_subsetI] 1)); | |
| 114 | by (rtac (Vfrom_mono RSN (2,subset_trans)) 2); | |
| 115 | by (REPEAT (resolve_tac [prem, subset_refl, subset_succI] 1)); | |
| 760 | 116 | qed "succ_in_Vfrom"; | 
| 0 | 117 | |
| 118 | (*** 0, successor and limit equations fof Vfrom ***) | |
| 119 | ||
| 5067 | 120 | Goal "Vfrom(A,0) = A"; | 
| 2033 | 121 | by (stac Vfrom 1); | 
| 2925 | 122 | by (Blast_tac 1); | 
| 760 | 123 | qed "Vfrom_0"; | 
| 0 | 124 | |
| 5067 | 125 | Goal "!!i. Ord(i) ==> Vfrom(A,succ(i)) = A Un Pow(Vfrom(A,i))"; | 
| 0 | 126 | by (rtac (Vfrom RS trans) 1); | 
| 6 
8ce8c4d13d4d
Installation of new simplifier for ZF.  Deleted all congruence rules not
 lcp parents: 
0diff
changeset | 127 | by (rtac (succI1 RS RepFunI RS Union_upper RSN | 
| 1461 | 128 | (2, equalityI RS subst_context)) 1); | 
| 0 | 129 | by (rtac UN_least 1); | 
| 130 | by (rtac (subset_refl RS Vfrom_mono RS Pow_mono) 1); | |
| 27 | 131 | by (etac (ltI RS le_imp_subset) 1); | 
| 132 | by (etac Ord_succ 1); | |
| 760 | 133 | qed "Vfrom_succ_lemma"; | 
| 0 | 134 | |
| 5067 | 135 | Goal "Vfrom(A,succ(i)) = A Un Pow(Vfrom(A,i))"; | 
| 0 | 136 | by (res_inst_tac [("x1", "succ(i)")] (Vfrom_rank_eq RS subst) 1);
 | 
| 137 | by (res_inst_tac [("x1", "i")] (Vfrom_rank_eq RS subst) 1);
 | |
| 2033 | 138 | by (stac rank_succ 1); | 
| 0 | 139 | by (rtac (Ord_rank RS Vfrom_succ_lemma) 1); | 
| 760 | 140 | qed "Vfrom_succ"; | 
| 0 | 141 | |
| 142 | (*The premise distinguishes this from Vfrom(A,0); allowing X=0 forces | |
| 143 | the conclusion to be Vfrom(A,Union(X)) = A Un (UN y:X. Vfrom(A,y)) *) | |
| 144 | val [prem] = goal Univ.thy "y:X ==> Vfrom(A,Union(X)) = (UN y:X. Vfrom(A,y))"; | |
| 2033 | 145 | by (stac Vfrom 1); | 
| 0 | 146 | by (rtac equalityI 1); | 
| 147 | (*first inclusion*) | |
| 148 | by (rtac Un_least 1); | |
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 149 | by (rtac (A_subset_Vfrom RS subset_trans) 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 150 | by (rtac (prem RS UN_upper) 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 151 | by (rtac UN_least 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 152 | by (etac UnionE 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 153 | by (rtac subset_trans 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 154 | by (etac UN_upper 2); | 
| 2033 | 155 | by (stac Vfrom 1); | 
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 156 | by (etac ([UN_upper, Un_upper2] MRS subset_trans) 1); | 
| 0 | 157 | (*opposite inclusion*) | 
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 158 | by (rtac UN_least 1); | 
| 2033 | 159 | by (stac Vfrom 1); | 
| 2925 | 160 | by (Blast_tac 1); | 
| 760 | 161 | qed "Vfrom_Union"; | 
| 0 | 162 | |
| 163 | (*** Vfrom applied to Limit ordinals ***) | |
| 164 | ||
| 165 | (*NB. limit ordinals are non-empty; | |
| 166 | Vfrom(A,0) = A = A Un (UN y:0. Vfrom(A,y)) *) | |
| 167 | val [limiti] = goal Univ.thy | |
| 168 | "Limit(i) ==> Vfrom(A,i) = (UN y:i. Vfrom(A,y))"; | |
| 27 | 169 | by (rtac (limiti RS (Limit_has_0 RS ltD) RS Vfrom_Union RS subst) 1); | 
| 2033 | 170 | by (stac (limiti RS Limit_Union_eq) 1); | 
| 0 | 171 | by (rtac refl 1); | 
| 760 | 172 | qed "Limit_Vfrom_eq"; | 
| 0 | 173 | |
| 5067 | 174 | Goal "!!a. [| a: Vfrom(A,j); Limit(i); j<i |] ==> a : Vfrom(A,i)"; | 
| 27 | 175 | by (rtac (Limit_Vfrom_eq RS equalityD2 RS subsetD) 1); | 
| 176 | by (REPEAT (ares_tac [ltD RS UN_I] 1)); | |
| 760 | 177 | qed "Limit_VfromI"; | 
| 27 | 178 | |
| 179 | val prems = goal Univ.thy | |
| 1461 | 180 | "[| a: Vfrom(A,i); Limit(i); \ | 
| 181 | \ !!x. [| x<i; a: Vfrom(A,x) |] ==> R \ | |
| 27 | 182 | \ |] ==> R"; | 
| 183 | by (rtac (Limit_Vfrom_eq RS equalityD1 RS subsetD RS UN_E) 1); | |
| 184 | by (REPEAT (ares_tac (prems @ [ltI, Limit_is_Ord]) 1)); | |
| 760 | 185 | qed "Limit_VfromE"; | 
| 0 | 186 | |
| 516 | 187 | val zero_in_VLimit = Limit_has_0 RS ltD RS zero_in_Vfrom; | 
| 484 | 188 | |
| 0 | 189 | val [major,limiti] = goal Univ.thy | 
| 190 |     "[| a: Vfrom(A,i);  Limit(i) |] ==> {a} : Vfrom(A,i)";
 | |
| 27 | 191 | by (rtac ([major,limiti] MRS Limit_VfromE) 1); | 
| 192 | by (etac ([singleton_in_Vfrom, limiti] MRS Limit_VfromI) 1); | |
| 0 | 193 | by (etac (limiti RS Limit_has_succ) 1); | 
| 760 | 194 | qed "singleton_in_VLimit"; | 
| 0 | 195 | |
| 196 | val Vfrom_UnI1 = Un_upper1 RS (subset_refl RS Vfrom_mono RS subsetD) | |
| 197 | and Vfrom_UnI2 = Un_upper2 RS (subset_refl RS Vfrom_mono RS subsetD); | |
| 198 | ||
| 199 | (*Hard work is finding a single j:i such that {a,b}<=Vfrom(A,j)*)
 | |
| 200 | val [aprem,bprem,limiti] = goal Univ.thy | |
| 201 | "[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i) |] ==> \ | |
| 202 | \    {a,b} : Vfrom(A,i)";
 | |
| 27 | 203 | by (rtac ([aprem,limiti] MRS Limit_VfromE) 1); | 
| 204 | by (rtac ([bprem,limiti] MRS Limit_VfromE) 1); | |
| 205 | by (rtac ([doubleton_in_Vfrom, limiti] MRS Limit_VfromI) 1); | |
| 206 | by (etac Vfrom_UnI1 1); | |
| 207 | by (etac Vfrom_UnI2 1); | |
| 208 | by (REPEAT (ares_tac [limiti, Limit_has_succ, Un_least_lt] 1)); | |
| 760 | 209 | qed "doubleton_in_VLimit"; | 
| 0 | 210 | |
| 211 | val [aprem,bprem,limiti] = goal Univ.thy | |
| 212 | "[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i) |] ==> \ | |
| 213 | \ <a,b> : Vfrom(A,i)"; | |
| 214 | (*Infer that a, b occur at ordinals x,xa < i.*) | |
| 27 | 215 | by (rtac ([aprem,limiti] MRS Limit_VfromE) 1); | 
| 216 | by (rtac ([bprem,limiti] MRS Limit_VfromE) 1); | |
| 217 | by (rtac ([Pair_in_Vfrom, limiti] MRS Limit_VfromI) 1); | |
| 0 | 218 | (*Infer that succ(succ(x Un xa)) < i *) | 
| 27 | 219 | by (etac Vfrom_UnI1 1); | 
| 220 | by (etac Vfrom_UnI2 1); | |
| 221 | by (REPEAT (ares_tac [limiti, Limit_has_succ, Un_least_lt] 1)); | |
| 760 | 222 | qed "Pair_in_VLimit"; | 
| 484 | 223 | |
| 5067 | 224 | Goal "!!i. Limit(i) ==> Vfrom(A,i)*Vfrom(A,i) <= Vfrom(A,i)"; | 
| 516 | 225 | by (REPEAT (ares_tac [subsetI,Pair_in_VLimit] 1 | 
| 484 | 226 | ORELSE eresolve_tac [SigmaE, ssubst] 1)); | 
| 760 | 227 | qed "product_VLimit"; | 
| 484 | 228 | |
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 229 | bind_thm ("Sigma_subset_VLimit",
 | 
| 1461 | 230 | [Sigma_mono, product_VLimit] MRS subset_trans); | 
| 484 | 231 | |
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 232 | bind_thm ("nat_subset_VLimit", 
 | 
| 1461 | 233 | [nat_le_Limit RS le_imp_subset, i_subset_Vfrom] MRS subset_trans); | 
| 484 | 234 | |
| 5067 | 235 | Goal "!!i. [| n: nat; Limit(i) |] ==> n : Vfrom(A,i)"; | 
| 516 | 236 | by (REPEAT (ares_tac [nat_subset_VLimit RS subsetD] 1)); | 
| 760 | 237 | qed "nat_into_VLimit"; | 
| 484 | 238 | |
| 239 | (** Closure under disjoint union **) | |
| 240 | ||
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 241 | bind_thm ("zero_in_VLimit", Limit_has_0 RS ltD RS zero_in_Vfrom);
 | 
| 484 | 242 | |
| 5067 | 243 | Goal "!!i. Limit(i) ==> 1 : Vfrom(A,i)"; | 
| 516 | 244 | by (REPEAT (ares_tac [nat_into_VLimit, nat_0I, nat_succI] 1)); | 
| 760 | 245 | qed "one_in_VLimit"; | 
| 484 | 246 | |
| 5067 | 247 | Goalw [Inl_def] | 
| 484 | 248 | "!!A a. [| a: Vfrom(A,i); Limit(i) |] ==> Inl(a) : Vfrom(A,i)"; | 
| 516 | 249 | by (REPEAT (ares_tac [zero_in_VLimit, Pair_in_VLimit] 1)); | 
| 760 | 250 | qed "Inl_in_VLimit"; | 
| 484 | 251 | |
| 5067 | 252 | Goalw [Inr_def] | 
| 484 | 253 | "!!A b. [| b: Vfrom(A,i); Limit(i) |] ==> Inr(b) : Vfrom(A,i)"; | 
| 516 | 254 | by (REPEAT (ares_tac [one_in_VLimit, Pair_in_VLimit] 1)); | 
| 760 | 255 | qed "Inr_in_VLimit"; | 
| 484 | 256 | |
| 5067 | 257 | Goal "!!i. Limit(i) ==> Vfrom(C,i)+Vfrom(C,i) <= Vfrom(C,i)"; | 
| 4091 | 258 | by (blast_tac (claset() addSIs [Inl_in_VLimit, Inr_in_VLimit]) 1); | 
| 760 | 259 | qed "sum_VLimit"; | 
| 484 | 260 | |
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 261 | bind_thm ("sum_subset_VLimit", [sum_mono, sum_VLimit] MRS subset_trans);
 | 
| 484 | 262 | |
| 0 | 263 | |
| 264 | ||
| 265 | (*** Properties assuming Transset(A) ***) | |
| 266 | ||
| 5067 | 267 | Goal "!!i A. Transset(A) ==> Transset(Vfrom(A,i))"; | 
| 0 | 268 | by (eps_ind_tac "i" 1); | 
| 2033 | 269 | by (stac Vfrom 1); | 
| 4091 | 270 | by (blast_tac (claset() addSIs [Transset_Union_family, Transset_Un, | 
| 1461 | 271 | Transset_Pow]) 1); | 
| 760 | 272 | qed "Transset_Vfrom"; | 
| 0 | 273 | |
| 5067 | 274 | Goal "!!A i. Transset(A) ==> Vfrom(A, succ(i)) = Pow(Vfrom(A,i))"; | 
| 0 | 275 | by (rtac (Vfrom_succ RS trans) 1); | 
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 276 | by (rtac (Un_upper2 RSN (2,equalityI)) 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 277 | by (rtac (subset_refl RSN (2,Un_least)) 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 278 | by (rtac (A_subset_Vfrom RS subset_trans) 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 279 | by (etac (Transset_Vfrom RS (Transset_iff_Pow RS iffD1)) 1); | 
| 760 | 280 | qed "Transset_Vfrom_succ"; | 
| 0 | 281 | |
| 435 | 282 | goalw Ordinal.thy [Pair_def,Transset_def] | 
| 0 | 283 | "!!C. [| <a,b> <= C; Transset(C) |] ==> a: C & b: C"; | 
| 2925 | 284 | by (Blast_tac 1); | 
| 760 | 285 | qed "Transset_Pair_subset"; | 
| 0 | 286 | |
| 5067 | 287 | Goal | 
| 0 | 288 | "!!a b.[| <a,b> <= Vfrom(A,i); Transset(A); Limit(i) |] ==> \ | 
| 289 | \ <a,b> : Vfrom(A,i)"; | |
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 290 | by (etac (Transset_Pair_subset RS conjE) 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 291 | by (etac Transset_Vfrom 1); | 
| 516 | 292 | by (REPEAT (ares_tac [Pair_in_VLimit] 1)); | 
| 760 | 293 | qed "Transset_Pair_subset_VLimit"; | 
| 0 | 294 | |
| 295 | ||
| 296 | (*** Closure under product/sum applied to elements -- thus Vfrom(A,i) | |
| 297 | is a model of simple type theory provided A is a transitive set | |
| 298 | and i is a limit ordinal | |
| 299 | ***) | |
| 300 | ||
| 187 | 301 | (*General theorem for membership in Vfrom(A,i) when i is a limit ordinal*) | 
| 302 | val [aprem,bprem,limiti,step] = goal Univ.thy | |
| 1461 | 303 | "[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i); \ | 
| 187 | 304 | \ !!x y j. [| j<i; 1:j; x: Vfrom(A,j); y: Vfrom(A,j) \ | 
| 1461 | 305 | \ |] ==> EX k. h(x,y): Vfrom(A,k) & k<i |] ==> \ | 
| 187 | 306 | \ h(a,b) : Vfrom(A,i)"; | 
| 307 | (*Infer that a, b occur at ordinals x,xa < i.*) | |
| 308 | by (rtac ([aprem,limiti] MRS Limit_VfromE) 1); | |
| 309 | by (rtac ([bprem,limiti] MRS Limit_VfromE) 1); | |
| 828 | 310 | by (res_inst_tac [("j1", "x Un xa Un 2")] (step RS exE) 1);
 | 
| 187 | 311 | by (DO_GOAL [etac conjE, etac Limit_VfromI, rtac limiti, atac] 5); | 
| 312 | by (etac (Vfrom_UnI2 RS Vfrom_UnI1) 4); | |
| 313 | by (etac (Vfrom_UnI1 RS Vfrom_UnI1) 3); | |
| 314 | by (rtac (succI1 RS UnI2) 2); | |
| 315 | by (REPEAT (ares_tac [limiti, Limit_has_0, Limit_has_succ, Un_least_lt] 1)); | |
| 760 | 316 | qed "in_VLimit"; | 
| 0 | 317 | |
| 318 | (** products **) | |
| 319 | ||
| 5067 | 320 | Goal | 
| 187 | 321 | "!!A. [| a: Vfrom(A,j); b: Vfrom(A,j); Transset(A) |] ==> \ | 
| 322 | \ a*b : Vfrom(A, succ(succ(succ(j))))"; | |
| 0 | 323 | by (dtac Transset_Vfrom 1); | 
| 324 | by (rtac subset_mem_Vfrom 1); | |
| 325 | by (rewtac Transset_def); | |
| 4091 | 326 | by (blast_tac (claset() addIs [Pair_in_Vfrom]) 1); | 
| 760 | 327 | qed "prod_in_Vfrom"; | 
| 0 | 328 | |
| 329 | val [aprem,bprem,limiti,transset] = goal Univ.thy | |
| 330 | "[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i); Transset(A) |] ==> \ | |
| 331 | \ a*b : Vfrom(A,i)"; | |
| 516 | 332 | by (rtac ([aprem,bprem,limiti] MRS in_VLimit) 1); | 
| 187 | 333 | by (REPEAT (ares_tac [exI, conjI, prod_in_Vfrom, transset, | 
| 1461 | 334 | limiti RS Limit_has_succ] 1)); | 
| 760 | 335 | qed "prod_in_VLimit"; | 
| 0 | 336 | |
| 337 | (** Disjoint sums, aka Quine ordered pairs **) | |
| 338 | ||
| 5067 | 339 | Goalw [sum_def] | 
| 187 | 340 | "!!A. [| a: Vfrom(A,j); b: Vfrom(A,j); Transset(A); 1:j |] ==> \ | 
| 341 | \ a+b : Vfrom(A, succ(succ(succ(j))))"; | |
| 0 | 342 | by (dtac Transset_Vfrom 1); | 
| 343 | by (rtac subset_mem_Vfrom 1); | |
| 344 | by (rewtac Transset_def); | |
| 4091 | 345 | by (blast_tac (claset() addIs [zero_in_Vfrom, Pair_in_Vfrom, | 
| 1461 | 346 | i_subset_Vfrom RS subsetD]) 1); | 
| 760 | 347 | qed "sum_in_Vfrom"; | 
| 0 | 348 | |
| 349 | val [aprem,bprem,limiti,transset] = goal Univ.thy | |
| 350 | "[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i); Transset(A) |] ==> \ | |
| 351 | \ a+b : Vfrom(A,i)"; | |
| 516 | 352 | by (rtac ([aprem,bprem,limiti] MRS in_VLimit) 1); | 
| 187 | 353 | by (REPEAT (ares_tac [exI, conjI, sum_in_Vfrom, transset, | 
| 1461 | 354 | limiti RS Limit_has_succ] 1)); | 
| 760 | 355 | qed "sum_in_VLimit"; | 
| 0 | 356 | |
| 357 | (** function space! **) | |
| 358 | ||
| 5067 | 359 | Goalw [Pi_def] | 
| 187 | 360 | "!!A. [| a: Vfrom(A,j); b: Vfrom(A,j); Transset(A) |] ==> \ | 
| 361 | \ a->b : Vfrom(A, succ(succ(succ(succ(j)))))"; | |
| 0 | 362 | by (dtac Transset_Vfrom 1); | 
| 363 | by (rtac subset_mem_Vfrom 1); | |
| 364 | by (rtac (Collect_subset RS subset_trans) 1); | |
| 2033 | 365 | by (stac Vfrom 1); | 
| 0 | 366 | by (rtac (subset_trans RS subset_trans) 1); | 
| 367 | by (rtac Un_upper2 3); | |
| 368 | by (rtac (succI1 RS UN_upper) 2); | |
| 369 | by (rtac Pow_mono 1); | |
| 370 | by (rewtac Transset_def); | |
| 4091 | 371 | by (blast_tac (claset() addIs [Pair_in_Vfrom]) 1); | 
| 760 | 372 | qed "fun_in_Vfrom"; | 
| 0 | 373 | |
| 374 | val [aprem,bprem,limiti,transset] = goal Univ.thy | |
| 375 | "[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i); Transset(A) |] ==> \ | |
| 376 | \ a->b : Vfrom(A,i)"; | |
| 516 | 377 | by (rtac ([aprem,bprem,limiti] MRS in_VLimit) 1); | 
| 187 | 378 | by (REPEAT (ares_tac [exI, conjI, fun_in_Vfrom, transset, | 
| 1461 | 379 | limiti RS Limit_has_succ] 1)); | 
| 760 | 380 | qed "fun_in_VLimit"; | 
| 0 | 381 | |
| 5067 | 382 | Goalw [Pi_def] | 
| 3074 | 383 | "!!A. [| a: Vfrom(A,j); Transset(A) |] ==> \ | 
| 384 | \ Pow(a) : Vfrom(A, succ(succ(j)))"; | |
| 385 | by (dtac Transset_Vfrom 1); | |
| 386 | by (rtac subset_mem_Vfrom 1); | |
| 387 | by (rewtac Transset_def); | |
| 388 | by (stac Vfrom 1); | |
| 389 | by (Blast_tac 1); | |
| 390 | qed "Pow_in_Vfrom"; | |
| 391 | ||
| 5067 | 392 | Goal | 
| 3074 | 393 | "!!a. [| a: Vfrom(A,i); Limit(i); Transset(A) |] ==> Pow(a) : Vfrom(A,i)"; | 
| 4393 | 394 | (*Blast_tac: PROOF FAILED*) | 
| 395 | by (fast_tac (claset() addEs [Limit_VfromE] | |
| 3074 | 396 | addIs [Limit_has_succ, Pow_in_Vfrom, Limit_VfromI]) 1); | 
| 397 | qed "Pow_in_VLimit"; | |
| 398 | ||
| 0 | 399 | |
| 400 | (*** The set Vset(i) ***) | |
| 401 | ||
| 5067 | 402 | Goal "Vset(i) = (UN j:i. Pow(Vset(j)))"; | 
| 2033 | 403 | by (stac Vfrom 1); | 
| 2925 | 404 | by (Blast_tac 1); | 
| 760 | 405 | qed "Vset"; | 
| 0 | 406 | |
| 407 | val Vset_succ = Transset_0 RS Transset_Vfrom_succ; | |
| 408 | ||
| 409 | val Transset_Vset = Transset_0 RS Transset_Vfrom; | |
| 410 | ||
| 411 | (** Characterisation of the elements of Vset(i) **) | |
| 412 | ||
| 27 | 413 | val [ordi] = goal Univ.thy "Ord(i) ==> ALL b. b : Vset(i) --> rank(b) < i"; | 
| 0 | 414 | by (rtac (ordi RS trans_induct) 1); | 
| 2033 | 415 | by (stac Vset 1); | 
| 4152 | 416 | by Safe_tac; | 
| 2033 | 417 | by (stac rank 1); | 
| 27 | 418 | by (rtac UN_succ_least_lt 1); | 
| 2925 | 419 | by (Blast_tac 2); | 
| 27 | 420 | by (REPEAT (ares_tac [ltI] 1)); | 
| 3736 
39ee3d31cfbc
Much tidying including step_tac -> clarify_tac or safe_tac; sometimes
 paulson parents: 
3074diff
changeset | 421 | qed_spec_mp "VsetD"; | 
| 0 | 422 | |
| 423 | val [ordi] = goal Univ.thy "Ord(i) ==> ALL b. rank(b) : i --> b : Vset(i)"; | |
| 424 | by (rtac (ordi RS trans_induct) 1); | |
| 425 | by (rtac allI 1); | |
| 2033 | 426 | by (stac Vset 1); | 
| 4091 | 427 | by (blast_tac (claset() addSIs [rank_lt RS ltD]) 1); | 
| 3736 
39ee3d31cfbc
Much tidying including step_tac -> clarify_tac or safe_tac; sometimes
 paulson parents: 
3074diff
changeset | 428 | val lemma = result(); | 
| 0 | 429 | |
| 5067 | 430 | Goal "!!x i. rank(x)<i ==> x : Vset(i)"; | 
| 27 | 431 | by (etac ltE 1); | 
| 3736 
39ee3d31cfbc
Much tidying including step_tac -> clarify_tac or safe_tac; sometimes
 paulson parents: 
3074diff
changeset | 432 | by (etac (lemma RS spec RS mp) 1); | 
| 27 | 433 | by (assume_tac 1); | 
| 760 | 434 | qed "VsetI"; | 
| 0 | 435 | |
| 5067 | 436 | Goal "!!i. Ord(i) ==> b : Vset(i) <-> rank(b) < i"; | 
| 0 | 437 | by (rtac iffI 1); | 
| 27 | 438 | by (REPEAT (eresolve_tac [asm_rl, VsetD, VsetI] 1)); | 
| 760 | 439 | qed "Vset_Ord_rank_iff"; | 
| 0 | 440 | |
| 5067 | 441 | Goal "b : Vset(a) <-> rank(b) < rank(a)"; | 
| 0 | 442 | by (rtac (Vfrom_rank_eq RS subst) 1); | 
| 443 | by (rtac (Ord_rank RS Vset_Ord_rank_iff) 1); | |
| 760 | 444 | qed "Vset_rank_iff"; | 
| 0 | 445 | |
| 5067 | 446 | Goal "!!i. Ord(i) ==> rank(Vset(i)) = i"; | 
| 2033 | 447 | by (stac rank 1); | 
| 0 | 448 | by (rtac equalityI 1); | 
| 4152 | 449 | by Safe_tac; | 
| 828 | 450 | by (EVERY' [rtac UN_I, | 
| 1461 | 451 | etac (i_subset_Vfrom RS subsetD), | 
| 452 | etac (Ord_in_Ord RS rank_of_Ord RS ssubst), | |
| 453 | assume_tac, | |
| 454 | rtac succI1] 3); | |
| 27 | 455 | by (REPEAT (eresolve_tac [asm_rl, VsetD RS ltD, Ord_trans] 1)); | 
| 760 | 456 | qed "rank_Vset"; | 
| 0 | 457 | |
| 458 | (** Lemmas for reasoning about sets in terms of their elements' ranks **) | |
| 459 | ||
| 5067 | 460 | Goal "a <= Vset(rank(a))"; | 
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 461 | by (rtac subsetI 1); | 
| 27 | 462 | by (etac (rank_lt RS VsetI) 1); | 
| 760 | 463 | qed "arg_subset_Vset_rank"; | 
| 0 | 464 | |
| 465 | val [iprem] = goal Univ.thy | |
| 466 | "[| !!i. Ord(i) ==> a Int Vset(i) <= b |] ==> a <= b"; | |
| 27 | 467 | by (rtac ([subset_refl, arg_subset_Vset_rank] MRS | 
| 1461 | 468 | Int_greatest RS subset_trans) 1); | 
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 469 | by (rtac (Ord_rank RS iprem) 1); | 
| 760 | 470 | qed "Int_Vset_subset"; | 
| 0 | 471 | |
| 472 | (** Set up an environment for simplification **) | |
| 473 | ||
| 5067 | 474 | Goalw [Inl_def] "rank(a) < rank(Inl(a))"; | 
| 3889 
59bab7a52b4c
moved rank_Inl, rank_Inr from Epsilon.ML to Univ.ML;
 wenzelm parents: 
3736diff
changeset | 475 | by (rtac rank_pair2 1); | 
| 
59bab7a52b4c
moved rank_Inl, rank_Inr from Epsilon.ML to Univ.ML;
 wenzelm parents: 
3736diff
changeset | 476 | qed "rank_Inl"; | 
| 
59bab7a52b4c
moved rank_Inl, rank_Inr from Epsilon.ML to Univ.ML;
 wenzelm parents: 
3736diff
changeset | 477 | |
| 5067 | 478 | Goalw [Inr_def] "rank(a) < rank(Inr(a))"; | 
| 3889 
59bab7a52b4c
moved rank_Inl, rank_Inr from Epsilon.ML to Univ.ML;
 wenzelm parents: 
3736diff
changeset | 479 | by (rtac rank_pair2 1); | 
| 
59bab7a52b4c
moved rank_Inl, rank_Inr from Epsilon.ML to Univ.ML;
 wenzelm parents: 
3736diff
changeset | 480 | qed "rank_Inr"; | 
| 
59bab7a52b4c
moved rank_Inl, rank_Inr from Epsilon.ML to Univ.ML;
 wenzelm parents: 
3736diff
changeset | 481 | |
| 0 | 482 | val rank_rls = [rank_Inl, rank_Inr, rank_pair1, rank_pair2]; | 
| 27 | 483 | val rank_trans_rls = rank_rls @ (rank_rls RLN (2, [lt_trans])); | 
| 0 | 484 | |
| 4091 | 485 | val rank_ss = simpset() addsimps [VsetI] addsimps rank_trans_rls; | 
| 0 | 486 | |
| 487 | (** Recursion over Vset levels! **) | |
| 488 | ||
| 489 | (*NOT SUITABLE FOR REWRITING: recursive!*) | |
| 5067 | 490 | Goalw [Vrec_def] "Vrec(a,H) = H(a, lam x:Vset(rank(a)). Vrec(x,H))"; | 
| 2033 | 491 | by (stac transrec 1); | 
| 4091 | 492 | by (simp_tac (simpset() addsimps [Ord_rank, Ord_succ, VsetD RS ltD RS beta, | 
| 1461 | 493 | VsetI RS beta, le_refl]) 1); | 
| 760 | 494 | qed "Vrec"; | 
| 0 | 495 | |
| 496 | (*This form avoids giant explosions in proofs. NOTE USE OF == *) | |
| 497 | val rew::prems = goal Univ.thy | |
| 498 | "[| !!x. h(x)==Vrec(x,H) |] ==> \ | |
| 499 | \ h(a) = H(a, lam x: Vset(rank(a)). h(x))"; | |
| 500 | by (rewtac rew); | |
| 501 | by (rtac Vrec 1); | |
| 760 | 502 | qed "def_Vrec"; | 
| 0 | 503 | |
| 504 | ||
| 505 | (*** univ(A) ***) | |
| 506 | ||
| 5067 | 507 | Goalw [univ_def] "!!A B. A<=B ==> univ(A) <= univ(B)"; | 
| 0 | 508 | by (etac Vfrom_mono 1); | 
| 509 | by (rtac subset_refl 1); | |
| 760 | 510 | qed "univ_mono"; | 
| 0 | 511 | |
| 5067 | 512 | Goalw [univ_def] "!!A. Transset(A) ==> Transset(univ(A))"; | 
| 0 | 513 | by (etac Transset_Vfrom 1); | 
| 760 | 514 | qed "Transset_univ"; | 
| 0 | 515 | |
| 516 | (** univ(A) as a limit **) | |
| 517 | ||
| 5067 | 518 | Goalw [univ_def] "univ(A) = (UN i:nat. Vfrom(A,i))"; | 
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 519 | by (rtac (Limit_nat RS Limit_Vfrom_eq) 1); | 
| 760 | 520 | qed "univ_eq_UN"; | 
| 0 | 521 | |
| 5067 | 522 | Goal "!!c. c <= univ(A) ==> c = (UN i:nat. c Int Vfrom(A,i))"; | 
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 523 | by (rtac (subset_UN_iff_eq RS iffD1) 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 524 | by (etac (univ_eq_UN RS subst) 1); | 
| 760 | 525 | qed "subset_univ_eq_Int"; | 
| 0 | 526 | |
| 527 | val [aprem, iprem] = goal Univ.thy | |
| 1461 | 528 | "[| a <= univ(X); \ | 
| 529 | \ !!i. i:nat ==> a Int Vfrom(X,i) <= b \ | |
| 0 | 530 | \ |] ==> a <= b"; | 
| 2033 | 531 | by (stac (aprem RS subset_univ_eq_Int) 1); | 
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 532 | by (rtac UN_least 1); | 
| 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 533 | by (etac iprem 1); | 
| 760 | 534 | qed "univ_Int_Vfrom_subset"; | 
| 0 | 535 | |
| 536 | val prems = goal Univ.thy | |
| 537 | "[| a <= univ(X); b <= univ(X); \ | |
| 538 | \ !!i. i:nat ==> a Int Vfrom(X,i) = b Int Vfrom(X,i) \ | |
| 539 | \ |] ==> a = b"; | |
| 15 
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
 lcp parents: 
6diff
changeset | 540 | by (rtac equalityI 1); | 
| 0 | 541 | by (ALLGOALS | 
| 542 | (resolve_tac (prems RL [univ_Int_Vfrom_subset]) THEN' | |
| 543 | eresolve_tac (prems RL [equalityD1,equalityD2] RL [subset_trans]) THEN' | |
| 544 | rtac Int_lower1)); | |
| 760 | 545 | qed "univ_Int_Vfrom_eq"; | 
| 0 | 546 | |
| 547 | (** Closure properties **) | |
| 548 | ||
| 5067 | 549 | Goalw [univ_def] "0 : univ(A)"; | 
| 0 | 550 | by (rtac (nat_0I RS zero_in_Vfrom) 1); | 
| 760 | 551 | qed "zero_in_univ"; | 
| 0 | 552 | |
| 5067 | 553 | Goalw [univ_def] "A <= univ(A)"; | 
| 0 | 554 | by (rtac A_subset_Vfrom 1); | 
| 760 | 555 | qed "A_subset_univ"; | 
| 0 | 556 | |
| 557 | val A_into_univ = A_subset_univ RS subsetD; | |
| 558 | ||
| 559 | (** Closure under unordered and ordered pairs **) | |
| 560 | ||
| 5067 | 561 | Goalw [univ_def] "!!A a. a: univ(A) ==> {a} : univ(A)";
 | 
| 516 | 562 | by (REPEAT (ares_tac [singleton_in_VLimit, Limit_nat] 1)); | 
| 760 | 563 | qed "singleton_in_univ"; | 
| 0 | 564 | |
| 5067 | 565 | Goalw [univ_def] | 
| 0 | 566 |     "!!A a. [| a: univ(A);  b: univ(A) |] ==> {a,b} : univ(A)";
 | 
| 516 | 567 | by (REPEAT (ares_tac [doubleton_in_VLimit, Limit_nat] 1)); | 
| 760 | 568 | qed "doubleton_in_univ"; | 
| 0 | 569 | |
| 5067 | 570 | Goalw [univ_def] | 
| 0 | 571 | "!!A a. [| a: univ(A); b: univ(A) |] ==> <a,b> : univ(A)"; | 
| 516 | 572 | by (REPEAT (ares_tac [Pair_in_VLimit, Limit_nat] 1)); | 
| 760 | 573 | qed "Pair_in_univ"; | 
| 0 | 574 | |
| 5067 | 575 | Goalw [univ_def] "univ(A)*univ(A) <= univ(A)"; | 
| 516 | 576 | by (rtac (Limit_nat RS product_VLimit) 1); | 
| 760 | 577 | qed "product_univ"; | 
| 0 | 578 | |
| 579 | ||
| 580 | (** The natural numbers **) | |
| 581 | ||
| 5067 | 582 | Goalw [univ_def] "nat <= univ(A)"; | 
| 0 | 583 | by (rtac i_subset_Vfrom 1); | 
| 760 | 584 | qed "nat_subset_univ"; | 
| 0 | 585 | |
| 586 | (* n:nat ==> n:univ(A) *) | |
| 782 
200a16083201
added bind_thm for theorems defined by "standard ..."
 clasohm parents: 
760diff
changeset | 587 | bind_thm ("nat_into_univ", (nat_subset_univ RS subsetD));
 | 
| 0 | 588 | |
| 589 | (** instances for 1 and 2 **) | |
| 590 | ||
| 5067 | 591 | Goalw [univ_def] "1 : univ(A)"; | 
| 516 | 592 | by (rtac (Limit_nat RS one_in_VLimit) 1); | 
| 760 | 593 | qed "one_in_univ"; | 
| 0 | 594 | |
| 595 | (*unused!*) | |
| 5067 | 596 | Goal "2 : univ(A)"; | 
| 0 | 597 | by (REPEAT (ares_tac [nat_into_univ, nat_0I, nat_succI] 1)); | 
| 760 | 598 | qed "two_in_univ"; | 
| 0 | 599 | |
| 5067 | 600 | Goalw [bool_def] "bool <= univ(A)"; | 
| 4091 | 601 | by (blast_tac (claset() addSIs [zero_in_univ,one_in_univ]) 1); | 
| 760 | 602 | qed "bool_subset_univ"; | 
| 0 | 603 | |
| 782 
200a16083201
added bind_thm for theorems defined by "standard ..."
 clasohm parents: 
760diff
changeset | 604 | bind_thm ("bool_into_univ", (bool_subset_univ RS subsetD));
 | 
| 0 | 605 | |
| 606 | ||
| 607 | (** Closure under disjoint union **) | |
| 608 | ||
| 5067 | 609 | Goalw [univ_def] "!!A a. a: univ(A) ==> Inl(a) : univ(A)"; | 
| 516 | 610 | by (etac (Limit_nat RSN (2,Inl_in_VLimit)) 1); | 
| 760 | 611 | qed "Inl_in_univ"; | 
| 0 | 612 | |
| 5067 | 613 | Goalw [univ_def] "!!A b. b: univ(A) ==> Inr(b) : univ(A)"; | 
| 516 | 614 | by (etac (Limit_nat RSN (2,Inr_in_VLimit)) 1); | 
| 760 | 615 | qed "Inr_in_univ"; | 
| 0 | 616 | |
| 5067 | 617 | Goalw [univ_def] "univ(C)+univ(C) <= univ(C)"; | 
| 516 | 618 | by (rtac (Limit_nat RS sum_VLimit) 1); | 
| 760 | 619 | qed "sum_univ"; | 
| 0 | 620 | |
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 621 | bind_thm ("sum_subset_univ", [sum_mono, sum_univ] MRS subset_trans);
 | 
| 484 | 622 | |
| 623 | ||
| 0 | 624 | (** Closure under binary union -- use Un_least **) | 
| 625 | (** Closure under Collect -- use (Collect_subset RS subset_trans) **) | |
| 626 | (** Closure under RepFun -- use RepFun_subset **) | |
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 627 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 628 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 629 | (*** Finite Branching Closure Properties ***) | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 630 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 631 | (** Closure under finite powerset **) | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 632 | |
| 5067 | 633 | Goal | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 634 | "!!i. [| b: Fin(Vfrom(A,i)); Limit(i) |] ==> EX j. b <= Vfrom(A,j) & j<i"; | 
| 1461 | 635 | by (etac Fin_induct 1); | 
| 4091 | 636 | by (blast_tac (claset() addSDs [Limit_has_0]) 1); | 
| 4152 | 637 | by Safe_tac; | 
| 1461 | 638 | by (etac Limit_VfromE 1); | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 639 | by (assume_tac 1); | 
| 4091 | 640 | by (blast_tac (claset() addSIs [Un_least_lt] addIs [Vfrom_UnI1, Vfrom_UnI2]) 1); | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 641 | val Fin_Vfrom_lemma = result(); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 642 | |
| 5067 | 643 | Goal "!!i. Limit(i) ==> Fin(Vfrom(A,i)) <= Vfrom(A,i)"; | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 644 | by (rtac subsetI 1); | 
| 1461 | 645 | by (dtac Fin_Vfrom_lemma 1); | 
| 4152 | 646 | by Safe_tac; | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 647 | by (resolve_tac [Vfrom RS ssubst] 1); | 
| 4091 | 648 | by (blast_tac (claset() addSDs [ltD]) 1); | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 649 | val Fin_VLimit = result(); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 650 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 651 | bind_thm ("Fin_subset_VLimit", [Fin_mono, Fin_VLimit] MRS subset_trans);
 | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 652 | |
| 5067 | 653 | Goalw [univ_def] "Fin(univ(A)) <= univ(A)"; | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 654 | by (rtac (Limit_nat RS Fin_VLimit) 1); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 655 | val Fin_univ = result(); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 656 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 657 | (** Closure under finite powers (functions from a fixed natural number) **) | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 658 | |
| 5067 | 659 | Goal | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 660 | "!!i. [| n: nat; Limit(i) |] ==> n -> Vfrom(A,i) <= Vfrom(A,i)"; | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 661 | by (eresolve_tac [nat_fun_subset_Fin RS subset_trans] 1); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 662 | by (REPEAT (ares_tac [Fin_subset_VLimit, Sigma_subset_VLimit, | 
| 1461 | 663 | nat_subset_VLimit, subset_refl] 1)); | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 664 | val nat_fun_VLimit = result(); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 665 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 666 | bind_thm ("nat_fun_subset_VLimit", [Pi_mono, nat_fun_VLimit] MRS subset_trans);
 | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 667 | |
| 5067 | 668 | Goalw [univ_def] "!!i. n: nat ==> n -> univ(A) <= univ(A)"; | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 669 | by (etac (Limit_nat RSN (2,nat_fun_VLimit)) 1); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 670 | val nat_fun_univ = result(); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 671 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 672 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 673 | (** Closure under finite function space **) | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 674 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 675 | (*General but seldom-used version; normally the domain is fixed*) | 
| 5067 | 676 | Goal | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 677 | "!!i. Limit(i) ==> Vfrom(A,i) -||> Vfrom(A,i) <= Vfrom(A,i)"; | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 678 | by (resolve_tac [FiniteFun.dom_subset RS subset_trans] 1); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 679 | by (REPEAT (ares_tac [Fin_subset_VLimit, Sigma_subset_VLimit, subset_refl] 1)); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 680 | val FiniteFun_VLimit1 = result(); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 681 | |
| 5067 | 682 | Goalw [univ_def] "univ(A) -||> univ(A) <= univ(A)"; | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 683 | by (rtac (Limit_nat RS FiniteFun_VLimit1) 1); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 684 | val FiniteFun_univ1 = result(); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 685 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 686 | (*Version for a fixed domain*) | 
| 5067 | 687 | Goal | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 688 | "!!i. [| W <= Vfrom(A,i); Limit(i) |] ==> W -||> Vfrom(A,i) <= Vfrom(A,i)"; | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 689 | by (eresolve_tac [subset_refl RSN (2, FiniteFun_mono) RS subset_trans] 1); | 
| 1461 | 690 | by (etac FiniteFun_VLimit1 1); | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 691 | val FiniteFun_VLimit = result(); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 692 | |
| 5067 | 693 | Goalw [univ_def] | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 694 | "!!W. W <= univ(A) ==> W -||> univ(A) <= univ(A)"; | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 695 | by (etac (Limit_nat RSN (2, FiniteFun_VLimit)) 1); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 696 | val FiniteFun_univ = result(); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 697 | |
| 5067 | 698 | Goal | 
| 803 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 699 | "!!W. [| f: W -||> univ(A); W <= univ(A) |] ==> f : univ(A)"; | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 700 | by (eresolve_tac [FiniteFun_univ RS subsetD] 1); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 701 | by (assume_tac 1); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 702 | val FiniteFun_in_univ = result(); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 703 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 704 | (*Remove <= from the rule above*) | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 705 | val FiniteFun_in_univ' = subsetI RSN (2, FiniteFun_in_univ); | 
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 706 | |
| 
4c8333ab3eae
changed useless "qed" calls for lemmas back to uses of "result",
 lcp parents: 
782diff
changeset | 707 |