src/HOL/subset.ML
author wenzelm
Fri, 03 Jul 1998 17:34:55 +0200
changeset 5123 97c1d5c7b701
parent 4159 4aff9b7e5597
child 5316 7a8975451a89
permissions -rw-r--r--
stepping stones;
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
1531
e5eb247ad13c Added a constant UNIV == {x.True}
nipkow
parents: 1465
diff changeset
    15
goal Set.thy "!!x. 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
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    21
val prems = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    22
    "B:A ==> B <= Union(A)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
by (REPEAT (ares_tac (prems@[subsetI,UnionI]) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
qed "Union_upper";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    26
val [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    27
    "[| !!X. X:A ==> X<=C |] ==> Union(A) <= C";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    28
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    29
by (REPEAT (eresolve_tac [asm_rl, UnionE, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    30
qed "Union_least";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    32
(** General union **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    33
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
val prems = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    35
    "a:A ==> B(a) <= (UN x:A. B(x))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    36
by (REPEAT (ares_tac (prems@[UN_I RS subsetI]) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    37
qed "UN_upper";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    38
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    39
val [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
    "[| !!x. x:A ==> B(x)<=C |] ==> (UN x:A. B(x)) <= C";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    41
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    42
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
    43
qed "UN_least";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    44
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    45
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    46
(*** Big Intersection -- greatest lower bound of a set ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    47
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    48
goal Set.thy "!!B. B:A ==> Inter(A) <= B";
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    49
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    50
qed "Inter_lower";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    51
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    52
val [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    53
    "[| !!X. X:A ==> C<=X |] ==> C <= Inter(A)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    54
by (rtac (InterI RS subsetI) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    55
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
qed "Inter_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    57
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    58
val prems = goal Set.thy "a:A ==> (INT x:A. B(x)) <= B(a)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    59
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    60
by (REPEAT (resolve_tac prems 1 ORELSE etac INT_D 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
qed "INT_lower";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    62
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
val [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    64
    "[| !!x. x:A ==> C<=B(x) |] ==> C <= (INT x:A. B(x))";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    65
by (rtac (INT_I RS subsetI) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    67
qed "INT_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    68
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    69
(*** Finite Union -- the least upper bound of 2 sets ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    70
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    71
goal Set.thy "A <= A Un B";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    72
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    73
qed "Un_upper1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    74
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    75
goal Set.thy "B <= A Un B";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    76
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    77
qed "Un_upper2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    78
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    79
goal Set.thy "!!C. [| A<=C;  B<=C |] ==> A Un B <= C";
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    80
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    81
qed "Un_least";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    82
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    83
(*** Finite Intersection -- the greatest lower bound of 2 sets *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    84
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    85
goal Set.thy "A Int B <= A";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    86
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    87
qed "Int_lower1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    88
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    89
goal Set.thy "A Int B <= B";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    90
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    91
qed "Int_lower2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    92
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    93
goal Set.thy "!!C. [| C<=A;  C<=B |] ==> C <= A Int B";
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    94
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    95
qed "Int_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    96
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    97
(*** Set difference ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    98
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    99
qed_goal "Diff_subset" Set.thy "A-B <= (A::'a set)"
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
   100
 (fn _ => [ (Blast_tac 1) ]);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   101
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   102
(*** Monotonicity ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   103
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   104
val [prem] = goal Set.thy "mono(f) ==> f(A) Un f(B) <= f(A Un B)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   105
by (rtac Un_least 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   106
by (rtac (Un_upper1 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   107
by (rtac (Un_upper2 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   108
qed "mono_Un";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   109
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   110
val [prem] = goal Set.thy "mono(f) ==> f(A Int B) <= f(A) Int f(B)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   111
by (rtac Int_greatest 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   112
by (rtac (Int_lower1 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   113
by (rtac (Int_lower2 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   114
qed "mono_Int";