author  lcp 
Tue, 26 Jul 1994 13:44:42 +0200  
changeset 485  5e00a676a211 
parent 435  ca5356bd315a 
child 516  1957113f0d7d 
permissions  rwrr 
0  1 
(* Title: ZF/zf.ML 
2 
ID: $Id$ 

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 ZermeloFraenkel Set Theory 

7 
*) 

8 

9 
open ZF; 

10 

11 
signature ZF_LEMMAS = 

12 
sig 

435  13 
val ballE : thm 
14 
val ballI : thm 

15 
val ball_cong : thm 

16 
val ball_simp : thm 

17 
val ball_tac : int > tactic 

18 
val bexCI : thm 

19 
val bexE : thm 

20 
val bexI : thm 

21 
val bex_cong : thm 

22 
val bspec : thm 

23 
val CollectD1 : thm 

24 
val CollectD2 : thm 

25 
val CollectE : thm 

26 
val CollectI : thm 

27 
val Collect_cong : thm 

28 
val emptyE : thm 

29 
val empty_subsetI : thm 

30 
val equalityCE : thm 

31 
val equalityD1 : thm 

32 
val equalityD2 : thm 

33 
val equalityE : thm 

34 
val equalityI : thm 

35 
val equality_iffI : thm 

36 
val equals0D : thm 

37 
val equals0I : thm 

38 
val ex1_functional : thm 

39 
val InterD : thm 

40 
val InterE : thm 

41 
val InterI : thm 

485  42 
val Inter_iff : thm 
435  43 
val INT_E : thm 
44 
val INT_I : thm 

45 
val INT_cong : thm 

46 
val lemmas_cs : claset 

47 
val PowD : thm 

48 
val PowI : thm 

49 
val RepFunE : thm 

50 
val RepFunI : thm 

51 
val RepFun_eqI : thm 

52 
val RepFun_cong : thm 

485  53 
val RepFun_iff : thm 
435  54 
val ReplaceE : thm 
485  55 
val ReplaceE2 : thm 
435  56 
val ReplaceI : thm 
57 
val Replace_iff : thm 

58 
val Replace_cong : thm 

59 
val rev_ballE : thm 

60 
val rev_bspec : thm 

61 
val rev_subsetD : thm 

62 
val separation : thm 

63 
val setup_induction : thm 

64 
val set_mp_tac : int > tactic 

65 
val subsetCE : thm 

66 
val subsetD : thm 

67 
val subsetI : thm 

68 
val subset_iff : thm 

69 
val subset_refl : thm 

70 
val subset_trans : thm 

71 
val UnionE : thm 

72 
val UnionI : thm 

73 
val UN_E : thm 

74 
val UN_I : thm 

75 
val UN_cong : thm 

0  76 
end; 
77 

78 

79 
structure ZF_Lemmas : ZF_LEMMAS = 

80 
struct 

81 

82 
(*** Bounded universal quantifier ***) 

83 

84 
val ballI = prove_goalw ZF.thy [Ball_def] 

85 
"[ !!x. x:A ==> P(x) ] ==> ALL x:A. P(x)" 

86 
(fn prems=> [ (REPEAT (ares_tac (prems @ [allI,impI]) 1)) ]); 

87 

88 
val bspec = prove_goalw ZF.thy [Ball_def] 

89 
"[ ALL x:A. P(x); x: A ] ==> P(x)" 

90 
(fn major::prems=> 

91 
[ (rtac (major RS spec RS mp) 1), 

92 
(resolve_tac prems 1) ]); 

93 

94 
val ballE = prove_goalw ZF.thy [Ball_def] 

37  95 
"[ ALL x:A. P(x); P(x) ==> Q; x~:A ==> Q ] ==> Q" 
0  96 
(fn major::prems=> 
97 
[ (rtac (major RS allE) 1), 

98 
(REPEAT (eresolve_tac (prems@[asm_rl,impCE]) 1)) ]); 

99 

100 
(*Used in the datatype package*) 

101 
val rev_bspec = prove_goal ZF.thy 

102 
"!!x A P. [ x: A; ALL x:A. P(x) ] ==> P(x)" 

103 
(fn _ => 

104 
[ REPEAT (ares_tac [bspec] 1) ]); 

105 

106 
(*Instantiates x first: better for automatic theorem proving?*) 

107 
val rev_ballE = prove_goal ZF.thy 

37  108 
"[ ALL x:A. P(x); x~:A ==> Q; P(x) ==> Q ] ==> Q" 
0  109 
(fn major::prems=> 
110 
[ (rtac (major RS ballE) 1), 

111 
(REPEAT (eresolve_tac prems 1)) ]); 

112 

113 
(*Takes assumptions ALL x:A.P(x) and a:A; creates assumption P(a)*) 

114 
val ball_tac = dtac bspec THEN' assume_tac; 

115 

116 
(*Trival rewrite rule; (ALL x:A.P)<>P holds only if A is nonempty!*) 

6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset

117 
val ball_simp = prove_goal ZF.thy "(ALL x:A. True) <> True" 
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset

118 
(fn _=> [ (REPEAT (ares_tac [TrueI,ballI,iffI] 1)) ]); 
0  119 

120 
(*Congruence rule for rewriting*) 

121 
val ball_cong = prove_goalw ZF.thy [Ball_def] 

6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset

122 
"[ 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

123 
(fn prems=> [ (simp_tac (FOL_ss addsimps prems) 1) ]); 
0  124 

125 
(*** Bounded existential quantifier ***) 

126 

127 
val bexI = prove_goalw ZF.thy [Bex_def] 

128 
"[ P(x); x: A ] ==> EX x:A. P(x)" 

129 
(fn prems=> [ (REPEAT (ares_tac (prems @ [exI,conjI]) 1)) ]); 

130 

131 
(*Not of the general form for such rules; ~EX has become ALL~ *) 

132 
val bexCI = prove_goal ZF.thy 

133 
"[ ALL x:A. ~P(x) ==> P(a); a: A ] ==> EX x:A.P(x)" 

134 
(fn prems=> 

135 
[ (rtac classical 1), 

136 
(REPEAT (ares_tac (prems@[bexI,ballI,notI,notE]) 1)) ]); 

137 

138 
val bexE = prove_goalw ZF.thy [Bex_def] 

139 
"[ EX x:A. P(x); !!x. [ x:A; P(x) ] ==> Q \ 

140 
\ ] ==> Q" 

141 
(fn major::prems=> 

142 
[ (rtac (major RS exE) 1), 

143 
(REPEAT (eresolve_tac (prems @ [asm_rl,conjE]) 1)) ]); 

144 

145 
(*We do not even have (EX x:A. True) <> True unless A is nonempty!!*) 

146 

147 
val bex_cong = prove_goalw ZF.thy [Bex_def] 

148 
"[ 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

149 
\ ] ==> Bex(A,P) <> Bex(A',P')" 
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset

150 
(fn prems=> [ (simp_tac (FOL_ss addsimps prems addcongs [conj_cong]) 1) ]); 
0  151 

152 
(*** Rules for subsets ***) 

153 

154 
val subsetI = prove_goalw ZF.thy [subset_def] 

155 
"(!!x.x:A ==> x:B) ==> A <= B" 

156 
(fn prems=> [ (REPEAT (ares_tac (prems @ [ballI]) 1)) ]); 

157 

158 
(*Rule in Modus Ponens style [was called subsetE] *) 

159 
val subsetD = prove_goalw ZF.thy [subset_def] "[ A <= B; c:A ] ==> c:B" 

160 
(fn major::prems=> 

161 
[ (rtac (major RS bspec) 1), 

162 
(resolve_tac prems 1) ]); 

163 

164 
(*Classical elimination rule*) 

165 
val subsetCE = prove_goalw ZF.thy [subset_def] 

37  166 
"[ A <= B; c~:A ==> P; c:B ==> P ] ==> P" 
0  167 
(fn major::prems=> 
168 
[ (rtac (major RS ballE) 1), 

169 
(REPEAT (eresolve_tac prems 1)) ]); 

170 

171 
(*Takes assumptions A<=B; c:A and creates the assumption c:B *) 

172 
val set_mp_tac = dtac subsetD THEN' assume_tac; 

173 

174 
(*Sometimes useful with premises in this order*) 

175 
val rev_subsetD = prove_goal ZF.thy "!!A B c. [ c:A; A<=B ] ==> c:B" 

176 
(fn _=> [REPEAT (ares_tac [subsetD] 1)]); 

177 

178 
val subset_refl = prove_goal ZF.thy "A <= A" 

179 
(fn _=> [ (rtac subsetI 1), atac 1 ]); 

180 

181 
val subset_trans = prove_goal ZF.thy "[ A<=B; B<=C ] ==> A<=C" 

182 
(fn prems=> [ (REPEAT (ares_tac ([subsetI]@(prems RL [subsetD])) 1)) ]); 

183 

435  184 
(*Useful for proving A<=B by rewriting in some cases*) 
185 
val subset_iff = prove_goalw ZF.thy [subset_def,Ball_def] 

186 
"A<=B <> (ALL x. x:A > x:B)" 

187 
(fn _=> [ (rtac iff_refl 1) ]); 

188 

0  189 

190 
(*** Rules for equality ***) 

191 

192 
(*Antisymmetry of the subset relation*) 

193 
val equalityI = prove_goal ZF.thy "[ A <= B; B <= A ] ==> A = B" 

194 
(fn prems=> [ (REPEAT (resolve_tac (prems@[conjI, extension RS iffD2]) 1)) ]); 

195 

196 
val equality_iffI = prove_goal ZF.thy "(!!x. x:A <> x:B) ==> A = B" 

197 
(fn [prem] => 

198 
[ (rtac equalityI 1), 

199 
(REPEAT (ares_tac [subsetI, prem RS iffD1, prem RS iffD2] 1)) ]); 

200 

201 
val equalityD1 = prove_goal ZF.thy "A = B ==> A<=B" 

202 
(fn prems=> 

203 
[ (rtac (extension RS iffD1 RS conjunct1) 1), 

204 
(resolve_tac prems 1) ]); 

205 

206 
val equalityD2 = prove_goal ZF.thy "A = B ==> B<=A" 

207 
(fn prems=> 

208 
[ (rtac (extension RS iffD1 RS conjunct2) 1), 

209 
(resolve_tac prems 1) ]); 

210 

211 
val equalityE = prove_goal ZF.thy 

212 
"[ A = B; [ A<=B; B<=A ] ==> P ] ==> P" 

213 
(fn prems=> 

214 
[ (DEPTH_SOLVE (resolve_tac (prems@[equalityD1,equalityD2]) 1)) ]); 

215 

216 
val equalityCE = prove_goal ZF.thy 

37  217 
"[ A = B; [ c:A; c:B ] ==> P; [ c~:A; c~:B ] ==> P ] ==> P" 
0  218 
(fn major::prems=> 
219 
[ (rtac (major RS equalityE) 1), 

220 
(REPEAT (contr_tac 1 ORELSE eresolve_tac ([asm_rl,subsetCE]@prems) 1)) ]); 

221 

222 
(*Lemma for creating induction formulae  for "pattern matching" on p 

223 
To make the induction hypotheses usable, apply "spec" or "bspec" to 

224 
put universal quantifiers over the free variables in p. 

225 
Would it be better to do subgoal_tac "ALL z. p = f(z) > R(z)" ??*) 

226 
val setup_induction = prove_goal ZF.thy 

227 
"[ p: A; !!z. z: A ==> p=z > R ] ==> R" 

228 
(fn prems=> 

229 
[ (rtac mp 1), 

230 
(REPEAT (resolve_tac (refl::prems) 1)) ]); 

231 

232 

233 
(*** Rules for Replace  the derived form of replacement ***) 

234 

235 
val ex1_functional = prove_goal ZF.thy 

236 
"[ EX! z. P(a,z); P(a,b); P(a,c) ] ==> b = c" 

237 
(fn prems=> 

238 
[ (cut_facts_tac prems 1), 

239 
(best_tac FOL_dup_cs 1) ]); 

240 

241 
val Replace_iff = prove_goalw ZF.thy [Replace_def] 

242 
"b : {y. x:A, P(x,y)} <> (EX x:A. P(x,b) & (ALL y. P(x,y) > y=b))" 

243 
(fn _=> 

244 
[ (rtac (replacement RS iff_trans) 1), 

245 
(REPEAT (ares_tac [refl,bex_cong,iffI,ballI,allI,conjI,impI,ex1I] 1 

246 
ORELSE eresolve_tac [conjE, spec RS mp, ex1_functional] 1)) ]); 

247 

248 
(*Introduction; there must be a unique y such that P(x,y), namely y=b. *) 

249 
val ReplaceI = prove_goal ZF.thy 

485  250 
"[ P(x,b); x: A; !!y. P(x,y) ==> y=b ] ==> \ 
0  251 
\ b : {y. x:A, P(x,y)}" 
252 
(fn prems=> 

253 
[ (rtac (Replace_iff RS iffD2) 1), 

254 
(REPEAT (ares_tac (prems@[bexI,conjI,allI,impI]) 1)) ]); 

255 

256 
(*Elimination; may asssume there is a unique y such that P(x,y), namely y=b. *) 

257 
val ReplaceE = prove_goal ZF.thy 

258 
"[ b : {y. x:A, P(x,y)}; \ 

259 
\ !!x. [ x: A; P(x,b); ALL y. P(x,y)>y=b ] ==> R \ 

260 
\ ] ==> R" 

261 
(fn prems=> 

262 
[ (rtac (Replace_iff RS iffD1 RS bexE) 1), 

263 
(etac conjE 2), 

264 
(REPEAT (ares_tac prems 1)) ]); 

265 

485  266 
(*As above but without the (generally useless) 3rd assumption*) 
267 
val ReplaceE2 = prove_goal ZF.thy 

268 
"[ b : {y. x:A, P(x,y)}; \ 

269 
\ !!x. [ x: A; P(x,b) ] ==> R \ 

270 
\ ] ==> R" 

271 
(fn major::prems=> 

272 
[ (rtac (major RS ReplaceE) 1), 

273 
(REPEAT (ares_tac prems 1)) ]); 

274 

0  275 
val Replace_cong = prove_goal ZF.thy 
276 
"[ 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

277 
\ Replace(A,P) = Replace(B,Q)" 
0  278 
(fn prems=> 
279 
let val substprems = prems RL [subst, ssubst] 

280 
and iffprems = prems RL [iffD1,iffD2] 

281 
in [ (rtac equalityI 1), 

282 
(REPEAT (eresolve_tac (substprems@[asm_rl, ReplaceE, spec RS mp]) 1 

283 
ORELSE resolve_tac [subsetI, ReplaceI] 1 

284 
ORELSE (resolve_tac iffprems 1 THEN assume_tac 2))) ] 

285 
end); 

286 

287 
(*** Rules for RepFun ***) 

288 

289 
val RepFunI = prove_goalw ZF.thy [RepFun_def] 

290 
"!!a A. a : A ==> f(a) : {f(x). x:A}" 

291 
(fn _ => [ (REPEAT (ares_tac [ReplaceI,refl] 1)) ]); 

292 

120  293 
(*Useful for coinduction proofs*) 
0  294 
val RepFun_eqI = prove_goal ZF.thy 
295 
"!!b a f. [ b=f(a); a : A ] ==> b : {f(x). x:A}" 

296 
(fn _ => [ etac ssubst 1, etac RepFunI 1 ]); 

297 

298 
val RepFunE = prove_goalw ZF.thy [RepFun_def] 

299 
"[ b : {f(x). x:A}; \ 

300 
\ !!x.[ x:A; b=f(x) ] ==> P ] ==> \ 

301 
\ P" 

302 
(fn major::prems=> 

303 
[ (rtac (major RS ReplaceE) 1), 

304 
(REPEAT (ares_tac prems 1)) ]); 

305 

306 
val RepFun_cong = prove_goalw ZF.thy [RepFun_def] 

6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset

307 
"[ A=B; !!x. x:B ==> f(x)=g(x) ] ==> RepFun(A,f) = RepFun(B,g)" 
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset

308 
(fn prems=> [ (simp_tac (FOL_ss addcongs [Replace_cong] addsimps prems) 1) ]); 
0  309 

485  310 
val RepFun_iff = prove_goalw ZF.thy [Bex_def] 
311 
"b : {f(x). x:A} <> (EX x:A. b=f(x))" 

312 
(fn _ => [ (fast_tac (FOL_cs addIs [RepFunI] addSEs [RepFunE]) 1) ]); 

313 

0  314 

315 
(*** Rules for Collect  forming a subset by separation ***) 

316 

317 
(*Separation is derivable from Replacement*) 

318 
val separation = prove_goalw ZF.thy [Collect_def] 

319 
"a : {x:A. P(x)} <> a:A & P(a)" 

320 
(fn _=> [ (fast_tac (FOL_cs addIs [bexI,ReplaceI] 

321 
addSEs [bexE,ReplaceE]) 1) ]); 

322 

323 
val CollectI = prove_goal ZF.thy 

324 
"[ a:A; P(a) ] ==> a : {x:A. P(x)}" 

325 
(fn prems=> 

326 
[ (rtac (separation RS iffD2) 1), 

327 
(REPEAT (resolve_tac (prems@[conjI]) 1)) ]); 

328 

329 
val CollectE = prove_goal ZF.thy 

330 
"[ a : {x:A. P(x)}; [ a:A; P(a) ] ==> R ] ==> R" 

331 
(fn prems=> 

332 
[ (rtac (separation RS iffD1 RS conjE) 1), 

333 
(REPEAT (ares_tac prems 1)) ]); 

334 

335 
val CollectD1 = prove_goal ZF.thy "a : {x:A. P(x)} ==> a:A" 

336 
(fn [major]=> 

337 
[ (rtac (major RS CollectE) 1), 

338 
(assume_tac 1) ]); 

339 

340 
val CollectD2 = prove_goal ZF.thy "a : {x:A. P(x)} ==> P(a)" 

341 
(fn [major]=> 

342 
[ (rtac (major RS CollectE) 1), 

343 
(assume_tac 1) ]); 

344 

345 
val Collect_cong = prove_goalw ZF.thy [Collect_def] 

6
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset

346 
"[ A=B; !!x. x:B ==> P(x) <> Q(x) ] ==> Collect(A,P) = Collect(B,Q)" 
8ce8c4d13d4d
Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents:
0
diff
changeset

347 
(fn prems=> [ (simp_tac (FOL_ss addcongs [Replace_cong] addsimps prems) 1) ]); 
0  348 

349 
(*** Rules for Unions ***) 

350 

351 
(*The order of the premises presupposes that C is rigid; A may be flexible*) 

352 
val UnionI = prove_goal ZF.thy "[ B: C; A: B ] ==> A: Union(C)" 

353 
(fn prems=> 

485  354 
[ (resolve_tac [Union_iff RS iffD2] 1), 
0  355 
(REPEAT (resolve_tac (prems @ [bexI]) 1)) ]); 
356 

357 
val UnionE = prove_goal ZF.thy 

358 
"[ A : Union(C); !!B.[ A: B; B: C ] ==> R ] ==> R" 

359 
(fn prems=> 

485  360 
[ (resolve_tac [Union_iff RS iffD1 RS bexE] 1), 
0  361 
(REPEAT (ares_tac prems 1)) ]); 
362 

363 
(*** Rules for Inter ***) 

364 

365 
(*Not obviously useful towards proving InterI, InterD, InterE*) 

366 
val Inter_iff = prove_goalw ZF.thy [Inter_def,Ball_def] 

367 
"A : Inter(C) <> (ALL x:C. A: x) & (EX x. x:C)" 

368 
(fn _=> [ (rtac (separation RS iff_trans) 1), 

369 
(fast_tac (FOL_cs addIs [UnionI] addSEs [UnionE]) 1) ]); 

370 

371 
(* Intersection is wellbehaved only if the family is nonempty! *) 

372 
val InterI = prove_goalw ZF.thy [Inter_def] 

373 
"[ !!x. x: C ==> A: x; c:C ] ==> A : Inter(C)" 

374 
(fn prems=> 

375 
[ (DEPTH_SOLVE (ares_tac ([CollectI,UnionI,ballI] @ prems) 1)) ]); 

376 

377 
(*A "destruct" rule  every B in C contains A as an element, but 

378 
A:B can hold when B:C does not! This rule is analogous to "spec". *) 

379 
val InterD = prove_goalw ZF.thy [Inter_def] 

380 
"[ A : Inter(C); B : C ] ==> A : B" 

381 
(fn [major,minor]=> 

382 
[ (rtac (major RS CollectD2 RS bspec) 1), 

383 
(rtac minor 1) ]); 

384 

385 
(*"Classical" elimination rule  does not require exhibiting B:C *) 

386 
val InterE = prove_goalw ZF.thy [Inter_def] 

37  387 
"[ A : Inter(C); A:B ==> R; B~:C ==> R ] ==> R" 
0  388 
(fn major::prems=> 
389 
[ (rtac (major RS CollectD2 RS ballE) 1), 

390 
(REPEAT (eresolve_tac prems 1)) ]); 

391 

392 
(*** Rules for Unions of families ***) 

393 
(* UN x:A. B(x) abbreviates Union({B(x). x:A}) *) 

394 

485  395 
val UN_iff = prove_goalw ZF.thy [Bex_def] 
396 
"b : (UN x:A. B(x)) <> (EX x:A. b : B(x))" 

397 
(fn _=> [ (fast_tac (FOL_cs addIs [UnionI, RepFunI] 

398 
addSEs [UnionE, RepFunE]) 1) ]); 

399 

0  400 
(*The order of the premises presupposes that A is rigid; b may be flexible*) 
401 
val UN_I = prove_goal ZF.thy "[ a: A; b: B(a) ] ==> b: (UN x:A. B(x))" 

402 
(fn prems=> 

403 
[ (REPEAT (resolve_tac (prems@[UnionI,RepFunI]) 1)) ]); 

404 

405 
val UN_E = prove_goal ZF.thy 

406 
"[ b : (UN x:A. B(x)); !!x.[ x: A; b: B(x) ] ==> R ] ==> R" 

407 
(fn major::prems=> 

408 
[ (rtac (major RS UnionE) 1), 

409 
(REPEAT (eresolve_tac (prems@[asm_rl, RepFunE, subst]) 1)) ]); 

410 

435  411 
val UN_cong = prove_goal ZF.thy 
412 
"[ A=B; !!x. x:B ==> C(x)=D(x) ] ==> (UN x:A.C(x)) = (UN x:B.D(x))" 

413 
(fn prems=> [ (simp_tac (FOL_ss addcongs [RepFun_cong] addsimps prems) 1) ]); 

414 

0  415 

416 
(*** Rules for Intersections of families ***) 

417 
(* INT x:A. B(x) abbreviates Inter({B(x). x:A}) *) 

418 

485  419 
val INT_iff = prove_goal ZF.thy 
420 
"b : (INT x:A. B(x)) <> (ALL x:A. b : B(x)) & (EX x. x:A)" 

421 
(fn _=> [ (simp_tac (FOL_ss addsimps [Inter_def, Ball_def, Bex_def, 

422 
separation, Union_iff, RepFun_iff]) 1), 

423 
(fast_tac FOL_cs 1) ]); 

424 

0  425 
val INT_I = prove_goal ZF.thy 
426 
"[ !!x. x: A ==> b: B(x); a: A ] ==> b: (INT x:A. B(x))" 

427 
(fn prems=> 

428 
[ (REPEAT (ares_tac (prems@[InterI,RepFunI]) 1 

429 
ORELSE eresolve_tac [RepFunE,ssubst] 1)) ]); 

430 

431 
val INT_E = prove_goal ZF.thy 

432 
"[ b : (INT x:A. B(x)); a: A ] ==> b : B(a)" 

433 
(fn [major,minor]=> 

434 
[ (rtac (major RS InterD) 1), 

435 
(rtac (minor RS RepFunI) 1) ]); 

436 

435  437 
val INT_cong = prove_goal ZF.thy 
438 
"[ A=B; !!x. x:B ==> C(x)=D(x) ] ==> (INT x:A.C(x)) = (INT x:B.D(x))" 

439 
(fn prems=> [ (simp_tac (FOL_ss addcongs [RepFun_cong] addsimps prems) 1) ]); 

440 

0  441 

442 
(*** Rules for Powersets ***) 

443 

444 
val PowI = prove_goal ZF.thy "A <= B ==> A : Pow(B)" 

485  445 
(fn [prem]=> [ (rtac (prem RS (Pow_iff RS iffD2)) 1) ]); 
0  446 

447 
val PowD = prove_goal ZF.thy "A : Pow(B) ==> A<=B" 

485  448 
(fn [major]=> [ (rtac (major RS (Pow_iff RS iffD1)) 1) ]); 
0  449 

450 

451 
(*** Rules for the empty set ***) 

452 

453 
(*The set {x:0.False} is empty; by foundation it equals 0 

454 
See Suppes, page 21.*) 

455 
val emptyE = prove_goal ZF.thy "a:0 ==> P" 

456 
(fn [major]=> 

457 
[ (rtac (foundation RS disjE) 1), 

458 
(etac (equalityD2 RS subsetD RS CollectD2 RS FalseE) 1), 

459 
(rtac major 1), 

460 
(etac bexE 1), 

461 
(etac (CollectD2 RS FalseE) 1) ]); 

462 

463 
val empty_subsetI = prove_goal ZF.thy "0 <= A" 

464 
(fn _ => [ (REPEAT (ares_tac [equalityI,subsetI,emptyE] 1)) ]); 

465 

466 
val equals0I = prove_goal ZF.thy "[ !!y. y:A ==> False ] ==> A=0" 

467 
(fn prems=> 

468 
[ (REPEAT (ares_tac (prems@[empty_subsetI,subsetI,equalityI]) 1 

469 
ORELSE eresolve_tac (prems RL [FalseE]) 1)) ]); 

470 

471 
val equals0D = prove_goal ZF.thy "[ A=0; a:A ] ==> P" 

472 
(fn [major,minor]=> 

473 
[ (rtac (minor RS (major RS equalityD1 RS subsetD RS emptyE)) 1) ]); 

474 

475 
val lemmas_cs = FOL_cs 

476 
addSIs [ballI, InterI, CollectI, PowI, subsetI] 

477 
addIs [bexI, UnionI, ReplaceI, RepFunI] 

485  478 
addSEs [bexE, make_elim PowD, UnionE, ReplaceE2, RepFunE, 
0  479 
CollectE, emptyE] 
480 
addEs [rev_ballE, InterD, make_elim InterD, subsetD, subsetCE]; 

481 

482 
end; 

483 

484 
open ZF_Lemmas; 