author | lcp |
Tue, 21 Jun 1994 17:20:34 +0200 | |
changeset 435 | ca5356bd315a |
parent 187 | 8729bfdcb638 |
child 484 | 70b789956bd3 |
permissions | -rw-r--r-- |
435 | 1 |
(* Title: ZF/Univ |
0 | 2 |
ID: $Id$ |
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!*) |
|
12 |
goal Univ.thy "Vfrom(A,i) = A Un (UN j:i. Pow(Vfrom(A,j)))"; |
|
13 |
by (rtac (Vfrom_def RS def_transrec RS ssubst) 1); |
|
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
14 |
by (simp_tac ZF_ss 1); |
0 | 15 |
val Vfrom = result(); |
16 |
||
17 |
(** Monotonicity **) |
|
18 |
||
19 |
goal Univ.thy "!!A B. A<=B ==> ALL j. i<=j --> Vfrom(A,i) <= Vfrom(B,j)"; |
|
20 |
by (eps_ind_tac "i" 1); |
|
21 |
by (rtac (impI RS allI) 1); |
|
22 |
by (rtac (Vfrom RS ssubst) 1); |
|
23 |
by (rtac (Vfrom RS ssubst) 1); |
|
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); |
|
31 |
val Vfrom_mono_lemma = result(); |
|
32 |
||
33 |
(* [| A<=B; i<=x |] ==> Vfrom(A,i) <= Vfrom(B,x) *) |
|
34 |
val Vfrom_mono = standard (Vfrom_mono_lemma RS spec RS mp); |
|
35 |
||
36 |
||
37 |
(** A fundamental equality: Vfrom does not require ordinals! **) |
|
38 |
||
39 |
goal Univ.thy "Vfrom(A,x) <= Vfrom(A,rank(x))"; |
|
40 |
by (eps_ind_tac "x" 1); |
|
41 |
by (rtac (Vfrom RS ssubst) 1); |
|
42 |
by (rtac (Vfrom RS ssubst) 1); |
|
27 | 43 |
by (fast_tac (ZF_cs addSIs [rank_lt RS ltD]) 1); |
0 | 44 |
val Vfrom_rank_subset1 = result(); |
45 |
||
46 |
goal Univ.thy "Vfrom(A,rank(x)) <= Vfrom(A,x)"; |
|
47 |
by (eps_ind_tac "x" 1); |
|
48 |
by (rtac (Vfrom RS ssubst) 1); |
|
49 |
by (rtac (Vfrom RS ssubst) 1); |
|
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
50 |
by (rtac (subset_refl RS Un_mono) 1); |
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
51 |
by (rtac UN_least 1); |
27 | 52 |
(*expand rank(x1) = (UN y:x1. succ(rank(y))) in assumptions*) |
53 |
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:
6
diff
changeset
|
54 |
by (rtac subset_trans 1); |
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
55 |
by (etac UN_upper 2); |
27 | 56 |
by (rtac (subset_refl RS Vfrom_mono RS subset_trans RS Pow_mono) 1); |
57 |
by (etac (ltI RS le_imp_subset) 1); |
|
58 |
by (rtac (Ord_rank RS Ord_succ) 1); |
|
0 | 59 |
by (etac bspec 1); |
60 |
by (assume_tac 1); |
|
61 |
val Vfrom_rank_subset2 = result(); |
|
62 |
||
63 |
goal Univ.thy "Vfrom(A,rank(x)) = Vfrom(A,x)"; |
|
64 |
by (rtac equalityI 1); |
|
65 |
by (rtac Vfrom_rank_subset2 1); |
|
66 |
by (rtac Vfrom_rank_subset1 1); |
|
67 |
val Vfrom_rank_eq = result(); |
|
68 |
||
69 |
||
70 |
(*** Basic closure properties ***) |
|
71 |
||
72 |
goal Univ.thy "!!x y. y:x ==> 0 : Vfrom(A,x)"; |
|
73 |
by (rtac (Vfrom RS ssubst) 1); |
|
74 |
by (fast_tac ZF_cs 1); |
|
75 |
val zero_in_Vfrom = result(); |
|
76 |
||
77 |
goal Univ.thy "i <= Vfrom(A,i)"; |
|
78 |
by (eps_ind_tac "i" 1); |
|
79 |
by (rtac (Vfrom RS ssubst) 1); |
|
80 |
by (fast_tac ZF_cs 1); |
|
81 |
val i_subset_Vfrom = result(); |
|
82 |
||
83 |
goal Univ.thy "A <= Vfrom(A,i)"; |
|
84 |
by (rtac (Vfrom RS ssubst) 1); |
|
85 |
by (rtac Un_upper1 1); |
|
86 |
val A_subset_Vfrom = result(); |
|
87 |
||
88 |
goal Univ.thy "!!A a i. a <= Vfrom(A,i) ==> a: Vfrom(A,succ(i))"; |
|
89 |
by (rtac (Vfrom RS ssubst) 1); |
|
90 |
by (fast_tac ZF_cs 1); |
|
91 |
val subset_mem_Vfrom = result(); |
|
92 |
||
93 |
(** Finite sets and ordered pairs **) |
|
94 |
||
95 |
goal Univ.thy "!!a. a: Vfrom(A,i) ==> {a} : Vfrom(A,succ(i))"; |
|
96 |
by (rtac subset_mem_Vfrom 1); |
|
97 |
by (safe_tac ZF_cs); |
|
98 |
val singleton_in_Vfrom = result(); |
|
99 |
||
100 |
goal Univ.thy |
|
101 |
"!!A. [| a: Vfrom(A,i); b: Vfrom(A,i) |] ==> {a,b} : Vfrom(A,succ(i))"; |
|
102 |
by (rtac subset_mem_Vfrom 1); |
|
103 |
by (safe_tac ZF_cs); |
|
104 |
val doubleton_in_Vfrom = result(); |
|
105 |
||
106 |
goalw Univ.thy [Pair_def] |
|
107 |
"!!A. [| a: Vfrom(A,i); b: Vfrom(A,i) |] ==> \ |
|
108 |
\ <a,b> : Vfrom(A,succ(succ(i)))"; |
|
109 |
by (REPEAT (ares_tac [doubleton_in_Vfrom] 1)); |
|
110 |
val Pair_in_Vfrom = result(); |
|
111 |
||
112 |
val [prem] = goal Univ.thy |
|
113 |
"a<=Vfrom(A,i) ==> succ(a) : Vfrom(A,succ(succ(i)))"; |
|
114 |
by (REPEAT (resolve_tac [subset_mem_Vfrom, succ_subsetI] 1)); |
|
115 |
by (rtac (Vfrom_mono RSN (2,subset_trans)) 2); |
|
116 |
by (REPEAT (resolve_tac [prem, subset_refl, subset_succI] 1)); |
|
117 |
val succ_in_Vfrom = result(); |
|
118 |
||
119 |
(*** 0, successor and limit equations fof Vfrom ***) |
|
120 |
||
121 |
goal Univ.thy "Vfrom(A,0) = A"; |
|
122 |
by (rtac (Vfrom RS ssubst) 1); |
|
123 |
by (fast_tac eq_cs 1); |
|
124 |
val Vfrom_0 = result(); |
|
125 |
||
126 |
goal Univ.thy "!!i. Ord(i) ==> Vfrom(A,succ(i)) = A Un Pow(Vfrom(A,i))"; |
|
127 |
by (rtac (Vfrom RS trans) 1); |
|
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
128 |
by (rtac (succI1 RS RepFunI RS Union_upper RSN |
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
129 |
(2, equalityI RS subst_context)) 1); |
0 | 130 |
by (rtac UN_least 1); |
131 |
by (rtac (subset_refl RS Vfrom_mono RS Pow_mono) 1); |
|
27 | 132 |
by (etac (ltI RS le_imp_subset) 1); |
133 |
by (etac Ord_succ 1); |
|
0 | 134 |
val Vfrom_succ_lemma = result(); |
135 |
||
136 |
goal Univ.thy "Vfrom(A,succ(i)) = A Un Pow(Vfrom(A,i))"; |
|
137 |
by (res_inst_tac [("x1", "succ(i)")] (Vfrom_rank_eq RS subst) 1); |
|
138 |
by (res_inst_tac [("x1", "i")] (Vfrom_rank_eq RS subst) 1); |
|
139 |
by (rtac (rank_succ RS ssubst) 1); |
|
140 |
by (rtac (Ord_rank RS Vfrom_succ_lemma) 1); |
|
141 |
val Vfrom_succ = result(); |
|
142 |
||
143 |
(*The premise distinguishes this from Vfrom(A,0); allowing X=0 forces |
|
144 |
the conclusion to be Vfrom(A,Union(X)) = A Un (UN y:X. Vfrom(A,y)) *) |
|
145 |
val [prem] = goal Univ.thy "y:X ==> Vfrom(A,Union(X)) = (UN y:X. Vfrom(A,y))"; |
|
146 |
by (rtac (Vfrom RS ssubst) 1); |
|
147 |
by (rtac equalityI 1); |
|
148 |
(*first inclusion*) |
|
149 |
by (rtac Un_least 1); |
|
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
150 |
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:
6
diff
changeset
|
151 |
by (rtac (prem RS UN_upper) 1); |
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
152 |
by (rtac UN_least 1); |
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
153 |
by (etac UnionE 1); |
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
154 |
by (rtac subset_trans 1); |
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
155 |
by (etac UN_upper 2); |
0 | 156 |
by (rtac (Vfrom RS ssubst) 1); |
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
157 |
by (etac ([UN_upper, Un_upper2] MRS subset_trans) 1); |
0 | 158 |
(*opposite inclusion*) |
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
159 |
by (rtac UN_least 1); |
0 | 160 |
by (rtac (Vfrom RS ssubst) 1); |
161 |
by (fast_tac ZF_cs 1); |
|
162 |
val Vfrom_Union = result(); |
|
163 |
||
164 |
goal Univ.thy "!!i. Ord(i) ==> i=0 | (EX j. i=succ(j)) | Limit(i)"; |
|
27 | 165 |
by (fast_tac (ZF_cs addSIs [non_succ_LimitI, Ord_0_lt]) 1); |
0 | 166 |
val Ord_cases_lemma = result(); |
167 |
||
168 |
val major::prems = goal Univ.thy |
|
169 |
"[| Ord(i); \ |
|
170 |
\ i=0 ==> P; \ |
|
171 |
\ !!j. i=succ(j) ==> P; \ |
|
172 |
\ Limit(i) ==> P \ |
|
173 |
\ |] ==> P"; |
|
174 |
by (cut_facts_tac [major RS Ord_cases_lemma] 1); |
|
175 |
by (REPEAT (eresolve_tac (prems@[disjE, exE]) 1)); |
|
176 |
val Ord_cases = result(); |
|
177 |
||
178 |
||
179 |
(*** Vfrom applied to Limit ordinals ***) |
|
180 |
||
181 |
(*NB. limit ordinals are non-empty; |
|
182 |
Vfrom(A,0) = A = A Un (UN y:0. Vfrom(A,y)) *) |
|
183 |
val [limiti] = goal Univ.thy |
|
184 |
"Limit(i) ==> Vfrom(A,i) = (UN y:i. Vfrom(A,y))"; |
|
27 | 185 |
by (rtac (limiti RS (Limit_has_0 RS ltD) RS Vfrom_Union RS subst) 1); |
0 | 186 |
by (rtac (limiti RS Limit_Union_eq RS ssubst) 1); |
187 |
by (rtac refl 1); |
|
188 |
val Limit_Vfrom_eq = result(); |
|
189 |
||
27 | 190 |
goal Univ.thy "!!a. [| a: Vfrom(A,j); Limit(i); j<i |] ==> a : Vfrom(A,i)"; |
191 |
by (rtac (Limit_Vfrom_eq RS equalityD2 RS subsetD) 1); |
|
192 |
by (REPEAT (ares_tac [ltD RS UN_I] 1)); |
|
193 |
val Limit_VfromI = result(); |
|
194 |
||
195 |
val prems = goal Univ.thy |
|
196 |
"[| a: Vfrom(A,i); Limit(i); \ |
|
197 |
\ !!x. [| x<i; a: Vfrom(A,x) |] ==> R \ |
|
198 |
\ |] ==> R"; |
|
199 |
by (rtac (Limit_Vfrom_eq RS equalityD1 RS subsetD RS UN_E) 1); |
|
200 |
by (REPEAT (ares_tac (prems @ [ltI, Limit_is_Ord]) 1)); |
|
201 |
val Limit_VfromE = result(); |
|
0 | 202 |
|
203 |
val [major,limiti] = goal Univ.thy |
|
204 |
"[| a: Vfrom(A,i); Limit(i) |] ==> {a} : Vfrom(A,i)"; |
|
27 | 205 |
by (rtac ([major,limiti] MRS Limit_VfromE) 1); |
206 |
by (etac ([singleton_in_Vfrom, limiti] MRS Limit_VfromI) 1); |
|
0 | 207 |
by (etac (limiti RS Limit_has_succ) 1); |
208 |
val singleton_in_Vfrom_limit = result(); |
|
209 |
||
210 |
val Vfrom_UnI1 = Un_upper1 RS (subset_refl RS Vfrom_mono RS subsetD) |
|
211 |
and Vfrom_UnI2 = Un_upper2 RS (subset_refl RS Vfrom_mono RS subsetD); |
|
212 |
||
213 |
(*Hard work is finding a single j:i such that {a,b}<=Vfrom(A,j)*) |
|
214 |
val [aprem,bprem,limiti] = goal Univ.thy |
|
215 |
"[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i) |] ==> \ |
|
216 |
\ {a,b} : Vfrom(A,i)"; |
|
27 | 217 |
by (rtac ([aprem,limiti] MRS Limit_VfromE) 1); |
218 |
by (rtac ([bprem,limiti] MRS Limit_VfromE) 1); |
|
219 |
by (rtac ([doubleton_in_Vfrom, limiti] MRS Limit_VfromI) 1); |
|
220 |
by (etac Vfrom_UnI1 1); |
|
221 |
by (etac Vfrom_UnI2 1); |
|
222 |
by (REPEAT (ares_tac [limiti, Limit_has_succ, Un_least_lt] 1)); |
|
0 | 223 |
val doubleton_in_Vfrom_limit = result(); |
224 |
||
225 |
val [aprem,bprem,limiti] = goal Univ.thy |
|
226 |
"[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i) |] ==> \ |
|
227 |
\ <a,b> : Vfrom(A,i)"; |
|
228 |
(*Infer that a, b occur at ordinals x,xa < i.*) |
|
27 | 229 |
by (rtac ([aprem,limiti] MRS Limit_VfromE) 1); |
230 |
by (rtac ([bprem,limiti] MRS Limit_VfromE) 1); |
|
231 |
by (rtac ([Pair_in_Vfrom, limiti] MRS Limit_VfromI) 1); |
|
0 | 232 |
(*Infer that succ(succ(x Un xa)) < i *) |
27 | 233 |
by (etac Vfrom_UnI1 1); |
234 |
by (etac Vfrom_UnI2 1); |
|
235 |
by (REPEAT (ares_tac [limiti, Limit_has_succ, Un_least_lt] 1)); |
|
0 | 236 |
val Pair_in_Vfrom_limit = result(); |
237 |
||
238 |
||
239 |
(*** Properties assuming Transset(A) ***) |
|
240 |
||
241 |
goal Univ.thy "!!i A. Transset(A) ==> Transset(Vfrom(A,i))"; |
|
242 |
by (eps_ind_tac "i" 1); |
|
243 |
by (rtac (Vfrom RS ssubst) 1); |
|
244 |
by (fast_tac (ZF_cs addSIs [Transset_Union_family, Transset_Un, |
|
245 |
Transset_Pow]) 1); |
|
246 |
val Transset_Vfrom = result(); |
|
247 |
||
248 |
goal Univ.thy "!!A i. Transset(A) ==> Vfrom(A, succ(i)) = Pow(Vfrom(A,i))"; |
|
249 |
by (rtac (Vfrom_succ RS trans) 1); |
|
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
250 |
by (rtac (Un_upper2 RSN (2,equalityI)) 1); |
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
251 |
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:
6
diff
changeset
|
252 |
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:
6
diff
changeset
|
253 |
by (etac (Transset_Vfrom RS (Transset_iff_Pow RS iffD1)) 1); |
0 | 254 |
val Transset_Vfrom_succ = result(); |
255 |
||
435 | 256 |
goalw Ordinal.thy [Pair_def,Transset_def] |
0 | 257 |
"!!C. [| <a,b> <= C; Transset(C) |] ==> a: C & b: C"; |
258 |
by (fast_tac ZF_cs 1); |
|
259 |
val Transset_Pair_subset = result(); |
|
260 |
||
261 |
goal Univ.thy |
|
262 |
"!!a b.[| <a,b> <= Vfrom(A,i); Transset(A); Limit(i) |] ==> \ |
|
263 |
\ <a,b> : Vfrom(A,i)"; |
|
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
264 |
by (etac (Transset_Pair_subset RS conjE) 1); |
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
265 |
by (etac Transset_Vfrom 1); |
0 | 266 |
by (REPEAT (ares_tac [Pair_in_Vfrom_limit] 1)); |
267 |
val Transset_Pair_subset_Vfrom_limit = result(); |
|
268 |
||
269 |
||
270 |
(*** Closure under product/sum applied to elements -- thus Vfrom(A,i) |
|
271 |
is a model of simple type theory provided A is a transitive set |
|
272 |
and i is a limit ordinal |
|
273 |
***) |
|
274 |
||
187 | 275 |
(*General theorem for membership in Vfrom(A,i) when i is a limit ordinal*) |
276 |
val [aprem,bprem,limiti,step] = goal Univ.thy |
|
277 |
"[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i); \ |
|
278 |
\ !!x y j. [| j<i; 1:j; x: Vfrom(A,j); y: Vfrom(A,j) \ |
|
279 |
\ |] ==> EX k. h(x,y): Vfrom(A,k) & k<i |] ==> \ |
|
280 |
\ h(a,b) : Vfrom(A,i)"; |
|
281 |
(*Infer that a, b occur at ordinals x,xa < i.*) |
|
282 |
by (rtac ([aprem,limiti] MRS Limit_VfromE) 1); |
|
283 |
by (rtac ([bprem,limiti] MRS Limit_VfromE) 1); |
|
284 |
by (res_inst_tac [("j1", "x Un xa Un succ(1)")] (step RS exE) 1); |
|
285 |
by (DO_GOAL [etac conjE, etac Limit_VfromI, rtac limiti, atac] 5); |
|
286 |
by (etac (Vfrom_UnI2 RS Vfrom_UnI1) 4); |
|
287 |
by (etac (Vfrom_UnI1 RS Vfrom_UnI1) 3); |
|
288 |
by (rtac (succI1 RS UnI2) 2); |
|
289 |
by (REPEAT (ares_tac [limiti, Limit_has_0, Limit_has_succ, Un_least_lt] 1)); |
|
290 |
val in_Vfrom_limit = result(); |
|
0 | 291 |
|
292 |
(** products **) |
|
293 |
||
294 |
goal Univ.thy |
|
187 | 295 |
"!!A. [| a: Vfrom(A,j); b: Vfrom(A,j); Transset(A) |] ==> \ |
296 |
\ a*b : Vfrom(A, succ(succ(succ(j))))"; |
|
0 | 297 |
by (dtac Transset_Vfrom 1); |
298 |
by (rtac subset_mem_Vfrom 1); |
|
299 |
by (rewtac Transset_def); |
|
300 |
by (fast_tac (ZF_cs addIs [Pair_in_Vfrom]) 1); |
|
301 |
val prod_in_Vfrom = result(); |
|
302 |
||
303 |
val [aprem,bprem,limiti,transset] = goal Univ.thy |
|
304 |
"[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i); Transset(A) |] ==> \ |
|
305 |
\ a*b : Vfrom(A,i)"; |
|
187 | 306 |
by (rtac ([aprem,bprem,limiti] MRS in_Vfrom_limit) 1); |
307 |
by (REPEAT (ares_tac [exI, conjI, prod_in_Vfrom, transset, |
|
308 |
limiti RS Limit_has_succ] 1)); |
|
0 | 309 |
val prod_in_Vfrom_limit = result(); |
310 |
||
311 |
(** Disjoint sums, aka Quine ordered pairs **) |
|
312 |
||
313 |
goalw Univ.thy [sum_def] |
|
187 | 314 |
"!!A. [| a: Vfrom(A,j); b: Vfrom(A,j); Transset(A); 1:j |] ==> \ |
315 |
\ a+b : Vfrom(A, succ(succ(succ(j))))"; |
|
0 | 316 |
by (dtac Transset_Vfrom 1); |
317 |
by (rtac subset_mem_Vfrom 1); |
|
318 |
by (rewtac Transset_def); |
|
319 |
by (fast_tac (ZF_cs addIs [zero_in_Vfrom, Pair_in_Vfrom, |
|
320 |
i_subset_Vfrom RS subsetD]) 1); |
|
321 |
val sum_in_Vfrom = result(); |
|
322 |
||
323 |
val [aprem,bprem,limiti,transset] = goal Univ.thy |
|
324 |
"[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i); Transset(A) |] ==> \ |
|
325 |
\ a+b : Vfrom(A,i)"; |
|
187 | 326 |
by (rtac ([aprem,bprem,limiti] MRS in_Vfrom_limit) 1); |
327 |
by (REPEAT (ares_tac [exI, conjI, sum_in_Vfrom, transset, |
|
328 |
limiti RS Limit_has_succ] 1)); |
|
0 | 329 |
val sum_in_Vfrom_limit = result(); |
330 |
||
331 |
(** function space! **) |
|
332 |
||
333 |
goalw Univ.thy [Pi_def] |
|
187 | 334 |
"!!A. [| a: Vfrom(A,j); b: Vfrom(A,j); Transset(A) |] ==> \ |
335 |
\ a->b : Vfrom(A, succ(succ(succ(succ(j)))))"; |
|
0 | 336 |
by (dtac Transset_Vfrom 1); |
337 |
by (rtac subset_mem_Vfrom 1); |
|
338 |
by (rtac (Collect_subset RS subset_trans) 1); |
|
339 |
by (rtac (Vfrom RS ssubst) 1); |
|
340 |
by (rtac (subset_trans RS subset_trans) 1); |
|
341 |
by (rtac Un_upper2 3); |
|
342 |
by (rtac (succI1 RS UN_upper) 2); |
|
343 |
by (rtac Pow_mono 1); |
|
344 |
by (rewtac Transset_def); |
|
345 |
by (fast_tac (ZF_cs addIs [Pair_in_Vfrom]) 1); |
|
346 |
val fun_in_Vfrom = result(); |
|
347 |
||
348 |
val [aprem,bprem,limiti,transset] = goal Univ.thy |
|
349 |
"[| a: Vfrom(A,i); b: Vfrom(A,i); Limit(i); Transset(A) |] ==> \ |
|
350 |
\ a->b : Vfrom(A,i)"; |
|
187 | 351 |
by (rtac ([aprem,bprem,limiti] MRS in_Vfrom_limit) 1); |
352 |
by (REPEAT (ares_tac [exI, conjI, fun_in_Vfrom, transset, |
|
353 |
limiti RS Limit_has_succ] 1)); |
|
0 | 354 |
val fun_in_Vfrom_limit = result(); |
355 |
||
356 |
||
357 |
(*** The set Vset(i) ***) |
|
358 |
||
359 |
goal Univ.thy "Vset(i) = (UN j:i. Pow(Vset(j)))"; |
|
360 |
by (rtac (Vfrom RS ssubst) 1); |
|
361 |
by (fast_tac eq_cs 1); |
|
362 |
val Vset = result(); |
|
363 |
||
364 |
val Vset_succ = Transset_0 RS Transset_Vfrom_succ; |
|
365 |
||
366 |
val Transset_Vset = Transset_0 RS Transset_Vfrom; |
|
367 |
||
368 |
(** Characterisation of the elements of Vset(i) **) |
|
369 |
||
27 | 370 |
val [ordi] = goal Univ.thy "Ord(i) ==> ALL b. b : Vset(i) --> rank(b) < i"; |
0 | 371 |
by (rtac (ordi RS trans_induct) 1); |
372 |
by (rtac (Vset RS ssubst) 1); |
|
373 |
by (safe_tac ZF_cs); |
|
374 |
by (rtac (rank RS ssubst) 1); |
|
27 | 375 |
by (rtac UN_succ_least_lt 1); |
376 |
by (fast_tac ZF_cs 2); |
|
377 |
by (REPEAT (ares_tac [ltI] 1)); |
|
0 | 378 |
val Vset_rank_imp1 = result(); |
379 |
||
27 | 380 |
(* [| Ord(i); x : Vset(i) |] ==> rank(x) < i *) |
381 |
val VsetD = standard (Vset_rank_imp1 RS spec RS mp); |
|
0 | 382 |
|
383 |
val [ordi] = goal Univ.thy "Ord(i) ==> ALL b. rank(b) : i --> b : Vset(i)"; |
|
384 |
by (rtac (ordi RS trans_induct) 1); |
|
385 |
by (rtac allI 1); |
|
386 |
by (rtac (Vset RS ssubst) 1); |
|
27 | 387 |
by (fast_tac (ZF_cs addSIs [rank_lt RS ltD]) 1); |
0 | 388 |
val Vset_rank_imp2 = result(); |
389 |
||
27 | 390 |
goal Univ.thy "!!x i. rank(x)<i ==> x : Vset(i)"; |
391 |
by (etac ltE 1); |
|
392 |
by (etac (Vset_rank_imp2 RS spec RS mp) 1); |
|
393 |
by (assume_tac 1); |
|
394 |
val VsetI = result(); |
|
0 | 395 |
|
27 | 396 |
goal Univ.thy "!!i. Ord(i) ==> b : Vset(i) <-> rank(b) < i"; |
0 | 397 |
by (rtac iffI 1); |
27 | 398 |
by (REPEAT (eresolve_tac [asm_rl, VsetD, VsetI] 1)); |
0 | 399 |
val Vset_Ord_rank_iff = result(); |
400 |
||
27 | 401 |
goal Univ.thy "b : Vset(a) <-> rank(b) < rank(a)"; |
0 | 402 |
by (rtac (Vfrom_rank_eq RS subst) 1); |
403 |
by (rtac (Ord_rank RS Vset_Ord_rank_iff) 1); |
|
404 |
val Vset_rank_iff = result(); |
|
405 |
||
406 |
goal Univ.thy "!!i. Ord(i) ==> rank(Vset(i)) = i"; |
|
407 |
by (rtac (rank RS ssubst) 1); |
|
408 |
by (rtac equalityI 1); |
|
409 |
by (safe_tac ZF_cs); |
|
410 |
by (EVERY' [wtac UN_I, |
|
411 |
etac (i_subset_Vfrom RS subsetD), |
|
412 |
etac (Ord_in_Ord RS rank_of_Ord RS ssubst), |
|
413 |
assume_tac, |
|
414 |
rtac succI1] 3); |
|
27 | 415 |
by (REPEAT (eresolve_tac [asm_rl, VsetD RS ltD, Ord_trans] 1)); |
0 | 416 |
val rank_Vset = result(); |
417 |
||
418 |
(** Lemmas for reasoning about sets in terms of their elements' ranks **) |
|
419 |
||
420 |
goal Univ.thy "a <= Vset(rank(a))"; |
|
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
421 |
by (rtac subsetI 1); |
27 | 422 |
by (etac (rank_lt RS VsetI) 1); |
0 | 423 |
val arg_subset_Vset_rank = result(); |
424 |
||
425 |
val [iprem] = goal Univ.thy |
|
426 |
"[| !!i. Ord(i) ==> a Int Vset(i) <= b |] ==> a <= b"; |
|
27 | 427 |
by (rtac ([subset_refl, arg_subset_Vset_rank] MRS |
428 |
Int_greatest RS subset_trans) 1); |
|
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
429 |
by (rtac (Ord_rank RS iprem) 1); |
0 | 430 |
val Int_Vset_subset = result(); |
431 |
||
432 |
(** Set up an environment for simplification **) |
|
433 |
||
434 |
val rank_rls = [rank_Inl, rank_Inr, rank_pair1, rank_pair2]; |
|
27 | 435 |
val rank_trans_rls = rank_rls @ (rank_rls RLN (2, [lt_trans])); |
0 | 436 |
|
437 |
val rank_ss = ZF_ss |
|
27 | 438 |
addsimps [case_Inl, case_Inr, VsetI] |
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
439 |
addsimps rank_trans_rls; |
0 | 440 |
|
441 |
(** Recursion over Vset levels! **) |
|
442 |
||
443 |
(*NOT SUITABLE FOR REWRITING: recursive!*) |
|
444 |
goalw Univ.thy [Vrec_def] "Vrec(a,H) = H(a, lam x:Vset(rank(a)). Vrec(x,H))"; |
|
445 |
by (rtac (transrec RS ssubst) 1); |
|
27 | 446 |
by (simp_tac (ZF_ss addsimps [Ord_rank, Ord_succ, VsetD RS ltD RS beta, |
447 |
VsetI RS beta, le_refl]) 1); |
|
0 | 448 |
val Vrec = result(); |
449 |
||
450 |
(*This form avoids giant explosions in proofs. NOTE USE OF == *) |
|
451 |
val rew::prems = goal Univ.thy |
|
452 |
"[| !!x. h(x)==Vrec(x,H) |] ==> \ |
|
453 |
\ h(a) = H(a, lam x: Vset(rank(a)). h(x))"; |
|
454 |
by (rewtac rew); |
|
455 |
by (rtac Vrec 1); |
|
456 |
val def_Vrec = result(); |
|
457 |
||
458 |
||
459 |
(*** univ(A) ***) |
|
460 |
||
461 |
goalw Univ.thy [univ_def] "!!A B. A<=B ==> univ(A) <= univ(B)"; |
|
462 |
by (etac Vfrom_mono 1); |
|
463 |
by (rtac subset_refl 1); |
|
464 |
val univ_mono = result(); |
|
465 |
||
466 |
goalw Univ.thy [univ_def] "!!A. Transset(A) ==> Transset(univ(A))"; |
|
467 |
by (etac Transset_Vfrom 1); |
|
468 |
val Transset_univ = result(); |
|
469 |
||
470 |
(** univ(A) as a limit **) |
|
471 |
||
472 |
goalw Univ.thy [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:
6
diff
changeset
|
473 |
by (rtac (Limit_nat RS Limit_Vfrom_eq) 1); |
0 | 474 |
val univ_eq_UN = result(); |
475 |
||
476 |
goal Univ.thy "!!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:
6
diff
changeset
|
477 |
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:
6
diff
changeset
|
478 |
by (etac (univ_eq_UN RS subst) 1); |
0 | 479 |
val subset_univ_eq_Int = result(); |
480 |
||
481 |
val [aprem, iprem] = goal Univ.thy |
|
482 |
"[| a <= univ(X); \ |
|
483 |
\ !!i. i:nat ==> a Int Vfrom(X,i) <= b \ |
|
484 |
\ |] ==> a <= b"; |
|
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
485 |
by (rtac (aprem RS subset_univ_eq_Int RS ssubst) 1); |
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
486 |
by (rtac UN_least 1); |
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
487 |
by (etac iprem 1); |
0 | 488 |
val univ_Int_Vfrom_subset = result(); |
489 |
||
490 |
val prems = goal Univ.thy |
|
491 |
"[| a <= univ(X); b <= univ(X); \ |
|
492 |
\ !!i. i:nat ==> a Int Vfrom(X,i) = b Int Vfrom(X,i) \ |
|
493 |
\ |] ==> a = b"; |
|
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
494 |
by (rtac equalityI 1); |
0 | 495 |
by (ALLGOALS |
496 |
(resolve_tac (prems RL [univ_Int_Vfrom_subset]) THEN' |
|
497 |
eresolve_tac (prems RL [equalityD1,equalityD2] RL [subset_trans]) THEN' |
|
498 |
rtac Int_lower1)); |
|
499 |
val univ_Int_Vfrom_eq = result(); |
|
500 |
||
501 |
(** Closure properties **) |
|
502 |
||
503 |
goalw Univ.thy [univ_def] "0 : univ(A)"; |
|
504 |
by (rtac (nat_0I RS zero_in_Vfrom) 1); |
|
505 |
val zero_in_univ = result(); |
|
506 |
||
507 |
goalw Univ.thy [univ_def] "A <= univ(A)"; |
|
508 |
by (rtac A_subset_Vfrom 1); |
|
509 |
val A_subset_univ = result(); |
|
510 |
||
511 |
val A_into_univ = A_subset_univ RS subsetD; |
|
512 |
||
513 |
(** Closure under unordered and ordered pairs **) |
|
514 |
||
515 |
goalw Univ.thy [univ_def] "!!A a. a: univ(A) ==> {a} : univ(A)"; |
|
516 |
by (rtac singleton_in_Vfrom_limit 1); |
|
517 |
by (REPEAT (ares_tac [Ord_nat,Limit_nat] 1)); |
|
518 |
val singleton_in_univ = result(); |
|
519 |
||
520 |
goalw Univ.thy [univ_def] |
|
521 |
"!!A a. [| a: univ(A); b: univ(A) |] ==> {a,b} : univ(A)"; |
|
522 |
by (rtac doubleton_in_Vfrom_limit 1); |
|
523 |
by (REPEAT (ares_tac [Ord_nat,Limit_nat] 1)); |
|
524 |
val doubleton_in_univ = result(); |
|
525 |
||
526 |
goalw Univ.thy [univ_def] |
|
527 |
"!!A a. [| a: univ(A); b: univ(A) |] ==> <a,b> : univ(A)"; |
|
528 |
by (rtac Pair_in_Vfrom_limit 1); |
|
529 |
by (REPEAT (ares_tac [Ord_nat,Limit_nat] 1)); |
|
530 |
val Pair_in_univ = result(); |
|
531 |
||
532 |
goal Univ.thy "univ(A)*univ(A) <= univ(A)"; |
|
533 |
by (REPEAT (ares_tac [subsetI,Pair_in_univ] 1 |
|
534 |
ORELSE eresolve_tac [SigmaE, ssubst] 1)); |
|
535 |
val product_univ = result(); |
|
536 |
||
537 |
val Sigma_subset_univ = standard |
|
538 |
(Sigma_mono RS (product_univ RSN (2,subset_trans))); |
|
539 |
||
540 |
goalw Univ.thy [univ_def] |
|
541 |
"!!a b.[| <a,b> <= univ(A); Transset(A) |] ==> <a,b> : univ(A)"; |
|
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
542 |
by (etac Transset_Pair_subset_Vfrom_limit 1); |
0 | 543 |
by (REPEAT (ares_tac [Ord_nat,Limit_nat] 1)); |
544 |
val Transset_Pair_subset_univ = result(); |
|
545 |
||
546 |
||
547 |
(** The natural numbers **) |
|
548 |
||
549 |
goalw Univ.thy [univ_def] "nat <= univ(A)"; |
|
550 |
by (rtac i_subset_Vfrom 1); |
|
551 |
val nat_subset_univ = result(); |
|
552 |
||
553 |
(* n:nat ==> n:univ(A) *) |
|
554 |
val nat_into_univ = standard (nat_subset_univ RS subsetD); |
|
555 |
||
556 |
(** instances for 1 and 2 **) |
|
557 |
||
15
6c6d2f6e3185
ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents:
6
diff
changeset
|
558 |
goal Univ.thy "1 : univ(A)"; |
0 | 559 |
by (REPEAT (ares_tac [nat_into_univ, nat_0I, nat_succI] 1)); |
560 |
val one_in_univ = result(); |
|
561 |
||
562 |
(*unused!*) |
|
27 | 563 |
goal Univ.thy "succ(1) : univ(A)"; |
0 | 564 |
by (REPEAT (ares_tac [nat_into_univ, nat_0I, nat_succI] 1)); |
565 |
val two_in_univ = result(); |
|
566 |
||
567 |
goalw Univ.thy [bool_def] "bool <= univ(A)"; |
|
568 |
by (fast_tac (ZF_cs addSIs [zero_in_univ,one_in_univ]) 1); |
|
569 |
val bool_subset_univ = result(); |
|
570 |
||
571 |
val bool_into_univ = standard (bool_subset_univ RS subsetD); |
|
572 |
||
573 |
||
574 |
(** Closure under disjoint union **) |
|
575 |
||
576 |
goalw Univ.thy [Inl_def] "!!A a. a: univ(A) ==> Inl(a) : univ(A)"; |
|
577 |
by (REPEAT (ares_tac [zero_in_univ,Pair_in_univ] 1)); |
|
578 |
val Inl_in_univ = result(); |
|
579 |
||
580 |
goalw Univ.thy [Inr_def] "!!A b. b: univ(A) ==> Inr(b) : univ(A)"; |
|
581 |
by (REPEAT (ares_tac [one_in_univ, Pair_in_univ] 1)); |
|
582 |
val Inr_in_univ = result(); |
|
583 |
||
584 |
goal Univ.thy "univ(C)+univ(C) <= univ(C)"; |
|
585 |
by (REPEAT (ares_tac [subsetI,Inl_in_univ,Inr_in_univ] 1 |
|
586 |
ORELSE eresolve_tac [sumE, ssubst] 1)); |
|
587 |
val sum_univ = result(); |
|
588 |
||
589 |
val sum_subset_univ = standard |
|
590 |
(sum_mono RS (sum_univ RSN (2,subset_trans))); |
|
591 |
||
592 |
||
593 |
(** Closure under binary union -- use Un_least **) |
|
594 |
(** Closure under Collect -- use (Collect_subset RS subset_trans) **) |
|
595 |
(** Closure under RepFun -- use RepFun_subset **) |
|
596 |
||
597 |