src/ZF/equalities.thy
author paulson
Mon May 20 11:45:57 2002 +0200 (2002-05-20)
changeset 13165 31d020705aff
parent 2469 b50b8c0eec01
child 13168 afcbca3498b0
permissions -rw-r--r--
conversion of equalities and WF to Isar
paulson@13165
     1
(*  Title:      ZF/equalities
paulson@13165
     2
    ID:         $Id$
paulson@13165
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
paulson@13165
     4
    Copyright   1992  University of Cambridge
paulson@13165
     5
paulson@13165
     6
Set Theory examples: Union, Intersection, Inclusion, etc.
paulson@13165
     7
    (Thanks also to Philippe de Groote.)
paulson@13165
     8
*)
paulson@13165
     9
paulson@13165
    10
theory equalities = domrange:
paulson@13165
    11
paulson@13165
    12
(** Finite Sets **)
paulson@13165
    13
paulson@13165
    14
(* cons_def refers to Upair; reversing the equality LOOPS in rewriting!*)
paulson@13165
    15
lemma cons_eq: "{a} Un B = cons(a,B)"
paulson@13165
    16
by blast
paulson@13165
    17
paulson@13165
    18
lemma cons_commute: "cons(a, cons(b, C)) = cons(b, cons(a, C))"
paulson@13165
    19
by blast
paulson@13165
    20
paulson@13165
    21
lemma cons_absorb: "a: B ==> cons(a,B) = B"
paulson@13165
    22
by blast
paulson@13165
    23
paulson@13165
    24
lemma cons_Diff: "a: B ==> cons(a, B-{a}) = B"
paulson@13165
    25
by blast
paulson@13165
    26
paulson@13165
    27
lemma equal_singleton [rule_format]: "[| a: C;  ALL y:C. y=b |] ==> C = {b}"
paulson@13165
    28
by blast
paulson@13165
    29
paulson@13165
    30
paulson@13165
    31
(** Binary Intersection **)
paulson@13165
    32
paulson@13165
    33
(*NOT an equality, but it seems to belong here...*)
paulson@13165
    34
lemma Int_cons: "cons(a,B) Int C <= cons(a, B Int C)"
paulson@13165
    35
by blast
paulson@13165
    36
paulson@13165
    37
lemma Int_absorb [simp]: "A Int A = A"
paulson@13165
    38
by blast
paulson@13165
    39
paulson@13165
    40
lemma Int_left_absorb: "A Int (A Int B) = A Int B"
paulson@13165
    41
by blast
paulson@13165
    42
paulson@13165
    43
lemma Int_commute: "A Int B = B Int A"
paulson@13165
    44
by blast
paulson@13165
    45
paulson@13165
    46
lemma Int_left_commute: "A Int (B Int C) = B Int (A Int C)"
paulson@13165
    47
by blast
paulson@13165
    48
paulson@13165
    49
lemma Int_assoc: "(A Int B) Int C  =  A Int (B Int C)"
paulson@13165
    50
by blast
paulson@13165
    51
paulson@13165
    52
(*Intersection is an AC-operator*)
paulson@13165
    53
lemmas Int_ac= Int_assoc Int_left_absorb Int_commute Int_left_commute
paulson@13165
    54
paulson@13165
    55
lemma Int_Un_distrib: "A Int (B Un C) = (A Int B) Un (A Int C)"
paulson@13165
    56
by blast
paulson@13165
    57
paulson@13165
    58
lemma Int_Un_distrib2: "(B Un C) Int A = (B Int A) Un (C Int A)"
paulson@13165
    59
by blast
paulson@13165
    60
paulson@13165
    61
lemma subset_Int_iff: "A<=B <-> A Int B = A"
paulson@13165
    62
by (blast elim!: equalityE)
paulson@13165
    63
paulson@13165
    64
lemma subset_Int_iff2: "A<=B <-> B Int A = A"
paulson@13165
    65
by (blast elim!: equalityE)
paulson@13165
    66
paulson@13165
    67
lemma Int_Diff_eq: "C<=A ==> (A-B) Int C = C-B"
paulson@13165
    68
by blast
paulson@13165
    69
paulson@13165
    70
(** Binary Union **)
paulson@13165
    71
paulson@13165
    72
lemma Un_cons: "cons(a,B) Un C = cons(a, B Un C)"
paulson@13165
    73
by blast
paulson@13165
    74
paulson@13165
    75
lemma Un_absorb [simp]: "A Un A = A"
paulson@13165
    76
by blast
paulson@13165
    77
paulson@13165
    78
lemma Un_left_absorb: "A Un (A Un B) = A Un B"
paulson@13165
    79
by blast
paulson@13165
    80
paulson@13165
    81
lemma Un_commute: "A Un B = B Un A"
paulson@13165
    82
by blast
paulson@13165
    83
paulson@13165
    84
lemma Un_left_commute: "A Un (B Un C) = B Un (A Un C)"
paulson@13165
    85
by blast
paulson@13165
    86
paulson@13165
    87
lemma Un_assoc: "(A Un B) Un C  =  A Un (B Un C)"
paulson@13165
    88
by blast
paulson@13165
    89
paulson@13165
    90
(*Union is an AC-operator*)
paulson@13165
    91
lemmas Un_ac = Un_assoc Un_left_absorb Un_commute Un_left_commute
paulson@13165
    92
paulson@13165
    93
lemma Un_Int_distrib: "(A Int B) Un C  =  (A Un C) Int (B Un C)"
paulson@13165
    94
by blast
paulson@13165
    95
paulson@13165
    96
lemma subset_Un_iff: "A<=B <-> A Un B = B"
paulson@13165
    97
by (blast elim!: equalityE)
paulson@13165
    98
paulson@13165
    99
lemma subset_Un_iff2: "A<=B <-> B Un A = B"
paulson@13165
   100
by (blast elim!: equalityE)
paulson@13165
   101
paulson@13165
   102
lemma Un_empty [iff]: "(A Un B = 0) <-> (A = 0 & B = 0)"
paulson@13165
   103
by blast
paulson@13165
   104
paulson@13165
   105
lemma Un_eq_Union: "A Un B = Union({A, B})"
paulson@13165
   106
by blast
paulson@13165
   107
paulson@13165
   108
(** Simple properties of Diff -- set difference **)
paulson@13165
   109
paulson@13165
   110
lemma Diff_cancel: "A - A = 0"
paulson@13165
   111
by blast
paulson@13165
   112
paulson@13165
   113
lemma Diff_triv: "A  Int B = 0 ==> A - B = A"
paulson@13165
   114
by blast
paulson@13165
   115
paulson@13165
   116
lemma empty_Diff [simp]: "0 - A = 0"
paulson@13165
   117
by blast
paulson@13165
   118
paulson@13165
   119
lemma Diff_0 [simp]: "A - 0 = A"
paulson@13165
   120
by blast
paulson@13165
   121
paulson@13165
   122
lemma Diff_eq_0_iff: "A - B = 0 <-> A <= B"
paulson@13165
   123
by (blast elim: equalityE)
paulson@13165
   124
paulson@13165
   125
(*NOT SUITABLE FOR REWRITING since {a} == cons(a,0)*)
paulson@13165
   126
lemma Diff_cons: "A - cons(a,B) = A - B - {a}"
paulson@13165
   127
by blast
paulson@13165
   128
paulson@13165
   129
(*NOT SUITABLE FOR REWRITING since {a} == cons(a,0)*)
paulson@13165
   130
lemma Diff_cons2: "A - cons(a,B) = A - {a} - B"
paulson@13165
   131
by blast
paulson@13165
   132
paulson@13165
   133
lemma Diff_disjoint: "A Int (B-A) = 0"
paulson@13165
   134
by blast
paulson@13165
   135
paulson@13165
   136
lemma Diff_partition: "A<=B ==> A Un (B-A) = B"
paulson@13165
   137
by blast
paulson@13165
   138
paulson@13165
   139
lemma subset_Un_Diff: "A <= B Un (A - B)"
paulson@13165
   140
by blast
paulson@13165
   141
paulson@13165
   142
lemma double_complement: "[| A<=B; B<=C |] ==> B-(C-A) = A"
paulson@13165
   143
by blast
paulson@13165
   144
paulson@13165
   145
lemma double_complement_Un: "(A Un B) - (B-A) = A"
paulson@13165
   146
by blast
paulson@13165
   147
paulson@13165
   148
lemma Un_Int_crazy: 
paulson@13165
   149
 "(A Int B) Un (B Int C) Un (C Int A) = (A Un B) Int (B Un C) Int (C Un A)"
paulson@13165
   150
apply blast
paulson@13165
   151
done
paulson@13165
   152
paulson@13165
   153
lemma Diff_Un: "A - (B Un C) = (A-B) Int (A-C)"
paulson@13165
   154
by blast
paulson@13165
   155
paulson@13165
   156
lemma Diff_Int: "A - (B Int C) = (A-B) Un (A-C)"
paulson@13165
   157
by blast
paulson@13165
   158
paulson@13165
   159
lemma Un_Diff: "(A Un B) - C = (A - C) Un (B - C)"
paulson@13165
   160
by blast
paulson@13165
   161
paulson@13165
   162
lemma Int_Diff: "(A Int B) - C = A Int (B - C)"
paulson@13165
   163
by blast
paulson@13165
   164
paulson@13165
   165
lemma Diff_Int_distrib: "C Int (A-B) = (C Int A) - (C Int B)"
paulson@13165
   166
by blast
paulson@13165
   167
paulson@13165
   168
lemma Diff_Int_distrib2: "(A-B) Int C = (A Int C) - (B Int C)"
paulson@13165
   169
by blast
paulson@13165
   170
paulson@13165
   171
(*Halmos, Naive Set Theory, page 16.*)
paulson@13165
   172
lemma Un_Int_assoc_iff: "(A Int B) Un C = A Int (B Un C)  <->  C<=A"
paulson@13165
   173
by (blast elim!: equalityE)
paulson@13165
   174
paulson@13165
   175
paulson@13165
   176
(** Big Union and Intersection **)
paulson@13165
   177
paulson@13165
   178
lemma Union_cons [simp]: "Union(cons(a,B)) = a Un Union(B)"
paulson@13165
   179
by blast
paulson@13165
   180
paulson@13165
   181
lemma Union_Un_distrib: "Union(A Un B) = Union(A) Un Union(B)"
paulson@13165
   182
by blast
paulson@13165
   183
paulson@13165
   184
lemma Union_Int_subset: "Union(A Int B) <= Union(A) Int Union(B)"
paulson@13165
   185
by blast
paulson@13165
   186
paulson@13165
   187
lemma Union_disjoint: "Union(C) Int A = 0 <-> (ALL B:C. B Int A = 0)"
paulson@13165
   188
by (blast elim!: equalityE)
paulson@13165
   189
paulson@13165
   190
lemma Union_empty_iff: "Union(A) = 0 <-> (ALL B:A. B=0)"
paulson@13165
   191
by blast
paulson@13165
   192
paulson@13165
   193
lemma Inter_0: "Inter(0) = 0"
paulson@13165
   194
by (unfold Inter_def, blast)
paulson@13165
   195
paulson@13165
   196
lemma Inter_Un_subset: "[| z:A; z:B |] ==> Inter(A) Un Inter(B) <= Inter(A Int B)"
paulson@13165
   197
by blast
paulson@13165
   198
paulson@13165
   199
(* A good challenge: Inter is ill-behaved on the empty set *)
paulson@13165
   200
lemma Inter_Un_distrib:
paulson@13165
   201
     "[| a:A;  b:B |] ==> Inter(A Un B) = Inter(A) Int Inter(B)"
paulson@13165
   202
by blast
paulson@13165
   203
paulson@13165
   204
lemma Union_singleton: "Union({b}) = b"
paulson@13165
   205
by blast
paulson@13165
   206
paulson@13165
   207
lemma Inter_singleton: "Inter({b}) = b"
paulson@13165
   208
by blast
paulson@13165
   209
paulson@13165
   210
lemma Inter_cons [simp]:
paulson@13165
   211
     "Inter(cons(a,B)) = (if B=0 then a else a Int Inter(B))"
paulson@13165
   212
by force
paulson@13165
   213
paulson@13165
   214
(** Unions and Intersections of Families **)
paulson@13165
   215
paulson@13165
   216
lemma Union_eq_UN: "Union(A) = (UN x:A. x)"
paulson@13165
   217
by blast
paulson@13165
   218
paulson@13165
   219
lemma Inter_eq_INT: "Inter(A) = (INT x:A. x)"
paulson@13165
   220
by (unfold Inter_def, blast)
paulson@13165
   221
paulson@13165
   222
lemma UN_0 [simp]: "(UN i:0. A(i)) = 0"
paulson@13165
   223
by blast
paulson@13165
   224
paulson@13165
   225
lemma UN_singleton: "(UN x:A. {x}) = A"
paulson@13165
   226
by blast
paulson@13165
   227
paulson@13165
   228
lemma UN_Un: "(UN i: A Un B. C(i)) = (UN i: A. C(i)) Un (UN i:B. C(i))"
paulson@13165
   229
by blast
paulson@13165
   230
paulson@13165
   231
lemma INT_Un: "(INT i:I Un J. A(i)) = (if I=0 then INT j:J. A(j)  
paulson@13165
   232
                              else if J=0 then INT i:I. A(i)  
paulson@13165
   233
                              else ((INT i:I. A(i)) Int  (INT j:J. A(j))))"
paulson@13165
   234
apply auto
paulson@13165
   235
apply (blast intro!: equalityI)
paulson@13165
   236
done
paulson@13165
   237
paulson@13165
   238
lemma UN_UN_flatten: "(UN x : (UN y:A. B(y)). C(x)) = (UN y:A. UN x: B(y). C(x))"
paulson@13165
   239
by blast
paulson@13165
   240
paulson@13165
   241
(*Halmos, Naive Set Theory, page 35.*)
paulson@13165
   242
lemma Int_UN_distrib: "B Int (UN i:I. A(i)) = (UN i:I. B Int A(i))"
paulson@13165
   243
by blast
paulson@13165
   244
paulson@13165
   245
lemma Un_INT_distrib: "i:I ==> B Un (INT i:I. A(i)) = (INT i:I. B Un A(i))"
paulson@13165
   246
by blast
paulson@13165
   247
paulson@13165
   248
lemma Int_UN_distrib2:
paulson@13165
   249
     "(UN i:I. A(i)) Int (UN j:J. B(j)) = (UN i:I. UN j:J. A(i) Int B(j))"
paulson@13165
   250
by blast
paulson@13165
   251
paulson@13165
   252
lemma Un_INT_distrib2: "[| i:I;  j:J |] ==>  
paulson@13165
   253
      (INT i:I. A(i)) Un (INT j:J. B(j)) = (INT i:I. INT j:J. A(i) Un B(j))"
paulson@13165
   254
by blast
paulson@13165
   255
paulson@13165
   256
lemma UN_constant: "a: A ==> (UN y:A. c) = c"
paulson@13165
   257
by blast
paulson@13165
   258
paulson@13165
   259
lemma INT_constant: "a: A ==> (INT y:A. c) = c"
paulson@13165
   260
by blast
paulson@13165
   261
paulson@13165
   262
lemma UN_RepFun [simp]: "(UN y: RepFun(A,f). B(y)) = (UN x:A. B(f(x)))"
paulson@13165
   263
by blast
paulson@13165
   264
paulson@13165
   265
lemma INT_RepFun [simp]: "(INT x:RepFun(A,f). B(x))    = (INT a:A. B(f(a)))"
paulson@13165
   266
by (auto simp add: Inter_def)
paulson@13165
   267
paulson@13165
   268
lemma INT_Union_eq:
paulson@13165
   269
     "0 ~: A ==> (INT x: Union(A). B(x)) = (INT y:A. INT x:y. B(x))"
paulson@13165
   270
apply (simp add: Inter_def)
paulson@13165
   271
apply (subgoal_tac "ALL x:A. x~=0")
paulson@13165
   272
prefer 2 apply blast
paulson@13165
   273
apply force
paulson@13165
   274
done
paulson@13165
   275
paulson@13165
   276
lemma INT_UN_eq: "(ALL x:A. B(x) ~= 0)  
paulson@13165
   277
      ==> (INT z: (UN x:A. B(x)). C(z)) = (INT x:A. INT z: B(x). C(z))"
paulson@13165
   278
apply (subst INT_Union_eq, blast)
paulson@13165
   279
apply (simp add: Inter_def)
paulson@13165
   280
done
paulson@13165
   281
paulson@13165
   282
paulson@13165
   283
(** Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5: 
paulson@13165
   284
    Union of a family of unions **)
paulson@13165
   285
paulson@13165
   286
lemma UN_Un_distrib:
paulson@13165
   287
     "(UN i:I. A(i) Un B(i)) = (UN i:I. A(i))  Un  (UN i:I. B(i))"
paulson@13165
   288
by blast
paulson@13165
   289
paulson@13165
   290
lemma INT_Int_distrib:
paulson@13165
   291
     "i:I ==> (INT i:I. A(i) Int B(i)) = (INT i:I. A(i)) Int (INT i:I. B(i))"
paulson@13165
   292
by blast
paulson@13165
   293
paulson@13165
   294
lemma UN_Int_subset:
paulson@13165
   295
     "(UN z:I Int J. A(z)) <= (UN z:I. A(z)) Int (UN z:J. A(z))"
paulson@13165
   296
by blast
paulson@13165
   297
paulson@13165
   298
(** Devlin, page 12, exercise 5: Complements **)
paulson@13165
   299
paulson@13165
   300
lemma Diff_UN: "i:I ==> B - (UN i:I. A(i)) = (INT i:I. B - A(i))"
paulson@13165
   301
by blast
paulson@13165
   302
paulson@13165
   303
lemma Diff_INT: "i:I ==> B - (INT i:I. A(i)) = (UN i:I. B - A(i))"
paulson@13165
   304
by blast
paulson@13165
   305
paulson@13165
   306
(** Unions and Intersections with General Sum **)
paulson@13165
   307
paulson@13165
   308
(*Not suitable for rewriting: LOOPS!*)
paulson@13165
   309
lemma Sigma_cons1: "Sigma(cons(a,B), C) = ({a}*C(a)) Un Sigma(B,C)"
paulson@13165
   310
by blast
paulson@13165
   311
paulson@13165
   312
(*Not suitable for rewriting: LOOPS!*)
paulson@13165
   313
lemma Sigma_cons2: "A * cons(b,B) = A*{b} Un A*B"
paulson@13165
   314
by blast
paulson@13165
   315
paulson@13165
   316
lemma Sigma_succ1: "Sigma(succ(A), B) = ({A}*B(A)) Un Sigma(A,B)"
paulson@13165
   317
by blast
paulson@13165
   318
paulson@13165
   319
lemma Sigma_succ2: "A * succ(B) = A*{B} Un A*B"
paulson@13165
   320
by blast
paulson@13165
   321
paulson@13165
   322
lemma SUM_UN_distrib1:
paulson@13165
   323
     "(SUM x:(UN y:A. C(y)). B(x)) = (UN y:A. SUM x:C(y). B(x))"
paulson@13165
   324
by blast
paulson@13165
   325
paulson@13165
   326
lemma SUM_UN_distrib2:
paulson@13165
   327
     "(SUM i:I. UN j:J. C(i,j)) = (UN j:J. SUM i:I. C(i,j))"
paulson@13165
   328
by blast
paulson@13165
   329
paulson@13165
   330
lemma SUM_Un_distrib1:
paulson@13165
   331
     "(SUM i:I Un J. C(i)) = (SUM i:I. C(i)) Un (SUM j:J. C(j))"
paulson@13165
   332
by blast
paulson@13165
   333
paulson@13165
   334
lemma SUM_Un_distrib2:
paulson@13165
   335
     "(SUM i:I. A(i) Un B(i)) = (SUM i:I. A(i)) Un (SUM i:I. B(i))"
paulson@13165
   336
by blast
paulson@13165
   337
paulson@13165
   338
(*First-order version of the above, for rewriting*)
paulson@13165
   339
lemma prod_Un_distrib2: "I * (A Un B) = I*A Un I*B"
paulson@13165
   340
by (rule SUM_Un_distrib2)
paulson@13165
   341
paulson@13165
   342
lemma SUM_Int_distrib1:
paulson@13165
   343
     "(SUM i:I Int J. C(i)) = (SUM i:I. C(i)) Int (SUM j:J. C(j))"
paulson@13165
   344
by blast
paulson@13165
   345
paulson@13165
   346
lemma SUM_Int_distrib2:
paulson@13165
   347
     "(SUM i:I. A(i) Int B(i)) = (SUM i:I. A(i)) Int (SUM i:I. B(i))"
paulson@13165
   348
by blast
paulson@13165
   349
paulson@13165
   350
(*First-order version of the above, for rewriting*)
paulson@13165
   351
lemma prod_Int_distrib2: "I * (A Int B) = I*A Int I*B"
paulson@13165
   352
by (rule SUM_Int_distrib2)
paulson@13165
   353
paulson@13165
   354
(*Cf Aczel, Non-Well-Founded Sets, page 115*)
paulson@13165
   355
lemma SUM_eq_UN: "(SUM i:I. A(i)) = (UN i:I. {i} * A(i))"
paulson@13165
   356
by blast
paulson@13165
   357
paulson@13165
   358
(** Domain **)
paulson@13165
   359
paulson@13165
   360
lemma domain_of_prod: "b:B ==> domain(A*B) = A"
paulson@13165
   361
by blast
paulson@13165
   362
paulson@13165
   363
lemma domain_0 [simp]: "domain(0) = 0"
paulson@13165
   364
by blast
paulson@13165
   365
paulson@13165
   366
lemma domain_cons [simp]: "domain(cons(<a,b>,r)) = cons(a, domain(r))"
paulson@13165
   367
by blast
paulson@13165
   368
paulson@13165
   369
lemma domain_Un_eq [simp]: "domain(A Un B) = domain(A) Un domain(B)"
paulson@13165
   370
by blast
paulson@13165
   371
paulson@13165
   372
lemma domain_Int_subset: "domain(A Int B) <= domain(A) Int domain(B)"
paulson@13165
   373
by blast
paulson@13165
   374
paulson@13165
   375
lemma domain_Diff_subset: "domain(A) - domain(B) <= domain(A - B)"
paulson@13165
   376
by blast
paulson@13165
   377
paulson@13165
   378
lemma domain_converse [simp]: "domain(converse(r)) = range(r)"
paulson@13165
   379
by blast
clasohm@124
   380
paulson@13165
   381
lemma domain_UN: "domain(UN x:A. B(x)) = (UN x:A. domain(B(x)))"
paulson@13165
   382
by blast
paulson@13165
   383
paulson@13165
   384
lemma domain_Union: "domain(Union(A)) = (UN x:A. domain(x))"
paulson@13165
   385
by blast
paulson@13165
   386
paulson@13165
   387
paulson@13165
   388
(** Range **)
paulson@13165
   389
paulson@13165
   390
lemma range_of_prod: "a:A ==> range(A*B) = B"
paulson@13165
   391
by blast
paulson@13165
   392
paulson@13165
   393
lemma range_0 [simp]: "range(0) = 0"
paulson@13165
   394
by blast
paulson@13165
   395
paulson@13165
   396
lemma range_cons [simp]: "range(cons(<a,b>,r)) = cons(b, range(r))"
paulson@13165
   397
by blast
paulson@13165
   398
paulson@13165
   399
lemma range_Un_eq [simp]: "range(A Un B) = range(A) Un range(B)"
paulson@13165
   400
by blast
paulson@13165
   401
paulson@13165
   402
lemma range_Int_subset: "range(A Int B) <= range(A) Int range(B)"
paulson@13165
   403
by blast
paulson@13165
   404
paulson@13165
   405
lemma range_Diff_subset: "range(A) - range(B) <= range(A - B)"
paulson@13165
   406
by blast
paulson@13165
   407
paulson@13165
   408
lemma range_converse [simp]: "range(converse(r)) = domain(r)"
paulson@13165
   409
by blast
paulson@13165
   410
paulson@13165
   411
paulson@13165
   412
(** Field **)
paulson@13165
   413
paulson@13165
   414
lemma field_of_prod: "field(A*A) = A"
paulson@13165
   415
by blast
paulson@13165
   416
paulson@13165
   417
lemma field_0 [simp]: "field(0) = 0"
paulson@13165
   418
by blast
paulson@13165
   419
paulson@13165
   420
lemma field_cons [simp]: "field(cons(<a,b>,r)) = cons(a, cons(b, field(r)))"
paulson@13165
   421
by blast
paulson@13165
   422
paulson@13165
   423
lemma field_Un_eq [simp]: "field(A Un B) = field(A) Un field(B)"
paulson@13165
   424
by blast
paulson@13165
   425
paulson@13165
   426
lemma field_Int_subset: "field(A Int B) <= field(A) Int field(B)"
paulson@13165
   427
by blast
paulson@13165
   428
paulson@13165
   429
lemma field_Diff_subset: "field(A) - field(B) <= field(A - B)"
paulson@13165
   430
by blast
paulson@13165
   431
paulson@13165
   432
lemma field_converse [simp]: "field(converse(r)) = field(r)"
paulson@13165
   433
by blast
paulson@13165
   434
paulson@13165
   435
paulson@13165
   436
(** Image **)
paulson@13165
   437
paulson@13165
   438
lemma image_0 [simp]: "r``0 = 0"
paulson@13165
   439
by blast
paulson@13165
   440
paulson@13165
   441
lemma image_Un [simp]: "r``(A Un B) = (r``A) Un (r``B)"
paulson@13165
   442
by blast
paulson@13165
   443
paulson@13165
   444
lemma image_Int_subset: "r``(A Int B) <= (r``A) Int (r``B)"
paulson@13165
   445
by blast
paulson@13165
   446
paulson@13165
   447
lemma image_Int_square_subset: "(r Int A*A)``B <= (r``B) Int A"
paulson@13165
   448
by blast
paulson@13165
   449
paulson@13165
   450
lemma image_Int_square: "B<=A ==> (r Int A*A)``B = (r``B) Int A"
paulson@13165
   451
by blast
paulson@13165
   452
paulson@13165
   453
paulson@13165
   454
(*Image laws for special relations*)
paulson@13165
   455
lemma image_0_left [simp]: "0``A = 0"
paulson@13165
   456
by blast
paulson@13165
   457
paulson@13165
   458
lemma image_Un_left: "(r Un s)``A = (r``A) Un (s``A)"
paulson@13165
   459
by blast
paulson@13165
   460
paulson@13165
   461
lemma image_Int_subset_left: "(r Int s)``A <= (r``A) Int (s``A)"
paulson@13165
   462
by blast
paulson@13165
   463
paulson@13165
   464
paulson@13165
   465
(** Inverse Image **)
paulson@13165
   466
paulson@13165
   467
lemma vimage_0 [simp]: "r-``0 = 0"
paulson@13165
   468
by blast
paulson@13165
   469
paulson@13165
   470
lemma vimage_Un [simp]: "r-``(A Un B) = (r-``A) Un (r-``B)"
paulson@13165
   471
by blast
paulson@13165
   472
paulson@13165
   473
lemma vimage_Int_subset: "r-``(A Int B) <= (r-``A) Int (r-``B)"
paulson@13165
   474
by blast
paulson@13165
   475
paulson@13165
   476
(*NOT suitable for rewriting*)
paulson@13165
   477
lemma vimage_eq_UN: "f -``B = (UN y:B. f-``{y})"
paulson@13165
   478
by blast
paulson@13165
   479
paulson@13165
   480
lemma function_vimage_Int:
paulson@13165
   481
     "function(f) ==> f-``(A Int B) = (f-``A)  Int  (f-``B)"
paulson@13165
   482
by (unfold function_def, blast)
paulson@13165
   483
paulson@13165
   484
lemma function_vimage_Diff: "function(f) ==> f-``(A-B) = (f-``A) - (f-``B)"
paulson@13165
   485
by (unfold function_def, blast)
paulson@13165
   486
paulson@13165
   487
lemma function_image_vimage: "function(f) ==> f `` (f-`` A) <= A"
paulson@13165
   488
by (unfold function_def, blast)
paulson@13165
   489
paulson@13165
   490
lemma vimage_Int_square_subset: "(r Int A*A)-``B <= (r-``B) Int A"
paulson@13165
   491
by blast
paulson@13165
   492
paulson@13165
   493
lemma vimage_Int_square: "B<=A ==> (r Int A*A)-``B = (r-``B) Int A"
paulson@13165
   494
by blast
paulson@13165
   495
paulson@13165
   496
paulson@13165
   497
paulson@13165
   498
(*Invese image laws for special relations*)
paulson@13165
   499
lemma vimage_0_left [simp]: "0-``A = 0"
paulson@13165
   500
by blast
paulson@13165
   501
paulson@13165
   502
lemma vimage_Un_left: "(r Un s)-``A = (r-``A) Un (s-``A)"
paulson@13165
   503
by blast
paulson@13165
   504
paulson@13165
   505
lemma vimage_Int_subset_left: "(r Int s)-``A <= (r-``A) Int (s-``A)"
paulson@13165
   506
by blast
paulson@13165
   507
paulson@13165
   508
paulson@13165
   509
(** Converse **)
paulson@13165
   510
paulson@13165
   511
lemma converse_Un [simp]: "converse(A Un B) = converse(A) Un converse(B)"
paulson@13165
   512
by blast
paulson@13165
   513
paulson@13165
   514
lemma converse_Int [simp]: "converse(A Int B) = converse(A) Int converse(B)"
paulson@13165
   515
by blast
paulson@13165
   516
paulson@13165
   517
lemma converse_Diff [simp]: "converse(A - B) = converse(A) - converse(B)"
paulson@13165
   518
by blast
paulson@13165
   519
paulson@13165
   520
lemma converse_UN [simp]: "converse(UN x:A. B(x)) = (UN x:A. converse(B(x)))"
paulson@13165
   521
by blast
paulson@13165
   522
paulson@13165
   523
(*Unfolding Inter avoids using excluded middle on A=0*)
paulson@13165
   524
lemma converse_INT [simp]:
paulson@13165
   525
     "converse(INT x:A. B(x)) = (INT x:A. converse(B(x)))"
paulson@13165
   526
apply (unfold Inter_def, blast)
paulson@13165
   527
done
paulson@13165
   528
paulson@13165
   529
(** Pow **)
paulson@13165
   530
paulson@13165
   531
lemma Pow_0 [simp]: "Pow(0) = {0}"
paulson@13165
   532
by blast
paulson@13165
   533
paulson@13165
   534
lemma Pow_insert: "Pow (cons(a,A)) = Pow(A) Un {cons(a,X) . X: Pow(A)}"
paulson@13165
   535
apply (rule equalityI, safe)
paulson@13165
   536
apply (erule swap)
paulson@13165
   537
apply (rule_tac a = "x-{a}" in RepFun_eqI, auto) 
paulson@13165
   538
done
paulson@13165
   539
paulson@13165
   540
lemma Un_Pow_subset: "Pow(A) Un Pow(B) <= Pow(A Un B)"
paulson@13165
   541
by blast
paulson@13165
   542
paulson@13165
   543
lemma UN_Pow_subset: "(UN x:A. Pow(B(x))) <= Pow(UN x:A. B(x))"
paulson@13165
   544
by blast
paulson@13165
   545
paulson@13165
   546
lemma subset_Pow_Union: "A <= Pow(Union(A))"
paulson@13165
   547
by blast
paulson@13165
   548
paulson@13165
   549
lemma Union_Pow_eq [simp]: "Union(Pow(A)) = A"
paulson@13165
   550
by blast
paulson@13165
   551
paulson@13165
   552
lemma Pow_Int_eq [simp]: "Pow(A Int B) = Pow(A) Int Pow(B)"
paulson@13165
   553
by blast
paulson@13165
   554
paulson@13165
   555
lemma Pow_INT_eq: "x:A ==> Pow(INT x:A. B(x)) = (INT x:A. Pow(B(x)))"
paulson@13165
   556
by blast
paulson@13165
   557
paulson@13165
   558
(** RepFun **)
paulson@13165
   559
paulson@13165
   560
lemma RepFun_eq_0_iff [simp]: "{f(x).x:A}=0 <-> A=0"
paulson@13165
   561
by blast
paulson@13165
   562
paulson@13165
   563
lemma RepFun_constant [simp]: "{c. x:A} = (if A=0 then 0 else {c})"
paulson@13165
   564
apply auto
paulson@13165
   565
apply blast
paulson@13165
   566
done
paulson@13165
   567
paulson@13165
   568
(** Collect **)
paulson@2469
   569
paulson@13165
   570
lemma Collect_Un: "Collect(A Un B, P) = Collect(A,P) Un Collect(B,P)"
paulson@13165
   571
by blast
paulson@13165
   572
paulson@13165
   573
lemma Collect_Int: "Collect(A Int B, P) = Collect(A,P) Int Collect(B,P)"
paulson@13165
   574
by blast
paulson@13165
   575
paulson@13165
   576
lemma Collect_Diff: "Collect(A - B, P) = Collect(A,P) - Collect(B,P)"
paulson@13165
   577
by blast
paulson@13165
   578
paulson@13165
   579
lemma Collect_cons: "{x:cons(a,B). P(x)} =  
paulson@13165
   580
      (if P(a) then cons(a, {x:B. P(x)}) else {x:B. P(x)})"
paulson@13165
   581
by (simp, blast)
paulson@13165
   582
paulson@13165
   583
lemma Int_Collect_self_eq: "A Int Collect(A,P) = Collect(A,P)"
paulson@13165
   584
by blast
paulson@13165
   585
paulson@13165
   586
lemma Collect_Collect_eq [simp]:
paulson@13165
   587
     "Collect(Collect(A,P), Q) = Collect(A, %x. P(x) & Q(x))"
paulson@13165
   588
by blast
paulson@13165
   589
paulson@13165
   590
lemma Collect_Int_Collect_eq:
paulson@13165
   591
     "Collect(A,P) Int Collect(A,Q) = Collect(A, %x. P(x) & Q(x))"
paulson@13165
   592
by blast
paulson@13165
   593
paulson@13165
   594
ML
paulson@13165
   595
{*
paulson@13165
   596
val cons_eq = thm "cons_eq";
paulson@13165
   597
val cons_commute = thm "cons_commute";
paulson@13165
   598
val cons_absorb = thm "cons_absorb";
paulson@13165
   599
val cons_Diff = thm "cons_Diff";
paulson@13165
   600
val equal_singleton = thm "equal_singleton";
paulson@13165
   601
val Int_cons = thm "Int_cons";
paulson@13165
   602
val Int_absorb = thm "Int_absorb";
paulson@13165
   603
val Int_left_absorb = thm "Int_left_absorb";
paulson@13165
   604
val Int_commute = thm "Int_commute";
paulson@13165
   605
val Int_left_commute = thm "Int_left_commute";
paulson@13165
   606
val Int_assoc = thm "Int_assoc";
paulson@13165
   607
val Int_Un_distrib = thm "Int_Un_distrib";
paulson@13165
   608
val Int_Un_distrib2 = thm "Int_Un_distrib2";
paulson@13165
   609
val subset_Int_iff = thm "subset_Int_iff";
paulson@13165
   610
val subset_Int_iff2 = thm "subset_Int_iff2";
paulson@13165
   611
val Int_Diff_eq = thm "Int_Diff_eq";
paulson@13165
   612
val Un_cons = thm "Un_cons";
paulson@13165
   613
val Un_absorb = thm "Un_absorb";
paulson@13165
   614
val Un_left_absorb = thm "Un_left_absorb";
paulson@13165
   615
val Un_commute = thm "Un_commute";
paulson@13165
   616
val Un_left_commute = thm "Un_left_commute";
paulson@13165
   617
val Un_assoc = thm "Un_assoc";
paulson@13165
   618
val Un_Int_distrib = thm "Un_Int_distrib";
paulson@13165
   619
val subset_Un_iff = thm "subset_Un_iff";
paulson@13165
   620
val subset_Un_iff2 = thm "subset_Un_iff2";
paulson@13165
   621
val Un_empty = thm "Un_empty";
paulson@13165
   622
val Un_eq_Union = thm "Un_eq_Union";
paulson@13165
   623
val Diff_cancel = thm "Diff_cancel";
paulson@13165
   624
val Diff_triv = thm "Diff_triv";
paulson@13165
   625
val empty_Diff = thm "empty_Diff";
paulson@13165
   626
val Diff_0 = thm "Diff_0";
paulson@13165
   627
val Diff_eq_0_iff = thm "Diff_eq_0_iff";
paulson@13165
   628
val Diff_cons = thm "Diff_cons";
paulson@13165
   629
val Diff_cons2 = thm "Diff_cons2";
paulson@13165
   630
val Diff_disjoint = thm "Diff_disjoint";
paulson@13165
   631
val Diff_partition = thm "Diff_partition";
paulson@13165
   632
val subset_Un_Diff = thm "subset_Un_Diff";
paulson@13165
   633
val double_complement = thm "double_complement";
paulson@13165
   634
val double_complement_Un = thm "double_complement_Un";
paulson@13165
   635
val Un_Int_crazy = thm "Un_Int_crazy";
paulson@13165
   636
val Diff_Un = thm "Diff_Un";
paulson@13165
   637
val Diff_Int = thm "Diff_Int";
paulson@13165
   638
val Un_Diff = thm "Un_Diff";
paulson@13165
   639
val Int_Diff = thm "Int_Diff";
paulson@13165
   640
val Diff_Int_distrib = thm "Diff_Int_distrib";
paulson@13165
   641
val Diff_Int_distrib2 = thm "Diff_Int_distrib2";
paulson@13165
   642
val Un_Int_assoc_iff = thm "Un_Int_assoc_iff";
paulson@13165
   643
val Union_cons = thm "Union_cons";
paulson@13165
   644
val Union_Un_distrib = thm "Union_Un_distrib";
paulson@13165
   645
val Union_Int_subset = thm "Union_Int_subset";
paulson@13165
   646
val Union_disjoint = thm "Union_disjoint";
paulson@13165
   647
val Union_empty_iff = thm "Union_empty_iff";
paulson@13165
   648
val Inter_0 = thm "Inter_0";
paulson@13165
   649
val Inter_Un_subset = thm "Inter_Un_subset";
paulson@13165
   650
val Inter_Un_distrib = thm "Inter_Un_distrib";
paulson@13165
   651
val Union_singleton = thm "Union_singleton";
paulson@13165
   652
val Inter_singleton = thm "Inter_singleton";
paulson@13165
   653
val Inter_cons = thm "Inter_cons";
paulson@13165
   654
val Union_eq_UN = thm "Union_eq_UN";
paulson@13165
   655
val Inter_eq_INT = thm "Inter_eq_INT";
paulson@13165
   656
val UN_0 = thm "UN_0";
paulson@13165
   657
val UN_singleton = thm "UN_singleton";
paulson@13165
   658
val UN_Un = thm "UN_Un";
paulson@13165
   659
val INT_Un = thm "INT_Un";
paulson@13165
   660
val UN_UN_flatten = thm "UN_UN_flatten";
paulson@13165
   661
val Int_UN_distrib = thm "Int_UN_distrib";
paulson@13165
   662
val Un_INT_distrib = thm "Un_INT_distrib";
paulson@13165
   663
val Int_UN_distrib2 = thm "Int_UN_distrib2";
paulson@13165
   664
val Un_INT_distrib2 = thm "Un_INT_distrib2";
paulson@13165
   665
val UN_constant = thm "UN_constant";
paulson@13165
   666
val INT_constant = thm "INT_constant";
paulson@13165
   667
val UN_RepFun = thm "UN_RepFun";
paulson@13165
   668
val INT_RepFun = thm "INT_RepFun";
paulson@13165
   669
val INT_Union_eq = thm "INT_Union_eq";
paulson@13165
   670
val INT_UN_eq = thm "INT_UN_eq";
paulson@13165
   671
val UN_Un_distrib = thm "UN_Un_distrib";
paulson@13165
   672
val INT_Int_distrib = thm "INT_Int_distrib";
paulson@13165
   673
val UN_Int_subset = thm "UN_Int_subset";
paulson@13165
   674
val Diff_UN = thm "Diff_UN";
paulson@13165
   675
val Diff_INT = thm "Diff_INT";
paulson@13165
   676
val Sigma_cons1 = thm "Sigma_cons1";
paulson@13165
   677
val Sigma_cons2 = thm "Sigma_cons2";
paulson@13165
   678
val Sigma_succ1 = thm "Sigma_succ1";
paulson@13165
   679
val Sigma_succ2 = thm "Sigma_succ2";
paulson@13165
   680
val SUM_UN_distrib1 = thm "SUM_UN_distrib1";
paulson@13165
   681
val SUM_UN_distrib2 = thm "SUM_UN_distrib2";
paulson@13165
   682
val SUM_Un_distrib1 = thm "SUM_Un_distrib1";
paulson@13165
   683
val SUM_Un_distrib2 = thm "SUM_Un_distrib2";
paulson@13165
   684
val prod_Un_distrib2 = thm "prod_Un_distrib2";
paulson@13165
   685
val SUM_Int_distrib1 = thm "SUM_Int_distrib1";
paulson@13165
   686
val SUM_Int_distrib2 = thm "SUM_Int_distrib2";
paulson@13165
   687
val prod_Int_distrib2 = thm "prod_Int_distrib2";
paulson@13165
   688
val SUM_eq_UN = thm "SUM_eq_UN";
paulson@13165
   689
val domain_of_prod = thm "domain_of_prod";
paulson@13165
   690
val domain_0 = thm "domain_0";
paulson@13165
   691
val domain_cons = thm "domain_cons";
paulson@13165
   692
val domain_Un_eq = thm "domain_Un_eq";
paulson@13165
   693
val domain_Int_subset = thm "domain_Int_subset";
paulson@13165
   694
val domain_Diff_subset = thm "domain_Diff_subset";
paulson@13165
   695
val domain_converse = thm "domain_converse";
paulson@13165
   696
val domain_UN = thm "domain_UN";
paulson@13165
   697
val domain_Union = thm "domain_Union";
paulson@13165
   698
val range_of_prod = thm "range_of_prod";
paulson@13165
   699
val range_0 = thm "range_0";
paulson@13165
   700
val range_cons = thm "range_cons";
paulson@13165
   701
val range_Un_eq = thm "range_Un_eq";
paulson@13165
   702
val range_Int_subset = thm "range_Int_subset";
paulson@13165
   703
val range_Diff_subset = thm "range_Diff_subset";
paulson@13165
   704
val range_converse = thm "range_converse";
paulson@13165
   705
val field_of_prod = thm "field_of_prod";
paulson@13165
   706
val field_0 = thm "field_0";
paulson@13165
   707
val field_cons = thm "field_cons";
paulson@13165
   708
val field_Un_eq = thm "field_Un_eq";
paulson@13165
   709
val field_Int_subset = thm "field_Int_subset";
paulson@13165
   710
val field_Diff_subset = thm "field_Diff_subset";
paulson@13165
   711
val field_converse = thm "field_converse";
paulson@13165
   712
val image_0 = thm "image_0";
paulson@13165
   713
val image_Un = thm "image_Un";
paulson@13165
   714
val image_Int_subset = thm "image_Int_subset";
paulson@13165
   715
val image_Int_square_subset = thm "image_Int_square_subset";
paulson@13165
   716
val image_Int_square = thm "image_Int_square";
paulson@13165
   717
val image_0_left = thm "image_0_left";
paulson@13165
   718
val image_Un_left = thm "image_Un_left";
paulson@13165
   719
val image_Int_subset_left = thm "image_Int_subset_left";
paulson@13165
   720
val vimage_0 = thm "vimage_0";
paulson@13165
   721
val vimage_Un = thm "vimage_Un";
paulson@13165
   722
val vimage_Int_subset = thm "vimage_Int_subset";
paulson@13165
   723
val vimage_eq_UN = thm "vimage_eq_UN";
paulson@13165
   724
val function_vimage_Int = thm "function_vimage_Int";
paulson@13165
   725
val function_vimage_Diff = thm "function_vimage_Diff";
paulson@13165
   726
val function_image_vimage = thm "function_image_vimage";
paulson@13165
   727
val vimage_Int_square_subset = thm "vimage_Int_square_subset";
paulson@13165
   728
val vimage_Int_square = thm "vimage_Int_square";
paulson@13165
   729
val vimage_0_left = thm "vimage_0_left";
paulson@13165
   730
val vimage_Un_left = thm "vimage_Un_left";
paulson@13165
   731
val vimage_Int_subset_left = thm "vimage_Int_subset_left";
paulson@13165
   732
val converse_Un = thm "converse_Un";
paulson@13165
   733
val converse_Int = thm "converse_Int";
paulson@13165
   734
val converse_Diff = thm "converse_Diff";
paulson@13165
   735
val converse_UN = thm "converse_UN";
paulson@13165
   736
val converse_INT = thm "converse_INT";
paulson@13165
   737
val Pow_0 = thm "Pow_0";
paulson@13165
   738
val Pow_insert = thm "Pow_insert";
paulson@13165
   739
val Un_Pow_subset = thm "Un_Pow_subset";
paulson@13165
   740
val UN_Pow_subset = thm "UN_Pow_subset";
paulson@13165
   741
val subset_Pow_Union = thm "subset_Pow_Union";
paulson@13165
   742
val Union_Pow_eq = thm "Union_Pow_eq";
paulson@13165
   743
val Pow_Int_eq = thm "Pow_Int_eq";
paulson@13165
   744
val Pow_INT_eq = thm "Pow_INT_eq";
paulson@13165
   745
val RepFun_eq_0_iff = thm "RepFun_eq_0_iff";
paulson@13165
   746
val RepFun_constant = thm "RepFun_constant";
paulson@13165
   747
val Collect_Un = thm "Collect_Un";
paulson@13165
   748
val Collect_Int = thm "Collect_Int";
paulson@13165
   749
val Collect_Diff = thm "Collect_Diff";
paulson@13165
   750
val Collect_cons = thm "Collect_cons";
paulson@13165
   751
val Int_Collect_self_eq = thm "Int_Collect_self_eq";
paulson@13165
   752
val Collect_Collect_eq = thm "Collect_Collect_eq";
paulson@13165
   753
val Collect_Int_Collect_eq = thm "Collect_Int_Collect_eq";
paulson@13165
   754
paulson@13165
   755
val Int_ac = thms "Int_ac";
paulson@13165
   756
val Un_ac = thms "Un_ac";
paulson@13165
   757
paulson@13165
   758
*}
paulson@13165
   759
paulson@13165
   760
end
paulson@13165
   761