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