src/HOL/subset.ML
author paulson
Fri Mar 29 13:16:38 1996 +0100 (1996-03-29)
changeset 1631 26570790f089
parent 1552 6f71b5d46700
child 1760 6f41a494f3b1
permissions -rw-r--r--
new lemma for mutilated chess board
clasohm@1465
     1
(*  Title:      HOL/subset
clasohm@923
     2
    ID:         $Id$
clasohm@1465
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@923
     4
    Copyright   1991  University of Cambridge
clasohm@923
     5
clasohm@923
     6
Derived rules involving subsets
clasohm@923
     7
Union and Intersection as lattice operations
clasohm@923
     8
*)
clasohm@923
     9
clasohm@923
    10
(*** insert ***)
clasohm@923
    11
clasohm@923
    12
qed_goal "subset_insertI" Set.thy "B <= insert a B"
clasohm@923
    13
 (fn _=> [ (rtac subsetI 1), (etac insertI2 1) ]);
clasohm@923
    14
nipkow@1531
    15
goal Set.thy "!!x. x ~: A ==> (A <= insert x B) = (A <= B)";
paulson@1552
    16
by (fast_tac set_cs 1);
nipkow@1531
    17
qed "subset_insert";
nipkow@1531
    18
paulson@1631
    19
qed_goal "subset_empty_iff" Set.thy "(A<={}) = (A={})"
paulson@1631
    20
 (fn _=> [ (fast_tac (set_cs addIs [equalityI]) 1) ]);
paulson@1631
    21
clasohm@923
    22
(*** Big Union -- least upper bound of a set  ***)
clasohm@923
    23
clasohm@923
    24
val prems = goal Set.thy
clasohm@923
    25
    "B:A ==> B <= Union(A)";
clasohm@923
    26
by (REPEAT (ares_tac (prems@[subsetI,UnionI]) 1));
clasohm@923
    27
qed "Union_upper";
clasohm@923
    28
clasohm@923
    29
val [prem] = goal Set.thy
clasohm@923
    30
    "[| !!X. X:A ==> X<=C |] ==> Union(A) <= C";
clasohm@1465
    31
by (rtac subsetI 1);
clasohm@923
    32
by (REPEAT (eresolve_tac [asm_rl, UnionE, prem RS subsetD] 1));
clasohm@923
    33
qed "Union_least";
clasohm@923
    34
clasohm@923
    35
(** General union **)
clasohm@923
    36
clasohm@923
    37
val prems = goal Set.thy
clasohm@923
    38
    "a:A ==> B(a) <= (UN x:A. B(x))";
clasohm@923
    39
by (REPEAT (ares_tac (prems@[UN_I RS subsetI]) 1));
clasohm@923
    40
qed "UN_upper";
clasohm@923
    41
clasohm@923
    42
val [prem] = goal Set.thy
clasohm@923
    43
    "[| !!x. x:A ==> B(x)<=C |] ==> (UN x:A. B(x)) <= C";
clasohm@1465
    44
by (rtac subsetI 1);
clasohm@923
    45
by (REPEAT (eresolve_tac [asm_rl, UN_E, prem RS subsetD] 1));
clasohm@923
    46
qed "UN_least";
clasohm@923
    47
clasohm@923
    48
goal Set.thy "B(a) <= (UN x. B(x))";
clasohm@923
    49
by (REPEAT (ares_tac [UN1_I RS subsetI] 1));
clasohm@923
    50
qed "UN1_upper";
clasohm@923
    51
clasohm@923
    52
val [prem] = goal Set.thy "[| !!x. B(x)<=C |] ==> (UN x. B(x)) <= C";
clasohm@1465
    53
by (rtac subsetI 1);
clasohm@923
    54
by (REPEAT (eresolve_tac [asm_rl, UN1_E, prem RS subsetD] 1));
clasohm@923
    55
qed "UN1_least";
clasohm@923
    56
clasohm@923
    57
clasohm@923
    58
(*** Big Intersection -- greatest lower bound of a set ***)
clasohm@923
    59
clasohm@923
    60
val prems = goal Set.thy "B:A ==> Inter(A) <= B";
clasohm@1465
    61
by (rtac subsetI 1);
clasohm@923
    62
by (REPEAT (resolve_tac prems 1 ORELSE etac InterD 1));
clasohm@923
    63
qed "Inter_lower";
clasohm@923
    64
clasohm@923
    65
val [prem] = goal Set.thy
clasohm@923
    66
    "[| !!X. X:A ==> C<=X |] ==> C <= Inter(A)";
clasohm@1465
    67
by (rtac (InterI RS subsetI) 1);
clasohm@923
    68
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
clasohm@923
    69
qed "Inter_greatest";
clasohm@923
    70
clasohm@923
    71
val prems = goal Set.thy "a:A ==> (INT x:A. B(x)) <= B(a)";
clasohm@1465
    72
by (rtac subsetI 1);
clasohm@923
    73
by (REPEAT (resolve_tac prems 1 ORELSE etac INT_D 1));
clasohm@923
    74
qed "INT_lower";
clasohm@923
    75
clasohm@923
    76
val [prem] = goal Set.thy
clasohm@923
    77
    "[| !!x. x:A ==> C<=B(x) |] ==> C <= (INT x:A. B(x))";
clasohm@1465
    78
by (rtac (INT_I RS subsetI) 1);
clasohm@923
    79
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
clasohm@923
    80
qed "INT_greatest";
clasohm@923
    81
clasohm@923
    82
goal Set.thy "(INT x. B(x)) <= B(a)";
clasohm@1465
    83
by (rtac subsetI 1);
clasohm@923
    84
by (REPEAT (resolve_tac prems 1 ORELSE etac INT1_D 1));
clasohm@923
    85
qed "INT1_lower";
clasohm@923
    86
clasohm@923
    87
val [prem] = goal Set.thy
clasohm@923
    88
    "[| !!x. C<=B(x) |] ==> C <= (INT x. B(x))";
clasohm@1465
    89
by (rtac (INT1_I RS subsetI) 1);
clasohm@923
    90
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
clasohm@923
    91
qed "INT1_greatest";
clasohm@923
    92
clasohm@923
    93
(*** Finite Union -- the least upper bound of 2 sets ***)
clasohm@923
    94
clasohm@923
    95
goal Set.thy "A <= A Un B";
clasohm@923
    96
by (REPEAT (ares_tac [subsetI,UnI1] 1));
clasohm@923
    97
qed "Un_upper1";
clasohm@923
    98
clasohm@923
    99
goal Set.thy "B <= A Un B";
clasohm@923
   100
by (REPEAT (ares_tac [subsetI,UnI2] 1));
clasohm@923
   101
qed "Un_upper2";
clasohm@923
   102
clasohm@923
   103
val prems = goal Set.thy "[| A<=C;  B<=C |] ==> A Un B <= C";
clasohm@923
   104
by (cut_facts_tac prems 1);
clasohm@923
   105
by (DEPTH_SOLVE (ares_tac [subsetI] 1 
clasohm@923
   106
          ORELSE eresolve_tac [UnE,subsetD] 1));
clasohm@923
   107
qed "Un_least";
clasohm@923
   108
clasohm@923
   109
(*** Finite Intersection -- the greatest lower bound of 2 sets *)
clasohm@923
   110
clasohm@923
   111
goal Set.thy "A Int B <= A";
clasohm@923
   112
by (REPEAT (ares_tac [subsetI] 1 ORELSE etac IntE 1));
clasohm@923
   113
qed "Int_lower1";
clasohm@923
   114
clasohm@923
   115
goal Set.thy "A Int B <= B";
clasohm@923
   116
by (REPEAT (ares_tac [subsetI] 1 ORELSE etac IntE 1));
clasohm@923
   117
qed "Int_lower2";
clasohm@923
   118
clasohm@923
   119
val prems = goal Set.thy "[| C<=A;  C<=B |] ==> C <= A Int B";
clasohm@923
   120
by (cut_facts_tac prems 1);
clasohm@923
   121
by (REPEAT (ares_tac [subsetI,IntI] 1
clasohm@923
   122
     ORELSE etac subsetD 1));
clasohm@923
   123
qed "Int_greatest";
clasohm@923
   124
clasohm@923
   125
(*** Set difference ***)
clasohm@923
   126
clasohm@923
   127
qed_goal "Diff_subset" Set.thy "A-B <= (A::'a set)"
clasohm@923
   128
 (fn _ => [ (REPEAT (ares_tac [subsetI] 1 ORELSE etac DiffE 1)) ]);
clasohm@923
   129
clasohm@923
   130
(*** Monotonicity ***)
clasohm@923
   131
clasohm@923
   132
val [prem] = goal Set.thy "mono(f) ==> f(A) Un f(B) <= f(A Un B)";
clasohm@923
   133
by (rtac Un_least 1);
clasohm@923
   134
by (rtac (Un_upper1 RS (prem RS monoD)) 1);
clasohm@923
   135
by (rtac (Un_upper2 RS (prem RS monoD)) 1);
clasohm@923
   136
qed "mono_Un";
clasohm@923
   137
clasohm@923
   138
val [prem] = goal Set.thy "mono(f) ==> f(A Int B) <= f(A) Int f(B)";
clasohm@923
   139
by (rtac Int_greatest 1);
clasohm@923
   140
by (rtac (Int_lower1 RS (prem RS monoD)) 1);
clasohm@923
   141
by (rtac (Int_lower2 RS (prem RS monoD)) 1);
clasohm@923
   142
qed "mono_Int";