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