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