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