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