author | paulson |
Tue, 24 Sep 1996 13:53:18 +0200 | |
changeset 2021 | dd5866263153 |
parent 1917 | 27b71d839d50 |
child 2024 | 909153d8318f |
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 |
||
1531 | 15 |
goal Set.thy "{x.False} = {}"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
16 |
by (Fast_tac 1); |
1531 | 17 |
qed "Collect_False_empty"; |
18 |
Addsimps [Collect_False_empty]; |
|
19 |
||
20 |
goal Set.thy "(A <= {}) = (A = {})"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
21 |
by (Fast_tac 1); |
1531 | 22 |
qed "subset_empty"; |
23 |
Addsimps [subset_empty]; |
|
24 |
||
1548 | 25 |
section ":"; |
923 | 26 |
|
27 |
goal Set.thy "x ~: {}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
28 |
by (Fast_tac 1); |
923 | 29 |
qed "in_empty"; |
1531 | 30 |
Addsimps[in_empty]; |
923 | 31 |
|
32 |
goal Set.thy "x : insert y A = (x=y | x:A)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
33 |
by (Fast_tac 1); |
923 | 34 |
qed "in_insert"; |
1531 | 35 |
Addsimps[in_insert]; |
923 | 36 |
|
1548 | 37 |
section "insert"; |
923 | 38 |
|
1531 | 39 |
(*NOT SUITABLE FOR REWRITING since {a} == insert a {}*) |
40 |
goal Set.thy "insert a A = {a} Un A"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
41 |
by (Fast_tac 1); |
1531 | 42 |
qed "insert_is_Un"; |
43 |
||
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
44 |
goal Set.thy "insert a A ~= {}"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
45 |
by (fast_tac (!claset addEs [equalityCE]) 1); |
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
46 |
qed"insert_not_empty"; |
1531 | 47 |
Addsimps[insert_not_empty]; |
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
48 |
|
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
49 |
bind_thm("empty_not_insert",insert_not_empty RS not_sym); |
1531 | 50 |
Addsimps[empty_not_insert]; |
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
51 |
|
923 | 52 |
goal Set.thy "!!a. a:A ==> insert a A = A"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
53 |
by (Fast_tac 1); |
923 | 54 |
qed "insert_absorb"; |
55 |
||
1531 | 56 |
goal Set.thy "insert x (insert x A) = insert x A"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
57 |
by (Fast_tac 1); |
1531 | 58 |
qed "insert_absorb2"; |
59 |
Addsimps [insert_absorb2]; |
|
60 |
||
1879 | 61 |
goal Set.thy "insert x (insert y A) = insert y (insert x A)"; |
62 |
by (Fast_tac 1); |
|
63 |
qed "insert_commute"; |
|
64 |
||
923 | 65 |
goal Set.thy "(insert x A <= B) = (x:B & A <= B)"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
66 |
by (Fast_tac 1); |
923 | 67 |
qed "insert_subset"; |
1531 | 68 |
Addsimps[insert_subset]; |
69 |
||
70 |
(* use new B rather than (A-{a}) to avoid infinite unfolding *) |
|
71 |
goal Set.thy "!!a. a:A ==> ? B. A = insert a B & a ~: B"; |
|
1553 | 72 |
by (res_inst_tac [("x","A-{a}")] exI 1); |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
73 |
by (Fast_tac 1); |
1531 | 74 |
qed "mk_disjoint_insert"; |
923 | 75 |
|
1843
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
76 |
goal Set.thy |
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
77 |
"!!A. A~={} ==> (UN x:A. insert a (B x)) = insert a (UN x:A. B x)"; |
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
78 |
by (Fast_tac 1); |
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
79 |
qed "UN_insert_distrib"; |
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
80 |
|
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
81 |
goal Set.thy "(UN x. insert a (B x)) = insert a (UN x. B x)"; |
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
82 |
by (Fast_tac 1); |
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
83 |
qed "UN1_insert_distrib"; |
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
84 |
|
1660 | 85 |
section "``"; |
923 | 86 |
|
87 |
goal Set.thy "f``{} = {}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
88 |
by (Fast_tac 1); |
923 | 89 |
qed "image_empty"; |
1531 | 90 |
Addsimps[image_empty]; |
923 | 91 |
|
92 |
goal Set.thy "f``insert a B = insert (f a) (f``B)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
93 |
by (Fast_tac 1); |
923 | 94 |
qed "image_insert"; |
1531 | 95 |
Addsimps[image_insert]; |
923 | 96 |
|
1660 | 97 |
qed_goal "ball_image" Set.thy "(!y:F``S. P y) = (!x:S. P (F x))" |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
98 |
(fn _ => [Fast_tac 1]); |
1660 | 99 |
|
1884 | 100 |
goal Set.thy "!!x. x:A ==> insert (f x) (f``A) = f``A"; |
101 |
by (Fast_tac 1); |
|
102 |
qed "insert_image"; |
|
103 |
Addsimps [insert_image]; |
|
104 |
||
1748 | 105 |
goalw Set.thy [image_def] |
1763 | 106 |
"(%x. if P x then f x else g x) `` S \ |
1748 | 107 |
\ = (f `` ({x.x:S & P x})) Un (g `` ({x.x:S & ~(P x)}))"; |
108 |
by(split_tac [expand_if] 1); |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
109 |
by(Fast_tac 1); |
1748 | 110 |
qed "if_image_distrib"; |
111 |
Addsimps[if_image_distrib]; |
|
112 |
||
113 |
||
1660 | 114 |
section "range"; |
115 |
||
116 |
qed_goal "ball_range" Set.thy "(!y:range f. P y) = (!x. P (f x))" |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
117 |
(fn _ => [Fast_tac 1]); |
1660 | 118 |
|
1884 | 119 |
qed_goalw "image_range" Set.thy [image_def] |
120 |
"f``range g = range (%x. f (g x))" |
|
121 |
(fn _ => [rtac Collect_cong 1, Fast_tac 1]); |
|
1660 | 122 |
|
1548 | 123 |
section "Int"; |
923 | 124 |
|
125 |
goal Set.thy "A Int A = A"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
126 |
by (Fast_tac 1); |
923 | 127 |
qed "Int_absorb"; |
1531 | 128 |
Addsimps[Int_absorb]; |
923 | 129 |
|
130 |
goal Set.thy "A Int B = B Int A"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
131 |
by (Fast_tac 1); |
923 | 132 |
qed "Int_commute"; |
133 |
||
134 |
goal Set.thy "(A Int B) Int C = A Int (B Int C)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
135 |
by (Fast_tac 1); |
923 | 136 |
qed "Int_assoc"; |
137 |
||
138 |
goal Set.thy "{} Int B = {}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
139 |
by (Fast_tac 1); |
923 | 140 |
qed "Int_empty_left"; |
1531 | 141 |
Addsimps[Int_empty_left]; |
923 | 142 |
|
143 |
goal Set.thy "A Int {} = {}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
144 |
by (Fast_tac 1); |
923 | 145 |
qed "Int_empty_right"; |
1531 | 146 |
Addsimps[Int_empty_right]; |
147 |
||
148 |
goal Set.thy "UNIV Int B = B"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
149 |
by (Fast_tac 1); |
1531 | 150 |
qed "Int_UNIV_left"; |
151 |
Addsimps[Int_UNIV_left]; |
|
152 |
||
153 |
goal Set.thy "A Int UNIV = A"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
154 |
by (Fast_tac 1); |
1531 | 155 |
qed "Int_UNIV_right"; |
156 |
Addsimps[Int_UNIV_right]; |
|
923 | 157 |
|
158 |
goal Set.thy "A Int (B Un C) = (A Int B) Un (A Int C)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
159 |
by (Fast_tac 1); |
923 | 160 |
qed "Int_Un_distrib"; |
161 |
||
1618 | 162 |
goal Set.thy "(B Un C) Int A = (B Int A) Un (C Int A)"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
163 |
by (Fast_tac 1); |
1618 | 164 |
qed "Int_Un_distrib2"; |
165 |
||
923 | 166 |
goal Set.thy "(A<=B) = (A Int B = A)"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
167 |
by (fast_tac (!claset addSEs [equalityE]) 1); |
923 | 168 |
qed "subset_Int_eq"; |
169 |
||
1531 | 170 |
goal Set.thy "(A Int B = UNIV) = (A = UNIV & B = UNIV)"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
171 |
by (fast_tac (!claset addEs [equalityCE]) 1); |
1531 | 172 |
qed "Int_UNIV"; |
173 |
Addsimps[Int_UNIV]; |
|
174 |
||
1548 | 175 |
section "Un"; |
923 | 176 |
|
177 |
goal Set.thy "A Un A = A"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
178 |
by (Fast_tac 1); |
923 | 179 |
qed "Un_absorb"; |
1531 | 180 |
Addsimps[Un_absorb]; |
923 | 181 |
|
182 |
goal Set.thy "A Un B = B Un A"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
183 |
by (Fast_tac 1); |
923 | 184 |
qed "Un_commute"; |
185 |
||
186 |
goal Set.thy "(A Un B) Un C = A Un (B Un C)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
187 |
by (Fast_tac 1); |
923 | 188 |
qed "Un_assoc"; |
189 |
||
190 |
goal Set.thy "{} Un B = B"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
191 |
by (Fast_tac 1); |
923 | 192 |
qed "Un_empty_left"; |
1531 | 193 |
Addsimps[Un_empty_left]; |
923 | 194 |
|
195 |
goal Set.thy "A Un {} = A"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
196 |
by (Fast_tac 1); |
923 | 197 |
qed "Un_empty_right"; |
1531 | 198 |
Addsimps[Un_empty_right]; |
199 |
||
200 |
goal Set.thy "UNIV Un B = UNIV"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
201 |
by (Fast_tac 1); |
1531 | 202 |
qed "Un_UNIV_left"; |
203 |
Addsimps[Un_UNIV_left]; |
|
204 |
||
205 |
goal Set.thy "A Un UNIV = UNIV"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
206 |
by (Fast_tac 1); |
1531 | 207 |
qed "Un_UNIV_right"; |
208 |
Addsimps[Un_UNIV_right]; |
|
923 | 209 |
|
1843
a6d7aef48c2f
Removed the unused eq_cs, and added some distributive laws
paulson
parents:
1786
diff
changeset
|
210 |
goal Set.thy "(insert a B) Un C = insert a (B Un C)"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
211 |
by (Fast_tac 1); |
923 | 212 |
qed "Un_insert_left"; |
213 |
||
1917 | 214 |
goal Set.thy "A Un (insert a B) = insert a (A Un B)"; |
215 |
by (Fast_tac 1); |
|
216 |
qed "Un_insert_right"; |
|
217 |
||
923 | 218 |
goal Set.thy "(A Int B) Un C = (A Un C) Int (B Un C)"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
219 |
by (Fast_tac 1); |
923 | 220 |
qed "Un_Int_distrib"; |
221 |
||
222 |
goal Set.thy |
|
223 |
"(A Int B) Un (B Int C) Un (C Int A) = (A Un B) Int (B Un C) Int (C Un A)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
224 |
by (Fast_tac 1); |
923 | 225 |
qed "Un_Int_crazy"; |
226 |
||
227 |
goal Set.thy "(A<=B) = (A Un B = B)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
228 |
by (fast_tac (!claset addSEs [equalityE]) 1); |
923 | 229 |
qed "subset_Un_eq"; |
230 |
||
231 |
goal Set.thy "(A <= insert b C) = (A <= C | b:A & A-{b} <= C)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
232 |
by (Fast_tac 1); |
923 | 233 |
qed "subset_insert_iff"; |
234 |
||
235 |
goal Set.thy "(A Un B = {}) = (A = {} & B = {})"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
236 |
by (fast_tac (!claset addEs [equalityCE]) 1); |
923 | 237 |
qed "Un_empty"; |
1531 | 238 |
Addsimps[Un_empty]; |
923 | 239 |
|
1548 | 240 |
section "Compl"; |
923 | 241 |
|
242 |
goal Set.thy "A Int Compl(A) = {}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
243 |
by (Fast_tac 1); |
923 | 244 |
qed "Compl_disjoint"; |
1531 | 245 |
Addsimps[Compl_disjoint]; |
923 | 246 |
|
1531 | 247 |
goal Set.thy "A Un Compl(A) = UNIV"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
248 |
by (Fast_tac 1); |
923 | 249 |
qed "Compl_partition"; |
250 |
||
251 |
goal Set.thy "Compl(Compl(A)) = A"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
252 |
by (Fast_tac 1); |
923 | 253 |
qed "double_complement"; |
1531 | 254 |
Addsimps[double_complement]; |
923 | 255 |
|
256 |
goal Set.thy "Compl(A Un B) = Compl(A) Int Compl(B)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
257 |
by (Fast_tac 1); |
923 | 258 |
qed "Compl_Un"; |
259 |
||
260 |
goal Set.thy "Compl(A Int B) = Compl(A) Un Compl(B)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
261 |
by (Fast_tac 1); |
923 | 262 |
qed "Compl_Int"; |
263 |
||
264 |
goal Set.thy "Compl(UN x:A. B(x)) = (INT x:A. Compl(B(x)))"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
265 |
by (Fast_tac 1); |
923 | 266 |
qed "Compl_UN"; |
267 |
||
268 |
goal Set.thy "Compl(INT x:A. B(x)) = (UN x:A. Compl(B(x)))"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
269 |
by (Fast_tac 1); |
923 | 270 |
qed "Compl_INT"; |
271 |
||
272 |
(*Halmos, Naive Set Theory, page 16.*) |
|
273 |
||
274 |
goal Set.thy "((A Int B) Un C = A Int (B Un C)) = (C<=A)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
275 |
by (fast_tac (!claset addSEs [equalityE]) 1); |
923 | 276 |
qed "Un_Int_assoc_eq"; |
277 |
||
278 |
||
1548 | 279 |
section "Union"; |
923 | 280 |
|
281 |
goal Set.thy "Union({}) = {}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
282 |
by (Fast_tac 1); |
923 | 283 |
qed "Union_empty"; |
1531 | 284 |
Addsimps[Union_empty]; |
285 |
||
286 |
goal Set.thy "Union(UNIV) = UNIV"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
287 |
by (Fast_tac 1); |
1531 | 288 |
qed "Union_UNIV"; |
289 |
Addsimps[Union_UNIV]; |
|
923 | 290 |
|
291 |
goal Set.thy "Union(insert a B) = a Un Union(B)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
292 |
by (Fast_tac 1); |
923 | 293 |
qed "Union_insert"; |
1531 | 294 |
Addsimps[Union_insert]; |
923 | 295 |
|
296 |
goal Set.thy "Union(A Un B) = Union(A) Un Union(B)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
297 |
by (Fast_tac 1); |
923 | 298 |
qed "Union_Un_distrib"; |
1531 | 299 |
Addsimps[Union_Un_distrib]; |
923 | 300 |
|
301 |
goal Set.thy "Union(A Int B) <= Union(A) Int Union(B)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
302 |
by (Fast_tac 1); |
923 | 303 |
qed "Union_Int_subset"; |
304 |
||
305 |
val prems = goal Set.thy |
|
306 |
"(Union(C) Int A = {}) = (! B:C. B Int A = {})"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
307 |
by (fast_tac (!claset addSEs [equalityE]) 1); |
923 | 308 |
qed "Union_disjoint"; |
309 |
||
1548 | 310 |
section "Inter"; |
311 |
||
1531 | 312 |
goal Set.thy "Inter({}) = UNIV"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
313 |
by (Fast_tac 1); |
1531 | 314 |
qed "Inter_empty"; |
315 |
Addsimps[Inter_empty]; |
|
316 |
||
317 |
goal Set.thy "Inter(UNIV) = {}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
318 |
by (Fast_tac 1); |
1531 | 319 |
qed "Inter_UNIV"; |
320 |
Addsimps[Inter_UNIV]; |
|
321 |
||
322 |
goal Set.thy "Inter(insert a B) = a Int Inter(B)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
323 |
by (Fast_tac 1); |
1531 | 324 |
qed "Inter_insert"; |
325 |
Addsimps[Inter_insert]; |
|
326 |
||
1564
822575c737bd
Deleted faulty comment; proved new rule Inter_Un_subset
paulson
parents:
1553
diff
changeset
|
327 |
goal Set.thy "Inter(A) Un Inter(B) <= Inter(A Int B)"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
328 |
by (Fast_tac 1); |
1564
822575c737bd
Deleted faulty comment; proved new rule Inter_Un_subset
paulson
parents:
1553
diff
changeset
|
329 |
qed "Inter_Un_subset"; |
1531 | 330 |
|
923 | 331 |
goal Set.thy "Inter(A Un B) = Inter(A) Int Inter(B)"; |
1786
8a31d85d27b8
best_tac, deepen_tac and safe_tac now also use default claset.
berghofe
parents:
1763
diff
changeset
|
332 |
by (best_tac (!claset) 1); |
923 | 333 |
qed "Inter_Un_distrib"; |
334 |
||
1548 | 335 |
section "UN and INT"; |
923 | 336 |
|
337 |
(*Basic identities*) |
|
338 |
||
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
339 |
goal Set.thy "(UN x:{}. B x) = {}"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
340 |
by (Fast_tac 1); |
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
341 |
qed "UN_empty"; |
1531 | 342 |
Addsimps[UN_empty]; |
343 |
||
344 |
goal Set.thy "(UN x:UNIV. B x) = (UN x. B x)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
345 |
by (Fast_tac 1); |
1531 | 346 |
qed "UN_UNIV"; |
347 |
Addsimps[UN_UNIV]; |
|
348 |
||
349 |
goal Set.thy "(INT x:{}. B x) = UNIV"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
350 |
by (Fast_tac 1); |
1531 | 351 |
qed "INT_empty"; |
352 |
Addsimps[INT_empty]; |
|
353 |
||
354 |
goal Set.thy "(INT x:UNIV. B x) = (INT x. B x)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
355 |
by (Fast_tac 1); |
1531 | 356 |
qed "INT_UNIV"; |
357 |
Addsimps[INT_UNIV]; |
|
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
358 |
|
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
359 |
goal Set.thy "(UN x:insert a A. B x) = B a Un UNION A B"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
360 |
by (Fast_tac 1); |
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
361 |
qed "UN_insert"; |
1531 | 362 |
Addsimps[UN_insert]; |
363 |
||
364 |
goal Set.thy "(INT x:insert a A. B x) = B a Int INTER A B"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
365 |
by (Fast_tac 1); |
1531 | 366 |
qed "INT_insert"; |
367 |
Addsimps[INT_insert]; |
|
1179
7678408f9751
Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents:
923
diff
changeset
|
368 |
|
2021 | 369 |
goal Set.thy |
370 |
"!!A. A~={} ==> (INT x:A. insert a (B x)) = insert a (INT x:A. B x)"; |
|
371 |
by (Fast_tac 1); |
|
372 |
qed "INT_insert_distrib"; |
|
373 |
||
374 |
goal Set.thy "(INT x. insert a (B x)) = insert a (INT x. B x)"; |
|
375 |
by (Fast_tac 1); |
|
376 |
qed "INT1_insert_distrib"; |
|
377 |
||
923 | 378 |
goal Set.thy "Union(range(f)) = (UN x.f(x))"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
379 |
by (Fast_tac 1); |
923 | 380 |
qed "Union_range_eq"; |
381 |
||
382 |
goal Set.thy "Inter(range(f)) = (INT x.f(x))"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
383 |
by (Fast_tac 1); |
923 | 384 |
qed "Inter_range_eq"; |
385 |
||
386 |
goal Set.thy "Union(B``A) = (UN x:A. B(x))"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
387 |
by (Fast_tac 1); |
923 | 388 |
qed "Union_image_eq"; |
389 |
||
390 |
goal Set.thy "Inter(B``A) = (INT x:A. B(x))"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
391 |
by (Fast_tac 1); |
923 | 392 |
qed "Inter_image_eq"; |
393 |
||
394 |
goal Set.thy "!!A. a: A ==> (UN y:A. c) = c"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
395 |
by (Fast_tac 1); |
923 | 396 |
qed "UN_constant"; |
397 |
||
398 |
goal Set.thy "!!A. a: A ==> (INT y:A. c) = c"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
399 |
by (Fast_tac 1); |
923 | 400 |
qed "INT_constant"; |
401 |
||
402 |
goal Set.thy "(UN x.B) = B"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
403 |
by (Fast_tac 1); |
923 | 404 |
qed "UN1_constant"; |
1531 | 405 |
Addsimps[UN1_constant]; |
923 | 406 |
|
407 |
goal Set.thy "(INT x.B) = B"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
408 |
by (Fast_tac 1); |
923 | 409 |
qed "INT1_constant"; |
1531 | 410 |
Addsimps[INT1_constant]; |
923 | 411 |
|
412 |
goal Set.thy "(UN x:A. B(x)) = Union({Y. ? x:A. Y=B(x)})"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
413 |
by (Fast_tac 1); |
923 | 414 |
qed "UN_eq"; |
415 |
||
416 |
(*Look: it has an EXISTENTIAL quantifier*) |
|
417 |
goal Set.thy "(INT x:A. B(x)) = Inter({Y. ? x:A. Y=B(x)})"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
418 |
by (Fast_tac 1); |
923 | 419 |
qed "INT_eq"; |
420 |
||
421 |
(*Distributive laws...*) |
|
422 |
||
423 |
goal Set.thy "A Int Union(B) = (UN C:B. A Int C)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
424 |
by (Fast_tac 1); |
923 | 425 |
qed "Int_Union"; |
426 |
||
427 |
(* Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5: |
|
428 |
Union of a family of unions **) |
|
429 |
goal Set.thy "(UN x:C. A(x) Un B(x)) = Union(A``C) Un Union(B``C)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
430 |
by (Fast_tac 1); |
923 | 431 |
qed "Un_Union_image"; |
432 |
||
433 |
(*Equivalent version*) |
|
434 |
goal Set.thy "(UN i:I. A(i) Un B(i)) = (UN i:I. A(i)) Un (UN i:I. B(i))"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
435 |
by (Fast_tac 1); |
923 | 436 |
qed "UN_Un_distrib"; |
437 |
||
438 |
goal Set.thy "A Un Inter(B) = (INT C:B. A Un C)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
439 |
by (Fast_tac 1); |
923 | 440 |
qed "Un_Inter"; |
441 |
||
442 |
goal Set.thy "(INT x:C. A(x) Int B(x)) = Inter(A``C) Int Inter(B``C)"; |
|
1786
8a31d85d27b8
best_tac, deepen_tac and safe_tac now also use default claset.
berghofe
parents:
1763
diff
changeset
|
443 |
by (best_tac (!claset) 1); |
923 | 444 |
qed "Int_Inter_image"; |
445 |
||
446 |
(*Equivalent version*) |
|
447 |
goal Set.thy "(INT i:I. A(i) Int B(i)) = (INT i:I. A(i)) Int (INT i:I. B(i))"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
448 |
by (Fast_tac 1); |
923 | 449 |
qed "INT_Int_distrib"; |
450 |
||
451 |
(*Halmos, Naive Set Theory, page 35.*) |
|
452 |
goal Set.thy "B Int (UN i:I. A(i)) = (UN i:I. B Int A(i))"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
453 |
by (Fast_tac 1); |
923 | 454 |
qed "Int_UN_distrib"; |
455 |
||
456 |
goal Set.thy "B Un (INT i:I. A(i)) = (INT i:I. B Un A(i))"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
457 |
by (Fast_tac 1); |
923 | 458 |
qed "Un_INT_distrib"; |
459 |
||
460 |
goal Set.thy |
|
461 |
"(UN i:I. A(i)) Int (UN j:J. B(j)) = (UN i:I. UN j:J. A(i) Int B(j))"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
462 |
by (Fast_tac 1); |
923 | 463 |
qed "Int_UN_distrib2"; |
464 |
||
465 |
goal Set.thy |
|
466 |
"(INT i:I. A(i)) Un (INT j:J. B(j)) = (INT i:I. INT j:J. A(i) Un B(j))"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
467 |
by (Fast_tac 1); |
923 | 468 |
qed "Un_INT_distrib2"; |
469 |
||
1548 | 470 |
section "-"; |
923 | 471 |
|
472 |
goal Set.thy "A-A = {}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
473 |
by (Fast_tac 1); |
923 | 474 |
qed "Diff_cancel"; |
1531 | 475 |
Addsimps[Diff_cancel]; |
923 | 476 |
|
477 |
goal Set.thy "{}-A = {}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
478 |
by (Fast_tac 1); |
923 | 479 |
qed "empty_Diff"; |
1531 | 480 |
Addsimps[empty_Diff]; |
923 | 481 |
|
482 |
goal Set.thy "A-{} = A"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
483 |
by (Fast_tac 1); |
923 | 484 |
qed "Diff_empty"; |
1531 | 485 |
Addsimps[Diff_empty]; |
486 |
||
487 |
goal Set.thy "A-UNIV = {}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
488 |
by (Fast_tac 1); |
1531 | 489 |
qed "Diff_UNIV"; |
490 |
Addsimps[Diff_UNIV]; |
|
491 |
||
492 |
goal Set.thy "!!x. x~:A ==> A - insert x B = A-B"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
493 |
by (Fast_tac 1); |
1531 | 494 |
qed "Diff_insert0"; |
495 |
Addsimps [Diff_insert0]; |
|
923 | 496 |
|
497 |
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*) |
|
498 |
goal Set.thy "A - insert a B = A - B - {a}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
499 |
by (Fast_tac 1); |
923 | 500 |
qed "Diff_insert"; |
501 |
||
502 |
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*) |
|
503 |
goal Set.thy "A - insert a B = A - {a} - B"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
504 |
by (Fast_tac 1); |
923 | 505 |
qed "Diff_insert2"; |
506 |
||
1531 | 507 |
goal Set.thy "insert x A - B = (if x:B then A-B else insert x (A-B))"; |
1553 | 508 |
by (simp_tac (!simpset setloop split_tac[expand_if]) 1); |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
509 |
by (Fast_tac 1); |
1531 | 510 |
qed "insert_Diff_if"; |
511 |
||
512 |
goal Set.thy "!!x. x:B ==> insert x A - B = A-B"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
513 |
by (Fast_tac 1); |
1531 | 514 |
qed "insert_Diff1"; |
515 |
Addsimps [insert_Diff1]; |
|
516 |
||
923 | 517 |
val prems = goal Set.thy "a:A ==> insert a (A-{a}) = A"; |
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
518 |
by (fast_tac (!claset addSIs prems) 1); |
923 | 519 |
qed "insert_Diff"; |
520 |
||
521 |
goal Set.thy "A Int (B-A) = {}"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
522 |
by (Fast_tac 1); |
923 | 523 |
qed "Diff_disjoint"; |
1531 | 524 |
Addsimps[Diff_disjoint]; |
923 | 525 |
|
526 |
goal Set.thy "!!A. A<=B ==> A Un (B-A) = B"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
527 |
by (Fast_tac 1); |
923 | 528 |
qed "Diff_partition"; |
529 |
||
530 |
goal Set.thy "!!A. [| A<=B; B<= C |] ==> (B - (C - A)) = (A :: 'a set)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
531 |
by (Fast_tac 1); |
923 | 532 |
qed "double_diff"; |
533 |
||
534 |
goal Set.thy "A - (B Un C) = (A-B) Int (A-C)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
535 |
by (Fast_tac 1); |
923 | 536 |
qed "Diff_Un"; |
537 |
||
538 |
goal Set.thy "A - (B Int C) = (A-B) Un (A-C)"; |
|
1754
852093aeb0ab
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1748
diff
changeset
|
539 |
by (Fast_tac 1); |
923 | 540 |
qed "Diff_Int"; |
541 |
||
1531 | 542 |
Addsimps[subset_UNIV, empty_subsetI, subset_refl]; |
2021 | 543 |
|
544 |
||
545 |
(** Miniscoping: pushing in big Unions and Intersections **) |
|
546 |
local |
|
547 |
fun prover s = prove_goal Set.thy s (fn _ => [Fast_tac 1]) |
|
548 |
in |
|
549 |
val UN1_simps = map prover |
|
550 |
["(UN x. insert a (B x)) = insert a (UN x. B x)", |
|
551 |
"(UN x. A x Int B) = ((UN x.A x) Int B)", |
|
552 |
"(UN x. A Int B x) = (A Int (UN x.B x))", |
|
553 |
"(UN x. A x Un B) = ((UN x.A x) Un B)", |
|
554 |
"(UN x. A Un B x) = (A Un (UN x.B x))", |
|
555 |
"(UN x. A x - B) = ((UN x.A x) - B)", |
|
556 |
"(UN x. A - B x) = (A - (INT x.B x))"]; |
|
557 |
||
558 |
val INT1_simps = map prover |
|
559 |
["(INT x. insert a (B x)) = insert a (INT x. B x)", |
|
560 |
"(INT x. A x Int B) = ((INT x.A x) Int B)", |
|
561 |
"(INT x. A Int B x) = (A Int (INT x.B x))", |
|
562 |
"(INT x. A x Un B) = ((INT x.A x) Un B)", |
|
563 |
"(INT x. A Un B x) = (A Un (INT x.B x))", |
|
564 |
"(INT x. A x - B) = ((INT x.A x) - B)", |
|
565 |
"(INT x. A - B x) = (A - (UN x.B x))"]; |
|
566 |
||
567 |
(*Analogous laws for bounded Unions and Intersections are conditional |
|
568 |
on the index set's being non-empty. Thus they are probably NOT worth |
|
569 |
adding as default rewrites.*) |
|
570 |
end; |
|
571 |
||
572 |
Addsimps (UN1_simps @ INT1_simps); |