author | paulson |
Mon, 03 May 1999 11:19:08 +0200 | |
changeset 6566 | 7ed743d18af7 |
parent 6287 | 61904a3eafaa |
child 7531 | 99c7e60d6b3f |
permissions | -rw-r--r-- |
1461 | 1 |
(* Title: ZF/ZF.ML |
0 | 2 |
ID: $Id$ |
1461 | 3 |
Author: Lawrence C Paulson and Martin D Coen, CU Computer Laboratory |
435 | 4 |
Copyright 1994 University of Cambridge |
0 | 5 |
|
6 |
Basic introduction and elimination rules for Zermelo-Fraenkel Set Theory |
|
7 |
*) |
|
8 |
||
825
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
9 |
(*Useful examples: singletonI RS subst_elem, subst_elem RSN (2,IntI) *) |
5137 | 10 |
Goal "[| b:A; a=b |] ==> a:A"; |
825
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
11 |
by (etac ssubst 1); |
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
12 |
by (assume_tac 1); |
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
13 |
val subst_elem = result(); |
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
14 |
|
2469 | 15 |
|
0 | 16 |
(*** Bounded universal quantifier ***) |
17 |
||
775 | 18 |
qed_goalw "ballI" ZF.thy [Ball_def] |
0 | 19 |
"[| !!x. x:A ==> P(x) |] ==> ALL x:A. P(x)" |
20 |
(fn prems=> [ (REPEAT (ares_tac (prems @ [allI,impI]) 1)) ]); |
|
21 |
||
775 | 22 |
qed_goalw "bspec" ZF.thy [Ball_def] |
0 | 23 |
"[| ALL x:A. P(x); x: A |] ==> P(x)" |
24 |
(fn major::prems=> |
|
25 |
[ (rtac (major RS spec RS mp) 1), |
|
26 |
(resolve_tac prems 1) ]); |
|
27 |
||
775 | 28 |
qed_goalw "ballE" ZF.thy [Ball_def] |
37 | 29 |
"[| ALL x:A. P(x); P(x) ==> Q; x~:A ==> Q |] ==> Q" |
0 | 30 |
(fn major::prems=> |
31 |
[ (rtac (major RS allE) 1), |
|
32 |
(REPEAT (eresolve_tac (prems@[asm_rl,impCE]) 1)) ]); |
|
33 |
||
34 |
(*Used in the datatype package*) |
|
775 | 35 |
qed_goal "rev_bspec" ZF.thy |
0 | 36 |
"!!x A P. [| x: A; ALL x:A. P(x) |] ==> P(x)" |
37 |
(fn _ => |
|
38 |
[ REPEAT (ares_tac [bspec] 1) ]); |
|
39 |
||
40 |
(*Instantiates x first: better for automatic theorem proving?*) |
|
775 | 41 |
qed_goal "rev_ballE" ZF.thy |
37 | 42 |
"[| ALL x:A. P(x); x~:A ==> Q; P(x) ==> Q |] ==> Q" |
0 | 43 |
(fn major::prems=> |
44 |
[ (rtac (major RS ballE) 1), |
|
45 |
(REPEAT (eresolve_tac prems 1)) ]); |
|
46 |
||
2469 | 47 |
AddSIs [ballI]; |
48 |
AddEs [rev_ballE]; |
|
49 |
||
0 | 50 |
(*Takes assumptions ALL x:A.P(x) and a:A; creates assumption P(a)*) |
51 |
val ball_tac = dtac bspec THEN' assume_tac; |
|
52 |
||
53 |
(*Trival rewrite rule; (ALL x:A.P)<->P holds only if A is nonempty!*) |
|
3840 | 54 |
qed_goal "ball_triv" ZF.thy "(ALL x:A. P) <-> ((EX x. x:A) --> P)" |
4091 | 55 |
(fn _=> [ simp_tac (simpset() addsimps [Ball_def]) 1 ]); |
3425 | 56 |
Addsimps [ball_triv]; |
0 | 57 |
|
58 |
(*Congruence rule for rewriting*) |
|
775 | 59 |
qed_goalw "ball_cong" ZF.thy [Ball_def] |
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
60 |
"[| A=A'; !!x. x:A' ==> P(x) <-> P'(x) |] ==> Ball(A,P) <-> Ball(A',P')" |
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
61 |
(fn prems=> [ (simp_tac (FOL_ss addsimps prems) 1) ]); |
0 | 62 |
|
63 |
(*** Bounded existential quantifier ***) |
|
64 |
||
6287 | 65 |
Goalw [Bex_def] "[| P(x); x: A |] ==> EX x:A. P(x)"; |
66 |
by (Blast_tac 1); |
|
67 |
qed "bexI"; |
|
68 |
||
69 |
(*The best argument order when there is only one x:A*) |
|
70 |
Goalw [Bex_def] "[| x:A; P(x) |] ==> EX x:A. P(x)"; |
|
71 |
by (Blast_tac 1); |
|
72 |
qed "rev_bexI"; |
|
0 | 73 |
|
74 |
(*Not of the general form for such rules; ~EX has become ALL~ *) |
|
775 | 75 |
qed_goal "bexCI" ZF.thy |
3840 | 76 |
"[| ALL x:A. ~P(x) ==> P(a); a: A |] ==> EX x:A. P(x)" |
0 | 77 |
(fn prems=> |
78 |
[ (rtac classical 1), |
|
79 |
(REPEAT (ares_tac (prems@[bexI,ballI,notI,notE]) 1)) ]); |
|
80 |
||
775 | 81 |
qed_goalw "bexE" ZF.thy [Bex_def] |
0 | 82 |
"[| EX x:A. P(x); !!x. [| x:A; P(x) |] ==> Q \ |
83 |
\ |] ==> Q" |
|
84 |
(fn major::prems=> |
|
85 |
[ (rtac (major RS exE) 1), |
|
86 |
(REPEAT (eresolve_tac (prems @ [asm_rl,conjE]) 1)) ]); |
|
87 |
||
2469 | 88 |
AddIs [bexI]; |
89 |
AddSEs [bexE]; |
|
90 |
||
0 | 91 |
(*We do not even have (EX x:A. True) <-> True unless A is nonempty!!*) |
3840 | 92 |
qed_goal "bex_triv" ZF.thy "(EX x:A. P) <-> ((EX x. x:A) & P)" |
4091 | 93 |
(fn _=> [ simp_tac (simpset() addsimps [Bex_def]) 1 ]); |
3425 | 94 |
Addsimps [bex_triv]; |
0 | 95 |
|
775 | 96 |
qed_goalw "bex_cong" ZF.thy [Bex_def] |
0 | 97 |
"[| A=A'; !!x. x:A' ==> P(x) <-> P'(x) \ |
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
98 |
\ |] ==> Bex(A,P) <-> Bex(A',P')" |
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
99 |
(fn prems=> [ (simp_tac (FOL_ss addsimps prems addcongs [conj_cong]) 1) ]); |
0 | 100 |
|
2469 | 101 |
Addcongs [ball_cong, bex_cong]; |
102 |
||
103 |
||
0 | 104 |
(*** Rules for subsets ***) |
105 |
||
775 | 106 |
qed_goalw "subsetI" ZF.thy [subset_def] |
3840 | 107 |
"(!!x. x:A ==> x:B) ==> A <= B" |
0 | 108 |
(fn prems=> [ (REPEAT (ares_tac (prems @ [ballI]) 1)) ]); |
109 |
||
110 |
(*Rule in Modus Ponens style [was called subsetE] *) |
|
775 | 111 |
qed_goalw "subsetD" ZF.thy [subset_def] "[| A <= B; c:A |] ==> c:B" |
0 | 112 |
(fn major::prems=> |
113 |
[ (rtac (major RS bspec) 1), |
|
114 |
(resolve_tac prems 1) ]); |
|
115 |
||
116 |
(*Classical elimination rule*) |
|
775 | 117 |
qed_goalw "subsetCE" ZF.thy [subset_def] |
37 | 118 |
"[| A <= B; c~:A ==> P; c:B ==> P |] ==> P" |
0 | 119 |
(fn major::prems=> |
120 |
[ (rtac (major RS ballE) 1), |
|
121 |
(REPEAT (eresolve_tac prems 1)) ]); |
|
122 |
||
2469 | 123 |
AddSIs [subsetI]; |
124 |
AddEs [subsetCE, subsetD]; |
|
125 |
||
126 |
||
0 | 127 |
(*Takes assumptions A<=B; c:A and creates the assumption c:B *) |
128 |
val set_mp_tac = dtac subsetD THEN' assume_tac; |
|
129 |
||
130 |
(*Sometimes useful with premises in this order*) |
|
775 | 131 |
qed_goal "rev_subsetD" ZF.thy "!!A B c. [| c:A; A<=B |] ==> c:B" |
2877 | 132 |
(fn _=> [ Blast_tac 1 ]); |
0 | 133 |
|
6111 | 134 |
(*Converts A<=B to x:A ==> x:B*) |
135 |
fun impOfSubs th = th RSN (2, rev_subsetD); |
|
136 |
||
1889 | 137 |
qed_goal "contra_subsetD" ZF.thy "!!c. [| A <= B; c ~: B |] ==> c ~: A" |
2877 | 138 |
(fn _=> [ Blast_tac 1 ]); |
1889 | 139 |
|
140 |
qed_goal "rev_contra_subsetD" ZF.thy "!!c. [| c ~: B; A <= B |] ==> c ~: A" |
|
2877 | 141 |
(fn _=> [ Blast_tac 1 ]); |
1889 | 142 |
|
775 | 143 |
qed_goal "subset_refl" ZF.thy "A <= A" |
2877 | 144 |
(fn _=> [ Blast_tac 1 ]); |
0 | 145 |
|
2469 | 146 |
Addsimps [subset_refl]; |
147 |
||
148 |
qed_goal "subset_trans" ZF.thy "!!A B C. [| A<=B; B<=C |] ==> A<=C" |
|
2877 | 149 |
(fn _=> [ Blast_tac 1 ]); |
0 | 150 |
|
435 | 151 |
(*Useful for proving A<=B by rewriting in some cases*) |
775 | 152 |
qed_goalw "subset_iff" ZF.thy [subset_def,Ball_def] |
435 | 153 |
"A<=B <-> (ALL x. x:A --> x:B)" |
154 |
(fn _=> [ (rtac iff_refl 1) ]); |
|
155 |
||
0 | 156 |
|
157 |
(*** Rules for equality ***) |
|
158 |
||
159 |
(*Anti-symmetry of the subset relation*) |
|
775 | 160 |
qed_goal "equalityI" ZF.thy "[| A <= B; B <= A |] ==> A = B" |
0 | 161 |
(fn prems=> [ (REPEAT (resolve_tac (prems@[conjI, extension RS iffD2]) 1)) ]); |
162 |
||
2493 | 163 |
AddIs [equalityI]; |
164 |
||
775 | 165 |
qed_goal "equality_iffI" ZF.thy "(!!x. x:A <-> x:B) ==> A = B" |
0 | 166 |
(fn [prem] => |
167 |
[ (rtac equalityI 1), |
|
168 |
(REPEAT (ares_tac [subsetI, prem RS iffD1, prem RS iffD2] 1)) ]); |
|
169 |
||
2469 | 170 |
bind_thm ("equalityD1", extension RS iffD1 RS conjunct1); |
171 |
bind_thm ("equalityD2", extension RS iffD1 RS conjunct2); |
|
0 | 172 |
|
775 | 173 |
qed_goal "equalityE" ZF.thy |
0 | 174 |
"[| A = B; [| A<=B; B<=A |] ==> P |] ==> P" |
175 |
(fn prems=> |
|
176 |
[ (DEPTH_SOLVE (resolve_tac (prems@[equalityD1,equalityD2]) 1)) ]); |
|
177 |
||
775 | 178 |
qed_goal "equalityCE" ZF.thy |
37 | 179 |
"[| A = B; [| c:A; c:B |] ==> P; [| c~:A; c~:B |] ==> P |] ==> P" |
0 | 180 |
(fn major::prems=> |
181 |
[ (rtac (major RS equalityE) 1), |
|
182 |
(REPEAT (contr_tac 1 ORELSE eresolve_tac ([asm_rl,subsetCE]@prems) 1)) ]); |
|
183 |
||
184 |
(*Lemma for creating induction formulae -- for "pattern matching" on p |
|
185 |
To make the induction hypotheses usable, apply "spec" or "bspec" to |
|
186 |
put universal quantifiers over the free variables in p. |
|
187 |
Would it be better to do subgoal_tac "ALL z. p = f(z) --> R(z)" ??*) |
|
775 | 188 |
qed_goal "setup_induction" ZF.thy |
0 | 189 |
"[| p: A; !!z. z: A ==> p=z --> R |] ==> R" |
190 |
(fn prems=> |
|
191 |
[ (rtac mp 1), |
|
192 |
(REPEAT (resolve_tac (refl::prems) 1)) ]); |
|
193 |
||
194 |
||
195 |
(*** Rules for Replace -- the derived form of replacement ***) |
|
196 |
||
775 | 197 |
qed_goalw "Replace_iff" ZF.thy [Replace_def] |
0 | 198 |
"b : {y. x:A, P(x,y)} <-> (EX x:A. P(x,b) & (ALL y. P(x,y) --> y=b))" |
199 |
(fn _=> |
|
200 |
[ (rtac (replacement RS iff_trans) 1), |
|
201 |
(REPEAT (ares_tac [refl,bex_cong,iffI,ballI,allI,conjI,impI,ex1I] 1 |
|
202 |
ORELSE eresolve_tac [conjE, spec RS mp, ex1_functional] 1)) ]); |
|
203 |
||
204 |
(*Introduction; there must be a unique y such that P(x,y), namely y=b. *) |
|
775 | 205 |
qed_goal "ReplaceI" ZF.thy |
485 | 206 |
"[| P(x,b); x: A; !!y. P(x,y) ==> y=b |] ==> \ |
0 | 207 |
\ b : {y. x:A, P(x,y)}" |
208 |
(fn prems=> |
|
209 |
[ (rtac (Replace_iff RS iffD2) 1), |
|
210 |
(REPEAT (ares_tac (prems@[bexI,conjI,allI,impI]) 1)) ]); |
|
211 |
||
212 |
(*Elimination; may asssume there is a unique y such that P(x,y), namely y=b. *) |
|
775 | 213 |
qed_goal "ReplaceE" ZF.thy |
0 | 214 |
"[| b : {y. x:A, P(x,y)}; \ |
215 |
\ !!x. [| x: A; P(x,b); ALL y. P(x,y)-->y=b |] ==> R \ |
|
216 |
\ |] ==> R" |
|
217 |
(fn prems=> |
|
218 |
[ (rtac (Replace_iff RS iffD1 RS bexE) 1), |
|
219 |
(etac conjE 2), |
|
220 |
(REPEAT (ares_tac prems 1)) ]); |
|
221 |
||
485 | 222 |
(*As above but without the (generally useless) 3rd assumption*) |
775 | 223 |
qed_goal "ReplaceE2" ZF.thy |
485 | 224 |
"[| b : {y. x:A, P(x,y)}; \ |
225 |
\ !!x. [| x: A; P(x,b) |] ==> R \ |
|
226 |
\ |] ==> R" |
|
227 |
(fn major::prems=> |
|
228 |
[ (rtac (major RS ReplaceE) 1), |
|
229 |
(REPEAT (ares_tac prems 1)) ]); |
|
230 |
||
2469 | 231 |
AddIs [ReplaceI]; |
232 |
AddSEs [ReplaceE2]; |
|
233 |
||
775 | 234 |
qed_goal "Replace_cong" ZF.thy |
0 | 235 |
"[| A=B; !!x y. x:B ==> P(x,y) <-> Q(x,y) |] ==> \ |
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
236 |
\ Replace(A,P) = Replace(B,Q)" |
0 | 237 |
(fn prems=> |
238 |
let val substprems = prems RL [subst, ssubst] |
|
239 |
and iffprems = prems RL [iffD1,iffD2] |
|
240 |
in [ (rtac equalityI 1), |
|
1461 | 241 |
(REPEAT (eresolve_tac (substprems@[asm_rl, ReplaceE, spec RS mp]) 1 |
242 |
ORELSE resolve_tac [subsetI, ReplaceI] 1 |
|
243 |
ORELSE (resolve_tac iffprems 1 THEN assume_tac 2))) ] |
|
0 | 244 |
end); |
245 |
||
2469 | 246 |
Addcongs [Replace_cong]; |
247 |
||
0 | 248 |
(*** Rules for RepFun ***) |
249 |
||
775 | 250 |
qed_goalw "RepFunI" ZF.thy [RepFun_def] |
0 | 251 |
"!!a A. a : A ==> f(a) : {f(x). x:A}" |
252 |
(fn _ => [ (REPEAT (ares_tac [ReplaceI,refl] 1)) ]); |
|
253 |
||
120 | 254 |
(*Useful for coinduction proofs*) |
775 | 255 |
qed_goal "RepFun_eqI" ZF.thy |
0 | 256 |
"!!b a f. [| b=f(a); a : A |] ==> b : {f(x). x:A}" |
257 |
(fn _ => [ etac ssubst 1, etac RepFunI 1 ]); |
|
258 |
||
775 | 259 |
qed_goalw "RepFunE" ZF.thy [RepFun_def] |
0 | 260 |
"[| b : {f(x). x:A}; \ |
261 |
\ !!x.[| x:A; b=f(x) |] ==> P |] ==> \ |
|
262 |
\ P" |
|
263 |
(fn major::prems=> |
|
264 |
[ (rtac (major RS ReplaceE) 1), |
|
265 |
(REPEAT (ares_tac prems 1)) ]); |
|
266 |
||
2716 | 267 |
AddIs [RepFun_eqI]; |
2469 | 268 |
AddSEs [RepFunE]; |
269 |
||
775 | 270 |
qed_goalw "RepFun_cong" ZF.thy [RepFun_def] |
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
271 |
"[| A=B; !!x. x:B ==> f(x)=g(x) |] ==> RepFun(A,f) = RepFun(B,g)" |
4091 | 272 |
(fn prems=> [ (simp_tac (simpset() addsimps prems) 1) ]); |
2469 | 273 |
|
274 |
Addcongs [RepFun_cong]; |
|
0 | 275 |
|
775 | 276 |
qed_goalw "RepFun_iff" ZF.thy [Bex_def] |
485 | 277 |
"b : {f(x). x:A} <-> (EX x:A. b=f(x))" |
2877 | 278 |
(fn _ => [Blast_tac 1]); |
485 | 279 |
|
5067 | 280 |
Goal "{x. x:A} = A"; |
2877 | 281 |
by (Blast_tac 1); |
2469 | 282 |
qed "triv_RepFun"; |
283 |
||
284 |
Addsimps [RepFun_iff, triv_RepFun]; |
|
0 | 285 |
|
286 |
(*** Rules for Collect -- forming a subset by separation ***) |
|
287 |
||
288 |
(*Separation is derivable from Replacement*) |
|
775 | 289 |
qed_goalw "separation" ZF.thy [Collect_def] |
0 | 290 |
"a : {x:A. P(x)} <-> a:A & P(a)" |
2877 | 291 |
(fn _=> [Blast_tac 1]); |
2469 | 292 |
|
293 |
Addsimps [separation]; |
|
0 | 294 |
|
775 | 295 |
qed_goal "CollectI" ZF.thy |
2469 | 296 |
"!!P. [| a:A; P(a) |] ==> a : {x:A. P(x)}" |
297 |
(fn _=> [ Asm_simp_tac 1 ]); |
|
0 | 298 |
|
775 | 299 |
qed_goal "CollectE" ZF.thy |
0 | 300 |
"[| a : {x:A. P(x)}; [| a:A; P(a) |] ==> R |] ==> R" |
301 |
(fn prems=> |
|
302 |
[ (rtac (separation RS iffD1 RS conjE) 1), |
|
303 |
(REPEAT (ares_tac prems 1)) ]); |
|
304 |
||
2469 | 305 |
qed_goal "CollectD1" ZF.thy "!!P. a : {x:A. P(x)} ==> a:A" |
306 |
(fn _=> [ (etac CollectE 1), (assume_tac 1) ]); |
|
0 | 307 |
|
2469 | 308 |
qed_goal "CollectD2" ZF.thy "!!P. a : {x:A. P(x)} ==> P(a)" |
309 |
(fn _=> [ (etac CollectE 1), (assume_tac 1) ]); |
|
0 | 310 |
|
775 | 311 |
qed_goalw "Collect_cong" ZF.thy [Collect_def] |
6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset
|
312 |
"[| A=B; !!x. x:B ==> P(x) <-> Q(x) |] ==> Collect(A,P) = Collect(B,Q)" |
4091 | 313 |
(fn prems=> [ (simp_tac (simpset() addsimps prems) 1) ]); |
2469 | 314 |
|
315 |
AddSIs [CollectI]; |
|
316 |
AddSEs [CollectE]; |
|
317 |
Addcongs [Collect_cong]; |
|
0 | 318 |
|
319 |
(*** Rules for Unions ***) |
|
320 |
||
2469 | 321 |
Addsimps [Union_iff]; |
322 |
||
0 | 323 |
(*The order of the premises presupposes that C is rigid; A may be flexible*) |
2469 | 324 |
qed_goal "UnionI" ZF.thy "!!C. [| B: C; A: B |] ==> A: Union(C)" |
2877 | 325 |
(fn _=> [ Simp_tac 1, Blast_tac 1 ]); |
0 | 326 |
|
775 | 327 |
qed_goal "UnionE" ZF.thy |
0 | 328 |
"[| A : Union(C); !!B.[| A: B; B: C |] ==> R |] ==> R" |
329 |
(fn prems=> |
|
485 | 330 |
[ (resolve_tac [Union_iff RS iffD1 RS bexE] 1), |
0 | 331 |
(REPEAT (ares_tac prems 1)) ]); |
332 |
||
333 |
(*** Rules for Unions of families ***) |
|
334 |
(* UN x:A. B(x) abbreviates Union({B(x). x:A}) *) |
|
335 |
||
775 | 336 |
qed_goalw "UN_iff" ZF.thy [Bex_def] |
485 | 337 |
"b : (UN x:A. B(x)) <-> (EX x:A. b : B(x))" |
2877 | 338 |
(fn _=> [ Simp_tac 1, Blast_tac 1 ]); |
2469 | 339 |
|
340 |
Addsimps [UN_iff]; |
|
485 | 341 |
|
0 | 342 |
(*The order of the premises presupposes that A is rigid; b may be flexible*) |
2469 | 343 |
qed_goal "UN_I" ZF.thy "!!A B. [| a: A; b: B(a) |] ==> b: (UN x:A. B(x))" |
2877 | 344 |
(fn _=> [ Simp_tac 1, Blast_tac 1 ]); |
0 | 345 |
|
775 | 346 |
qed_goal "UN_E" ZF.thy |
0 | 347 |
"[| b : (UN x:A. B(x)); !!x.[| x: A; b: B(x) |] ==> R |] ==> R" |
348 |
(fn major::prems=> |
|
349 |
[ (rtac (major RS UnionE) 1), |
|
350 |
(REPEAT (eresolve_tac (prems@[asm_rl, RepFunE, subst]) 1)) ]); |
|
351 |
||
775 | 352 |
qed_goal "UN_cong" ZF.thy |
3840 | 353 |
"[| A=B; !!x. x:B ==> C(x)=D(x) |] ==> (UN x:A. C(x)) = (UN x:B. D(x))" |
4091 | 354 |
(fn prems=> [ (simp_tac (simpset() addsimps prems) 1) ]); |
2469 | 355 |
|
356 |
(*No "Addcongs [UN_cong]" because UN is a combination of constants*) |
|
357 |
||
358 |
(* UN_E appears before UnionE so that it is tried first, to avoid expensive |
|
359 |
calls to hyp_subst_tac. Cannot include UN_I as it is unsafe: would enlarge |
|
360 |
the search space.*) |
|
361 |
AddIs [UnionI]; |
|
362 |
AddSEs [UN_E]; |
|
363 |
AddSEs [UnionE]; |
|
364 |
||
365 |
||
366 |
(*** Rules for Inter ***) |
|
367 |
||
368 |
(*Not obviously useful towards proving InterI, InterD, InterE*) |
|
369 |
qed_goalw "Inter_iff" ZF.thy [Inter_def,Ball_def] |
|
370 |
"A : Inter(C) <-> (ALL x:C. A: x) & (EX x. x:C)" |
|
2877 | 371 |
(fn _=> [ Simp_tac 1, Blast_tac 1 ]); |
435 | 372 |
|
2469 | 373 |
(* Intersection is well-behaved only if the family is non-empty! *) |
2815
c05fa3ce5439
Improved intersection rule InterI: now truly safe, since the unsafeness is
paulson
parents:
2716
diff
changeset
|
374 |
qed_goal "InterI" ZF.thy |
c05fa3ce5439
Improved intersection rule InterI: now truly safe, since the unsafeness is
paulson
parents:
2716
diff
changeset
|
375 |
"[| !!x. x: C ==> A: x; EX c. c:C |] ==> A : Inter(C)" |
4091 | 376 |
(fn prems=> [ (simp_tac (simpset() addsimps [Inter_iff]) 1), |
377 |
blast_tac (claset() addIs prems) 1 ]); |
|
2469 | 378 |
|
379 |
(*A "destruct" rule -- every B in C contains A as an element, but |
|
380 |
A:B can hold when B:C does not! This rule is analogous to "spec". *) |
|
381 |
qed_goalw "InterD" ZF.thy [Inter_def] |
|
382 |
"!!C. [| A : Inter(C); B : C |] ==> A : B" |
|
2877 | 383 |
(fn _=> [ Blast_tac 1 ]); |
2469 | 384 |
|
385 |
(*"Classical" elimination rule -- does not require exhibiting B:C *) |
|
386 |
qed_goalw "InterE" ZF.thy [Inter_def] |
|
2716 | 387 |
"[| A : Inter(C); B~:C ==> R; A:B ==> R |] ==> R" |
2469 | 388 |
(fn major::prems=> |
389 |
[ (rtac (major RS CollectD2 RS ballE) 1), |
|
390 |
(REPEAT (eresolve_tac prems 1)) ]); |
|
391 |
||
392 |
AddSIs [InterI]; |
|
2716 | 393 |
AddEs [InterD, InterE]; |
0 | 394 |
|
395 |
(*** Rules for Intersections of families ***) |
|
396 |
(* INT x:A. B(x) abbreviates Inter({B(x). x:A}) *) |
|
397 |
||
2469 | 398 |
qed_goalw "INT_iff" ZF.thy [Inter_def] |
485 | 399 |
"b : (INT x:A. B(x)) <-> (ALL x:A. b : B(x)) & (EX x. x:A)" |
2469 | 400 |
(fn _=> [ Simp_tac 1, Best_tac 1 ]); |
485 | 401 |
|
775 | 402 |
qed_goal "INT_I" ZF.thy |
0 | 403 |
"[| !!x. x: A ==> b: B(x); a: A |] ==> b: (INT x:A. B(x))" |
4091 | 404 |
(fn prems=> [ blast_tac (claset() addIs prems) 1 ]); |
0 | 405 |
|
775 | 406 |
qed_goal "INT_E" ZF.thy |
0 | 407 |
"[| b : (INT x:A. B(x)); a: A |] ==> b : B(a)" |
408 |
(fn [major,minor]=> |
|
409 |
[ (rtac (major RS InterD) 1), |
|
410 |
(rtac (minor RS RepFunI) 1) ]); |
|
411 |
||
775 | 412 |
qed_goal "INT_cong" ZF.thy |
3840 | 413 |
"[| A=B; !!x. x:B ==> C(x)=D(x) |] ==> (INT x:A. C(x)) = (INT x:B. D(x))" |
4091 | 414 |
(fn prems=> [ (simp_tac (simpset() addsimps prems) 1) ]); |
2469 | 415 |
|
416 |
(*No "Addcongs [INT_cong]" because INT is a combination of constants*) |
|
435 | 417 |
|
0 | 418 |
|
419 |
(*** Rules for Powersets ***) |
|
420 |
||
775 | 421 |
qed_goal "PowI" ZF.thy "A <= B ==> A : Pow(B)" |
485 | 422 |
(fn [prem]=> [ (rtac (prem RS (Pow_iff RS iffD2)) 1) ]); |
0 | 423 |
|
775 | 424 |
qed_goal "PowD" ZF.thy "A : Pow(B) ==> A<=B" |
485 | 425 |
(fn [major]=> [ (rtac (major RS (Pow_iff RS iffD1)) 1) ]); |
0 | 426 |
|
2469 | 427 |
AddSIs [PowI]; |
428 |
AddSDs [PowD]; |
|
429 |
||
0 | 430 |
|
431 |
(*** Rules for the empty set ***) |
|
432 |
||
433 |
(*The set {x:0.False} is empty; by foundation it equals 0 |
|
434 |
See Suppes, page 21.*) |
|
2469 | 435 |
qed_goal "not_mem_empty" ZF.thy "a ~: 0" |
436 |
(fn _=> |
|
437 |
[ (cut_facts_tac [foundation] 1), |
|
4091 | 438 |
(best_tac (claset() addDs [equalityD2]) 1) ]); |
2469 | 439 |
|
440 |
bind_thm ("emptyE", not_mem_empty RS notE); |
|
441 |
||
442 |
Addsimps [not_mem_empty]; |
|
443 |
AddSEs [emptyE]; |
|
0 | 444 |
|
775 | 445 |
qed_goal "empty_subsetI" ZF.thy "0 <= A" |
2877 | 446 |
(fn _=> [ Blast_tac 1 ]); |
2469 | 447 |
|
448 |
Addsimps [empty_subsetI]; |
|
0 | 449 |
|
775 | 450 |
qed_goal "equals0I" ZF.thy "[| !!y. y:A ==> False |] ==> A=0" |
4091 | 451 |
(fn prems=> [ blast_tac (claset() addDs prems) 1 ]); |
0 | 452 |
|
5467 | 453 |
qed_goal "equals0D" ZF.thy "!!P. A=0 ==> a ~: A" |
454 |
(fn _=> [ Blast_tac 1 ]); |
|
0 | 455 |
|
5467 | 456 |
AddDs [equals0D, sym RS equals0D]; |
5265
9d1d4c43c76d
Disjointness reasoning by AddEs [equals0E, sym RS equals0E]
paulson
parents:
5242
diff
changeset
|
457 |
|
825
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
458 |
qed_goal "not_emptyI" ZF.thy "!!A a. a:A ==> A ~= 0" |
2877 | 459 |
(fn _=> [ Blast_tac 1 ]); |
825
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
460 |
|
868
452f1e6ae3bc
Deleted semicolon at the end of the qed_goal line, which was preventing
lcp
parents:
854
diff
changeset
|
461 |
qed_goal "not_emptyE" ZF.thy "[| A ~= 0; !!x. x:A ==> R |] ==> R" |
825
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
462 |
(fn [major,minor]=> |
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
463 |
[ rtac ([major, equals0I] MRS swap) 1, |
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
464 |
swap_res_tac [minor] 1, |
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
465 |
assume_tac 1 ]); |
76d9575950f2
Added Krzysztof's theorems subst_elem, not_emptyI, not_emptyE
lcp
parents:
775
diff
changeset
|
466 |
|
0 | 467 |
|
748 | 468 |
(*** Cantor's Theorem: There is no surjection from a set to its powerset. ***) |
469 |
||
470 |
val cantor_cs = FOL_cs (*precisely the rules needed for the proof*) |
|
471 |
addSIs [ballI, CollectI, PowI, subsetI] addIs [bexI] |
|
472 |
addSEs [CollectE, equalityCE]; |
|
473 |
||
474 |
(*The search is undirected; similar proof attempts may fail. |
|
475 |
b represents ANY map, such as (lam x:A.b(x)): A->Pow(A). *) |
|
775 | 476 |
qed_goal "cantor" ZF.thy "EX S: Pow(A). ALL x:A. b(x) ~= S" |
2877 | 477 |
(fn _ => [best_tac cantor_cs 1]); |
748 | 478 |
|
516 | 479 |
(*Lemma for the inductive definition in Zorn.thy*) |
775 | 480 |
qed_goal "Union_in_Pow" ZF.thy |
516 | 481 |
"!!Y. Y : Pow(Pow(A)) ==> Union(Y) : Pow(A)" |
2877 | 482 |
(fn _ => [Blast_tac 1]); |
1902
e349b91cf197
Added function for storing default claset in theory.
berghofe
parents:
1889
diff
changeset
|
483 |
|
6111 | 484 |
|
485 |
local |
|
486 |
val (bspecT, bspec') = make_new_spec bspec |
|
487 |
in |
|
488 |
||
489 |
fun RSbspec th = |
|
490 |
(case concl_of th of |
|
491 |
_ $ (Const("Ball",_) $ _ $ Abs(a,_,_)) => |
|
492 |
let val ca = cterm_of (#sign(rep_thm th)) (Var((a,0),bspecT)) |
|
493 |
in th RS forall_elim ca bspec' end |
|
494 |
| _ => raise THM("RSbspec",0,[th])); |
|
495 |
||
496 |
val normalize_thm_ZF = normalize_thm [RSspec,RSbspec,RSmp]; |
|
497 |
||
498 |
fun qed_spec_mp name = |
|
499 |
let val thm = normalize_thm_ZF (result()) |
|
500 |
in bind_thm(name, thm) end; |
|
501 |
||
502 |
fun qed_goal_spec_mp name thy s p = |
|
503 |
bind_thm (name, normalize_thm_ZF (prove_goal thy s p)); |
|
504 |
||
505 |
fun qed_goalw_spec_mp name thy defs s p = |
|
506 |
bind_thm (name, normalize_thm_ZF (prove_goalw thy defs s p)); |
|
507 |
||
508 |
end; |
|
509 |
||
510 |
||
511 |
(* attributes *) |
|
512 |
||
513 |
local |
|
514 |
||
515 |
fun gen_rulify x = |
|
516 |
Attrib.no_args (Drule.rule_attribute (K (normalize_thm_ZF))) x; |
|
517 |
||
518 |
in |
|
519 |
||
520 |
val attrib_setup = |
|
521 |
[Attrib.add_attributes |
|
522 |
[("rulify", (gen_rulify, gen_rulify), |
|
523 |
"put theorem into standard rule form")]]; |
|
524 |
||
525 |
end; |