81 by (res_inst_tac [("x","A-{a}")] exI 1); |
81 by (res_inst_tac [("x","A-{a}")] exI 1); |
82 by (Blast_tac 1); |
82 by (Blast_tac 1); |
83 qed "mk_disjoint_insert"; |
83 qed "mk_disjoint_insert"; |
84 |
84 |
85 bind_thm ("insert_Collect", prove_goal thy |
85 bind_thm ("insert_Collect", prove_goal thy |
86 "insert a (Collect P) = {u. u ~= a --> P u}" (K [Auto_tac])); |
86 "insert a (Collect P) = {u. u ~= a --> P u}" (K [Auto_tac])); |
87 |
87 |
88 Goal "A~={} ==> (UN x:A. insert a (B x)) = insert a (UN x:A. B x)"; |
88 Goal "A~={} ==> (UN x:A. insert a (B x)) = insert a (UN x:A. B x)"; |
89 by (Blast_tac 1); |
89 by (Blast_tac 1); |
90 qed "UN_insert_distrib"; |
90 qed "UN_insert_distrib"; |
91 |
91 |
126 Goal "f `` {x. P x} = {f x | x. P x}"; |
126 Goal "f `` {x. P x} = {f x | x. P x}"; |
127 by (Blast_tac 1); |
127 by (Blast_tac 1); |
128 qed "image_Collect"; |
128 qed "image_Collect"; |
129 Addsimps [image_Collect]; |
129 Addsimps [image_Collect]; |
130 |
130 |
131 Goalw [image_def] |
131 Goalw [image_def] "(%x. if P x then f x else g x) `` S \ |
132 "(%x. if P x then f x else g x) `` S \ |
132 \ = (f `` (S Int {x. P x})) Un (g `` (S Int {x. ~(P x)}))"; |
133 \ = (f `` (S Int {x. P x})) Un (g `` (S Int {x. ~(P x)}))"; |
|
134 by (Simp_tac 1); |
133 by (Simp_tac 1); |
135 by (Blast_tac 1); |
134 by (Blast_tac 1); |
136 qed "if_image_distrib"; |
135 qed "if_image_distrib"; |
137 Addsimps[if_image_distrib]; |
136 Addsimps[if_image_distrib]; |
138 |
137 |
139 val prems= Goal "[|M = N; !!x. x:N ==> f x = g x|] ==> f``M = g``N"; |
138 val prems = Goal "[|M = N; !!x. x:N ==> f x = g x|] ==> f``M = g``N"; |
140 by (rtac set_ext 1); |
139 by (rtac set_ext 1); |
141 by (simp_tac (simpset() addsimps image_def::prems) 1); |
140 by (simp_tac (simpset() addsimps image_def::prems) 1); |
142 qed "image_cong"; |
141 qed "image_cong"; |
143 |
142 |
144 |
143 |
147 Goal "A Int A = A"; |
146 Goal "A Int A = A"; |
148 by (Blast_tac 1); |
147 by (Blast_tac 1); |
149 qed "Int_absorb"; |
148 qed "Int_absorb"; |
150 Addsimps[Int_absorb]; |
149 Addsimps[Int_absorb]; |
151 |
150 |
152 Goal " A Int (A Int B) = A Int B"; |
151 Goal "A Int (A Int B) = A Int B"; |
153 by (Blast_tac 1); |
152 by (Blast_tac 1); |
154 qed "Int_left_absorb"; |
153 qed "Int_left_absorb"; |
155 |
154 |
156 Goal "A Int B = B Int A"; |
155 Goal "A Int B = B Int A"; |
157 by (Blast_tac 1); |
156 by (Blast_tac 1); |
158 qed "Int_commute"; |
157 qed "Int_commute"; |
159 |
158 |
160 Goal "A Int (B Int C) = B Int (A Int C)"; |
159 Goal "A Int (B Int C) = B Int (A Int C)"; |
161 by (Blast_tac 1); |
160 by (Blast_tac 1); |
162 qed "Int_left_commute"; |
161 qed "Int_left_commute"; |
163 |
162 |
164 Goal "(A Int B) Int C = A Int (B Int C)"; |
163 Goal "(A Int B) Int C = A Int (B Int C)"; |
165 by (Blast_tac 1); |
164 by (Blast_tac 1); |
166 qed "Int_assoc"; |
165 qed "Int_assoc"; |
167 |
166 |
168 (*Intersection is an AC-operator*) |
167 (*Intersection is an AC-operator*) |
169 val Int_ac = [Int_assoc, Int_left_absorb, Int_commute, Int_left_commute]; |
168 val Int_ac = [Int_assoc, Int_left_absorb, Int_commute, Int_left_commute]; |
202 |
201 |
203 Goal "A Int B = Inter{A,B}"; |
202 Goal "A Int B = Inter{A,B}"; |
204 by (Blast_tac 1); |
203 by (Blast_tac 1); |
205 qed "Int_eq_Inter"; |
204 qed "Int_eq_Inter"; |
206 |
205 |
207 Goal "A Int (B Un C) = (A Int B) Un (A Int C)"; |
206 Goal "A Int (B Un C) = (A Int B) Un (A Int C)"; |
208 by (Blast_tac 1); |
207 by (Blast_tac 1); |
209 qed "Int_Un_distrib"; |
208 qed "Int_Un_distrib"; |
210 |
209 |
211 Goal "(B Un C) Int A = (B Int A) Un (C Int A)"; |
210 Goal "(B Un C) Int A = (B Int A) Un (C Int A)"; |
212 by (Blast_tac 1); |
211 by (Blast_tac 1); |
213 qed "Int_Un_distrib2"; |
212 qed "Int_Un_distrib2"; |
214 |
213 |
215 Goal "(A Int B = UNIV) = (A = UNIV & B = UNIV)"; |
214 Goal "(A Int B = UNIV) = (A = UNIV & B = UNIV)"; |
216 by (blast_tac (claset() addEs [equalityCE]) 1); |
215 by (blast_tac (claset() addEs [equalityCE]) 1); |
231 |
230 |
232 Goal " A Un (A Un B) = A Un B"; |
231 Goal " A Un (A Un B) = A Un B"; |
233 by (Blast_tac 1); |
232 by (Blast_tac 1); |
234 qed "Un_left_absorb"; |
233 qed "Un_left_absorb"; |
235 |
234 |
236 Goal "A Un B = B Un A"; |
235 Goal "A Un B = B Un A"; |
237 by (Blast_tac 1); |
236 by (Blast_tac 1); |
238 qed "Un_commute"; |
237 qed "Un_commute"; |
239 |
238 |
240 Goal "A Un (B Un C) = B Un (A Un C)"; |
239 Goal "A Un (B Un C) = B Un (A Un C)"; |
241 by (Blast_tac 1); |
240 by (Blast_tac 1); |
242 qed "Un_left_commute"; |
241 qed "Un_left_commute"; |
243 |
242 |
244 Goal "(A Un B) Un C = A Un (B Un C)"; |
243 Goal "(A Un B) Un C = A Un (B Un C)"; |
245 by (Blast_tac 1); |
244 by (Blast_tac 1); |
246 qed "Un_assoc"; |
245 qed "Un_assoc"; |
247 |
246 |
248 (*Union is an AC-operator*) |
247 (*Union is an AC-operator*) |
249 val Un_ac = [Un_assoc, Un_left_absorb, Un_commute, Un_left_commute]; |
248 val Un_ac = [Un_assoc, Un_left_absorb, Un_commute, Un_left_commute]; |
289 by (Blast_tac 1); |
288 by (Blast_tac 1); |
290 qed "Un_insert_right"; |
289 qed "Un_insert_right"; |
291 Addsimps[Un_insert_right]; |
290 Addsimps[Un_insert_right]; |
292 |
291 |
293 Goal "(insert a B) Int C = (if a:C then insert a (B Int C) \ |
292 Goal "(insert a B) Int C = (if a:C then insert a (B Int C) \ |
294 \ else B Int C)"; |
293 \ else B Int C)"; |
295 by (Simp_tac 1); |
294 by (Simp_tac 1); |
296 by (Blast_tac 1); |
295 by (Blast_tac 1); |
297 qed "Int_insert_left"; |
296 qed "Int_insert_left"; |
298 |
297 |
299 Goal "A Int (insert a B) = (if a:A then insert a (A Int B) \ |
298 Goal "A Int (insert a B) = (if a:A then insert a (A Int B) \ |
300 \ else A Int B)"; |
299 \ else A Int B)"; |
301 by (Simp_tac 1); |
300 by (Simp_tac 1); |
302 by (Blast_tac 1); |
301 by (Blast_tac 1); |
303 qed "Int_insert_right"; |
302 qed "Int_insert_right"; |
304 |
303 |
305 Goal "A Un (B Int C) = (A Un B) Int (A Un C)"; |
304 Goal "A Un (B Int C) = (A Un B) Int (A Un C)"; |
306 by (Blast_tac 1); |
305 by (Blast_tac 1); |
307 qed "Un_Int_distrib"; |
306 qed "Un_Int_distrib"; |
308 |
307 |
309 Goal "(B Int C) Un A = (B Un A) Int (C Un A)"; |
308 Goal "(B Int C) Un A = (B Un A) Int (C Un A)"; |
310 by (Blast_tac 1); |
309 by (Blast_tac 1); |
311 qed "Un_Int_distrib2"; |
310 qed "Un_Int_distrib2"; |
312 |
311 |
313 Goal "(A Int B) Un (B Int C) Un (C Int A) = (A Un B) Int (B Un C) Int (C Un A)"; |
312 Goal "(A Int B) Un (B Int C) Un (C Int A) = \ |
|
313 \ (A Un B) Int (B Un C) Int (C Un A)"; |
314 by (Blast_tac 1); |
314 by (Blast_tac 1); |
315 qed "Un_Int_crazy"; |
315 qed "Un_Int_crazy"; |
316 |
316 |
317 Goal "(A<=B) = (A Un B = B)"; |
317 Goal "(A<=B) = (A Un B = B)"; |
318 by (blast_tac (claset() addSEs [equalityCE]) 1); |
318 by (blast_tac (claset() addSEs [equalityCE]) 1); |