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