author | nipkow |
Fri, 21 Jul 2000 18:11:54 +0200 | |
changeset 9404 | 99476cf93dad |
parent 9304 | 342cbcb9c0d8 |
child 9907 | 473a6604da94 |
permissions | -rw-r--r-- |
1461 | 1 |
(* Title: ZF/subset |
0 | 2 |
ID: $Id$ |
1461 | 3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
0 | 4 |
Copyright 1991 University of Cambridge |
5 |
||
6 |
Derived rules involving subsets |
|
7 |
Union and Intersection as lattice operations |
|
8 |
*) |
|
9 |
||
10 |
(*** cons ***) |
|
11 |
||
9180 | 12 |
Goal "[| a:C; B<=C |] ==> cons(a,B) <= C"; |
13 |
by (Blast_tac 1); |
|
14 |
qed "cons_subsetI"; |
|
0 | 15 |
|
9180 | 16 |
Goal "B <= cons(a,B)"; |
17 |
by (Blast_tac 1); |
|
18 |
qed "subset_consI"; |
|
0 | 19 |
|
9180 | 20 |
Goal "cons(a,B)<=C <-> a:C & B<=C"; |
21 |
by (Blast_tac 1); |
|
22 |
qed "cons_subset_iff"; |
|
9304 | 23 |
AddIffs [cons_subset_iff]; |
0 | 24 |
|
25 |
(*A safe special case of subset elimination, adding no new variables |
|
26 |
[| cons(a,B) <= C; [| a : C; B <= C |] ==> R |] ==> R *) |
|
2469 | 27 |
bind_thm ("cons_subsetE", cons_subset_iff RS iffD1 RS conjE); |
0 | 28 |
|
9180 | 29 |
Goal "A<=0 <-> A=0"; |
30 |
by (Blast_tac 1) ; |
|
31 |
qed "subset_empty_iff"; |
|
0 | 32 |
|
9180 | 33 |
Goal "C<=cons(a,B) <-> C<=B | (a:C & C-{a} <= B)"; |
34 |
by (Blast_tac 1) ; |
|
35 |
qed "subset_cons_iff"; |
|
0 | 36 |
|
37 |
(*** succ ***) |
|
38 |
||
9180 | 39 |
Goal "i <= succ(i)"; |
40 |
by (Blast_tac 1) ; |
|
41 |
qed "subset_succI"; |
|
0 | 42 |
|
43 |
(*But if j is an ordinal or is transitive, then i:j implies i<=j! |
|
44 |
See ordinal/Ord_succ_subsetI*) |
|
9211 | 45 |
Goalw [succ_def] "[| i:j; i<=j |] ==> succ(i)<=j"; |
46 |
by (Blast_tac 1) ; |
|
47 |
qed "succ_subsetI"; |
|
0 | 48 |
|
9211 | 49 |
val major::prems= Goalw [succ_def] |
0 | 50 |
"[| succ(i) <= j; [| i:j; i<=j |] ==> P \ |
9211 | 51 |
\ |] ==> P"; |
52 |
by (rtac (major RS cons_subsetE) 1); |
|
53 |
by (REPEAT (ares_tac prems 1)) ; |
|
54 |
qed "succ_subsetE"; |
|
0 | 55 |
|
56 |
(*** singletons ***) |
|
57 |
||
9180 | 58 |
Goal "a:C ==> {a} <= C"; |
59 |
by (Blast_tac 1) ; |
|
60 |
qed "singleton_subsetI"; |
|
0 | 61 |
|
9180 | 62 |
Goal "{a} <= C ==> a:C"; |
63 |
by (Blast_tac 1) ; |
|
64 |
qed "singleton_subsetD"; |
|
0 | 65 |
|
66 |
(*** Big Union -- least upper bound of a set ***) |
|
67 |
||
9180 | 68 |
Goal "Union(A) <= C <-> (ALL x:A. x <= C)"; |
69 |
by (Blast_tac 1); |
|
70 |
qed "Union_subset_iff"; |
|
0 | 71 |
|
9180 | 72 |
Goal "B:A ==> B <= Union(A)"; |
73 |
by (Blast_tac 1); |
|
74 |
qed "Union_upper"; |
|
0 | 75 |
|
9180 | 76 |
val [prem]= Goal |
77 |
"[| !!x. x:A ==> x<=C |] ==> Union(A) <= C"; |
|
78 |
by (rtac (ballI RS (Union_subset_iff RS iffD2)) 1); |
|
79 |
by (etac prem 1) ; |
|
80 |
qed "Union_least"; |
|
0 | 81 |
|
82 |
(*** Union of a family of sets ***) |
|
83 |
||
5325
f7a5e06adea1
Yet more removal of "goal" commands, especially "goal ZF.thy", so ZF.thy
paulson
parents:
4091
diff
changeset
|
84 |
Goal "A <= (UN i:I. B(i)) <-> A = (UN i:I. A Int B(i))"; |
4091 | 85 |
by (blast_tac (claset() addSEs [equalityE]) 1); |
760 | 86 |
qed "subset_UN_iff_eq"; |
0 | 87 |
|
9180 | 88 |
Goal "(UN x:A. B(x)) <= C <-> (ALL x:A. B(x) <= C)"; |
89 |
by (Blast_tac 1); |
|
90 |
qed "UN_subset_iff"; |
|
0 | 91 |
|
9180 | 92 |
Goal "x:A ==> B(x) <= (UN x:A. B(x))"; |
93 |
by (etac (RepFunI RS Union_upper) 1); |
|
94 |
qed "UN_upper"; |
|
0 | 95 |
|
9180 | 96 |
val [prem]= Goal |
97 |
"[| !!x. x:A ==> B(x)<=C |] ==> (UN x:A. B(x)) <= C"; |
|
98 |
by (rtac (ballI RS (UN_subset_iff RS iffD2)) 1); |
|
99 |
by (etac prem 1) ; |
|
100 |
qed "UN_least"; |
|
0 | 101 |
|
102 |
||
103 |
(*** Big Intersection -- greatest lower bound of a nonempty set ***) |
|
104 |
||
9180 | 105 |
Goal "a: A ==> C <= Inter(A) <-> (ALL x:A. C <= x)"; |
106 |
by (Blast_tac 1); |
|
107 |
qed "Inter_subset_iff"; |
|
0 | 108 |
|
9180 | 109 |
Goal "B:A ==> Inter(A) <= B"; |
110 |
by (Blast_tac 1); |
|
111 |
qed "Inter_lower"; |
|
0 | 112 |
|
9180 | 113 |
val [prem1,prem2]= Goal |
114 |
"[| a:A; !!x. x:A ==> C<=x |] ==> C <= Inter(A)"; |
|
115 |
by (rtac ([prem1, ballI] MRS (Inter_subset_iff RS iffD2)) 1); |
|
116 |
by (etac prem2 1) ; |
|
117 |
qed "Inter_greatest"; |
|
0 | 118 |
|
119 |
(*** Intersection of a family of sets ***) |
|
120 |
||
9180 | 121 |
Goal "x:A ==> (INT x:A. B(x)) <= B(x)"; |
122 |
by (Blast_tac 1); |
|
123 |
qed "INT_lower"; |
|
0 | 124 |
|
9180 | 125 |
val [nonempty,prem] = Goal |
126 |
"[| a:A; !!x. x:A ==> C<=B(x) |] ==> C <= (INT x:A. B(x))"; |
|
127 |
by (rtac (nonempty RS RepFunI RS Inter_greatest) 1); |
|
128 |
by (REPEAT (eresolve_tac [RepFunE, prem, ssubst] 1)); |
|
129 |
qed "INT_greatest"; |
|
0 | 130 |
|
131 |
||
132 |
(*** Finite Union -- the least upper bound of 2 sets ***) |
|
133 |
||
9180 | 134 |
Goal "A Un B <= C <-> A <= C & B <= C"; |
135 |
by (Blast_tac 1); |
|
136 |
qed "Un_subset_iff"; |
|
0 | 137 |
|
9180 | 138 |
Goal "A <= A Un B"; |
139 |
by (Blast_tac 1); |
|
140 |
qed "Un_upper1"; |
|
0 | 141 |
|
9180 | 142 |
Goal "B <= A Un B"; |
143 |
by (Blast_tac 1); |
|
144 |
qed "Un_upper2"; |
|
0 | 145 |
|
9180 | 146 |
Goal "[| A<=C; B<=C |] ==> A Un B <= C"; |
147 |
by (Blast_tac 1); |
|
148 |
qed "Un_least"; |
|
2469 | 149 |
|
0 | 150 |
|
151 |
(*** Finite Intersection -- the greatest lower bound of 2 sets *) |
|
152 |
||
9180 | 153 |
Goal "C <= A Int B <-> C <= A & C <= B"; |
154 |
by (Blast_tac 1); |
|
155 |
qed "Int_subset_iff"; |
|
0 | 156 |
|
9180 | 157 |
Goal "A Int B <= A"; |
158 |
by (Blast_tac 1); |
|
159 |
qed "Int_lower1"; |
|
0 | 160 |
|
9180 | 161 |
Goal "A Int B <= B"; |
162 |
by (Blast_tac 1); |
|
163 |
qed "Int_lower2"; |
|
0 | 164 |
|
9180 | 165 |
Goal "[| C<=A; C<=B |] ==> C <= A Int B"; |
166 |
by (Blast_tac 1); |
|
167 |
qed "Int_greatest"; |
|
2469 | 168 |
|
0 | 169 |
|
170 |
(*** Set difference *) |
|
171 |
||
9180 | 172 |
Goal "A-B <= A"; |
173 |
by (Blast_tac 1); |
|
174 |
qed "Diff_subset"; |
|
0 | 175 |
|
9180 | 176 |
Goal "[| C<=A; C Int B = 0 |] ==> C <= A-B"; |
177 |
by (Blast_tac 1); |
|
178 |
qed "Diff_contains"; |
|
5325
f7a5e06adea1
Yet more removal of "goal" commands, especially "goal ZF.thy", so ZF.thy
paulson
parents:
4091
diff
changeset
|
179 |
|
f7a5e06adea1
Yet more removal of "goal" commands, especially "goal ZF.thy", so ZF.thy
paulson
parents:
4091
diff
changeset
|
180 |
Goal "B <= A - cons(c,C) <-> B<=A-C & c ~: B"; |
f7a5e06adea1
Yet more removal of "goal" commands, especially "goal ZF.thy", so ZF.thy
paulson
parents:
4091
diff
changeset
|
181 |
by (Blast_tac 1); |
f7a5e06adea1
Yet more removal of "goal" commands, especially "goal ZF.thy", so ZF.thy
paulson
parents:
4091
diff
changeset
|
182 |
qed "subset_Diff_cons_iff"; |
f7a5e06adea1
Yet more removal of "goal" commands, especially "goal ZF.thy", so ZF.thy
paulson
parents:
4091
diff
changeset
|
183 |
|
2469 | 184 |
|
0 | 185 |
|
186 |
(** Collect **) |
|
187 |
||
9180 | 188 |
Goal "Collect(A,P) <= A"; |
189 |
by (Blast_tac 1); |
|
190 |
qed "Collect_subset"; |
|
2469 | 191 |
|
0 | 192 |
|
193 |
(** RepFun **) |
|
194 |
||
5325
f7a5e06adea1
Yet more removal of "goal" commands, especially "goal ZF.thy", so ZF.thy
paulson
parents:
4091
diff
changeset
|
195 |
val prems = Goal "[| !!x. x:A ==> f(x): B |] ==> {f(x). x:A} <= B"; |
4091 | 196 |
by (blast_tac (claset() addIs prems) 1); |
760 | 197 |
qed "RepFun_subset"; |
689 | 198 |
|
2469 | 199 |
val subset_SIs = |
200 |
[subset_refl, cons_subsetI, subset_consI, |
|
201 |
Union_least, UN_least, Un_least, |
|
202 |
Inter_greatest, Int_greatest, RepFun_subset, |
|
203 |
Un_upper1, Un_upper2, Int_lower1, Int_lower2]; |
|
204 |
||
689 | 205 |
|
2469 | 206 |
(*A claset for subset reasoning*) |
4091 | 207 |
val subset_cs = claset() |
2469 | 208 |
delrules [subsetI, subsetCE] |
209 |
addSIs subset_SIs |
|
210 |
addIs [Union_upper, Inter_lower] |
|
211 |
addSEs [cons_subsetE]; |
|
212 |