src/HOL/subset.ML
author paulson
Fri, 19 Sep 1997 16:12:21 +0200
changeset 3685 5b8c0c8f576e
parent 2893 2ee005e46d6d
child 4159 4aff9b7e5597
permissions -rw-r--r--
Full version of TLS including session resumption, but no Oops
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
goal Set.thy "B(a) <= (UN x. B(x))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    46
by (REPEAT (ares_tac [UN1_I RS subsetI] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    47
qed "UN1_upper";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    48
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    49
val [prem] = goal Set.thy "[| !!x. B(x)<=C |] ==> (UN x. B(x)) <= C";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    50
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    51
by (REPEAT (eresolve_tac [asm_rl, UN1_E, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    52
qed "UN1_least";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    53
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    54
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    55
(*** Big Intersection -- greatest lower bound of a set ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    57
goal Set.thy "!!B. B:A ==> Inter(A) <= B";
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    58
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    59
qed "Inter_lower";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    60
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
val [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    62
    "[| !!X. X:A ==> C<=X |] ==> C <= Inter(A)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    63
by (rtac (InterI RS subsetI) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    64
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    65
qed "Inter_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    67
val prems = goal Set.thy "a:A ==> (INT x:A. B(x)) <= B(a)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    68
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    69
by (REPEAT (resolve_tac prems 1 ORELSE etac INT_D 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    70
qed "INT_lower";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    71
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    72
val [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    73
    "[| !!x. x:A ==> C<=B(x) |] ==> C <= (INT x:A. B(x))";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    74
by (rtac (INT_I RS subsetI) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    75
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    76
qed "INT_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    77
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    78
goal Set.thy "(INT x. B(x)) <= 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 "INT1_lower";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    81
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    82
val [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    83
    "[| !!x. C<=B(x) |] ==> C <= (INT x. B(x))";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    84
by (rtac (INT1_I RS subsetI) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    85
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    86
qed "INT1_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    87
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    88
(*** Finite Union -- the least upper bound of 2 sets ***)
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
goal Set.thy "A <= A Un B";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    91
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    92
qed "Un_upper1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    93
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    94
goal Set.thy "B <= A Un B";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    95
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    96
qed "Un_upper2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    97
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    98
goal Set.thy "!!C. [| A<=C;  B<=C |] ==> A Un B <= C";
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
    99
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   100
qed "Un_least";
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
(*** Finite Intersection -- the greatest lower bound of 2 sets *)
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
goal Set.thy "A Int B <= A";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
   105
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   106
qed "Int_lower1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   107
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   108
goal Set.thy "A Int B <= B";
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
   109
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   110
qed "Int_lower2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   111
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
   112
goal Set.thy "!!C. [| C<=A;  C<=B |] ==> C <= A Int B";
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
   113
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   114
qed "Int_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   115
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   116
(*** Set difference ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   117
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   118
qed_goal "Diff_subset" Set.thy "A-B <= (A::'a set)"
2893
2ee005e46d6d Calls Blast_tac. Tidied some proofs
paulson
parents: 2515
diff changeset
   119
 (fn _ => [ (Blast_tac 1) ]);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   120
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   121
(*** Monotonicity ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   122
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   123
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
   124
by (rtac Un_least 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   125
by (rtac (Un_upper1 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   126
by (rtac (Un_upper2 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   127
qed "mono_Un";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   128
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   129
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
   130
by (rtac Int_greatest 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   131
by (rtac (Int_lower1 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   132
by (rtac (Int_lower2 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   133
qed "mono_Int";