author | paulson |
Fri, 13 Sep 1996 18:47:01 +0200 | |
changeset 1999 | b5efc4108d04 |
parent 1761 | 29e08d527ba1 |
child 2515 | 6ff9bd353121 |
permissions | -rw-r--r-- |
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)"; |
1760
6f41a494f3b1
Replaced fast_tac by Fast_tac (which uses default claset)
berghofe
parents:
1631
diff
changeset
|
16 |
by (Fast_tac 1); |
1531 | 17 |
qed "subset_insert"; |
18 |
||
1631 | 19 |
qed_goal "subset_empty_iff" Set.thy "(A<={}) = (A={})" |
1761
29e08d527ba1
Removed equalityI from some proofs (because it is now included
berghofe
parents:
1760
diff
changeset
|
20 |
(fn _=> [ (Fast_tac 1) ]); |
1631 | 21 |
|
923 | 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"; |
|
1465 | 31 |
by (rtac subsetI 1); |
923 | 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"; |
|
1465 | 44 |
by (rtac subsetI 1); |
923 | 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"; |
|
1465 | 53 |
by (rtac subsetI 1); |
923 | 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"; |
|
1465 | 61 |
by (rtac subsetI 1); |
923 | 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)"; |
|
1465 | 67 |
by (rtac (InterI RS subsetI) 1); |
923 | 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)"; |
|
1465 | 72 |
by (rtac subsetI 1); |
923 | 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))"; |
|
1465 | 78 |
by (rtac (INT_I RS subsetI) 1); |
923 | 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)"; |
|
1465 | 83 |
by (rtac subsetI 1); |
923 | 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))"; |
|
1465 | 89 |
by (rtac (INT1_I RS subsetI) 1); |
923 | 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"; |