src/HOL/equalities.ML
author nipkow
Mon, 04 Mar 1996 14:37:33 +0100
changeset 1531 e5eb247ad13c
parent 1465 5d7a7e439cec
child 1548 afe750876848
permissions -rw-r--r--
Added a constant UNIV == {x.True} Added many new rewrite rules for sets. Moved LEAST into Nat. Added cardinality to Finite.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
     1
(*  Title:      HOL/equalities
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1994  University of Cambridge
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     5
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     6
Equalities involving union, intersection, inclusion, etc.
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     8
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     9
writeln"File HOL/equalities";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    11
val eq_cs = set_cs addSIs [equalityI];
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    13
goal Set.thy "{x.False} = {}";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    14
by(fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    15
qed "Collect_False_empty";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    16
Addsimps [Collect_False_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    17
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    18
goal Set.thy "(A <= {}) = (A = {})";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    19
by(fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    20
qed "subset_empty";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    21
Addsimps [subset_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    22
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
(** The membership relation, : **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
goal Set.thy "x ~: {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    26
by(fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    27
qed "in_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    28
Addsimps[in_empty];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    29
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    30
goal Set.thy "x : insert y A = (x=y | x:A)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
by(fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    32
qed "in_insert";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    33
Addsimps[in_insert];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    35
(** insert **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    36
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    37
(*NOT SUITABLE FOR REWRITING since {a} == insert a {}*)
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    38
goal Set.thy "insert a A = {a} Un A";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    39
by(fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    40
qed "insert_is_Un";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    41
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
    42
goal Set.thy "insert a A ~= {}";
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
    43
by (fast_tac (set_cs addEs [equalityCE]) 1);
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
    44
qed"insert_not_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    45
Addsimps[insert_not_empty];
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
    46
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
    47
bind_thm("empty_not_insert",insert_not_empty RS not_sym);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    48
Addsimps[empty_not_insert];
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
    49
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    50
goal Set.thy "!!a. a:A ==> insert a A = A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    51
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    52
qed "insert_absorb";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    53
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    54
goal Set.thy "insert x (insert x A) = insert x A";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    55
by(fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    56
qed "insert_absorb2";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    57
Addsimps [insert_absorb2];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    58
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    59
goal Set.thy "(insert x A <= B) = (x:B & A <= B)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    60
by (fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
qed "insert_subset";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    62
Addsimps[insert_subset];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    63
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    64
(* use new B rather than (A-{a}) to avoid infinite unfolding *)
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    65
goal Set.thy "!!a. a:A ==> ? B. A = insert a B & a ~: B";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    66
by(res_inst_tac [("x","A-{a}")] exI 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    67
by(fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    68
qed "mk_disjoint_insert";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    69
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    70
(** Image **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    71
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    72
goal Set.thy "f``{} = {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    73
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    74
qed "image_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    75
Addsimps[image_empty];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    76
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    77
goal Set.thy "f``insert a B = insert (f a) (f``B)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    78
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    79
qed "image_insert";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    80
Addsimps[image_insert];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    81
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    82
(** Binary Intersection **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    83
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    84
goal Set.thy "A Int A = A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    85
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    86
qed "Int_absorb";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    87
Addsimps[Int_absorb];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    88
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    89
goal Set.thy "A Int B  =  B Int A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    90
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    91
qed "Int_commute";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    92
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    93
goal Set.thy "(A Int B) Int C  =  A Int (B Int C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    94
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    95
qed "Int_assoc";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    96
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    97
goal Set.thy "{} Int B = {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    98
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    99
qed "Int_empty_left";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   100
Addsimps[Int_empty_left];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   101
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   102
goal Set.thy "A Int {} = {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   103
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   104
qed "Int_empty_right";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   105
Addsimps[Int_empty_right];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   106
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   107
goal Set.thy "UNIV Int B = B";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   108
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   109
qed "Int_UNIV_left";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   110
Addsimps[Int_UNIV_left];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   111
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   112
goal Set.thy "A Int UNIV = A";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   113
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   114
qed "Int_UNIV_right";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   115
Addsimps[Int_UNIV_right];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   116
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   117
goal Set.thy "A Int (B Un C)  =  (A Int B) Un (A Int C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   118
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   119
qed "Int_Un_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   120
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   121
goal Set.thy "(A<=B) = (A Int B = A)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   122
by (fast_tac (eq_cs addSEs [equalityE]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   123
qed "subset_Int_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   124
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   125
goal Set.thy "(A Int B = UNIV) = (A = UNIV & B = UNIV)";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   126
by (fast_tac (eq_cs addEs [equalityCE]) 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   127
qed "Int_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   128
Addsimps[Int_UNIV];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   129
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   130
(** Binary Union **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   131
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   132
goal Set.thy "A Un A = A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   133
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   134
qed "Un_absorb";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   135
Addsimps[Un_absorb];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   136
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   137
goal Set.thy "A Un B  =  B Un A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   138
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   139
qed "Un_commute";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   140
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   141
goal Set.thy "(A Un B) Un C  =  A Un (B Un C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   142
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   143
qed "Un_assoc";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   144
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   145
goal Set.thy "{} Un B = B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   146
by(fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   147
qed "Un_empty_left";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   148
Addsimps[Un_empty_left];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   149
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   150
goal Set.thy "A Un {} = A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   151
by(fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   152
qed "Un_empty_right";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   153
Addsimps[Un_empty_right];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   154
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   155
goal Set.thy "UNIV Un B = UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   156
by(fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   157
qed "Un_UNIV_left";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   158
Addsimps[Un_UNIV_left];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   159
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   160
goal Set.thy "A Un UNIV = UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   161
by(fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   162
qed "Un_UNIV_right";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   163
Addsimps[Un_UNIV_right];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   164
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   165
goal Set.thy "insert a B Un C = insert a (B Un C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   166
by(fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   167
qed "Un_insert_left";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   168
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   169
goal Set.thy "(A Int B) Un C  =  (A Un C) Int (B Un C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   170
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   171
qed "Un_Int_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   172
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   173
goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   174
 "(A Int B) Un (B Int C) Un (C Int A) = (A Un B) Int (B Un C) Int (C Un A)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   175
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   176
qed "Un_Int_crazy";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   177
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   178
goal Set.thy "(A<=B) = (A Un B = B)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   179
by (fast_tac (eq_cs addSEs [equalityE]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   180
qed "subset_Un_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   181
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   182
goal Set.thy "(A <= insert b C) = (A <= C | b:A & A-{b} <= C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   183
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   184
qed "subset_insert_iff";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   185
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   186
goal Set.thy "(A Un B = {}) = (A = {} & B = {})";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   187
by (fast_tac (eq_cs addEs [equalityCE]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   188
qed "Un_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   189
Addsimps[Un_empty];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   190
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   191
(** Simple properties of Compl -- complement of a set **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   192
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   193
goal Set.thy "A Int Compl(A) = {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   194
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   195
qed "Compl_disjoint";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   196
Addsimps[Compl_disjoint];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   197
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   198
goal Set.thy "A Un Compl(A) = UNIV";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   199
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   200
qed "Compl_partition";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   201
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   202
goal Set.thy "Compl(Compl(A)) = A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   203
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   204
qed "double_complement";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   205
Addsimps[double_complement];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   206
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   207
goal Set.thy "Compl(A Un B) = Compl(A) Int Compl(B)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   208
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   209
qed "Compl_Un";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   210
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   211
goal Set.thy "Compl(A Int B) = Compl(A) Un Compl(B)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   212
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   213
qed "Compl_Int";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   214
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   215
goal Set.thy "Compl(UN x:A. B(x)) = (INT x:A. Compl(B(x)))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   216
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   217
qed "Compl_UN";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   218
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   219
goal Set.thy "Compl(INT x:A. B(x)) = (UN x:A. Compl(B(x)))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   220
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   221
qed "Compl_INT";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   222
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   223
(*Halmos, Naive Set Theory, page 16.*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   224
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   225
goal Set.thy "((A Int B) Un C = A Int (B Un C)) = (C<=A)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   226
by (fast_tac (eq_cs addSEs [equalityE]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   227
qed "Un_Int_assoc_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   228
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   229
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   230
(** Big Union and Intersection **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   231
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   232
goal Set.thy "Union({}) = {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   233
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   234
qed "Union_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   235
Addsimps[Union_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   236
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   237
goal Set.thy "Union(UNIV) = UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   238
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   239
qed "Union_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   240
Addsimps[Union_UNIV];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   241
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   242
goal Set.thy "Union(insert a B) = a Un Union(B)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   243
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   244
qed "Union_insert";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   245
Addsimps[Union_insert];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   246
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   247
goal Set.thy "Union(A Un B) = Union(A) Un Union(B)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   248
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   249
qed "Union_Un_distrib";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   250
Addsimps[Union_Un_distrib];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   251
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   252
goal Set.thy "Union(A Int B) <= Union(A) Int Union(B)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   253
by (fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   254
qed "Union_Int_subset";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   255
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   256
val prems = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   257
   "(Union(C) Int A = {}) = (! B:C. B Int A = {})";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   258
by (fast_tac (eq_cs addSEs [equalityE]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   259
qed "Union_disjoint";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   260
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   261
goal Set.thy "Inter({}) = UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   262
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   263
qed "Inter_empty";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   264
Addsimps[Inter_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   265
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   266
goal Set.thy "Inter(UNIV) = {}";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   267
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   268
qed "Inter_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   269
Addsimps[Inter_UNIV];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   270
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   271
goal Set.thy "Inter(insert a B) = a Int Inter(B)";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   272
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   273
qed "Inter_insert";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   274
Addsimps[Inter_insert];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   275
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   276
(* Why does fast_tac fail???
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   277
goal Set.thy "Inter(A Int B) = Inter(A) Int Inter(B)";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   278
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   279
qed "Inter_Int_distrib";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   280
Addsimps[Inter_Int_distrib];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   281
*)
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   282
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   283
goal Set.thy "Inter(A Un B) = Inter(A) Int Inter(B)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   284
by (best_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   285
qed "Inter_Un_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   286
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   287
(** Unions and Intersections of Families **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   288
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   289
(*Basic identities*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   290
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   291
goal Set.thy "(UN x:{}. B x) = {}";
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   292
by (fast_tac eq_cs 1);
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   293
qed "UN_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   294
Addsimps[UN_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   295
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   296
goal Set.thy "(UN x:UNIV. B x) = (UN x. B x)";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   297
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   298
qed "UN_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   299
Addsimps[UN_UNIV];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   300
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   301
goal Set.thy "(INT x:{}. B x) = UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   302
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   303
qed "INT_empty";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   304
Addsimps[INT_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   305
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   306
goal Set.thy "(INT x:UNIV. B x) = (INT x. B x)";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   307
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   308
qed "INT_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   309
Addsimps[INT_UNIV];
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   310
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   311
goal Set.thy "(UN x:insert a A. B x) = B a Un UNION A B";
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   312
by (fast_tac eq_cs 1);
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   313
qed "UN_insert";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   314
Addsimps[UN_insert];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   315
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   316
goal Set.thy "(INT x:insert a A. B x) = B a Int INTER A B";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   317
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   318
qed "INT_insert";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   319
Addsimps[INT_insert];
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   320
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   321
goal Set.thy "Union(range(f)) = (UN x.f(x))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   322
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   323
qed "Union_range_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   324
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   325
goal Set.thy "Inter(range(f)) = (INT x.f(x))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   326
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   327
qed "Inter_range_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   328
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   329
goal Set.thy "Union(B``A) = (UN x:A. B(x))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   330
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   331
qed "Union_image_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   332
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   333
goal Set.thy "Inter(B``A) = (INT x:A. B(x))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   334
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   335
qed "Inter_image_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   336
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   337
goal Set.thy "!!A. a: A ==> (UN y:A. c) = c";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   338
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   339
qed "UN_constant";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   340
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   341
goal Set.thy "!!A. a: A ==> (INT y:A. c) = c";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   342
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   343
qed "INT_constant";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   344
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   345
goal Set.thy "(UN x.B) = B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   346
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   347
qed "UN1_constant";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   348
Addsimps[UN1_constant];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   349
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   350
goal Set.thy "(INT x.B) = B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   351
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   352
qed "INT1_constant";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   353
Addsimps[INT1_constant];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   354
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   355
goal Set.thy "(UN x:A. B(x)) = Union({Y. ? x:A. Y=B(x)})";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   356
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   357
qed "UN_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   358
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   359
(*Look: it has an EXISTENTIAL quantifier*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   360
goal Set.thy "(INT x:A. B(x)) = Inter({Y. ? x:A. Y=B(x)})";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   361
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   362
qed "INT_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   363
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   364
(*Distributive laws...*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   365
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   366
goal Set.thy "A Int Union(B) = (UN C:B. A Int C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   367
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   368
qed "Int_Union";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   369
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   370
(* Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5: 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   371
   Union of a family of unions **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   372
goal Set.thy "(UN x:C. A(x) Un B(x)) = Union(A``C)  Un  Union(B``C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   373
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   374
qed "Un_Union_image";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   375
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   376
(*Equivalent version*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   377
goal Set.thy "(UN i:I. A(i) Un B(i)) = (UN i:I. A(i))  Un  (UN i:I. B(i))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   378
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   379
qed "UN_Un_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   380
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   381
goal Set.thy "A Un Inter(B) = (INT C:B. A Un C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   382
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   383
qed "Un_Inter";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   384
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   385
goal Set.thy "(INT x:C. A(x) Int B(x)) = Inter(A``C) Int Inter(B``C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   386
by (best_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   387
qed "Int_Inter_image";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   388
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   389
(*Equivalent version*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   390
goal Set.thy "(INT i:I. A(i) Int B(i)) = (INT i:I. A(i)) Int (INT i:I. B(i))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   391
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   392
qed "INT_Int_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   393
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   394
(*Halmos, Naive Set Theory, page 35.*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   395
goal Set.thy "B Int (UN i:I. A(i)) = (UN i:I. B Int A(i))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   396
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   397
qed "Int_UN_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   398
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   399
goal Set.thy "B Un (INT i:I. A(i)) = (INT i:I. B Un A(i))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   400
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   401
qed "Un_INT_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   402
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   403
goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   404
    "(UN i:I. A(i)) Int (UN j:J. B(j)) = (UN i:I. UN j:J. A(i) Int B(j))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   405
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   406
qed "Int_UN_distrib2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   407
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   408
goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   409
    "(INT i:I. A(i)) Un (INT j:J. B(j)) = (INT i:I. INT j:J. A(i) Un B(j))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   410
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   411
qed "Un_INT_distrib2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   412
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   413
(** Simple properties of Diff -- set difference **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   414
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   415
goal Set.thy "A-A = {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   416
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   417
qed "Diff_cancel";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   418
Addsimps[Diff_cancel];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   419
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   420
goal Set.thy "{}-A = {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   421
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   422
qed "empty_Diff";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   423
Addsimps[empty_Diff];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   424
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   425
goal Set.thy "A-{} = A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   426
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   427
qed "Diff_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   428
Addsimps[Diff_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   429
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   430
goal Set.thy "A-UNIV = {}";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   431
by (fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   432
qed "Diff_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   433
Addsimps[Diff_UNIV];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   434
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   435
goal Set.thy "!!x. x~:A ==> A - insert x B = A-B";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   436
by(fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   437
qed "Diff_insert0";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   438
Addsimps [Diff_insert0];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   439
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   440
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   441
goal Set.thy "A - insert a B = A - B - {a}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   442
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   443
qed "Diff_insert";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   444
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   445
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   446
goal Set.thy "A - insert a B = A - {a} - B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   447
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   448
qed "Diff_insert2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   449
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   450
goal Set.thy "insert x A - B = (if x:B then A-B else insert x (A-B))";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   451
by(simp_tac (!simpset setloop split_tac[expand_if]) 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   452
by(fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   453
qed "insert_Diff_if";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   454
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   455
goal Set.thy "!!x. x:B ==> insert x A - B = A-B";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   456
by(fast_tac eq_cs 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   457
qed "insert_Diff1";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   458
Addsimps [insert_Diff1];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   459
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   460
val prems = goal Set.thy "a:A ==> insert a (A-{a}) = A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   461
by (fast_tac (eq_cs addSIs prems) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   462
qed "insert_Diff";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   463
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   464
goal Set.thy "A Int (B-A) = {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   465
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   466
qed "Diff_disjoint";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   467
Addsimps[Diff_disjoint];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   468
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   469
goal Set.thy "!!A. A<=B ==> A Un (B-A) = B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   470
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   471
qed "Diff_partition";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   472
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   473
goal Set.thy "!!A. [| A<=B; B<= C |] ==> (B - (C - A)) = (A :: 'a set)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   474
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   475
qed "double_diff";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   476
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   477
goal Set.thy "A - (B Un C) = (A-B) Int (A-C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   478
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   479
qed "Diff_Un";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   480
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   481
goal Set.thy "A - (B Int C) = (A-B) Un (A-C)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   482
by (fast_tac eq_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   483
qed "Diff_Int";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   484
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   485
(* Congruence rule for set comprehension *)
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   486
val prems = goal Set.thy
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   487
  "[| !!x. P x = Q x; !!x. Q x ==> f x = g x |] ==> \
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   488
\  {f x |x. P x} = {g x|x. Q x}";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   489
by(simp_tac (!simpset addsimps prems) 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   490
br set_ext 1;
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   491
br iffI 1;
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   492
by(fast_tac (eq_cs addss (!simpset addsimps prems)) 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   493
be CollectE 1;
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   494
be exE 1;
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   495
by(Asm_simp_tac 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   496
be conjE 1;
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   497
by(rtac exI 1 THEN rtac conjI 1 THEN atac 2);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   498
by(asm_simp_tac (!simpset addsimps prems) 1);
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   499
qed "Collect_cong1";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   500
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   501
Addsimps[subset_UNIV, empty_subsetI, subset_refl];