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