1465
|
1 |
(* Title: HOL/subset
|
923
|
2 |
ID: $Id$
|
1465
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory
|
923
|
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 |
|
1531
|
15 |
goal Set.thy "!!x. x ~: A ==> (A <= insert x B) = (A <= B)";
|
2893
|
16 |
by (Blast_tac 1);
|
1531
|
17 |
qed "subset_insert";
|
|
18 |
|
923
|
19 |
(*** Big Union -- least upper bound of a set ***)
|
|
20 |
|
|
21 |
val prems = goal Set.thy
|
|
22 |
"B:A ==> B <= Union(A)";
|
|
23 |
by (REPEAT (ares_tac (prems@[subsetI,UnionI]) 1));
|
|
24 |
qed "Union_upper";
|
|
25 |
|
|
26 |
val [prem] = goal Set.thy
|
|
27 |
"[| !!X. X:A ==> X<=C |] ==> Union(A) <= C";
|
1465
|
28 |
by (rtac subsetI 1);
|
923
|
29 |
by (REPEAT (eresolve_tac [asm_rl, UnionE, prem RS subsetD] 1));
|
|
30 |
qed "Union_least";
|
|
31 |
|
|
32 |
(** General union **)
|
|
33 |
|
|
34 |
val prems = goal Set.thy
|
|
35 |
"a:A ==> B(a) <= (UN x:A. B(x))";
|
|
36 |
by (REPEAT (ares_tac (prems@[UN_I RS subsetI]) 1));
|
|
37 |
qed "UN_upper";
|
|
38 |
|
|
39 |
val [prem] = goal Set.thy
|
|
40 |
"[| !!x. x:A ==> B(x)<=C |] ==> (UN x:A. B(x)) <= C";
|
1465
|
41 |
by (rtac subsetI 1);
|
923
|
42 |
by (REPEAT (eresolve_tac [asm_rl, UN_E, prem RS subsetD] 1));
|
|
43 |
qed "UN_least";
|
|
44 |
|
|
45 |
goal Set.thy "B(a) <= (UN x. B(x))";
|
|
46 |
by (REPEAT (ares_tac [UN1_I RS subsetI] 1));
|
|
47 |
qed "UN1_upper";
|
|
48 |
|
|
49 |
val [prem] = goal Set.thy "[| !!x. B(x)<=C |] ==> (UN x. B(x)) <= C";
|
1465
|
50 |
by (rtac subsetI 1);
|
923
|
51 |
by (REPEAT (eresolve_tac [asm_rl, UN1_E, prem RS subsetD] 1));
|
|
52 |
qed "UN1_least";
|
|
53 |
|
|
54 |
|
|
55 |
(*** Big Intersection -- greatest lower bound of a set ***)
|
|
56 |
|
2893
|
57 |
goal Set.thy "!!B. B:A ==> Inter(A) <= B";
|
|
58 |
by (Blast_tac 1);
|
923
|
59 |
qed "Inter_lower";
|
|
60 |
|
|
61 |
val [prem] = goal Set.thy
|
|
62 |
"[| !!X. X:A ==> C<=X |] ==> C <= Inter(A)";
|
1465
|
63 |
by (rtac (InterI RS subsetI) 1);
|
923
|
64 |
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
|
|
65 |
qed "Inter_greatest";
|
|
66 |
|
|
67 |
val prems = goal Set.thy "a:A ==> (INT x:A. B(x)) <= B(a)";
|
1465
|
68 |
by (rtac subsetI 1);
|
923
|
69 |
by (REPEAT (resolve_tac prems 1 ORELSE etac INT_D 1));
|
|
70 |
qed "INT_lower";
|
|
71 |
|
|
72 |
val [prem] = goal Set.thy
|
|
73 |
"[| !!x. x:A ==> C<=B(x) |] ==> C <= (INT x:A. B(x))";
|
1465
|
74 |
by (rtac (INT_I RS subsetI) 1);
|
923
|
75 |
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
|
|
76 |
qed "INT_greatest";
|
|
77 |
|
|
78 |
goal Set.thy "(INT x. B(x)) <= B(a)";
|
2893
|
79 |
by (Blast_tac 1);
|
923
|
80 |
qed "INT1_lower";
|
|
81 |
|
|
82 |
val [prem] = goal Set.thy
|
|
83 |
"[| !!x. C<=B(x) |] ==> C <= (INT x. B(x))";
|
1465
|
84 |
by (rtac (INT1_I RS subsetI) 1);
|
923
|
85 |
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1));
|
|
86 |
qed "INT1_greatest";
|
|
87 |
|
|
88 |
(*** Finite Union -- the least upper bound of 2 sets ***)
|
|
89 |
|
|
90 |
goal Set.thy "A <= A Un B";
|
2893
|
91 |
by (Blast_tac 1);
|
923
|
92 |
qed "Un_upper1";
|
|
93 |
|
|
94 |
goal Set.thy "B <= A Un B";
|
2893
|
95 |
by (Blast_tac 1);
|
923
|
96 |
qed "Un_upper2";
|
|
97 |
|
2893
|
98 |
goal Set.thy "!!C. [| A<=C; B<=C |] ==> A Un B <= C";
|
|
99 |
by (Blast_tac 1);
|
923
|
100 |
qed "Un_least";
|
|
101 |
|
|
102 |
(*** Finite Intersection -- the greatest lower bound of 2 sets *)
|
|
103 |
|
|
104 |
goal Set.thy "A Int B <= A";
|
2893
|
105 |
by (Blast_tac 1);
|
923
|
106 |
qed "Int_lower1";
|
|
107 |
|
|
108 |
goal Set.thy "A Int B <= B";
|
2893
|
109 |
by (Blast_tac 1);
|
923
|
110 |
qed "Int_lower2";
|
|
111 |
|
2893
|
112 |
goal Set.thy "!!C. [| C<=A; C<=B |] ==> C <= A Int B";
|
|
113 |
by (Blast_tac 1);
|
923
|
114 |
qed "Int_greatest";
|
|
115 |
|
|
116 |
(*** Set difference ***)
|
|
117 |
|
|
118 |
qed_goal "Diff_subset" Set.thy "A-B <= (A::'a set)"
|
2893
|
119 |
(fn _ => [ (Blast_tac 1) ]);
|
923
|
120 |
|
|
121 |
(*** Monotonicity ***)
|
|
122 |
|
|
123 |
val [prem] = goal Set.thy "mono(f) ==> f(A) Un f(B) <= f(A Un B)";
|
|
124 |
by (rtac Un_least 1);
|
|
125 |
by (rtac (Un_upper1 RS (prem RS monoD)) 1);
|
|
126 |
by (rtac (Un_upper2 RS (prem RS monoD)) 1);
|
|
127 |
qed "mono_Un";
|
|
128 |
|
|
129 |
val [prem] = goal Set.thy "mono(f) ==> f(A Int B) <= f(A) Int f(B)";
|
|
130 |
by (rtac Int_greatest 1);
|
|
131 |
by (rtac (Int_lower1 RS (prem RS monoD)) 1);
|
|
132 |
by (rtac (Int_lower2 RS (prem RS monoD)) 1);
|
|
133 |
qed "mono_Int";
|