author | paulson |
Tue, 08 Sep 1998 15:17:11 +0200 | |
changeset 5434 | 9b4bed3f394c |
parent 5331 | 3d27b96a08b0 |
child 5490 | 85855f65d0c6 |
permissions | -rw-r--r-- |
1465 | 1 |
(* Title: HOL/equalities |
923 | 2 |
ID: $Id$ |
1465 | 3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
923 | 4 |
Copyright 1994 University of Cambridge |
5 |
||
6 |
Equalities involving union, intersection, inclusion, etc. |
|
7 |
*) |
|
8 |
||
9 |
writeln"File HOL/equalities"; |
|
10 |
||
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
11 |
AddSIs [equalityI]; |
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
12 |
|
1548 | 13 |
section "{}"; |
14 |
||
5069 | 15 |
Goal "{x. False} = {}"; |
2891 | 16 |
by (Blast_tac 1); |
1531 | 17 |
qed "Collect_False_empty"; |
18 |
Addsimps [Collect_False_empty]; |
|
19 |
||
5069 | 20 |
Goal "(A <= {}) = (A = {})"; |
2891 | 21 |
by (Blast_tac 1); |
1531 | 22 |
qed "subset_empty"; |
23 |
Addsimps [subset_empty]; |
|
24 |
||
5069 | 25 |
Goalw [psubset_def] "~ (A < {})"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
26 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
27 |
qed "not_psubset_empty"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
28 |
AddIffs [not_psubset_empty]; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
29 |
|
5069 | 30 |
Goal "{x. P x | Q x} = {x. P x} Un {x. Q x}"; |
4748 | 31 |
by (Blast_tac 1); |
32 |
qed "Collect_disj_eq"; |
|
33 |
||
5069 | 34 |
Goal "{x. P x & Q x} = {x. P x} Int {x. Q x}"; |
4748 | 35 |
by (Blast_tac 1); |
36 |
qed "Collect_conj_eq"; |
|
37 |
||
38 |
||
1548 | 39 |
section "insert"; |
923 | 40 |
|
1531 | 41 |
(*NOT SUITABLE FOR REWRITING since {a} == insert a {}*) |
5069 | 42 |
Goal "insert a A = {a} Un A"; |
2891 | 43 |
by (Blast_tac 1); |
1531 | 44 |
qed "insert_is_Un"; |
45 |
||
5069 | 46 |
Goal "insert a A ~= {}"; |
4089 | 47 |
by (blast_tac (claset() addEs [equalityCE]) 1); |
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
48 |
qed"insert_not_empty"; |
1531 | 49 |
Addsimps[insert_not_empty]; |
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
50 |
|
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
51 |
bind_thm("empty_not_insert",insert_not_empty RS not_sym); |
1531 | 52 |
Addsimps[empty_not_insert]; |
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
53 |
|
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
54 |
Goal "a:A ==> insert a A = A"; |
2891 | 55 |
by (Blast_tac 1); |
923 | 56 |
qed "insert_absorb"; |
4605 | 57 |
(* Addsimps [insert_absorb] causes recursive (ie quadtratic) calls |
58 |
in case of nested inserts! |
|
59 |
*) |
|
923 | 60 |
|
5069 | 61 |
Goal "insert x (insert x A) = insert x A"; |
2891 | 62 |
by (Blast_tac 1); |
1531 | 63 |
qed "insert_absorb2"; |
64 |
Addsimps [insert_absorb2]; |
|
65 |
||
5069 | 66 |
Goal "insert x (insert y A) = insert y (insert x A)"; |
2891 | 67 |
by (Blast_tac 1); |
1879 | 68 |
qed "insert_commute"; |
69 |
||
5069 | 70 |
Goal "(insert x A <= B) = (x:B & A <= B)"; |
2891 | 71 |
by (Blast_tac 1); |
923 | 72 |
qed "insert_subset"; |
1531 | 73 |
Addsimps[insert_subset]; |
74 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
75 |
Goal "insert a A ~= insert a B ==> A ~= B"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
76 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
77 |
qed "insert_lim"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
78 |
|
1531 | 79 |
(* use new B rather than (A-{a}) to avoid infinite unfolding *) |
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
80 |
Goal "a:A ==> ? B. A = insert a B & a ~: B"; |
1553 | 81 |
by (res_inst_tac [("x","A-{a}")] exI 1); |
2891 | 82 |
by (Blast_tac 1); |
1531 | 83 |
qed "mk_disjoint_insert"; |
923 | 84 |
|
4882 | 85 |
bind_thm ("insert_Collect", prove_goal thy |
86 |
"insert a (Collect P) = {u. u ~= a --> P u}" (K [Auto_tac])); |
|
87 |
||
5278 | 88 |
Goal "A~={} ==> (UN x:A. insert a (B x)) = insert a (UN x:A. B x)"; |
2891 | 89 |
by (Blast_tac 1); |
1843
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
90 |
qed "UN_insert_distrib"; |
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
91 |
|
1660 | 92 |
section "``"; |
923 | 93 |
|
5069 | 94 |
Goal "f``{} = {}"; |
2891 | 95 |
by (Blast_tac 1); |
923 | 96 |
qed "image_empty"; |
1531 | 97 |
Addsimps[image_empty]; |
923 | 98 |
|
5069 | 99 |
Goal "f``insert a B = insert (f a) (f``B)"; |
2891 | 100 |
by (Blast_tac 1); |
923 | 101 |
qed "image_insert"; |
1531 | 102 |
Addsimps[image_insert]; |
923 | 103 |
|
5069 | 104 |
Goal "(f `` (UNION A B)) = (UN x:A.(f `` (B x)))"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
105 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
106 |
qed "image_UNION"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
107 |
|
5069 | 108 |
Goal "(%x. x) `` Y = Y"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
109 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
110 |
qed "image_id"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
111 |
|
5069 | 112 |
Goal "f``(g``A) = (%x. f (g x)) `` A"; |
3457 | 113 |
by (Blast_tac 1); |
4059 | 114 |
qed "image_image"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
115 |
|
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
116 |
Goal "x:A ==> insert (f x) (f``A) = f``A"; |
2891 | 117 |
by (Blast_tac 1); |
1884 | 118 |
qed "insert_image"; |
119 |
Addsimps [insert_image]; |
|
120 |
||
5069 | 121 |
Goal "(f``A = {}) = (A = {})"; |
4306
ddbe1a9722ab
Tidying and using equalityCE instead of the slower equalityE
paulson
parents:
4231
diff
changeset
|
122 |
by (blast_tac (claset() addSEs [equalityCE]) 1); |
3415
c068bd2f0bbd
Moved image_is_empty from Finite.ML to equalities.ML
nipkow
parents:
3384
diff
changeset
|
123 |
qed "image_is_empty"; |
c068bd2f0bbd
Moved image_is_empty from Finite.ML to equalities.ML
nipkow
parents:
3384
diff
changeset
|
124 |
AddIffs [image_is_empty]; |
c068bd2f0bbd
Moved image_is_empty from Finite.ML to equalities.ML
nipkow
parents:
3384
diff
changeset
|
125 |
|
5281 | 126 |
Goal "f `` {x. P x} = {f x | x. P x}"; |
5319
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5316
diff
changeset
|
127 |
by (Blast_tac 1); |
5281 | 128 |
qed "image_Collect"; |
129 |
Addsimps [image_Collect]; |
|
130 |
||
5069 | 131 |
Goalw [image_def] |
1763 | 132 |
"(%x. if P x then f x else g x) `` S \ |
4200 | 133 |
\ = (f `` (S Int {x. P x})) Un (g `` (S Int {x. ~(P x)}))"; |
4686 | 134 |
by (Simp_tac 1); |
2891 | 135 |
by (Blast_tac 1); |
1748 | 136 |
qed "if_image_distrib"; |
137 |
Addsimps[if_image_distrib]; |
|
138 |
||
5316 | 139 |
val prems= Goal "[|M = N; !!x. x:N ==> f x = g x|] ==> f``M = g``N"; |
4136 | 140 |
by (rtac set_ext 1); |
141 |
by (simp_tac (simpset() addsimps image_def::prems) 1); |
|
142 |
qed "image_cong"; |
|
143 |
||
1748 | 144 |
|
1548 | 145 |
section "Int"; |
923 | 146 |
|
5069 | 147 |
Goal "A Int A = A"; |
2891 | 148 |
by (Blast_tac 1); |
923 | 149 |
qed "Int_absorb"; |
1531 | 150 |
Addsimps[Int_absorb]; |
923 | 151 |
|
5069 | 152 |
Goal " A Int (A Int B) = A Int B"; |
4609 | 153 |
by (Blast_tac 1); |
154 |
qed "Int_left_absorb"; |
|
155 |
||
5069 | 156 |
Goal "A Int B = B Int A"; |
2891 | 157 |
by (Blast_tac 1); |
923 | 158 |
qed "Int_commute"; |
159 |
||
5069 | 160 |
Goal "A Int (B Int C) = B Int (A Int C)"; |
4609 | 161 |
by (Blast_tac 1); |
162 |
qed "Int_left_commute"; |
|
163 |
||
5069 | 164 |
Goal "(A Int B) Int C = A Int (B Int C)"; |
2891 | 165 |
by (Blast_tac 1); |
923 | 166 |
qed "Int_assoc"; |
167 |
||
4609 | 168 |
(*Intersection is an AC-operator*) |
169 |
val Int_ac = [Int_assoc, Int_left_absorb, Int_commute, Int_left_commute]; |
|
170 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
171 |
Goal "B<=A ==> A Int B = B"; |
4662 | 172 |
by (Blast_tac 1); |
173 |
qed "Int_absorb1"; |
|
174 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
175 |
Goal "A<=B ==> A Int B = A"; |
4662 | 176 |
by (Blast_tac 1); |
177 |
qed "Int_absorb2"; |
|
178 |
||
5069 | 179 |
Goal "{} Int B = {}"; |
2891 | 180 |
by (Blast_tac 1); |
923 | 181 |
qed "Int_empty_left"; |
1531 | 182 |
Addsimps[Int_empty_left]; |
923 | 183 |
|
5069 | 184 |
Goal "A Int {} = {}"; |
2891 | 185 |
by (Blast_tac 1); |
923 | 186 |
qed "Int_empty_right"; |
1531 | 187 |
Addsimps[Int_empty_right]; |
188 |
||
5069 | 189 |
Goal "(A Int B = {}) = (A <= Compl B)"; |
4306
ddbe1a9722ab
Tidying and using equalityCE instead of the slower equalityE
paulson
parents:
4231
diff
changeset
|
190 |
by (blast_tac (claset() addSEs [equalityCE]) 1); |
3356 | 191 |
qed "disjoint_eq_subset_Compl"; |
192 |
||
5069 | 193 |
Goal "UNIV Int B = B"; |
2891 | 194 |
by (Blast_tac 1); |
1531 | 195 |
qed "Int_UNIV_left"; |
196 |
Addsimps[Int_UNIV_left]; |
|
197 |
||
5069 | 198 |
Goal "A Int UNIV = A"; |
2891 | 199 |
by (Blast_tac 1); |
1531 | 200 |
qed "Int_UNIV_right"; |
201 |
Addsimps[Int_UNIV_right]; |
|
923 | 202 |
|
5069 | 203 |
Goal "A Int B = Inter{A,B}"; |
4634 | 204 |
by (Blast_tac 1); |
205 |
qed "Int_eq_Inter"; |
|
206 |
||
5069 | 207 |
Goal "A Int (B Un C) = (A Int B) Un (A Int C)"; |
2891 | 208 |
by (Blast_tac 1); |
923 | 209 |
qed "Int_Un_distrib"; |
210 |
||
5069 | 211 |
Goal "(B Un C) Int A = (B Int A) Un (C Int A)"; |
2891 | 212 |
by (Blast_tac 1); |
1618 | 213 |
qed "Int_Un_distrib2"; |
214 |
||
5069 | 215 |
Goal "(A Int B = UNIV) = (A = UNIV & B = UNIV)"; |
4089 | 216 |
by (blast_tac (claset() addEs [equalityCE]) 1); |
1531 | 217 |
qed "Int_UNIV"; |
218 |
Addsimps[Int_UNIV]; |
|
219 |
||
5319
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5316
diff
changeset
|
220 |
Goal "(C <= A Int B) = (C <= A & C <= B)"; |
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5316
diff
changeset
|
221 |
by (Blast_tac 1); |
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5316
diff
changeset
|
222 |
qed "Int_subset_iff"; |
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5316
diff
changeset
|
223 |
|
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5316
diff
changeset
|
224 |
|
1548 | 225 |
section "Un"; |
923 | 226 |
|
5069 | 227 |
Goal "A Un A = A"; |
2891 | 228 |
by (Blast_tac 1); |
923 | 229 |
qed "Un_absorb"; |
1531 | 230 |
Addsimps[Un_absorb]; |
923 | 231 |
|
5069 | 232 |
Goal " A Un (A Un B) = A Un B"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
233 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
234 |
qed "Un_left_absorb"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
235 |
|
5069 | 236 |
Goal "A Un B = B Un A"; |
2891 | 237 |
by (Blast_tac 1); |
923 | 238 |
qed "Un_commute"; |
239 |
||
5069 | 240 |
Goal "A Un (B Un C) = B Un (A Un C)"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
241 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
242 |
qed "Un_left_commute"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
243 |
|
5069 | 244 |
Goal "(A Un B) Un C = A Un (B Un C)"; |
2891 | 245 |
by (Blast_tac 1); |
923 | 246 |
qed "Un_assoc"; |
247 |
||
4609 | 248 |
(*Union is an AC-operator*) |
249 |
val Un_ac = [Un_assoc, Un_left_absorb, Un_commute, Un_left_commute]; |
|
250 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
251 |
Goal "A<=B ==> A Un B = B"; |
4662 | 252 |
by (Blast_tac 1); |
253 |
qed "Un_absorb1"; |
|
254 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
255 |
Goal "B<=A ==> A Un B = A"; |
4662 | 256 |
by (Blast_tac 1); |
257 |
qed "Un_absorb2"; |
|
258 |
||
5069 | 259 |
Goal "{} Un B = B"; |
2891 | 260 |
by (Blast_tac 1); |
923 | 261 |
qed "Un_empty_left"; |
1531 | 262 |
Addsimps[Un_empty_left]; |
923 | 263 |
|
5069 | 264 |
Goal "A Un {} = A"; |
2891 | 265 |
by (Blast_tac 1); |
923 | 266 |
qed "Un_empty_right"; |
1531 | 267 |
Addsimps[Un_empty_right]; |
268 |
||
5069 | 269 |
Goal "UNIV Un B = UNIV"; |
2891 | 270 |
by (Blast_tac 1); |
1531 | 271 |
qed "Un_UNIV_left"; |
272 |
Addsimps[Un_UNIV_left]; |
|
273 |
||
5069 | 274 |
Goal "A Un UNIV = UNIV"; |
2891 | 275 |
by (Blast_tac 1); |
1531 | 276 |
qed "Un_UNIV_right"; |
277 |
Addsimps[Un_UNIV_right]; |
|
923 | 278 |
|
5069 | 279 |
Goal "A Un B = Union{A,B}"; |
4634 | 280 |
by (Blast_tac 1); |
281 |
qed "Un_eq_Union"; |
|
282 |
||
5069 | 283 |
Goal "(insert a B) Un C = insert a (B Un C)"; |
2891 | 284 |
by (Blast_tac 1); |
923 | 285 |
qed "Un_insert_left"; |
3384
5ef99c94e1fb
Now Un_insert_left, Un_insert_right are default rewrite rules
paulson
parents:
3356
diff
changeset
|
286 |
Addsimps[Un_insert_left]; |
923 | 287 |
|
5069 | 288 |
Goal "A Un (insert a B) = insert a (A Un B)"; |
2891 | 289 |
by (Blast_tac 1); |
1917 | 290 |
qed "Un_insert_right"; |
3384
5ef99c94e1fb
Now Un_insert_left, Un_insert_right are default rewrite rules
paulson
parents:
3356
diff
changeset
|
291 |
Addsimps[Un_insert_right]; |
1917 | 292 |
|
5069 | 293 |
Goal "(insert a B) Int C = (if a:C then insert a (B Int C) \ |
4306
ddbe1a9722ab
Tidying and using equalityCE instead of the slower equalityE
paulson
parents:
4231
diff
changeset
|
294 |
\ else B Int C)"; |
4686 | 295 |
by (Simp_tac 1); |
3356 | 296 |
by (Blast_tac 1); |
297 |
qed "Int_insert_left"; |
|
298 |
||
5069 | 299 |
Goal "A Int (insert a B) = (if a:A then insert a (A Int B) \ |
4306
ddbe1a9722ab
Tidying and using equalityCE instead of the slower equalityE
paulson
parents:
4231
diff
changeset
|
300 |
\ else A Int B)"; |
4686 | 301 |
by (Simp_tac 1); |
3356 | 302 |
by (Blast_tac 1); |
303 |
qed "Int_insert_right"; |
|
304 |
||
5069 | 305 |
Goal "A Un (B Int C) = (A Un B) Int (A Un C)"; |
2891 | 306 |
by (Blast_tac 1); |
923 | 307 |
qed "Un_Int_distrib"; |
308 |
||
5069 | 309 |
Goal "(B Int C) Un A = (B Un A) Int (C Un A)"; |
4609 | 310 |
by (Blast_tac 1); |
311 |
qed "Un_Int_distrib2"; |
|
312 |
||
5278 | 313 |
Goal "(A Int B) Un (B Int C) Un (C Int A) = (A Un B) Int (B Un C) Int (C Un A)"; |
2891 | 314 |
by (Blast_tac 1); |
923 | 315 |
qed "Un_Int_crazy"; |
316 |
||
5069 | 317 |
Goal "(A<=B) = (A Un B = B)"; |
4306
ddbe1a9722ab
Tidying and using equalityCE instead of the slower equalityE
paulson
parents:
4231
diff
changeset
|
318 |
by (blast_tac (claset() addSEs [equalityCE]) 1); |
923 | 319 |
qed "subset_Un_eq"; |
320 |
||
5069 | 321 |
Goal "(A <= insert b C) = (A <= C | b:A & A-{b} <= C)"; |
2891 | 322 |
by (Blast_tac 1); |
923 | 323 |
qed "subset_insert_iff"; |
324 |
||
5069 | 325 |
Goal "(A Un B = {}) = (A = {} & B = {})"; |
4089 | 326 |
by (blast_tac (claset() addEs [equalityCE]) 1); |
923 | 327 |
qed "Un_empty"; |
1531 | 328 |
Addsimps[Un_empty]; |
923 | 329 |
|
5319
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5316
diff
changeset
|
330 |
Goal "(A Un B <= C) = (A <= C & B <= C)"; |
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5316
diff
changeset
|
331 |
by (Blast_tac 1); |
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5316
diff
changeset
|
332 |
qed "Un_subset_iff"; |
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5316
diff
changeset
|
333 |
|
5331 | 334 |
Goal "(A - B) Un (A Int B) = A"; |
335 |
by (Blast_tac 1); |
|
336 |
qed "Un_Diff_Int"; |
|
337 |
||
5319
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5316
diff
changeset
|
338 |
|
1548 | 339 |
section "Compl"; |
923 | 340 |
|
5069 | 341 |
Goal "A Int Compl(A) = {}"; |
2891 | 342 |
by (Blast_tac 1); |
923 | 343 |
qed "Compl_disjoint"; |
1531 | 344 |
Addsimps[Compl_disjoint]; |
923 | 345 |
|
5069 | 346 |
Goal "A Un Compl(A) = UNIV"; |
2891 | 347 |
by (Blast_tac 1); |
923 | 348 |
qed "Compl_partition"; |
349 |
||
5069 | 350 |
Goal "Compl(Compl(A)) = A"; |
2891 | 351 |
by (Blast_tac 1); |
923 | 352 |
qed "double_complement"; |
1531 | 353 |
Addsimps[double_complement]; |
923 | 354 |
|
5069 | 355 |
Goal "Compl(A Un B) = Compl(A) Int Compl(B)"; |
2891 | 356 |
by (Blast_tac 1); |
923 | 357 |
qed "Compl_Un"; |
358 |
||
5069 | 359 |
Goal "Compl(A Int B) = Compl(A) Un Compl(B)"; |
2891 | 360 |
by (Blast_tac 1); |
923 | 361 |
qed "Compl_Int"; |
362 |
||
5069 | 363 |
Goal "Compl(UN x:A. B(x)) = (INT x:A. Compl(B(x)))"; |
2891 | 364 |
by (Blast_tac 1); |
923 | 365 |
qed "Compl_UN"; |
366 |
||
5069 | 367 |
Goal "Compl(INT x:A. B(x)) = (UN x:A. Compl(B(x)))"; |
2891 | 368 |
by (Blast_tac 1); |
923 | 369 |
qed "Compl_INT"; |
370 |
||
4615 | 371 |
Addsimps [Compl_Un, Compl_Int, Compl_UN, Compl_INT]; |
372 |
||
923 | 373 |
(*Halmos, Naive Set Theory, page 16.*) |
374 |
||
5069 | 375 |
Goal "((A Int B) Un C = A Int (B Un C)) = (C<=A)"; |
4306
ddbe1a9722ab
Tidying and using equalityCE instead of the slower equalityE
paulson
parents:
4231
diff
changeset
|
376 |
by (blast_tac (claset() addSEs [equalityCE]) 1); |
923 | 377 |
qed "Un_Int_assoc_eq"; |
378 |
||
379 |
||
1548 | 380 |
section "Union"; |
923 | 381 |
|
5069 | 382 |
Goal "Union({}) = {}"; |
2891 | 383 |
by (Blast_tac 1); |
923 | 384 |
qed "Union_empty"; |
1531 | 385 |
Addsimps[Union_empty]; |
386 |
||
5069 | 387 |
Goal "Union(UNIV) = UNIV"; |
2891 | 388 |
by (Blast_tac 1); |
1531 | 389 |
qed "Union_UNIV"; |
390 |
Addsimps[Union_UNIV]; |
|
923 | 391 |
|
5069 | 392 |
Goal "Union(insert a B) = a Un Union(B)"; |
2891 | 393 |
by (Blast_tac 1); |
923 | 394 |
qed "Union_insert"; |
1531 | 395 |
Addsimps[Union_insert]; |
923 | 396 |
|
5069 | 397 |
Goal "Union(A Un B) = Union(A) Un Union(B)"; |
2891 | 398 |
by (Blast_tac 1); |
923 | 399 |
qed "Union_Un_distrib"; |
1531 | 400 |
Addsimps[Union_Un_distrib]; |
923 | 401 |
|
5069 | 402 |
Goal "Union(A Int B) <= Union(A) Int Union(B)"; |
2891 | 403 |
by (Blast_tac 1); |
923 | 404 |
qed "Union_Int_subset"; |
405 |
||
5069 | 406 |
Goal "(Union M = {}) = (! A : M. A = {})"; |
4306
ddbe1a9722ab
Tidying and using equalityCE instead of the slower equalityE
paulson
parents:
4231
diff
changeset
|
407 |
by (blast_tac (claset() addEs [equalityCE]) 1); |
ddbe1a9722ab
Tidying and using equalityCE instead of the slower equalityE
paulson
parents:
4231
diff
changeset
|
408 |
qed "Union_empty_conv"; |
4003 | 409 |
AddIffs [Union_empty_conv]; |
410 |
||
5069 | 411 |
Goal "(Union(C) Int A = {}) = (! B:C. B Int A = {})"; |
4306
ddbe1a9722ab
Tidying and using equalityCE instead of the slower equalityE
paulson
parents:
4231
diff
changeset
|
412 |
by (blast_tac (claset() addSEs [equalityCE]) 1); |
923 | 413 |
qed "Union_disjoint"; |
414 |
||
1548 | 415 |
section "Inter"; |
416 |
||
5069 | 417 |
Goal "Inter({}) = UNIV"; |
2891 | 418 |
by (Blast_tac 1); |
1531 | 419 |
qed "Inter_empty"; |
420 |
Addsimps[Inter_empty]; |
|
421 |
||
5069 | 422 |
Goal "Inter(UNIV) = {}"; |
2891 | 423 |
by (Blast_tac 1); |
1531 | 424 |
qed "Inter_UNIV"; |
425 |
Addsimps[Inter_UNIV]; |
|
426 |
||
5069 | 427 |
Goal "Inter(insert a B) = a Int Inter(B)"; |
2891 | 428 |
by (Blast_tac 1); |
1531 | 429 |
qed "Inter_insert"; |
430 |
Addsimps[Inter_insert]; |
|
431 |
||
5069 | 432 |
Goal "Inter(A) Un Inter(B) <= Inter(A Int B)"; |
2891 | 433 |
by (Blast_tac 1); |
1564
822575c737bd
Deleted faulty comment; proved new rule Inter_Un_subset
paulson
parents:
1553
diff
changeset
|
434 |
qed "Inter_Un_subset"; |
1531 | 435 |
|
5069 | 436 |
Goal "Inter(A Un B) = Inter(A) Int Inter(B)"; |
2891 | 437 |
by (Blast_tac 1); |
923 | 438 |
qed "Inter_Un_distrib"; |
439 |
||
1548 | 440 |
section "UN and INT"; |
923 | 441 |
|
442 |
(*Basic identities*) |
|
443 |
||
4200 | 444 |
val not_empty = prove_goal Set.thy "(A ~= {}) = (? x. x:A)" (K [Blast_tac 1]); |
4136 | 445 |
(*Addsimps[not_empty];*) |
446 |
||
5069 | 447 |
Goal "(UN x:{}. B x) = {}"; |
2891 | 448 |
by (Blast_tac 1); |
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
449 |
qed "UN_empty"; |
1531 | 450 |
Addsimps[UN_empty]; |
451 |
||
5069 | 452 |
Goal "(UN x:A. {}) = {}"; |
3457 | 453 |
by (Blast_tac 1); |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
454 |
qed "UN_empty2"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
455 |
Addsimps[UN_empty2]; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
456 |
|
5069 | 457 |
Goal "(UN x:A. {x}) = A"; |
4645 | 458 |
by (Blast_tac 1); |
459 |
qed "UN_singleton"; |
|
460 |
Addsimps [UN_singleton]; |
|
461 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
462 |
Goal "k:I ==> A k Un (UN i:I. A i) = (UN i:I. A i)"; |
4634 | 463 |
by (Blast_tac 1); |
464 |
qed "UN_absorb"; |
|
465 |
||
5069 | 466 |
Goal "(INT x:{}. B x) = UNIV"; |
2891 | 467 |
by (Blast_tac 1); |
1531 | 468 |
qed "INT_empty"; |
469 |
Addsimps[INT_empty]; |
|
470 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
471 |
Goal "k:I ==> A k Int (INT i:I. A i) = (INT i:I. A i)"; |
4634 | 472 |
by (Blast_tac 1); |
473 |
qed "INT_absorb"; |
|
474 |
||
5069 | 475 |
Goal "(UN x:insert a A. B x) = B a Un UNION A B"; |
2891 | 476 |
by (Blast_tac 1); |
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
477 |
qed "UN_insert"; |
1531 | 478 |
Addsimps[UN_insert]; |
479 |
||
5069 | 480 |
Goal "(UN i: A Un B. M i) = ((UN i: A. M i) Un (UN i:B. M i))"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
481 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
482 |
qed "UN_Un"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
483 |
|
5069 | 484 |
Goal "(UN x : (UN y:A. B y). C x) = (UN y:A. UN x: B y. C x)"; |
4771 | 485 |
by (Blast_tac 1); |
486 |
qed "UN_UN_flatten"; |
|
487 |
||
5069 | 488 |
Goal "(INT x:insert a A. B x) = B a Int INTER A B"; |
2891 | 489 |
by (Blast_tac 1); |
1531 | 490 |
qed "INT_insert"; |
491 |
Addsimps[INT_insert]; |
|
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
492 |
|
5148
74919e8f221c
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5143
diff
changeset
|
493 |
Goal "A~={} ==> (INT x:A. insert a (B x)) = insert a (INT x:A. B x)"; |
2891 | 494 |
by (Blast_tac 1); |
2021 | 495 |
qed "INT_insert_distrib"; |
496 |
||
5069 | 497 |
Goal "Union(B``A) = (UN x:A. B(x))"; |
2891 | 498 |
by (Blast_tac 1); |
923 | 499 |
qed "Union_image_eq"; |
500 |
||
5069 | 501 |
Goal "Inter(B``A) = (INT x:A. B(x))"; |
2891 | 502 |
by (Blast_tac 1); |
923 | 503 |
qed "Inter_image_eq"; |
504 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
505 |
Goal "A~={} ==> (UN y:A. c) = c"; |
2891 | 506 |
by (Blast_tac 1); |
923 | 507 |
qed "UN_constant"; |
4159
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
508 |
Addsimps[UN_constant]; |
923 | 509 |
|
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
510 |
Goal "A~={} ==> (INT y:A. c) = c"; |
2891 | 511 |
by (Blast_tac 1); |
923 | 512 |
qed "INT_constant"; |
4159
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
513 |
Addsimps[INT_constant]; |
923 | 514 |
|
5069 | 515 |
Goal "(UN x:A. B(x)) = Union({Y. ? x:A. Y=B(x)})"; |
2891 | 516 |
by (Blast_tac 1); |
923 | 517 |
qed "UN_eq"; |
518 |
||
519 |
(*Look: it has an EXISTENTIAL quantifier*) |
|
5069 | 520 |
Goal "(INT x:A. B(x)) = Inter({Y. ? x:A. Y=B(x)})"; |
2891 | 521 |
by (Blast_tac 1); |
923 | 522 |
qed "INT_eq"; |
523 |
||
5069 | 524 |
Goalw [o_def] "UNION A (g o f) = UNION (f``A) g"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
525 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
526 |
qed "UNION_o"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
527 |
|
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
528 |
|
923 | 529 |
(*Distributive laws...*) |
530 |
||
5069 | 531 |
Goal "A Int Union(B) = (UN C:B. A Int C)"; |
2891 | 532 |
by (Blast_tac 1); |
923 | 533 |
qed "Int_Union"; |
534 |
||
5069 | 535 |
Goal "Union(B) Int A = (UN C:B. C Int A)"; |
4674 | 536 |
by (Blast_tac 1); |
537 |
qed "Int_Union2"; |
|
538 |
||
4306
ddbe1a9722ab
Tidying and using equalityCE instead of the slower equalityE
paulson
parents:
4231
diff
changeset
|
539 |
(* Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5: |
923 | 540 |
Union of a family of unions **) |
5069 | 541 |
Goal "(UN x:C. A(x) Un B(x)) = Union(A``C) Un Union(B``C)"; |
2891 | 542 |
by (Blast_tac 1); |
923 | 543 |
qed "Un_Union_image"; |
544 |
||
545 |
(*Equivalent version*) |
|
5069 | 546 |
Goal "(UN i:I. A(i) Un B(i)) = (UN i:I. A(i)) Un (UN i:I. B(i))"; |
2891 | 547 |
by (Blast_tac 1); |
923 | 548 |
qed "UN_Un_distrib"; |
549 |
||
5069 | 550 |
Goal "A Un Inter(B) = (INT C:B. A Un C)"; |
2891 | 551 |
by (Blast_tac 1); |
923 | 552 |
qed "Un_Inter"; |
553 |
||
5069 | 554 |
Goal "(INT x:C. A(x) Int B(x)) = Inter(A``C) Int Inter(B``C)"; |
2891 | 555 |
by (Blast_tac 1); |
923 | 556 |
qed "Int_Inter_image"; |
557 |
||
558 |
(*Equivalent version*) |
|
5069 | 559 |
Goal "(INT i:I. A(i) Int B(i)) = (INT i:I. A(i)) Int (INT i:I. B(i))"; |
2891 | 560 |
by (Blast_tac 1); |
923 | 561 |
qed "INT_Int_distrib"; |
562 |
||
563 |
(*Halmos, Naive Set Theory, page 35.*) |
|
5069 | 564 |
Goal "B Int (UN i:I. A(i)) = (UN i:I. B Int A(i))"; |
2891 | 565 |
by (Blast_tac 1); |
923 | 566 |
qed "Int_UN_distrib"; |
567 |
||
5069 | 568 |
Goal "B Un (INT i:I. A(i)) = (INT i:I. B Un A(i))"; |
2891 | 569 |
by (Blast_tac 1); |
923 | 570 |
qed "Un_INT_distrib"; |
571 |
||
5278 | 572 |
Goal "(UN i:I. A(i)) Int (UN j:J. B(j)) = (UN i:I. UN j:J. A(i) Int B(j))"; |
2891 | 573 |
by (Blast_tac 1); |
923 | 574 |
qed "Int_UN_distrib2"; |
575 |
||
5278 | 576 |
Goal "(INT i:I. A(i)) Un (INT j:J. B(j)) = (INT i:I. INT j:J. A(i) Un B(j))"; |
2891 | 577 |
by (Blast_tac 1); |
923 | 578 |
qed "Un_INT_distrib2"; |
579 |
||
2512 | 580 |
|
581 |
section"Bounded quantifiers"; |
|
582 |
||
3860 | 583 |
(** The following are not added to the default simpset because |
584 |
(a) they duplicate the body and (b) there are no similar rules for Int. **) |
|
2512 | 585 |
|
5069 | 586 |
Goal "(ALL x:A Un B. P x) = ((ALL x:A. P x) & (ALL x:B. P x))"; |
2891 | 587 |
by (Blast_tac 1); |
2519 | 588 |
qed "ball_Un"; |
589 |
||
5069 | 590 |
Goal "(EX x:A Un B. P x) = ((EX x:A. P x) | (EX x:B. P x))"; |
2891 | 591 |
by (Blast_tac 1); |
2519 | 592 |
qed "bex_Un"; |
2512 | 593 |
|
5069 | 594 |
Goal "(ALL z: UNION A B. P z) = (ALL x:A. ALL z:B x. P z)"; |
4771 | 595 |
by (Blast_tac 1); |
596 |
qed "ball_UN"; |
|
597 |
||
5069 | 598 |
Goal "(EX z: UNION A B. P z) = (EX x:A. EX z:B x. P z)"; |
4771 | 599 |
by (Blast_tac 1); |
600 |
qed "bex_UN"; |
|
601 |
||
2512 | 602 |
|
1548 | 603 |
section "-"; |
923 | 604 |
|
5069 | 605 |
Goal "A-B = A Int Compl B"; |
4609 | 606 |
by (Blast_tac 1); |
4662 | 607 |
qed "Diff_eq"; |
4609 | 608 |
|
5069 | 609 |
Goal "A-A = {}"; |
2891 | 610 |
by (Blast_tac 1); |
923 | 611 |
qed "Diff_cancel"; |
1531 | 612 |
Addsimps[Diff_cancel]; |
923 | 613 |
|
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
614 |
Goal "A Int B = {} ==> A-B = A"; |
4674 | 615 |
by (blast_tac (claset() addEs [equalityE]) 1); |
616 |
qed "Diff_triv"; |
|
617 |
||
5069 | 618 |
Goal "{}-A = {}"; |
2891 | 619 |
by (Blast_tac 1); |
923 | 620 |
qed "empty_Diff"; |
1531 | 621 |
Addsimps[empty_Diff]; |
923 | 622 |
|
5069 | 623 |
Goal "A-{} = A"; |
2891 | 624 |
by (Blast_tac 1); |
923 | 625 |
qed "Diff_empty"; |
1531 | 626 |
Addsimps[Diff_empty]; |
627 |
||
5069 | 628 |
Goal "A-UNIV = {}"; |
2891 | 629 |
by (Blast_tac 1); |
1531 | 630 |
qed "Diff_UNIV"; |
631 |
Addsimps[Diff_UNIV]; |
|
632 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
633 |
Goal "x~:A ==> A - insert x B = A-B"; |
2891 | 634 |
by (Blast_tac 1); |
1531 | 635 |
qed "Diff_insert0"; |
636 |
Addsimps [Diff_insert0]; |
|
923 | 637 |
|
638 |
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*) |
|
5069 | 639 |
Goal "A - insert a B = A - B - {a}"; |
2891 | 640 |
by (Blast_tac 1); |
923 | 641 |
qed "Diff_insert"; |
642 |
||
643 |
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*) |
|
5069 | 644 |
Goal "A - insert a B = A - {a} - B"; |
2891 | 645 |
by (Blast_tac 1); |
923 | 646 |
qed "Diff_insert2"; |
647 |
||
5069 | 648 |
Goal "insert x A - B = (if x:B then A-B else insert x (A-B))"; |
4686 | 649 |
by (Simp_tac 1); |
2891 | 650 |
by (Blast_tac 1); |
1531 | 651 |
qed "insert_Diff_if"; |
652 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
653 |
Goal "x:B ==> insert x A - B = A-B"; |
2891 | 654 |
by (Blast_tac 1); |
1531 | 655 |
qed "insert_Diff1"; |
656 |
Addsimps [insert_Diff1]; |
|
657 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
658 |
Goal "a:A ==> insert a (A-{a}) = A"; |
2922 | 659 |
by (Blast_tac 1); |
923 | 660 |
qed "insert_Diff"; |
661 |
||
5069 | 662 |
Goal "A Int (B-A) = {}"; |
2891 | 663 |
by (Blast_tac 1); |
923 | 664 |
qed "Diff_disjoint"; |
1531 | 665 |
Addsimps[Diff_disjoint]; |
923 | 666 |
|
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
667 |
Goal "A<=B ==> A Un (B-A) = B"; |
2891 | 668 |
by (Blast_tac 1); |
923 | 669 |
qed "Diff_partition"; |
670 |
||
5143
b94cd208f073
Removal of leading "\!\!..." from most Goal commands
paulson
parents:
5069
diff
changeset
|
671 |
Goal "[| A<=B; B<= C |] ==> (B - (C - A)) = (A :: 'a set)"; |
2891 | 672 |
by (Blast_tac 1); |
923 | 673 |
qed "double_diff"; |
674 |
||
5069 | 675 |
Goal "A Un (B-A) = A Un B"; |
4645 | 676 |
by (Blast_tac 1); |
677 |
qed "Un_Diff_cancel"; |
|
678 |
||
5069 | 679 |
Goal "(B-A) Un A = B Un A"; |
4645 | 680 |
by (Blast_tac 1); |
681 |
qed "Un_Diff_cancel2"; |
|
682 |
||
683 |
Addsimps [Un_Diff_cancel, Un_Diff_cancel2]; |
|
684 |
||
5069 | 685 |
Goal "A - (B Un C) = (A-B) Int (A-C)"; |
2891 | 686 |
by (Blast_tac 1); |
923 | 687 |
qed "Diff_Un"; |
688 |
||
5069 | 689 |
Goal "A - (B Int C) = (A-B) Un (A-C)"; |
2891 | 690 |
by (Blast_tac 1); |
923 | 691 |
qed "Diff_Int"; |
692 |
||
5069 | 693 |
Goal "(A Un B) - C = (A - C) Un (B - C)"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
694 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
695 |
qed "Un_Diff"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
696 |
|
5069 | 697 |
Goal "(A Int B) - C = A Int (B - C)"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
698 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
699 |
qed "Int_Diff"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
700 |
|
5069 | 701 |
Goal "C Int (A-B) = (C Int A) - (C Int B)"; |
4748 | 702 |
by (Blast_tac 1); |
703 |
qed "Diff_Int_distrib"; |
|
704 |
||
5069 | 705 |
Goal "(A-B) Int C = (A Int C) - (B Int C)"; |
4645 | 706 |
by (Blast_tac 1); |
4748 | 707 |
qed "Diff_Int_distrib2"; |
4645 | 708 |
|
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
709 |
|
5238 | 710 |
section "Quantification over type \"bool\""; |
711 |
||
712 |
Goal "(ALL b::bool. P b) = (P True & P False)"; |
|
713 |
by Auto_tac; |
|
714 |
by (case_tac "b" 1); |
|
715 |
by Auto_tac; |
|
716 |
qed "all_bool_eq"; |
|
717 |
||
718 |
Goal "(EX b::bool. P b) = (P True | P False)"; |
|
719 |
by Auto_tac; |
|
720 |
by (case_tac "b" 1); |
|
721 |
by Auto_tac; |
|
722 |
qed "ex_bool_eq"; |
|
723 |
||
724 |
Goal "A Un B = (UN b. if b then A else B)"; |
|
725 |
by Auto_tac; |
|
726 |
by (asm_full_simp_tac (simpset() addsimps [split_if_mem2]) 1); |
|
727 |
qed "Un_eq_UN"; |
|
728 |
||
729 |
Goal "(UN b::bool. A b) = (A True Un A False)"; |
|
730 |
by Auto_tac; |
|
731 |
by (case_tac "b" 1); |
|
732 |
by Auto_tac; |
|
733 |
qed "UN_bool_eq"; |
|
734 |
||
735 |
Goal "(INT b::bool. A b) = (A True Int A False)"; |
|
736 |
by Auto_tac; |
|
737 |
by (case_tac "b" 1); |
|
738 |
by Auto_tac; |
|
739 |
qed "INT_bool_eq"; |
|
740 |
||
741 |
||
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
742 |
section "Miscellany"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
743 |
|
5069 | 744 |
Goal "(A = B) = ((A <= (B::'a set)) & (B<=A))"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
745 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
746 |
qed "set_eq_subset"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
747 |
|
5069 | 748 |
Goal "A <= B = (! t. t:A --> t:B)"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
749 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
750 |
qed "subset_iff"; |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
751 |
|
5069 | 752 |
Goalw [psubset_def] "((A::'a set) <= B) = ((A < B) | (A=B))"; |
3222
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
753 |
by (Blast_tac 1); |
726a9b069947
Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents:
2922
diff
changeset
|
754 |
qed "subset_iff_psubset_eq"; |
2021 | 755 |
|
5069 | 756 |
Goal "(!x. x ~: A) = (A={})"; |
4423 | 757 |
by (Blast_tac 1); |
3896
ee8ebb74ec00
Various new lemmas. Improved conversion of equations to rewrite rules:
nipkow
parents:
3860
diff
changeset
|
758 |
qed "all_not_in_conv"; |
3907 | 759 |
AddIffs [all_not_in_conv]; |
3896
ee8ebb74ec00
Various new lemmas. Improved conversion of equations to rewrite rules:
nipkow
parents:
3860
diff
changeset
|
760 |
|
5069 | 761 |
Goalw [Pow_def] "Pow {} = {{}}"; |
4477
b3e5857d8d99
New Auto_tac (by Oheimb), and new syntax (without parens), and expandshort
paulson
parents:
4423
diff
changeset
|
762 |
by Auto_tac; |
3348
3f9a806f061e
Two useful facts about Powersets suggested by Florian Kammueller
paulson
parents:
3222
diff
changeset
|
763 |
qed "Pow_empty"; |
3f9a806f061e
Two useful facts about Powersets suggested by Florian Kammueller
paulson
parents:
3222
diff
changeset
|
764 |
Addsimps [Pow_empty]; |
3f9a806f061e
Two useful facts about Powersets suggested by Florian Kammueller
paulson
parents:
3222
diff
changeset
|
765 |
|
5069 | 766 |
Goal "Pow (insert a A) = Pow A Un (insert a `` Pow A)"; |
3724 | 767 |
by Safe_tac; |
3457 | 768 |
by (etac swap 1); |
3348
3f9a806f061e
Two useful facts about Powersets suggested by Florian Kammueller
paulson
parents:
3222
diff
changeset
|
769 |
by (res_inst_tac [("x", "x-{a}")] image_eqI 1); |
3f9a806f061e
Two useful facts about Powersets suggested by Florian Kammueller
paulson
parents:
3222
diff
changeset
|
770 |
by (ALLGOALS Blast_tac); |
3f9a806f061e
Two useful facts about Powersets suggested by Florian Kammueller
paulson
parents:
3222
diff
changeset
|
771 |
qed "Pow_insert"; |
3f9a806f061e
Two useful facts about Powersets suggested by Florian Kammueller
paulson
parents:
3222
diff
changeset
|
772 |
|
5189
362e4d6213c5
Added theorem distinct_lemma (needed for datatypes).
berghofe
parents:
5148
diff
changeset
|
773 |
(** for datatypes **) |
362e4d6213c5
Added theorem distinct_lemma (needed for datatypes).
berghofe
parents:
5148
diff
changeset
|
774 |
Goal "f x ~= f y ==> x ~= y"; |
362e4d6213c5
Added theorem distinct_lemma (needed for datatypes).
berghofe
parents:
5148
diff
changeset
|
775 |
by (Fast_tac 1); |
362e4d6213c5
Added theorem distinct_lemma (needed for datatypes).
berghofe
parents:
5148
diff
changeset
|
776 |
qed "distinct_lemma"; |
362e4d6213c5
Added theorem distinct_lemma (needed for datatypes).
berghofe
parents:
5148
diff
changeset
|
777 |
|
2021 | 778 |
|
779 |
(** Miniscoping: pushing in big Unions and Intersections **) |
|
780 |
local |
|
4059 | 781 |
fun prover s = prove_goal thy s (fn _ => [Blast_tac 1]) |
2021 | 782 |
in |
2513
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
783 |
val UN_simps = map prover |
4159
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
784 |
["!!C. C ~= {} ==> (UN x:C. insert a (B x)) = insert a (UN x:C. B x)", |
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
785 |
"!!C. C ~= {} ==> (UN x:C. A x Un B) = ((UN x:C. A x) Un B)", |
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
786 |
"!!C. C ~= {} ==> (UN x:C. A Un B x) = (A Un (UN x:C. B x))", |
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
787 |
"(UN x:C. A x Int B) = ((UN x:C. A x) Int B)", |
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
788 |
"(UN x:C. A Int B x) = (A Int (UN x:C. B x))", |
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
789 |
"(UN x:C. A x - B) = ((UN x:C. A x) - B)", |
4231 | 790 |
"(UN x:C. A - B x) = (A - (INT x:C. B x))", |
791 |
"(UN x:f``A. B x) = (UN a:A. B(f a))"]; |
|
2513
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
792 |
|
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
793 |
val INT_simps = map prover |
4159
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
794 |
["!!C. C ~= {} ==> (INT x:C. A x Int B) = ((INT x:C. A x) Int B)", |
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
795 |
"!!C. C ~= {} ==> (INT x:C. A Int B x) = (A Int (INT x:C. B x))", |
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
796 |
"!!C. C ~= {} ==> (INT x:C. A x - B) = ((INT x:C. A x) - B)", |
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
797 |
"!!C. C ~= {} ==> (INT x:C. A - B x) = (A - (UN x:C. B x))", |
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
798 |
"(INT x:C. insert a (B x)) = insert a (INT x:C. B x)", |
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
799 |
"(INT x:C. A x Un B) = ((INT x:C. A x) Un B)", |
4231 | 800 |
"(INT x:C. A Un B x) = (A Un (INT x:C. B x))", |
801 |
"(INT x:f``A. B x) = (INT a:A. B(f a))"]; |
|
2513
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
802 |
|
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
803 |
|
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
804 |
val ball_simps = map prover |
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
805 |
["(ALL x:A. P x | Q) = ((ALL x:A. P x) | Q)", |
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
806 |
"(ALL x:A. P | Q x) = (P | (ALL x:A. Q x))", |
3422 | 807 |
"(ALL x:A. P --> Q x) = (P --> (ALL x:A. Q x))", |
808 |
"(ALL x:A. P x --> Q) = ((EX x:A. P x) --> Q)", |
|
2513
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
809 |
"(ALL x:{}. P x) = True", |
4136 | 810 |
"(ALL x:UNIV. P x) = (ALL x. P x)", |
2513
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
811 |
"(ALL x:insert a B. P x) = (P(a) & (ALL x:B. P x))", |
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
812 |
"(ALL x:Union(A). P x) = (ALL y:A. ALL x:y. P x)", |
5233
3571ff68ceda
New rewrite rules for quantification over bounded UNIONs
paulson
parents:
5189
diff
changeset
|
813 |
"(ALL x: UNION A B. P x) = (ALL a:A. ALL x: B a. P x)", |
3860 | 814 |
"(ALL x:Collect Q. P x) = (ALL x. Q x --> P x)", |
815 |
"(ALL x:f``A. P x) = (ALL x:A. P(f x))", |
|
816 |
"(~(ALL x:A. P x)) = (EX x:A. ~P x)"]; |
|
2513
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
817 |
|
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
818 |
val ball_conj_distrib = |
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
819 |
prover "(ALL x:A. P x & Q x) = ((ALL x:A. P x) & (ALL x:A. Q x))"; |
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
820 |
|
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
821 |
val bex_simps = map prover |
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
822 |
["(EX x:A. P x & Q) = ((EX x:A. P x) & Q)", |
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
823 |
"(EX x:A. P & Q x) = (P & (EX x:A. Q x))", |
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
824 |
"(EX x:{}. P x) = False", |
4136 | 825 |
"(EX x:UNIV. P x) = (EX x. P x)", |
2513
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
826 |
"(EX x:insert a B. P x) = (P(a) | (EX x:B. P x))", |
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
827 |
"(EX x:Union(A). P x) = (EX y:A. EX x:y. P x)", |
5233
3571ff68ceda
New rewrite rules for quantification over bounded UNIONs
paulson
parents:
5189
diff
changeset
|
828 |
"(EX x: UNION A B. P x) = (EX a:A. EX x: B a. P x)", |
3860 | 829 |
"(EX x:Collect Q. P x) = (EX x. Q x & P x)", |
830 |
"(EX x:f``A. P x) = (EX x:A. P(f x))", |
|
831 |
"(~(EX x:A. P x)) = (ALL x:A. ~P x)"]; |
|
2513
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
832 |
|
3426 | 833 |
val bex_disj_distrib = |
2513
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
834 |
prover "(EX x:A. P x | Q x) = ((EX x:A. P x) | (EX x:A. Q x))"; |
d708d8cdc8e8
New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents:
2512
diff
changeset
|
835 |
|
2021 | 836 |
end; |
837 |
||
4159
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4136
diff
changeset
|
838 |
Addsimps (UN_simps @ INT_simps @ ball_simps @ bex_simps); |