src/HOL/equalities.ML
author clasohm
Wed Oct 04 13:10:03 1995 +0100 (1995-10-04 ago)
changeset 1264 3eb91524b938
parent 1179 7678408f9751
child 1465 5d7a7e439cec
permissions -rw-r--r--
added local simpsets; removed IOA from 'make test'
clasohm@923
     1
(*  Title: 	HOL/equalities
clasohm@923
     2
    ID:         $Id$
clasohm@923
     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
clasohm@923
    13
(** The membership relation, : **)
clasohm@923
    14
clasohm@923
    15
goal Set.thy "x ~: {}";
clasohm@923
    16
by(fast_tac set_cs 1);
clasohm@923
    17
qed "in_empty";
clasohm@923
    18
clasohm@923
    19
goal Set.thy "x : insert y A = (x=y | x:A)";
clasohm@923
    20
by(fast_tac set_cs 1);
clasohm@923
    21
qed "in_insert";
clasohm@923
    22
clasohm@923
    23
(** insert **)
clasohm@923
    24
nipkow@1179
    25
goal Set.thy "insert a A ~= {}";
nipkow@1179
    26
by (fast_tac (set_cs addEs [equalityCE]) 1);
nipkow@1179
    27
qed"insert_not_empty";
nipkow@1179
    28
nipkow@1179
    29
bind_thm("empty_not_insert",insert_not_empty RS not_sym);
nipkow@1179
    30
clasohm@923
    31
goal Set.thy "!!a. a:A ==> insert a A = A";
clasohm@923
    32
by (fast_tac eq_cs 1);
clasohm@923
    33
qed "insert_absorb";
clasohm@923
    34
clasohm@923
    35
goal Set.thy "(insert x A <= B) = (x:B & A <= B)";
clasohm@923
    36
by (fast_tac set_cs 1);
clasohm@923
    37
qed "insert_subset";
clasohm@923
    38
clasohm@923
    39
(** Image **)
clasohm@923
    40
clasohm@923
    41
goal Set.thy "f``{} = {}";
clasohm@923
    42
by (fast_tac eq_cs 1);
clasohm@923
    43
qed "image_empty";
clasohm@923
    44
clasohm@923
    45
goal Set.thy "f``insert a B = insert (f a) (f``B)";
clasohm@923
    46
by (fast_tac eq_cs 1);
clasohm@923
    47
qed "image_insert";
clasohm@923
    48
clasohm@923
    49
(** Binary Intersection **)
clasohm@923
    50
clasohm@923
    51
goal Set.thy "A Int A = A";
clasohm@923
    52
by (fast_tac eq_cs 1);
clasohm@923
    53
qed "Int_absorb";
clasohm@923
    54
clasohm@923
    55
goal Set.thy "A Int B  =  B Int A";
clasohm@923
    56
by (fast_tac eq_cs 1);
clasohm@923
    57
qed "Int_commute";
clasohm@923
    58
clasohm@923
    59
goal Set.thy "(A Int B) Int C  =  A Int (B Int C)";
clasohm@923
    60
by (fast_tac eq_cs 1);
clasohm@923
    61
qed "Int_assoc";
clasohm@923
    62
clasohm@923
    63
goal Set.thy "{} Int B = {}";
clasohm@923
    64
by (fast_tac eq_cs 1);
clasohm@923
    65
qed "Int_empty_left";
clasohm@923
    66
clasohm@923
    67
goal Set.thy "A Int {} = {}";
clasohm@923
    68
by (fast_tac eq_cs 1);
clasohm@923
    69
qed "Int_empty_right";
clasohm@923
    70
clasohm@923
    71
goal Set.thy "A Int (B Un C)  =  (A Int B) Un (A Int C)";
clasohm@923
    72
by (fast_tac eq_cs 1);
clasohm@923
    73
qed "Int_Un_distrib";
clasohm@923
    74
clasohm@923
    75
goal Set.thy "(A<=B) = (A Int B = A)";
clasohm@923
    76
by (fast_tac (eq_cs addSEs [equalityE]) 1);
clasohm@923
    77
qed "subset_Int_eq";
clasohm@923
    78
clasohm@923
    79
(** Binary Union **)
clasohm@923
    80
clasohm@923
    81
goal Set.thy "A Un A = A";
clasohm@923
    82
by (fast_tac eq_cs 1);
clasohm@923
    83
qed "Un_absorb";
clasohm@923
    84
clasohm@923
    85
goal Set.thy "A Un B  =  B Un A";
clasohm@923
    86
by (fast_tac eq_cs 1);
clasohm@923
    87
qed "Un_commute";
clasohm@923
    88
clasohm@923
    89
goal Set.thy "(A Un B) Un C  =  A Un (B Un C)";
clasohm@923
    90
by (fast_tac eq_cs 1);
clasohm@923
    91
qed "Un_assoc";
clasohm@923
    92
clasohm@923
    93
goal Set.thy "{} Un B = B";
clasohm@923
    94
by(fast_tac eq_cs 1);
clasohm@923
    95
qed "Un_empty_left";
clasohm@923
    96
clasohm@923
    97
goal Set.thy "A Un {} = A";
clasohm@923
    98
by(fast_tac eq_cs 1);
clasohm@923
    99
qed "Un_empty_right";
clasohm@923
   100
clasohm@923
   101
goal Set.thy "insert a B Un C = insert a (B Un C)";
clasohm@923
   102
by(fast_tac eq_cs 1);
clasohm@923
   103
qed "Un_insert_left";
clasohm@923
   104
clasohm@923
   105
goal Set.thy "(A Int B) Un C  =  (A Un C) Int (B Un C)";
clasohm@923
   106
by (fast_tac eq_cs 1);
clasohm@923
   107
qed "Un_Int_distrib";
clasohm@923
   108
clasohm@923
   109
goal Set.thy
clasohm@923
   110
 "(A Int B) Un (B Int C) Un (C Int A) = (A Un B) Int (B Un C) Int (C Un A)";
clasohm@923
   111
by (fast_tac eq_cs 1);
clasohm@923
   112
qed "Un_Int_crazy";
clasohm@923
   113
clasohm@923
   114
goal Set.thy "(A<=B) = (A Un B = B)";
clasohm@923
   115
by (fast_tac (eq_cs addSEs [equalityE]) 1);
clasohm@923
   116
qed "subset_Un_eq";
clasohm@923
   117
clasohm@923
   118
goal Set.thy "(A <= insert b C) = (A <= C | b:A & A-{b} <= C)";
clasohm@923
   119
by (fast_tac eq_cs 1);
clasohm@923
   120
qed "subset_insert_iff";
clasohm@923
   121
clasohm@923
   122
goal Set.thy "(A Un B = {}) = (A = {} & B = {})";
clasohm@923
   123
by (fast_tac (eq_cs addEs [equalityCE]) 1);
clasohm@923
   124
qed "Un_empty";
clasohm@923
   125
clasohm@923
   126
(** Simple properties of Compl -- complement of a set **)
clasohm@923
   127
clasohm@923
   128
goal Set.thy "A Int Compl(A) = {}";
clasohm@923
   129
by (fast_tac eq_cs 1);
clasohm@923
   130
qed "Compl_disjoint";
clasohm@923
   131
clasohm@923
   132
goal Set.thy "A Un Compl(A) = {x.True}";
clasohm@923
   133
by (fast_tac eq_cs 1);
clasohm@923
   134
qed "Compl_partition";
clasohm@923
   135
clasohm@923
   136
goal Set.thy "Compl(Compl(A)) = A";
clasohm@923
   137
by (fast_tac eq_cs 1);
clasohm@923
   138
qed "double_complement";
clasohm@923
   139
clasohm@923
   140
goal Set.thy "Compl(A Un B) = Compl(A) Int Compl(B)";
clasohm@923
   141
by (fast_tac eq_cs 1);
clasohm@923
   142
qed "Compl_Un";
clasohm@923
   143
clasohm@923
   144
goal Set.thy "Compl(A Int B) = Compl(A) Un Compl(B)";
clasohm@923
   145
by (fast_tac eq_cs 1);
clasohm@923
   146
qed "Compl_Int";
clasohm@923
   147
clasohm@923
   148
goal Set.thy "Compl(UN x:A. B(x)) = (INT x:A. Compl(B(x)))";
clasohm@923
   149
by (fast_tac eq_cs 1);
clasohm@923
   150
qed "Compl_UN";
clasohm@923
   151
clasohm@923
   152
goal Set.thy "Compl(INT x:A. B(x)) = (UN x:A. Compl(B(x)))";
clasohm@923
   153
by (fast_tac eq_cs 1);
clasohm@923
   154
qed "Compl_INT";
clasohm@923
   155
clasohm@923
   156
(*Halmos, Naive Set Theory, page 16.*)
clasohm@923
   157
clasohm@923
   158
goal Set.thy "((A Int B) Un C = A Int (B Un C)) = (C<=A)";
clasohm@923
   159
by (fast_tac (eq_cs addSEs [equalityE]) 1);
clasohm@923
   160
qed "Un_Int_assoc_eq";
clasohm@923
   161
clasohm@923
   162
clasohm@923
   163
(** Big Union and Intersection **)
clasohm@923
   164
clasohm@923
   165
goal Set.thy "Union({}) = {}";
clasohm@923
   166
by (fast_tac eq_cs 1);
clasohm@923
   167
qed "Union_empty";
clasohm@923
   168
clasohm@923
   169
goal Set.thy "Union(insert a B) = a Un Union(B)";
clasohm@923
   170
by (fast_tac eq_cs 1);
clasohm@923
   171
qed "Union_insert";
clasohm@923
   172
clasohm@923
   173
goal Set.thy "Union(A Un B) = Union(A) Un Union(B)";
clasohm@923
   174
by (fast_tac eq_cs 1);
clasohm@923
   175
qed "Union_Un_distrib";
clasohm@923
   176
clasohm@923
   177
goal Set.thy "Union(A Int B) <= Union(A) Int Union(B)";
clasohm@923
   178
by (fast_tac set_cs 1);
clasohm@923
   179
qed "Union_Int_subset";
clasohm@923
   180
clasohm@923
   181
val prems = goal Set.thy
clasohm@923
   182
   "(Union(C) Int A = {}) = (! B:C. B Int A = {})";
clasohm@923
   183
by (fast_tac (eq_cs addSEs [equalityE]) 1);
clasohm@923
   184
qed "Union_disjoint";
clasohm@923
   185
clasohm@923
   186
goal Set.thy "Inter(A Un B) = Inter(A) Int Inter(B)";
clasohm@923
   187
by (best_tac eq_cs 1);
clasohm@923
   188
qed "Inter_Un_distrib";
clasohm@923
   189
clasohm@923
   190
(** Unions and Intersections of Families **)
clasohm@923
   191
clasohm@923
   192
(*Basic identities*)
clasohm@923
   193
nipkow@1179
   194
goal Set.thy "(UN x:{}. B x) = {}";
nipkow@1179
   195
by (fast_tac eq_cs 1);
nipkow@1179
   196
qed "UN_empty";
nipkow@1179
   197
nipkow@1179
   198
goal Set.thy "(UN x:insert a A. B x) = B a Un UNION A B";
nipkow@1179
   199
by (fast_tac eq_cs 1);
nipkow@1179
   200
qed "UN_insert";
nipkow@1179
   201
clasohm@923
   202
goal Set.thy "Union(range(f)) = (UN x.f(x))";
clasohm@923
   203
by (fast_tac eq_cs 1);
clasohm@923
   204
qed "Union_range_eq";
clasohm@923
   205
clasohm@923
   206
goal Set.thy "Inter(range(f)) = (INT x.f(x))";
clasohm@923
   207
by (fast_tac eq_cs 1);
clasohm@923
   208
qed "Inter_range_eq";
clasohm@923
   209
clasohm@923
   210
goal Set.thy "Union(B``A) = (UN x:A. B(x))";
clasohm@923
   211
by (fast_tac eq_cs 1);
clasohm@923
   212
qed "Union_image_eq";
clasohm@923
   213
clasohm@923
   214
goal Set.thy "Inter(B``A) = (INT x:A. B(x))";
clasohm@923
   215
by (fast_tac eq_cs 1);
clasohm@923
   216
qed "Inter_image_eq";
clasohm@923
   217
clasohm@923
   218
goal Set.thy "!!A. a: A ==> (UN y:A. c) = c";
clasohm@923
   219
by (fast_tac eq_cs 1);
clasohm@923
   220
qed "UN_constant";
clasohm@923
   221
clasohm@923
   222
goal Set.thy "!!A. a: A ==> (INT y:A. c) = c";
clasohm@923
   223
by (fast_tac eq_cs 1);
clasohm@923
   224
qed "INT_constant";
clasohm@923
   225
clasohm@923
   226
goal Set.thy "(UN x.B) = B";
clasohm@923
   227
by (fast_tac eq_cs 1);
clasohm@923
   228
qed "UN1_constant";
clasohm@923
   229
clasohm@923
   230
goal Set.thy "(INT x.B) = B";
clasohm@923
   231
by (fast_tac eq_cs 1);
clasohm@923
   232
qed "INT1_constant";
clasohm@923
   233
clasohm@923
   234
goal Set.thy "(UN x:A. B(x)) = Union({Y. ? x:A. Y=B(x)})";
clasohm@923
   235
by (fast_tac eq_cs 1);
clasohm@923
   236
qed "UN_eq";
clasohm@923
   237
clasohm@923
   238
(*Look: it has an EXISTENTIAL quantifier*)
clasohm@923
   239
goal Set.thy "(INT x:A. B(x)) = Inter({Y. ? x:A. Y=B(x)})";
clasohm@923
   240
by (fast_tac eq_cs 1);
clasohm@923
   241
qed "INT_eq";
clasohm@923
   242
clasohm@923
   243
(*Distributive laws...*)
clasohm@923
   244
clasohm@923
   245
goal Set.thy "A Int Union(B) = (UN C:B. A Int C)";
clasohm@923
   246
by (fast_tac eq_cs 1);
clasohm@923
   247
qed "Int_Union";
clasohm@923
   248
clasohm@923
   249
(* Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5: 
clasohm@923
   250
   Union of a family of unions **)
clasohm@923
   251
goal Set.thy "(UN x:C. A(x) Un B(x)) = Union(A``C)  Un  Union(B``C)";
clasohm@923
   252
by (fast_tac eq_cs 1);
clasohm@923
   253
qed "Un_Union_image";
clasohm@923
   254
clasohm@923
   255
(*Equivalent version*)
clasohm@923
   256
goal Set.thy "(UN i:I. A(i) Un B(i)) = (UN i:I. A(i))  Un  (UN i:I. B(i))";
clasohm@923
   257
by (fast_tac eq_cs 1);
clasohm@923
   258
qed "UN_Un_distrib";
clasohm@923
   259
clasohm@923
   260
goal Set.thy "A Un Inter(B) = (INT C:B. A Un C)";
clasohm@923
   261
by (fast_tac eq_cs 1);
clasohm@923
   262
qed "Un_Inter";
clasohm@923
   263
clasohm@923
   264
goal Set.thy "(INT x:C. A(x) Int B(x)) = Inter(A``C) Int Inter(B``C)";
clasohm@923
   265
by (best_tac eq_cs 1);
clasohm@923
   266
qed "Int_Inter_image";
clasohm@923
   267
clasohm@923
   268
(*Equivalent version*)
clasohm@923
   269
goal Set.thy "(INT i:I. A(i) Int B(i)) = (INT i:I. A(i)) Int (INT i:I. B(i))";
clasohm@923
   270
by (fast_tac eq_cs 1);
clasohm@923
   271
qed "INT_Int_distrib";
clasohm@923
   272
clasohm@923
   273
(*Halmos, Naive Set Theory, page 35.*)
clasohm@923
   274
goal Set.thy "B Int (UN i:I. A(i)) = (UN i:I. B Int A(i))";
clasohm@923
   275
by (fast_tac eq_cs 1);
clasohm@923
   276
qed "Int_UN_distrib";
clasohm@923
   277
clasohm@923
   278
goal Set.thy "B Un (INT i:I. A(i)) = (INT i:I. B Un A(i))";
clasohm@923
   279
by (fast_tac eq_cs 1);
clasohm@923
   280
qed "Un_INT_distrib";
clasohm@923
   281
clasohm@923
   282
goal Set.thy
clasohm@923
   283
    "(UN i:I. A(i)) Int (UN j:J. B(j)) = (UN i:I. UN j:J. A(i) Int B(j))";
clasohm@923
   284
by (fast_tac eq_cs 1);
clasohm@923
   285
qed "Int_UN_distrib2";
clasohm@923
   286
clasohm@923
   287
goal Set.thy
clasohm@923
   288
    "(INT i:I. A(i)) Un (INT j:J. B(j)) = (INT i:I. INT j:J. A(i) Un B(j))";
clasohm@923
   289
by (fast_tac eq_cs 1);
clasohm@923
   290
qed "Un_INT_distrib2";
clasohm@923
   291
clasohm@923
   292
(** Simple properties of Diff -- set difference **)
clasohm@923
   293
clasohm@923
   294
goal Set.thy "A-A = {}";
clasohm@923
   295
by (fast_tac eq_cs 1);
clasohm@923
   296
qed "Diff_cancel";
clasohm@923
   297
clasohm@923
   298
goal Set.thy "{}-A = {}";
clasohm@923
   299
by (fast_tac eq_cs 1);
clasohm@923
   300
qed "empty_Diff";
clasohm@923
   301
clasohm@923
   302
goal Set.thy "A-{} = A";
clasohm@923
   303
by (fast_tac eq_cs 1);
clasohm@923
   304
qed "Diff_empty";
clasohm@923
   305
clasohm@923
   306
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*)
clasohm@923
   307
goal Set.thy "A - insert a B = A - B - {a}";
clasohm@923
   308
by (fast_tac eq_cs 1);
clasohm@923
   309
qed "Diff_insert";
clasohm@923
   310
clasohm@923
   311
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*)
clasohm@923
   312
goal Set.thy "A - insert a B = A - {a} - B";
clasohm@923
   313
by (fast_tac eq_cs 1);
clasohm@923
   314
qed "Diff_insert2";
clasohm@923
   315
clasohm@923
   316
val prems = goal Set.thy "a:A ==> insert a (A-{a}) = A";
clasohm@923
   317
by (fast_tac (eq_cs addSIs prems) 1);
clasohm@923
   318
qed "insert_Diff";
clasohm@923
   319
clasohm@923
   320
goal Set.thy "A Int (B-A) = {}";
clasohm@923
   321
by (fast_tac eq_cs 1);
clasohm@923
   322
qed "Diff_disjoint";
clasohm@923
   323
clasohm@923
   324
goal Set.thy "!!A. A<=B ==> A Un (B-A) = B";
clasohm@923
   325
by (fast_tac eq_cs 1);
clasohm@923
   326
qed "Diff_partition";
clasohm@923
   327
clasohm@923
   328
goal Set.thy "!!A. [| A<=B; B<= C |] ==> (B - (C - A)) = (A :: 'a set)";
clasohm@923
   329
by (fast_tac eq_cs 1);
clasohm@923
   330
qed "double_diff";
clasohm@923
   331
clasohm@923
   332
goal Set.thy "A - (B Un C) = (A-B) Int (A-C)";
clasohm@923
   333
by (fast_tac eq_cs 1);
clasohm@923
   334
qed "Diff_Un";
clasohm@923
   335
clasohm@923
   336
goal Set.thy "A - (B Int C) = (A-B) Un (A-C)";
clasohm@923
   337
by (fast_tac eq_cs 1);
clasohm@923
   338
qed "Diff_Int";
clasohm@923
   339
clasohm@1264
   340
Addsimps
clasohm@923
   341
  [in_empty,in_insert,insert_subset,
nipkow@1179
   342
   insert_not_empty,empty_not_insert,
clasohm@923
   343
   Int_absorb,Int_empty_left,Int_empty_right,
clasohm@923
   344
   Un_absorb,Un_empty_left,Un_empty_right,Un_empty,
nipkow@1179
   345
   UN_empty, UN_insert,
clasohm@923
   346
   UN1_constant,image_empty,
clasohm@923
   347
   Compl_disjoint,double_complement,
clasohm@923
   348
   Union_empty,Union_insert,empty_subsetI,subset_refl,
clasohm@923
   349
   Diff_cancel,empty_Diff,Diff_empty,Diff_disjoint];