src/HOL/equalities.ML
author wenzelm
Tue, 20 May 1997 19:29:50 +0200
changeset 3257 4e3724e0659f
parent 3222 726a9b069947
child 3348 3f9a806f061e
permissions -rw-r--r--
README generation;
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
1754
852093aeb0ab Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents: 1748
diff changeset
    11
AddSIs [equalityI];
852093aeb0ab Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents: 1748
diff changeset
    12
1548
afe750876848 Added 'section' commands
nipkow
parents: 1531
diff changeset
    13
section "{}";
afe750876848 Added 'section' commands
nipkow
parents: 1531
diff changeset
    14
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    15
goal Set.thy "{x.False} = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    16
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    17
qed "Collect_False_empty";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    18
Addsimps [Collect_False_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    19
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    20
goal Set.thy "(A <= {}) = (A = {})";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    21
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    22
qed "subset_empty";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    23
Addsimps [subset_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    24
3222
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    25
goalw thy [psubset_def] "~ (A < {})";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    26
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    27
qed "not_psubset_empty";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    28
AddIffs [not_psubset_empty];
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    29
1548
afe750876848 Added 'section' commands
nipkow
parents: 1531
diff changeset
    30
section "insert";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    32
(*NOT SUITABLE FOR REWRITING since {a} == insert a {}*)
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    33
goal Set.thy "insert a A = {a} Un A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    34
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    35
qed "insert_is_Un";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    36
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
    37
goal Set.thy "insert a A ~= {}";
2922
580647a879cf Using Blast_tac
paulson
parents: 2912
diff changeset
    38
by (blast_tac (!claset addEs [equalityCE]) 1);
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
    39
qed"insert_not_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    40
Addsimps[insert_not_empty];
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
    41
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
    42
bind_thm("empty_not_insert",insert_not_empty RS not_sym);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    43
Addsimps[empty_not_insert];
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
    44
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    45
goal Set.thy "!!a. a:A ==> insert a A = A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    46
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    47
qed "insert_absorb";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    48
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    49
goal Set.thy "insert x (insert x A) = insert x A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    50
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    51
qed "insert_absorb2";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    52
Addsimps [insert_absorb2];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    53
1879
83c70ad381c1 Added insert_commute
paulson
parents: 1843
diff changeset
    54
goal Set.thy "insert x (insert y A) = insert y (insert x A)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    55
by (Blast_tac 1);
1879
83c70ad381c1 Added insert_commute
paulson
parents: 1843
diff changeset
    56
qed "insert_commute";
83c70ad381c1 Added insert_commute
paulson
parents: 1843
diff changeset
    57
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    58
goal Set.thy "(insert x A <= B) = (x:B & A <= B)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    59
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    60
qed "insert_subset";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    61
Addsimps[insert_subset];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    62
3222
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    63
goal Set.thy "!!a. insert a A ~= insert a B ==> A ~= B";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    64
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    65
qed "insert_lim";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    66
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    67
(* use new B rather than (A-{a}) to avoid infinite unfolding *)
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    68
goal Set.thy "!!a. a:A ==> ? B. A = insert a B & a ~: B";
1553
4eb4a9c7d736 Ran expandshort
paulson
parents: 1548
diff changeset
    69
by (res_inst_tac [("x","A-{a}")] exI 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    70
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    71
qed "mk_disjoint_insert";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    72
1843
a6d7aef48c2f Removed the unused eq_cs, and added some distributive laws
paulson
parents: 1786
diff changeset
    73
goal Set.thy
a6d7aef48c2f Removed the unused eq_cs, and added some distributive laws
paulson
parents: 1786
diff changeset
    74
    "!!A. A~={} ==> (UN x:A. insert a (B x)) = insert a (UN x:A. B x)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    75
by (Blast_tac 1);
1843
a6d7aef48c2f Removed the unused eq_cs, and added some distributive laws
paulson
parents: 1786
diff changeset
    76
qed "UN_insert_distrib";
a6d7aef48c2f Removed the unused eq_cs, and added some distributive laws
paulson
parents: 1786
diff changeset
    77
a6d7aef48c2f Removed the unused eq_cs, and added some distributive laws
paulson
parents: 1786
diff changeset
    78
goal Set.thy "(UN x. insert a (B x)) = insert a (UN x. B x)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    79
by (Blast_tac 1);
1843
a6d7aef48c2f Removed the unused eq_cs, and added some distributive laws
paulson
parents: 1786
diff changeset
    80
qed "UN1_insert_distrib";
a6d7aef48c2f Removed the unused eq_cs, and added some distributive laws
paulson
parents: 1786
diff changeset
    81
1660
8cb42cd97579 *** empty log message ***
oheimb
parents: 1618
diff changeset
    82
section "``";
923
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 "f``{} = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    85
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    86
qed "image_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    87
Addsimps[image_empty];
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 "f``insert a B = insert (f a) (f``B)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
    90
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    91
qed "image_insert";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    92
Addsimps[image_insert];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    93
3222
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    94
goal Set.thy  "(f `` (UNION A B)) = (UN x:A.(f `` (B x)))";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    95
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    96
qed "image_UNION";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    97
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    98
goal Set.thy "(%x. x) `` Y = Y";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
    99
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   100
qed "image_id";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   101
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   102
goal Set.thy "f``(range g) = range (%x. f (g x))";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   103
by(Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   104
qed "image_range";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   105
1660
8cb42cd97579 *** empty log message ***
oheimb
parents: 1618
diff changeset
   106
qed_goal "ball_image" Set.thy "(!y:F``S. P y) = (!x:S. P (F x))"
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   107
 (fn _ => [Blast_tac 1]);
1660
8cb42cd97579 *** empty log message ***
oheimb
parents: 1618
diff changeset
   108
1884
5a1f81da3e12 Proved insert_image
paulson
parents: 1879
diff changeset
   109
goal Set.thy "!!x. x:A ==> insert (f x) (f``A) = f``A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   110
by (Blast_tac 1);
1884
5a1f81da3e12 Proved insert_image
paulson
parents: 1879
diff changeset
   111
qed "insert_image";
5a1f81da3e12 Proved insert_image
paulson
parents: 1879
diff changeset
   112
Addsimps [insert_image];
5a1f81da3e12 Proved insert_image
paulson
parents: 1879
diff changeset
   113
1748
88650ba93c10 Added if_image_distrib.
nipkow
parents: 1660
diff changeset
   114
goalw Set.thy [image_def]
1763
fb07e359b59f expanded TABs
berghofe
parents: 1754
diff changeset
   115
"(%x. if P x then f x else g x) `` S                    \
1748
88650ba93c10 Added if_image_distrib.
nipkow
parents: 1660
diff changeset
   116
\ = (f `` ({x.x:S & P x})) Un (g `` ({x.x:S & ~(P x)}))";
2031
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   117
by (split_tac [expand_if] 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   118
by (Blast_tac 1);
1748
88650ba93c10 Added if_image_distrib.
nipkow
parents: 1660
diff changeset
   119
qed "if_image_distrib";
88650ba93c10 Added if_image_distrib.
nipkow
parents: 1660
diff changeset
   120
Addsimps[if_image_distrib];
88650ba93c10 Added if_image_distrib.
nipkow
parents: 1660
diff changeset
   121
88650ba93c10 Added if_image_distrib.
nipkow
parents: 1660
diff changeset
   122
1660
8cb42cd97579 *** empty log message ***
oheimb
parents: 1618
diff changeset
   123
section "range";
8cb42cd97579 *** empty log message ***
oheimb
parents: 1618
diff changeset
   124
8cb42cd97579 *** empty log message ***
oheimb
parents: 1618
diff changeset
   125
qed_goal "ball_range" Set.thy "(!y:range f. P y) = (!x. P (f x))"
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   126
 (fn _ => [Blast_tac 1]);
1660
8cb42cd97579 *** empty log message ***
oheimb
parents: 1618
diff changeset
   127
8cb42cd97579 *** empty log message ***
oheimb
parents: 1618
diff changeset
   128
1548
afe750876848 Added 'section' commands
nipkow
parents: 1531
diff changeset
   129
section "Int";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   130
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   131
goal Set.thy "A Int A = A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   132
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   133
qed "Int_absorb";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   134
Addsimps[Int_absorb];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   135
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   136
goal Set.thy "A Int B  =  B Int A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   137
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   138
qed "Int_commute";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   139
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   140
goal Set.thy "(A Int B) Int C  =  A Int (B Int C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   141
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   142
qed "Int_assoc";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   143
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   144
goal Set.thy "{} Int B = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   145
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   146
qed "Int_empty_left";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   147
Addsimps[Int_empty_left];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   148
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   149
goal Set.thy "A Int {} = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   150
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   151
qed "Int_empty_right";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   152
Addsimps[Int_empty_right];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   153
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   154
goal Set.thy "UNIV Int B = B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   155
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   156
qed "Int_UNIV_left";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   157
Addsimps[Int_UNIV_left];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   158
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   159
goal Set.thy "A Int UNIV = A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   160
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   161
qed "Int_UNIV_right";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   162
Addsimps[Int_UNIV_right];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   163
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   164
goal Set.thy "A Int (B Un C)  =  (A Int B) Un (A Int C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   165
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   166
qed "Int_Un_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   167
1618
372880456b5b Library changes for mutilated checkerboard
paulson
parents: 1564
diff changeset
   168
goal Set.thy "(B Un C) Int A =  (B Int A) Un (C Int A)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   169
by (Blast_tac 1);
1618
372880456b5b Library changes for mutilated checkerboard
paulson
parents: 1564
diff changeset
   170
qed "Int_Un_distrib2";
372880456b5b Library changes for mutilated checkerboard
paulson
parents: 1564
diff changeset
   171
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   172
goal Set.thy "(A<=B) = (A Int B = A)";
2922
580647a879cf Using Blast_tac
paulson
parents: 2912
diff changeset
   173
by (blast_tac (!claset addSEs [equalityE]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   174
qed "subset_Int_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   175
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   176
goal Set.thy "(A Int B = UNIV) = (A = UNIV & B = UNIV)";
2922
580647a879cf Using Blast_tac
paulson
parents: 2912
diff changeset
   177
by (blast_tac (!claset addEs [equalityCE]) 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   178
qed "Int_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   179
Addsimps[Int_UNIV];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   180
1548
afe750876848 Added 'section' commands
nipkow
parents: 1531
diff changeset
   181
section "Un";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   182
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   183
goal Set.thy "A Un A = A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   184
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   185
qed "Un_absorb";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   186
Addsimps[Un_absorb];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   187
3222
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   188
goal Set.thy " A Un (A Un B) = A Un B";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   189
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   190
qed "Un_left_absorb";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   191
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   192
goal Set.thy "A Un B  =  B Un A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   193
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   194
qed "Un_commute";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   195
3222
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   196
goal Set.thy " A Un (B Un C) = B Un (A Un C)";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   197
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   198
qed "Un_left_commute";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   199
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   200
goal Set.thy "(A Un B) Un C  =  A Un (B Un C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   201
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   202
qed "Un_assoc";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   203
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   204
goal Set.thy "{} Un B = B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   205
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   206
qed "Un_empty_left";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   207
Addsimps[Un_empty_left];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   208
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   209
goal Set.thy "A Un {} = A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   210
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   211
qed "Un_empty_right";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   212
Addsimps[Un_empty_right];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   213
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   214
goal Set.thy "UNIV Un B = UNIV";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   215
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   216
qed "Un_UNIV_left";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   217
Addsimps[Un_UNIV_left];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   218
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   219
goal Set.thy "A Un UNIV = UNIV";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   220
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   221
qed "Un_UNIV_right";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   222
Addsimps[Un_UNIV_right];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   223
1843
a6d7aef48c2f Removed the unused eq_cs, and added some distributive laws
paulson
parents: 1786
diff changeset
   224
goal Set.thy "(insert a B) Un C = insert a (B Un C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   225
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   226
qed "Un_insert_left";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   227
1917
27b71d839d50 Added proof of Un_insert_right
paulson
parents: 1884
diff changeset
   228
goal Set.thy "A Un (insert a B) = insert a (A Un B)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   229
by (Blast_tac 1);
1917
27b71d839d50 Added proof of Un_insert_right
paulson
parents: 1884
diff changeset
   230
qed "Un_insert_right";
27b71d839d50 Added proof of Un_insert_right
paulson
parents: 1884
diff changeset
   231
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   232
goal Set.thy "(A Int B) Un C  =  (A Un C) Int (B Un C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   233
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   234
qed "Un_Int_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   235
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   236
goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   237
 "(A Int B) Un (B Int C) Un (C Int A) = (A Un B) Int (B Un C) Int (C Un A)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   238
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   239
qed "Un_Int_crazy";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   240
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   241
goal Set.thy "(A<=B) = (A Un B = B)";
2922
580647a879cf Using Blast_tac
paulson
parents: 2912
diff changeset
   242
by (blast_tac (!claset addSEs [equalityE]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   243
qed "subset_Un_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   244
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   245
goal Set.thy "(A <= insert b C) = (A <= C | b:A & A-{b} <= C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   246
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   247
qed "subset_insert_iff";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   248
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   249
goal Set.thy "(A Un B = {}) = (A = {} & B = {})";
2922
580647a879cf Using Blast_tac
paulson
parents: 2912
diff changeset
   250
by (blast_tac (!claset addEs [equalityCE]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   251
qed "Un_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   252
Addsimps[Un_empty];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   253
1548
afe750876848 Added 'section' commands
nipkow
parents: 1531
diff changeset
   254
section "Compl";
923
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
goal Set.thy "A Int Compl(A) = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   257
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   258
qed "Compl_disjoint";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   259
Addsimps[Compl_disjoint];
923
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 "A Un Compl(A) = UNIV";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   262
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   263
qed "Compl_partition";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   264
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   265
goal Set.thy "Compl(Compl(A)) = A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   266
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   267
qed "double_complement";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   268
Addsimps[double_complement];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   269
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   270
goal Set.thy "Compl(A Un B) = Compl(A) Int Compl(B)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   271
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   272
qed "Compl_Un";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   273
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   274
goal Set.thy "Compl(A Int B) = Compl(A) Un Compl(B)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   275
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   276
qed "Compl_Int";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   277
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   278
goal Set.thy "Compl(UN x:A. B(x)) = (INT x:A. Compl(B(x)))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   279
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   280
qed "Compl_UN";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   281
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   282
goal Set.thy "Compl(INT x:A. B(x)) = (UN x:A. Compl(B(x)))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   283
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   284
qed "Compl_INT";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   285
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   286
(*Halmos, Naive Set Theory, page 16.*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   287
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   288
goal Set.thy "((A Int B) Un C = A Int (B Un C)) = (C<=A)";
2922
580647a879cf Using Blast_tac
paulson
parents: 2912
diff changeset
   289
by (blast_tac (!claset addSEs [equalityE]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   290
qed "Un_Int_assoc_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   291
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   292
1548
afe750876848 Added 'section' commands
nipkow
parents: 1531
diff changeset
   293
section "Union";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   294
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   295
goal Set.thy "Union({}) = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   296
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   297
qed "Union_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   298
Addsimps[Union_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   299
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   300
goal Set.thy "Union(UNIV) = UNIV";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   301
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   302
qed "Union_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   303
Addsimps[Union_UNIV];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   304
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   305
goal Set.thy "Union(insert a B) = a Un Union(B)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   306
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   307
qed "Union_insert";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   308
Addsimps[Union_insert];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   309
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   310
goal Set.thy "Union(A Un B) = Union(A) Un Union(B)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   311
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   312
qed "Union_Un_distrib";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   313
Addsimps[Union_Un_distrib];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   314
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   315
goal Set.thy "Union(A Int B) <= Union(A) Int Union(B)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   316
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   317
qed "Union_Int_subset";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   318
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   319
val prems = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   320
   "(Union(C) Int A = {}) = (! B:C. B Int A = {})";
2922
580647a879cf Using Blast_tac
paulson
parents: 2912
diff changeset
   321
by (blast_tac (!claset addSEs [equalityE]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   322
qed "Union_disjoint";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   323
1548
afe750876848 Added 'section' commands
nipkow
parents: 1531
diff changeset
   324
section "Inter";
afe750876848 Added 'section' commands
nipkow
parents: 1531
diff changeset
   325
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   326
goal Set.thy "Inter({}) = UNIV";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   327
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   328
qed "Inter_empty";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   329
Addsimps[Inter_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   330
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   331
goal Set.thy "Inter(UNIV) = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   332
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   333
qed "Inter_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   334
Addsimps[Inter_UNIV];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   335
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   336
goal Set.thy "Inter(insert a B) = a Int Inter(B)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   337
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   338
qed "Inter_insert";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   339
Addsimps[Inter_insert];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   340
1564
822575c737bd Deleted faulty comment; proved new rule Inter_Un_subset
paulson
parents: 1553
diff changeset
   341
goal Set.thy "Inter(A) Un Inter(B) <= Inter(A Int B)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   342
by (Blast_tac 1);
1564
822575c737bd Deleted faulty comment; proved new rule Inter_Un_subset
paulson
parents: 1553
diff changeset
   343
qed "Inter_Un_subset";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   344
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   345
goal Set.thy "Inter(A Un B) = Inter(A) Int Inter(B)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   346
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   347
qed "Inter_Un_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   348
1548
afe750876848 Added 'section' commands
nipkow
parents: 1531
diff changeset
   349
section "UN and INT";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   350
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   351
(*Basic identities*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   352
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   353
goal Set.thy "(UN x:{}. B x) = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   354
by (Blast_tac 1);
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   355
qed "UN_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   356
Addsimps[UN_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   357
3222
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   358
goal Set.thy "(UN x:A. {}) = {}";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   359
by(Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   360
qed "UN_empty2";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   361
Addsimps[UN_empty2];
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   362
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   363
goal Set.thy "(UN x:UNIV. B x) = (UN x. B x)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   364
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   365
qed "UN_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   366
Addsimps[UN_UNIV];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   367
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   368
goal Set.thy "(INT x:{}. B x) = UNIV";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   369
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   370
qed "INT_empty";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   371
Addsimps[INT_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   372
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   373
goal Set.thy "(INT x:UNIV. B x) = (INT x. B x)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   374
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   375
qed "INT_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   376
Addsimps[INT_UNIV];
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   377
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   378
goal Set.thy "(UN x:insert a A. B x) = B a Un UNION A B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   379
by (Blast_tac 1);
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   380
qed "UN_insert";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   381
Addsimps[UN_insert];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   382
3222
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   383
goal Set.thy "(UN i: A Un B. M i) = ((UN i: A. M i) Un (UN i:B. M i))";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   384
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   385
qed "UN_Un";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   386
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   387
goal Set.thy "(INT x:insert a A. B x) = B a Int INTER A B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   388
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   389
qed "INT_insert";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   390
Addsimps[INT_insert];
1179
7678408f9751 Added insert_not_empty, UN_empty and UN_insert (to set_ss).
nipkow
parents: 923
diff changeset
   391
2021
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   392
goal Set.thy
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   393
    "!!A. A~={} ==> (INT x:A. insert a (B x)) = insert a (INT x:A. B x)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   394
by (Blast_tac 1);
2021
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   395
qed "INT_insert_distrib";
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   396
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   397
goal Set.thy "(INT x. insert a (B x)) = insert a (INT x. B x)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   398
by (Blast_tac 1);
2021
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   399
qed "INT1_insert_distrib";
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   400
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   401
goal Set.thy "Union(range(f)) = (UN x.f(x))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   402
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   403
qed "Union_range_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   404
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   405
goal Set.thy "Inter(range(f)) = (INT x.f(x))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   406
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   407
qed "Inter_range_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   408
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   409
goal Set.thy "Union(B``A) = (UN x:A. B(x))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   410
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   411
qed "Union_image_eq";
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
goal Set.thy "Inter(B``A) = (INT x:A. B(x))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   414
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   415
qed "Inter_image_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   416
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   417
goal Set.thy "!!A. a: A ==> (UN y:A. c) = c";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   418
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   419
qed "UN_constant";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   420
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   421
goal Set.thy "!!A. a: A ==> (INT y:A. c) = c";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   422
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   423
qed "INT_constant";
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 "(UN x.B) = B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   426
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   427
qed "UN1_constant";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   428
Addsimps[UN1_constant];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   429
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   430
goal Set.thy "(INT x.B) = B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   431
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   432
qed "INT1_constant";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   433
Addsimps[INT1_constant];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   434
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   435
goal Set.thy "(UN x:A. B(x)) = Union({Y. ? x:A. Y=B(x)})";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   436
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   437
qed "UN_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   438
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   439
(*Look: it has an EXISTENTIAL quantifier*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   440
goal Set.thy "(INT x:A. B(x)) = Inter({Y. ? x:A. Y=B(x)})";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   441
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   442
qed "INT_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   443
3222
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   444
goalw Set.thy [o_def] "UNION A (g o f) = UNION (f``A) g";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   445
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   446
qed "UNION_o";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   447
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   448
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   449
(*Distributive laws...*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   450
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   451
goal Set.thy "A Int Union(B) = (UN C:B. A Int C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   452
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   453
qed "Int_Union";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   454
2912
3fac3e8d5d3e moved inj and surj from Set to Fun and Inv -> inv.
nipkow
parents: 2891
diff changeset
   455
(* Devlin, Setdamentals of Contemporary Set Theory, page 12, exercise 5: 
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   456
   Union of a family of unions **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   457
goal Set.thy "(UN x:C. A(x) Un B(x)) = Union(A``C)  Un  Union(B``C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   458
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   459
qed "Un_Union_image";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   460
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   461
(*Equivalent version*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   462
goal Set.thy "(UN i:I. A(i) Un B(i)) = (UN i:I. A(i))  Un  (UN i:I. B(i))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   463
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   464
qed "UN_Un_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   465
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   466
goal Set.thy "A Un Inter(B) = (INT C:B. A Un C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   467
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   468
qed "Un_Inter";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   469
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   470
goal Set.thy "(INT x:C. A(x) Int B(x)) = Inter(A``C) Int Inter(B``C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   471
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   472
qed "Int_Inter_image";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   473
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   474
(*Equivalent version*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   475
goal Set.thy "(INT i:I. A(i) Int B(i)) = (INT i:I. A(i)) Int (INT i:I. B(i))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   476
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   477
qed "INT_Int_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   478
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   479
(*Halmos, Naive Set Theory, page 35.*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   480
goal Set.thy "B Int (UN i:I. A(i)) = (UN i:I. B Int A(i))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   481
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   482
qed "Int_UN_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   483
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   484
goal Set.thy "B Un (INT i:I. A(i)) = (INT i:I. B Un A(i))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   485
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   486
qed "Un_INT_distrib";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   487
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   488
goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   489
    "(UN i:I. A(i)) Int (UN j:J. B(j)) = (UN i:I. UN j:J. A(i) Int B(j))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   490
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   491
qed "Int_UN_distrib2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   492
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   493
goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   494
    "(INT i:I. A(i)) Un (INT j:J. B(j)) = (INT i:I. INT j:J. A(i) Un B(j))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   495
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   496
qed "Un_INT_distrib2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   497
2512
0231e4f467f2 Got rid of Alls in List.
nipkow
parents: 2031
diff changeset
   498
0231e4f467f2 Got rid of Alls in List.
nipkow
parents: 2031
diff changeset
   499
section"Bounded quantifiers";
0231e4f467f2 Got rid of Alls in List.
nipkow
parents: 2031
diff changeset
   500
2519
761e3094e32f New rewrites for bounded quantifiers
paulson
parents: 2513
diff changeset
   501
(** These are not added to the default simpset because (a) they duplicate the
761e3094e32f New rewrites for bounded quantifiers
paulson
parents: 2513
diff changeset
   502
    body and (b) there are no similar rules for Int. **)
2512
0231e4f467f2 Got rid of Alls in List.
nipkow
parents: 2031
diff changeset
   503
2519
761e3094e32f New rewrites for bounded quantifiers
paulson
parents: 2513
diff changeset
   504
goal Set.thy "(ALL x:A Un B.P x) = ((ALL x:A.P x) & (ALL x:B.P x))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   505
by (Blast_tac 1);
2519
761e3094e32f New rewrites for bounded quantifiers
paulson
parents: 2513
diff changeset
   506
qed "ball_Un";
761e3094e32f New rewrites for bounded quantifiers
paulson
parents: 2513
diff changeset
   507
761e3094e32f New rewrites for bounded quantifiers
paulson
parents: 2513
diff changeset
   508
goal Set.thy "(EX x:A Un B.P x) = ((EX x:A.P x) | (EX x:B.P x))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   509
by (Blast_tac 1);
2519
761e3094e32f New rewrites for bounded quantifiers
paulson
parents: 2513
diff changeset
   510
qed "bex_Un";
2512
0231e4f467f2 Got rid of Alls in List.
nipkow
parents: 2031
diff changeset
   511
0231e4f467f2 Got rid of Alls in List.
nipkow
parents: 2031
diff changeset
   512
1548
afe750876848 Added 'section' commands
nipkow
parents: 1531
diff changeset
   513
section "-";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   514
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   515
goal Set.thy "A-A = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   516
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   517
qed "Diff_cancel";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   518
Addsimps[Diff_cancel];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   519
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   520
goal Set.thy "{}-A = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   521
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   522
qed "empty_Diff";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   523
Addsimps[empty_Diff];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   524
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   525
goal Set.thy "A-{} = A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   526
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   527
qed "Diff_empty";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   528
Addsimps[Diff_empty];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   529
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   530
goal Set.thy "A-UNIV = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   531
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   532
qed "Diff_UNIV";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   533
Addsimps[Diff_UNIV];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   534
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   535
goal Set.thy "!!x. x~:A ==> A - insert x B = A-B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   536
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   537
qed "Diff_insert0";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   538
Addsimps [Diff_insert0];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   539
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   540
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   541
goal Set.thy "A - insert a B = A - B - {a}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   542
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   543
qed "Diff_insert";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   544
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   545
(*NOT SUITABLE FOR REWRITING since {a} == insert a 0*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   546
goal Set.thy "A - insert a B = A - {a} - B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   547
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   548
qed "Diff_insert2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   549
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   550
goal Set.thy "insert x A - B = (if x:B then A-B else insert x (A-B))";
1553
4eb4a9c7d736 Ran expandshort
paulson
parents: 1548
diff changeset
   551
by (simp_tac (!simpset setloop split_tac[expand_if]) 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   552
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   553
qed "insert_Diff_if";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   554
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   555
goal Set.thy "!!x. x:B ==> insert x A - B = A-B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   556
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   557
qed "insert_Diff1";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   558
Addsimps [insert_Diff1];
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   559
2922
580647a879cf Using Blast_tac
paulson
parents: 2912
diff changeset
   560
goal Set.thy "!!a. a:A ==> insert a (A-{a}) = A";
580647a879cf Using Blast_tac
paulson
parents: 2912
diff changeset
   561
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   562
qed "insert_Diff";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   563
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   564
goal Set.thy "A Int (B-A) = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   565
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   566
qed "Diff_disjoint";
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
   567
Addsimps[Diff_disjoint];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   568
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   569
goal Set.thy "!!A. A<=B ==> A Un (B-A) = B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   570
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   571
qed "Diff_partition";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   572
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   573
goal Set.thy "!!A. [| A<=B; B<= C |] ==> (B - (C - A)) = (A :: 'a set)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   574
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   575
qed "double_diff";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   576
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   577
goal Set.thy "A - (B Un C) = (A-B) Int (A-C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   578
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   579
qed "Diff_Un";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   580
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   581
goal Set.thy "A - (B Int C) = (A-B) Un (A-C)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   582
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   583
qed "Diff_Int";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   584
3222
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   585
goal Set.thy "(A Un B) - C = (A - C) Un (B - C)";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   586
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   587
qed "Un_Diff";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   588
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   589
goal Set.thy "(A Int B) - C = (A - C) Int (B - C)";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   590
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   591
qed "Int_Diff";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   592
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   593
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   594
section "Miscellany";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   595
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   596
goal Set.thy "(A = B) = ((A <= (B::'a set)) & (B<=A))";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   597
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   598
qed "set_eq_subset";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   599
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   600
goal Set.thy "A <= B =  (! t.t:A --> t:B)";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   601
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   602
qed "subset_iff";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   603
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   604
goalw thy [psubset_def] "((A::'a set) <= B) = ((A < B) | (A=B))";
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   605
by (Blast_tac 1);
726a9b069947 Distributed Psubset stuff to basic set theory files, incl Finite.
nipkow
parents: 2922
diff changeset
   606
qed "subset_iff_psubset_eq";
2021
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   607
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   608
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   609
(** Miniscoping: pushing in big Unions and Intersections **)
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   610
local
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2519
diff changeset
   611
  fun prover s = prove_goal Set.thy s (fn _ => [Blast_tac 1])
2021
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   612
in
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   613
val UN1_simps = map prover 
2031
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   614
                ["(UN x. insert a (B x)) = insert a (UN x. B x)",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   615
                 "(UN x. A x Int B)  = ((UN x.A x) Int B)",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   616
                 "(UN x. A Int B x)  = (A Int (UN x.B x))",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   617
                 "(UN x. A x Un B)   = ((UN x.A x) Un B)",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   618
                 "(UN x. A Un B x)   = (A Un (UN x.B x))",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   619
                 "(UN x. A x - B)    = ((UN x.A x) - B)",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   620
                 "(UN x. A - B x)    = (A - (INT x.B x))"];
2021
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   621
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   622
val INT1_simps = map prover
2031
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   623
                ["(INT x. insert a (B x)) = insert a (INT x. B x)",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   624
                 "(INT x. A x Int B) = ((INT x.A x) Int B)",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   625
                 "(INT x. A Int B x) = (A Int (INT x.B x))",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   626
                 "(INT x. A x Un B)  = ((INT x.A x) Un B)",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   627
                 "(INT x. A Un B x)  = (A Un (INT x.B x))",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   628
                 "(INT x. A x - B)   = ((INT x.A x) - B)",
03a843f0f447 Ran expandshort
paulson
parents: 2024
diff changeset
   629
                 "(INT x. A - B x)   = (A - (UN x.B x))"];
2021
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   630
2513
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   631
val UN_simps = map prover 
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   632
                ["(UN x:C. A x Int B)  = ((UN x:C.A x) Int B)",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   633
                 "(UN x:C. A Int B x)  = (A Int (UN x:C.B x))",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   634
                 "(UN x:C. A x - B)    = ((UN x:C.A x) - B)",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   635
                 "(UN x:C. A - B x)    = (A - (INT x:C.B x))"];
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   636
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   637
val INT_simps = map prover
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   638
                ["(INT x:C. insert a (B x)) = insert a (INT x:C. B x)",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   639
                 "(INT x:C. A x Un B)  = ((INT x:C.A x) Un B)",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   640
                 "(INT x:C. A Un B x)  = (A Un (INT x:C.B x))"];
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   641
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   642
(*The missing laws for bounded Unions and Intersections are conditional
2021
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   643
  on the index set's being non-empty.  Thus they are probably NOT worth 
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   644
  adding as default rewrites.*)
2513
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   645
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   646
val ball_simps = map prover
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   647
    ["(ALL x:A. P x | Q) = ((ALL x:A. P x) | Q)",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   648
     "(ALL x:A. P | Q x) = (P | (ALL x:A. Q x))",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   649
     "(ALL x:{}. P x) = True",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   650
     "(ALL x:insert a B. P x) = (P(a) & (ALL x:B. P x))",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   651
     "(ALL x:Union(A). P x) = (ALL y:A. ALL x:y. P x)",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   652
     "(ALL x:Collect Q. P x) = (ALL x. Q x --> P x)"];
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   653
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   654
val ball_conj_distrib = 
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   655
    prover "(ALL x:A. P x & Q x) = ((ALL x:A. P x) & (ALL x:A. Q x))";
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   656
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   657
val bex_simps = map prover
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   658
    ["(EX x:A. P x & Q) = ((EX x:A. P x) & Q)",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   659
     "(EX x:A. P & Q x) = (P & (EX x:A. Q x))",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   660
     "(EX x:{}. P x) = False",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   661
     "(EX x:insert a B. P x) = (P(a) | (EX x:B. P x))",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   662
     "(EX x:Union(A). P x) = (EX y:A. EX x:y.  P x)",
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   663
     "(EX x:Collect Q. P x) = (EX x. Q x & P x)"];
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   664
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   665
val bex_conj_distrib = 
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   666
    prover "(EX x:A. P x | Q x) = ((EX x:A. P x) | (EX x:A. Q x))";
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   667
2021
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   668
end;
dd5866263153 Added miniscoping for UN and INT
paulson
parents: 1917
diff changeset
   669
2513
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   670
Addsimps (UN1_simps @ INT1_simps @ UN_simps @ INT_simps @ 
d708d8cdc8e8 New miniscoping rules for the bounded quantifiers and UN/INT operators
paulson
parents: 2512
diff changeset
   671
	  ball_simps @ bex_simps);