src/HOL/subset.ML
author clasohm
Tue, 30 Jan 1996 15:24:36 +0100
changeset 1465 5d7a7e439cec
parent 923 ff1574a81019
child 1531 e5eb247ad13c
permissions -rw-r--r--
expanded tabs
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
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
(*** Big Union -- least upper bound of a set  ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    16
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    17
val prems = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    18
    "B:A ==> B <= Union(A)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
by (REPEAT (ares_tac (prems@[subsetI,UnionI]) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    20
qed "Union_upper";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    21
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    22
val [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
    "[| !!X. X:A ==> X<=C |] ==> Union(A) <= C";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    24
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
by (REPEAT (eresolve_tac [asm_rl, UnionE, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    26
qed "Union_least";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    27
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    28
(** General union **)
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
val prems = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
    "a:A ==> B(a) <= (UN x:A. B(x))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    32
by (REPEAT (ares_tac (prems@[UN_I RS subsetI]) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    33
qed "UN_upper";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    35
val [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    36
    "[| !!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
goal Set.thy "B(a) <= (UN x. B(x))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    42
by (REPEAT (ares_tac [UN1_I RS subsetI] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    43
qed "UN1_upper";
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
val [prem] = goal Set.thy "[| !!x. B(x)<=C |] ==> (UN x. B(x)) <= C";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    46
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    47
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
    48
qed "UN1_least";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    49
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    50
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    51
(*** Big Intersection -- greatest lower bound of a set ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    52
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    53
val prems = goal Set.thy "B:A ==> Inter(A) <= B";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    54
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    55
by (REPEAT (resolve_tac prems 1 ORELSE etac InterD 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
qed "Inter_lower";
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 [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    59
    "[| !!X. X:A ==> C<=X |] ==> C <= Inter(A)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    60
by (rtac (InterI RS subsetI) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    62
qed "Inter_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    64
val prems = goal Set.thy "a:A ==> (INT x:A. B(x)) <= B(a)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    65
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
by (REPEAT (resolve_tac prems 1 ORELSE etac INT_D 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    67
qed "INT_lower";
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
val [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    70
    "[| !!x. x:A ==> C<=B(x) |] ==> C <= (INT x:A. B(x))";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    71
by (rtac (INT_I RS subsetI) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    72
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    73
qed "INT_greatest";
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 "(INT x. B(x)) <= B(a)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    76
by (rtac subsetI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    77
by (REPEAT (resolve_tac prems 1 ORELSE etac INT1_D 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    78
qed "INT1_lower";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    79
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    80
val [prem] = goal Set.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    81
    "[| !!x. C<=B(x) |] ==> C <= (INT x. B(x))";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
    82
by (rtac (INT1_I RS subsetI) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    83
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    84
qed "INT1_greatest";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    85
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    86
(*** Finite Union -- the least upper bound of 2 sets ***)
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
goal Set.thy "A <= A Un B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    89
by (REPEAT (ares_tac [subsetI,UnI1] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    90
qed "Un_upper1";
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
goal Set.thy "B <= A Un B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    93
by (REPEAT (ares_tac [subsetI,UnI2] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    94
qed "Un_upper2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    95
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    96
val prems = goal Set.thy "[| A<=C;  B<=C |] ==> A Un B <= C";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    97
by (cut_facts_tac prems 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    98
by (DEPTH_SOLVE (ares_tac [subsetI] 1 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    99
          ORELSE eresolve_tac [UnE,subsetD] 1));
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";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   105
by (REPEAT (ares_tac [subsetI] 1 ORELSE etac IntE 1));
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";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   109
by (REPEAT (ares_tac [subsetI] 1 ORELSE etac IntE 1));
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
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   112
val prems = goal Set.thy "[| C<=A;  C<=B |] ==> C <= A Int B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   113
by (cut_facts_tac prems 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   114
by (REPEAT (ares_tac [subsetI,IntI] 1
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   115
     ORELSE etac subsetD 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   116
qed "Int_greatest";
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
(*** Set difference ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   119
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   120
qed_goal "Diff_subset" Set.thy "A-B <= (A::'a set)"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   121
 (fn _ => [ (REPEAT (ares_tac [subsetI] 1 ORELSE etac DiffE 1)) ]);
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
(*** Monotonicity ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   124
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   125
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
   126
by (rtac Un_least 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   127
by (rtac (Un_upper1 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   128
by (rtac (Un_upper2 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   129
qed "mono_Un";
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
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
   132
by (rtac Int_greatest 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   133
by (rtac (Int_lower1 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   134
by (rtac (Int_lower2 RS (prem RS monoD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   135
qed "mono_Int";