src/HOL/subset.ML
author nipkow
Tue, 05 Jan 1999 17:27:59 +0100
changeset 6059 aa00e235ea27
parent 5316 7a8975451a89
child 7007 b46ccfee8e59
permissions -rw-r--r--
In Main: moved Bin to the left to preserve the solver in its simpset.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
     1
(*  Title:      HOL/subset
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
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   1991  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
Derived rules involving subsets
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
Union and Intersection as lattice operations
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
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
(*** insert ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    11
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
qed_goal "subset_insertI" Set.thy "B <= insert a B"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    13
 (fn _=> [ (rtac subsetI 1), (etac insertI2 1) ]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    14
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    15
Goal "x ~: A ==> (A <= insert x B) = (A <= B)";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    16
by (Blast_tac 1);
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    17
qed "subset_insert";
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    18
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
(*** Big Union -- least upper bound of a set  ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    20
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    21
Goal "B:A ==> B <= Union(A)";
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    22
by (REPEAT (ares_tac [subsetI,UnionI] 1));
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
qed "Union_upper";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    25
val [prem] = Goal "[| !!X. X:A ==> X<=C |] ==> Union(A) <= C";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    26
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    27
by (REPEAT (eresolve_tac [asm_rl, UnionE, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    28
qed "Union_least";
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
(** General union **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    32
Goal "a:A ==> B(a) <= (UN x:A. B(x))";
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    33
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
qed "UN_upper";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    35
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    36
val [prem] = Goal "[| !!x. x:A ==> B(x)<=C |] ==> (UN x:A. B(x)) <= C";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    37
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    38
by (REPEAT (eresolve_tac [asm_rl, UN_E, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    39
qed "UN_least";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    41
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    42
(*** Big Intersection -- greatest lower bound of a set ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    43
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    44
Goal "B:A ==> Inter(A) <= B";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    45
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    46
qed "Inter_lower";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    47
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    48
val [prem] = Goal "[| !!X. X:A ==> C<=X |] ==> C <= Inter(A)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    49
by (rtac (InterI RS subsetI) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    50
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    51
qed "Inter_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    52
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    53
Goal "a:A ==> (INT x:A. B(x)) <= B(a)";
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    54
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    55
qed "INT_lower";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    57
val [prem] = Goal "[| !!x. x:A ==> C<=B(x) |] ==> C <= (INT x:A. B(x))";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    58
by (rtac (INT_I RS subsetI) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    59
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    60
qed "INT_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    62
(*** Finite Union -- the least upper bound of 2 sets ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    64
Goal "A <= A Un B";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    65
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
qed "Un_upper1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    67
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    68
Goal "B <= A Un B";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    69
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    70
qed "Un_upper2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    71
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    72
Goal "[| A<=C;  B<=C |] ==> A Un B <= C";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    73
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    74
qed "Un_least";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    75
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    76
(*** Finite Intersection -- the greatest lower bound of 2 sets *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    77
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    78
Goal "A Int B <= A";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    79
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    80
qed "Int_lower1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    81
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    82
Goal "A Int B <= B";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    83
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    84
qed "Int_lower2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    85
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    86
Goal "[| C<=A;  C<=B |] ==> C <= A Int B";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    87
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    88
qed "Int_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    89
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    90
(*** Set difference ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    91
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    92
qed_goal "Diff_subset" Set.thy "A-B <= (A::'a set)"
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    93
 (fn _ => [ (Blast_tac 1) ]);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    94
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    95
(*** Monotonicity ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    96
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    97
Goal "mono(f) ==> f(A) Un f(B) <= f(A Un B)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    98
by (rtac Un_least 1);
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
    99
by (etac (Un_upper1 RSN (2,monoD)) 1);
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
   100
by (etac (Un_upper2 RSN (2,monoD)) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   101
qed "mono_Un";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   102
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
   103
Goal "mono(f) ==> f(A Int B) <= f(A) Int f(B)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   104
by (rtac Int_greatest 1);
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
   105
by (etac (Int_lower1 RSN (2,monoD)) 1);
7a8975451a89 even more tidying of Goal commands
paulson
parents: 4159
diff changeset
   106
by (etac (Int_lower2 RSN (2,monoD)) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   107
qed "mono_Int";