src/HOL/equalities.ML
author nipkow
Wed Mar 06 10:05:00 1996 +0100 (1996-03-06 ago)
changeset 1548 afe750876848
parent 1531 e5eb247ad13c
child 1553 4eb4a9c7d736
permissions -rw-r--r--
Added 'section' commands
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} = {}";
nipkow@1531
    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 = {})";
nipkow@1531
    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 ~: {}";
clasohm@923
    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)";
clasohm@923
    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";
nipkow@1531
    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";
nipkow@1531
    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";
nipkow@1531
    68
by(res_inst_tac [("x","A-{a}")] exI 1);
nipkow@1531
    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";
clasohm@923
   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";
clasohm@923
   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";
nipkow@1531
   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";
nipkow@1531
   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)";
clasohm@923
   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
nipkow@1531
   280
(* Why does fast_tac fail???
nipkow@1531
   281
goal Set.thy "Inter(A Int B) = Inter(A) Int Inter(B)";
nipkow@1531
   282
by (fast_tac eq_cs 1);
nipkow@1531
   283
qed "Inter_Int_distrib";
nipkow@1531
   284
Addsimps[Inter_Int_distrib];
nipkow@1531
   285
*)
nipkow@1531
   286
clasohm@923
   287
goal Set.thy "Inter(A Un B) = Inter(A) Int Inter(B)";
clasohm@923
   288
by (best_tac eq_cs 1);
clasohm@923
   289
qed "Inter_Un_distrib";
clasohm@923
   290
nipkow@1548
   291
section "UN and INT";
clasohm@923
   292
clasohm@923
   293
(*Basic identities*)
clasohm@923
   294
nipkow@1179
   295
goal Set.thy "(UN x:{}. B x) = {}";
nipkow@1179
   296
by (fast_tac eq_cs 1);
nipkow@1179
   297
qed "UN_empty";
nipkow@1531
   298
Addsimps[UN_empty];
nipkow@1531
   299
nipkow@1531
   300
goal Set.thy "(UN x:UNIV. B x) = (UN x. B x)";
nipkow@1531
   301
by (fast_tac eq_cs 1);
nipkow@1531
   302
qed "UN_UNIV";
nipkow@1531
   303
Addsimps[UN_UNIV];
nipkow@1531
   304
nipkow@1531
   305
goal Set.thy "(INT x:{}. B x) = UNIV";
nipkow@1531
   306
by (fast_tac eq_cs 1);
nipkow@1531
   307
qed "INT_empty";
nipkow@1531
   308
Addsimps[INT_empty];
nipkow@1531
   309
nipkow@1531
   310
goal Set.thy "(INT x:UNIV. B x) = (INT x. B x)";
nipkow@1531
   311
by (fast_tac eq_cs 1);
nipkow@1531
   312
qed "INT_UNIV";
nipkow@1531
   313
Addsimps[INT_UNIV];
nipkow@1179
   314
nipkow@1179
   315
goal Set.thy "(UN x:insert a A. B x) = B a Un UNION A B";
nipkow@1179
   316
by (fast_tac eq_cs 1);
nipkow@1179
   317
qed "UN_insert";
nipkow@1531
   318
Addsimps[UN_insert];
nipkow@1531
   319
nipkow@1531
   320
goal Set.thy "(INT x:insert a A. B x) = B a Int INTER A B";
nipkow@1531
   321
by (fast_tac eq_cs 1);
nipkow@1531
   322
qed "INT_insert";
nipkow@1531
   323
Addsimps[INT_insert];
nipkow@1179
   324
clasohm@923
   325
goal Set.thy "Union(range(f)) = (UN x.f(x))";
clasohm@923
   326
by (fast_tac eq_cs 1);
clasohm@923
   327
qed "Union_range_eq";
clasohm@923
   328
clasohm@923
   329
goal Set.thy "Inter(range(f)) = (INT x.f(x))";
clasohm@923
   330
by (fast_tac eq_cs 1);
clasohm@923
   331
qed "Inter_range_eq";
clasohm@923
   332
clasohm@923
   333
goal Set.thy "Union(B``A) = (UN x:A. B(x))";
clasohm@923
   334
by (fast_tac eq_cs 1);
clasohm@923
   335
qed "Union_image_eq";
clasohm@923
   336
clasohm@923
   337
goal Set.thy "Inter(B``A) = (INT x:A. B(x))";
clasohm@923
   338
by (fast_tac eq_cs 1);
clasohm@923
   339
qed "Inter_image_eq";
clasohm@923
   340
clasohm@923
   341
goal Set.thy "!!A. a: A ==> (UN y:A. c) = c";
clasohm@923
   342
by (fast_tac eq_cs 1);
clasohm@923
   343
qed "UN_constant";
clasohm@923
   344
clasohm@923
   345
goal Set.thy "!!A. a: A ==> (INT y:A. c) = c";
clasohm@923
   346
by (fast_tac eq_cs 1);
clasohm@923
   347
qed "INT_constant";
clasohm@923
   348
clasohm@923
   349
goal Set.thy "(UN x.B) = B";
clasohm@923
   350
by (fast_tac eq_cs 1);
clasohm@923
   351
qed "UN1_constant";
nipkow@1531
   352
Addsimps[UN1_constant];
clasohm@923
   353
clasohm@923
   354
goal Set.thy "(INT x.B) = B";
clasohm@923
   355
by (fast_tac eq_cs 1);
clasohm@923
   356
qed "INT1_constant";
nipkow@1531
   357
Addsimps[INT1_constant];
clasohm@923
   358
clasohm@923
   359
goal Set.thy "(UN x:A. B(x)) = Union({Y. ? x:A. Y=B(x)})";
clasohm@923
   360
by (fast_tac eq_cs 1);
clasohm@923
   361
qed "UN_eq";
clasohm@923
   362
clasohm@923
   363
(*Look: it has an EXISTENTIAL quantifier*)
clasohm@923
   364
goal Set.thy "(INT x:A. B(x)) = Inter({Y. ? x:A. Y=B(x)})";
clasohm@923
   365
by (fast_tac eq_cs 1);
clasohm@923
   366
qed "INT_eq";
clasohm@923
   367
clasohm@923
   368
(*Distributive laws...*)
clasohm@923
   369
clasohm@923
   370
goal Set.thy "A Int Union(B) = (UN C:B. A Int C)";
clasohm@923
   371
by (fast_tac eq_cs 1);
clasohm@923
   372
qed "Int_Union";
clasohm@923
   373
clasohm@923
   374
(* Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5: 
clasohm@923
   375
   Union of a family of unions **)
clasohm@923
   376
goal Set.thy "(UN x:C. A(x) Un B(x)) = Union(A``C)  Un  Union(B``C)";
clasohm@923
   377
by (fast_tac eq_cs 1);
clasohm@923
   378
qed "Un_Union_image";
clasohm@923
   379
clasohm@923
   380
(*Equivalent version*)
clasohm@923
   381
goal Set.thy "(UN i:I. A(i) Un B(i)) = (UN i:I. A(i))  Un  (UN i:I. B(i))";
clasohm@923
   382
by (fast_tac eq_cs 1);
clasohm@923
   383
qed "UN_Un_distrib";
clasohm@923
   384
clasohm@923
   385
goal Set.thy "A Un Inter(B) = (INT C:B. A Un C)";
clasohm@923
   386
by (fast_tac eq_cs 1);
clasohm@923
   387
qed "Un_Inter";
clasohm@923
   388
clasohm@923
   389
goal Set.thy "(INT x:C. A(x) Int B(x)) = Inter(A``C) Int Inter(B``C)";
clasohm@923
   390
by (best_tac eq_cs 1);
clasohm@923
   391
qed "Int_Inter_image";
clasohm@923
   392
clasohm@923
   393
(*Equivalent version*)
clasohm@923
   394
goal Set.thy "(INT i:I. A(i) Int B(i)) = (INT i:I. A(i)) Int (INT i:I. B(i))";
clasohm@923
   395
by (fast_tac eq_cs 1);
clasohm@923
   396
qed "INT_Int_distrib";
clasohm@923
   397
clasohm@923
   398
(*Halmos, Naive Set Theory, page 35.*)
clasohm@923
   399
goal Set.thy "B Int (UN i:I. A(i)) = (UN i:I. B Int A(i))";
clasohm@923
   400
by (fast_tac eq_cs 1);
clasohm@923
   401
qed "Int_UN_distrib";
clasohm@923
   402
clasohm@923
   403
goal Set.thy "B Un (INT i:I. A(i)) = (INT i:I. B Un A(i))";
clasohm@923
   404
by (fast_tac eq_cs 1);
clasohm@923
   405
qed "Un_INT_distrib";
clasohm@923
   406
clasohm@923
   407
goal Set.thy
clasohm@923
   408
    "(UN i:I. A(i)) Int (UN j:J. B(j)) = (UN i:I. UN j:J. A(i) Int B(j))";
clasohm@923
   409
by (fast_tac eq_cs 1);
clasohm@923
   410
qed "Int_UN_distrib2";
clasohm@923
   411
clasohm@923
   412
goal Set.thy
clasohm@923
   413
    "(INT i:I. A(i)) Un (INT j:J. B(j)) = (INT i:I. INT j:J. A(i) Un B(j))";
clasohm@923
   414
by (fast_tac eq_cs 1);
clasohm@923
   415
qed "Un_INT_distrib2";
clasohm@923
   416
nipkow@1548
   417
section "-";
clasohm@923
   418
clasohm@923
   419
goal Set.thy "A-A = {}";
clasohm@923
   420
by (fast_tac eq_cs 1);
clasohm@923
   421
qed "Diff_cancel";
nipkow@1531
   422
Addsimps[Diff_cancel];
clasohm@923
   423
clasohm@923
   424
goal Set.thy "{}-A = {}";
clasohm@923
   425
by (fast_tac eq_cs 1);
clasohm@923
   426
qed "empty_Diff";
nipkow@1531
   427
Addsimps[empty_Diff];
clasohm@923
   428
clasohm@923
   429
goal Set.thy "A-{} = A";
clasohm@923
   430
by (fast_tac eq_cs 1);
clasohm@923
   431
qed "Diff_empty";
nipkow@1531
   432
Addsimps[Diff_empty];
nipkow@1531
   433
nipkow@1531
   434
goal Set.thy "A-UNIV = {}";
nipkow@1531
   435
by (fast_tac eq_cs 1);
nipkow@1531
   436
qed "Diff_UNIV";
nipkow@1531
   437
Addsimps[Diff_UNIV];
nipkow@1531
   438
nipkow@1531
   439
goal Set.thy "!!x. x~:A ==> A - insert x B = A-B";
nipkow@1531
   440
by(fast_tac eq_cs 1);
nipkow@1531
   441
qed "Diff_insert0";
nipkow@1531
   442
Addsimps [Diff_insert0];
clasohm@923
   443
clasohm@923
   444
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*)
clasohm@923
   445
goal Set.thy "A - insert a B = A - B - {a}";
clasohm@923
   446
by (fast_tac eq_cs 1);
clasohm@923
   447
qed "Diff_insert";
clasohm@923
   448
clasohm@923
   449
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*)
clasohm@923
   450
goal Set.thy "A - insert a B = A - {a} - B";
clasohm@923
   451
by (fast_tac eq_cs 1);
clasohm@923
   452
qed "Diff_insert2";
clasohm@923
   453
nipkow@1531
   454
goal Set.thy "insert x A - B = (if x:B then A-B else insert x (A-B))";
nipkow@1531
   455
by(simp_tac (!simpset setloop split_tac[expand_if]) 1);
nipkow@1531
   456
by(fast_tac eq_cs 1);
nipkow@1531
   457
qed "insert_Diff_if";
nipkow@1531
   458
nipkow@1531
   459
goal Set.thy "!!x. x:B ==> insert x A - B = A-B";
nipkow@1531
   460
by(fast_tac eq_cs 1);
nipkow@1531
   461
qed "insert_Diff1";
nipkow@1531
   462
Addsimps [insert_Diff1];
nipkow@1531
   463
clasohm@923
   464
val prems = goal Set.thy "a:A ==> insert a (A-{a}) = A";
clasohm@923
   465
by (fast_tac (eq_cs addSIs prems) 1);
clasohm@923
   466
qed "insert_Diff";
clasohm@923
   467
clasohm@923
   468
goal Set.thy "A Int (B-A) = {}";
clasohm@923
   469
by (fast_tac eq_cs 1);
clasohm@923
   470
qed "Diff_disjoint";
nipkow@1531
   471
Addsimps[Diff_disjoint];
clasohm@923
   472
clasohm@923
   473
goal Set.thy "!!A. A<=B ==> A Un (B-A) = B";
clasohm@923
   474
by (fast_tac eq_cs 1);
clasohm@923
   475
qed "Diff_partition";
clasohm@923
   476
clasohm@923
   477
goal Set.thy "!!A. [| A<=B; B<= C |] ==> (B - (C - A)) = (A :: 'a set)";
clasohm@923
   478
by (fast_tac eq_cs 1);
clasohm@923
   479
qed "double_diff";
clasohm@923
   480
clasohm@923
   481
goal Set.thy "A - (B Un C) = (A-B) Int (A-C)";
clasohm@923
   482
by (fast_tac eq_cs 1);
clasohm@923
   483
qed "Diff_Un";
clasohm@923
   484
clasohm@923
   485
goal Set.thy "A - (B Int C) = (A-B) Un (A-C)";
clasohm@923
   486
by (fast_tac eq_cs 1);
clasohm@923
   487
qed "Diff_Int";
clasohm@923
   488
nipkow@1531
   489
Addsimps[subset_UNIV, empty_subsetI, subset_refl];