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