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