author | wenzelm |
Wed, 23 Nov 1994 15:09:44 +0100 | |
changeset 175 | 3b1e8c22a44e |
parent 171 | 16c4ea954511 |
child 179 | 978854c19b5e |
permissions | -rw-r--r-- |
0 | 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 |
val subset_insertI = prove_goal Set.thy "B <= insert(a,B)" |
|
13 |
(fn _=> [ (rtac subsetI 1), (etac insertI2 1) ]); |
|
14 |
||
15 |
(*** Big Union -- least upper bound of a set ***) |
|
16 |
||
17 |
val prems = goal Set.thy |
|
18 |
"B:A ==> B <= Union(A)"; |
|
19 |
by (REPEAT (ares_tac (prems@[subsetI,UnionI]) 1)); |
|
171 | 20 |
qed "Union_upper"; |
0 | 21 |
|
22 |
val [prem] = goal Set.thy |
|
23 |
"[| !!X. X:A ==> X<=C |] ==> Union(A) <= C"; |
|
24 |
br subsetI 1; |
|
25 |
by (REPEAT (eresolve_tac [asm_rl, UnionE, prem RS subsetD] 1)); |
|
171 | 26 |
qed "Union_least"; |
0 | 27 |
|
28 |
(** General union **) |
|
29 |
||
30 |
val prems = goal Set.thy |
|
31 |
"a:A ==> B(a) <= (UN x:A. B(x))"; |
|
32 |
by (REPEAT (ares_tac (prems@[UN_I RS subsetI]) 1)); |
|
171 | 33 |
qed "UN_upper"; |
0 | 34 |
|
35 |
val [prem] = goal Set.thy |
|
36 |
"[| !!x. x:A ==> B(x)<=C |] ==> (UN x:A. B(x)) <= C"; |
|
37 |
br subsetI 1; |
|
38 |
by (REPEAT (eresolve_tac [asm_rl, UN_E, prem RS subsetD] 1)); |
|
171 | 39 |
qed "UN_least"; |
0 | 40 |
|
41 |
goal Set.thy "B(a) <= (UN x. B(x))"; |
|
42 |
by (REPEAT (ares_tac [UN1_I RS subsetI] 1)); |
|
171 | 43 |
qed "UN1_upper"; |
0 | 44 |
|
45 |
val [prem] = goal Set.thy "[| !!x. B(x)<=C |] ==> (UN x. B(x)) <= C"; |
|
46 |
br subsetI 1; |
|
47 |
by (REPEAT (eresolve_tac [asm_rl, UN1_E, prem RS subsetD] 1)); |
|
171 | 48 |
qed "UN1_least"; |
0 | 49 |
|
50 |
||
51 |
(*** Big Intersection -- greatest lower bound of a set ***) |
|
52 |
||
53 |
val prems = goal Set.thy "B:A ==> Inter(A) <= B"; |
|
54 |
br subsetI 1; |
|
55 |
by (REPEAT (resolve_tac prems 1 ORELSE etac InterD 1)); |
|
171 | 56 |
qed "Inter_lower"; |
0 | 57 |
|
58 |
val [prem] = goal Set.thy |
|
59 |
"[| !!X. X:A ==> C<=X |] ==> C <= Inter(A)"; |
|
60 |
br (InterI RS subsetI) 1; |
|
61 |
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1)); |
|
171 | 62 |
qed "Inter_greatest"; |
0 | 63 |
|
64 |
val prems = goal Set.thy "a:A ==> (INT x:A. B(x)) <= B(a)"; |
|
65 |
br subsetI 1; |
|
66 |
by (REPEAT (resolve_tac prems 1 ORELSE etac INT_D 1)); |
|
171 | 67 |
qed "INT_lower"; |
0 | 68 |
|
69 |
val [prem] = goal Set.thy |
|
70 |
"[| !!x. x:A ==> C<=B(x) |] ==> C <= (INT x:A. B(x))"; |
|
71 |
br (INT_I RS subsetI) 1; |
|
72 |
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1)); |
|
171 | 73 |
qed "INT_greatest"; |
0 | 74 |
|
75 |
goal Set.thy "(INT x. B(x)) <= B(a)"; |
|
76 |
br subsetI 1; |
|
77 |
by (REPEAT (resolve_tac prems 1 ORELSE etac INT1_D 1)); |
|
171 | 78 |
qed "INT1_lower"; |
0 | 79 |
|
80 |
val [prem] = goal Set.thy |
|
81 |
"[| !!x. C<=B(x) |] ==> C <= (INT x. B(x))"; |
|
82 |
br (INT1_I RS subsetI) 1; |
|
83 |
by (REPEAT (eresolve_tac [asm_rl, prem RS subsetD] 1)); |
|
171 | 84 |
qed "INT1_greatest"; |
0 | 85 |
|
86 |
(*** Finite Union -- the least upper bound of 2 sets ***) |
|
87 |
||
88 |
goal Set.thy "A <= A Un B"; |
|
89 |
by (REPEAT (ares_tac [subsetI,UnI1] 1)); |
|
171 | 90 |
qed "Un_upper1"; |
0 | 91 |
|
92 |
goal Set.thy "B <= A Un B"; |
|
93 |
by (REPEAT (ares_tac [subsetI,UnI2] 1)); |
|
171 | 94 |
qed "Un_upper2"; |
0 | 95 |
|
96 |
val prems = goal Set.thy "[| A<=C; B<=C |] ==> A Un B <= C"; |
|
97 |
by (cut_facts_tac prems 1); |
|
98 |
by (DEPTH_SOLVE (ares_tac [subsetI] 1 |
|
99 |
ORELSE eresolve_tac [UnE,subsetD] 1)); |
|
171 | 100 |
qed "Un_least"; |
0 | 101 |
|
102 |
(*** Finite Intersection -- the greatest lower bound of 2 sets *) |
|
103 |
||
104 |
goal Set.thy "A Int B <= A"; |
|
105 |
by (REPEAT (ares_tac [subsetI] 1 ORELSE etac IntE 1)); |
|
171 | 106 |
qed "Int_lower1"; |
0 | 107 |
|
108 |
goal Set.thy "A Int B <= B"; |
|
109 |
by (REPEAT (ares_tac [subsetI] 1 ORELSE etac IntE 1)); |
|
171 | 110 |
qed "Int_lower2"; |
0 | 111 |
|
112 |
val prems = goal Set.thy "[| C<=A; C<=B |] ==> C <= A Int B"; |
|
113 |
by (cut_facts_tac prems 1); |
|
114 |
by (REPEAT (ares_tac [subsetI,IntI] 1 |
|
115 |
ORELSE etac subsetD 1)); |
|
171 | 116 |
qed "Int_greatest"; |
0 | 117 |
|
118 |
(*** Set difference ***) |
|
119 |
||
90
5c7a69cef18b
added parentheses made necessary by change of constrain's precedence
clasohm
parents:
57
diff
changeset
|
120 |
val Diff_subset = prove_goal Set.thy "A-B <= (A::'a set)" |
0 | 121 |
(fn _ => [ (REPEAT (ares_tac [subsetI] 1 ORELSE etac DiffE 1)) ]); |
122 |
||
123 |
(*** Monotonicity ***) |
|
124 |
||
125 |
val [prem] = goal Set.thy "mono(f) ==> f(A) Un f(B) <= f(A Un B)"; |
|
126 |
by (rtac Un_least 1); |
|
127 |
by (rtac (Un_upper1 RS (prem RS monoD)) 1); |
|
128 |
by (rtac (Un_upper2 RS (prem RS monoD)) 1); |
|
171 | 129 |
qed "mono_Un"; |
0 | 130 |
|
131 |
val [prem] = goal Set.thy "mono(f) ==> f(A Int B) <= f(A) Int f(B)"; |
|
132 |
by (rtac Int_greatest 1); |
|
133 |
by (rtac (Int_lower1 RS (prem RS monoD)) 1); |
|
134 |
by (rtac (Int_lower2 RS (prem RS monoD)) 1); |
|
171 | 135 |
qed "mono_Int"; |