author | nipkow |
Tue, 17 Nov 2015 11:44:10 +0100 | |
changeset 61692 | cb595e12451d |
parent 60770 | 240563fbf41d |
child 62020 | 5d208fd2507d |
permissions | -rw-r--r-- |
60770 | 1 |
section \<open>Extending FOL by a modified version of HOL set theory\<close> |
17456 | 2 |
|
3 |
theory Set |
|
48475 | 4 |
imports "~~/src/FOL/FOL" |
17456 | 5 |
begin |
0 | 6 |
|
39128
93a7365fb4ee
turned eta_contract into proper configuration option;
wenzelm
parents:
38499
diff
changeset
|
7 |
declare [[eta_contract]] |
93a7365fb4ee
turned eta_contract into proper configuration option;
wenzelm
parents:
38499
diff
changeset
|
8 |
|
17456 | 9 |
typedecl 'a set |
55380
4de48353034e
prefer vacuous definitional type classes over axiomatic ones;
wenzelm
parents:
48475
diff
changeset
|
10 |
instance set :: ("term") "term" .. |
0 | 11 |
|
12 |
consts |
|
58977 | 13 |
Collect :: "['a \<Rightarrow> o] \<Rightarrow> 'a set" (*comprehension*) |
14 |
Compl :: "('a set) \<Rightarrow> 'a set" (*complement*) |
|
15 |
Int :: "['a set, 'a set] \<Rightarrow> 'a set" (infixl "Int" 70) |
|
16 |
Un :: "['a set, 'a set] \<Rightarrow> 'a set" (infixl "Un" 65) |
|
17 |
Union :: "(('a set)set) \<Rightarrow> 'a set" (*...of a set*) |
|
18 |
Inter :: "(('a set)set) \<Rightarrow> 'a set" (*...of a set*) |
|
19 |
UNION :: "['a set, 'a \<Rightarrow> 'b set] \<Rightarrow> 'b set" (*general*) |
|
20 |
INTER :: "['a set, 'a \<Rightarrow> 'b set] \<Rightarrow> 'b set" (*general*) |
|
21 |
Ball :: "['a set, 'a \<Rightarrow> o] \<Rightarrow> o" (*bounded quants*) |
|
22 |
Bex :: "['a set, 'a \<Rightarrow> o] \<Rightarrow> o" (*bounded quants*) |
|
23 |
mono :: "['a set \<Rightarrow> 'b set] \<Rightarrow> o" (*monotonicity*) |
|
24 |
mem :: "['a, 'a set] \<Rightarrow> o" (infixl ":" 50) (*membership*) |
|
25 |
subset :: "['a set, 'a set] \<Rightarrow> o" (infixl "<=" 50) |
|
26 |
singleton :: "'a \<Rightarrow> 'a set" ("{_}") |
|
0 | 27 |
empty :: "'a set" ("{}") |
28 |
||
3935 | 29 |
syntax |
58977 | 30 |
"_Coll" :: "[idt, o] \<Rightarrow> 'a set" ("(1{_./ _})") (*collection*) |
0 | 31 |
|
32 |
(* Big Intersection / Union *) |
|
33 |
||
58977 | 34 |
"_INTER" :: "[idt, 'a set, 'b set] \<Rightarrow> 'b set" ("(INT _:_./ _)" [0, 0, 0] 10) |
35 |
"_UNION" :: "[idt, 'a set, 'b set] \<Rightarrow> 'b set" ("(UN _:_./ _)" [0, 0, 0] 10) |
|
0 | 36 |
|
37 |
(* Bounded Quantifiers *) |
|
38 |
||
58977 | 39 |
"_Ball" :: "[idt, 'a set, o] \<Rightarrow> o" ("(ALL _:_./ _)" [0, 0, 0] 10) |
40 |
"_Bex" :: "[idt, 'a set, o] \<Rightarrow> o" ("(EX _:_./ _)" [0, 0, 0] 10) |
|
0 | 41 |
|
42 |
translations |
|
58977 | 43 |
"{x. P}" == "CONST Collect(\<lambda>x. P)" |
44 |
"INT x:A. B" == "CONST INTER(A, \<lambda>x. B)" |
|
45 |
"UN x:A. B" == "CONST UNION(A, \<lambda>x. B)" |
|
46 |
"ALL x:A. P" == "CONST Ball(A, \<lambda>x. P)" |
|
47 |
"EX x:A. P" == "CONST Bex(A, \<lambda>x. P)" |
|
0 | 48 |
|
42156 | 49 |
axiomatization where |
58977 | 50 |
mem_Collect_iff: "(a : {x. P(x)}) \<longleftrightarrow> P(a)" and |
51 |
set_extension: "A = B \<longleftrightarrow> (ALL x. x:A \<longleftrightarrow> x:B)" |
|
0 | 52 |
|
17456 | 53 |
defs |
58977 | 54 |
Ball_def: "Ball(A, P) == ALL x. x:A \<longrightarrow> P(x)" |
55 |
Bex_def: "Bex(A, P) == EX x. x:A \<and> P(x)" |
|
56 |
mono_def: "mono(f) == (ALL A B. A <= B \<longrightarrow> f(A) <= f(B))" |
|
17456 | 57 |
subset_def: "A <= B == ALL x:A. x:B" |
58 |
singleton_def: "{a} == {x. x=a}" |
|
59 |
empty_def: "{} == {x. False}" |
|
60 |
Un_def: "A Un B == {x. x:A | x:B}" |
|
58977 | 61 |
Int_def: "A Int B == {x. x:A \<and> x:B}" |
62 |
Compl_def: "Compl(A) == {x. \<not>x:A}" |
|
17456 | 63 |
INTER_def: "INTER(A, B) == {y. ALL x:A. y: B(x)}" |
64 |
UNION_def: "UNION(A, B) == {y. EX x:A. y: B(x)}" |
|
65 |
Inter_def: "Inter(S) == (INT x:S. x)" |
|
66 |
Union_def: "Union(S) == (UN x:S. x)" |
|
67 |
||
20140 | 68 |
|
58977 | 69 |
lemma CollectI: "P(a) \<Longrightarrow> a : {x. P(x)}" |
20140 | 70 |
apply (rule mem_Collect_iff [THEN iffD2]) |
71 |
apply assumption |
|
72 |
done |
|
73 |
||
58977 | 74 |
lemma CollectD: "a : {x. P(x)} \<Longrightarrow> P(a)" |
20140 | 75 |
apply (erule mem_Collect_iff [THEN iffD1]) |
76 |
done |
|
77 |
||
78 |
lemmas CollectE = CollectD [elim_format] |
|
79 |
||
58977 | 80 |
lemma set_ext: "(\<And>x. x:A \<longleftrightarrow> x:B) \<Longrightarrow> A = B" |
20140 | 81 |
apply (rule set_extension [THEN iffD2]) |
82 |
apply simp |
|
83 |
done |
|
84 |
||
85 |
||
60770 | 86 |
subsection \<open>Bounded quantifiers\<close> |
20140 | 87 |
|
58977 | 88 |
lemma ballI: "(\<And>x. x:A \<Longrightarrow> P(x)) \<Longrightarrow> ALL x:A. P(x)" |
20140 | 89 |
by (simp add: Ball_def) |
90 |
||
58977 | 91 |
lemma bspec: "\<lbrakk>ALL x:A. P(x); x:A\<rbrakk> \<Longrightarrow> P(x)" |
20140 | 92 |
by (simp add: Ball_def) |
93 |
||
58977 | 94 |
lemma ballE: "\<lbrakk>ALL x:A. P(x); P(x) \<Longrightarrow> Q; \<not> x:A \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q" |
20140 | 95 |
unfolding Ball_def by blast |
96 |
||
58977 | 97 |
lemma bexI: "\<lbrakk>P(x); x:A\<rbrakk> \<Longrightarrow> EX x:A. P(x)" |
20140 | 98 |
unfolding Bex_def by blast |
99 |
||
58977 | 100 |
lemma bexCI: "\<lbrakk>EX x:A. \<not>P(x) \<Longrightarrow> P(a); a:A\<rbrakk> \<Longrightarrow> EX x:A. P(x)" |
20140 | 101 |
unfolding Bex_def by blast |
102 |
||
58977 | 103 |
lemma bexE: "\<lbrakk>EX x:A. P(x); \<And>x. \<lbrakk>x:A; P(x)\<rbrakk> \<Longrightarrow> Q\<rbrakk> \<Longrightarrow> Q" |
20140 | 104 |
unfolding Bex_def by blast |
105 |
||
106 |
(*Trival rewrite rule; (! x:A.P)=P holds only if A is nonempty!*) |
|
58977 | 107 |
lemma ball_rew: "(ALL x:A. True) \<longleftrightarrow> True" |
20140 | 108 |
by (blast intro: ballI) |
109 |
||
110 |
||
60770 | 111 |
subsection \<open>Congruence rules\<close> |
20140 | 112 |
|
113 |
lemma ball_cong: |
|
58977 | 114 |
"\<lbrakk>A = A'; \<And>x. x:A' \<Longrightarrow> P(x) \<longleftrightarrow> P'(x)\<rbrakk> \<Longrightarrow> |
115 |
(ALL x:A. P(x)) \<longleftrightarrow> (ALL x:A'. P'(x))" |
|
20140 | 116 |
by (blast intro: ballI elim: ballE) |
117 |
||
118 |
lemma bex_cong: |
|
58977 | 119 |
"\<lbrakk>A = A'; \<And>x. x:A' \<Longrightarrow> P(x) \<longleftrightarrow> P'(x)\<rbrakk> \<Longrightarrow> |
120 |
(EX x:A. P(x)) \<longleftrightarrow> (EX x:A'. P'(x))" |
|
20140 | 121 |
by (blast intro: bexI elim: bexE) |
122 |
||
123 |
||
60770 | 124 |
subsection \<open>Rules for subsets\<close> |
20140 | 125 |
|
58977 | 126 |
lemma subsetI: "(\<And>x. x:A \<Longrightarrow> x:B) \<Longrightarrow> A <= B" |
20140 | 127 |
unfolding subset_def by (blast intro: ballI) |
128 |
||
129 |
(*Rule in Modus Ponens style*) |
|
58977 | 130 |
lemma subsetD: "\<lbrakk>A <= B; c:A\<rbrakk> \<Longrightarrow> c:B" |
20140 | 131 |
unfolding subset_def by (blast elim: ballE) |
132 |
||
133 |
(*Classical elimination rule*) |
|
58977 | 134 |
lemma subsetCE: "\<lbrakk>A <= B; \<not>(c:A) \<Longrightarrow> P; c:B \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P" |
20140 | 135 |
by (blast dest: subsetD) |
136 |
||
137 |
lemma subset_refl: "A <= A" |
|
138 |
by (blast intro: subsetI) |
|
139 |
||
58977 | 140 |
lemma subset_trans: "\<lbrakk>A <= B; B <= C\<rbrakk> \<Longrightarrow> A <= C" |
20140 | 141 |
by (blast intro: subsetI dest: subsetD) |
142 |
||
143 |
||
60770 | 144 |
subsection \<open>Rules for equality\<close> |
20140 | 145 |
|
146 |
(*Anti-symmetry of the subset relation*) |
|
58977 | 147 |
lemma subset_antisym: "\<lbrakk>A <= B; B <= A\<rbrakk> \<Longrightarrow> A = B" |
20140 | 148 |
by (blast intro: set_ext dest: subsetD) |
149 |
||
150 |
lemmas equalityI = subset_antisym |
|
151 |
||
152 |
(* Equality rules from ZF set theory -- are they appropriate here? *) |
|
58977 | 153 |
lemma equalityD1: "A = B \<Longrightarrow> A<=B" |
154 |
and equalityD2: "A = B \<Longrightarrow> B<=A" |
|
20140 | 155 |
by (simp_all add: subset_refl) |
156 |
||
58977 | 157 |
lemma equalityE: "\<lbrakk>A = B; \<lbrakk>A <= B; B <= A\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P" |
20140 | 158 |
by (simp add: subset_refl) |
159 |
||
58977 | 160 |
lemma equalityCE: "\<lbrakk>A = B; \<lbrakk>c:A; c:B\<rbrakk> \<Longrightarrow> P; \<lbrakk>\<not> c:A; \<not> c:B\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P" |
20140 | 161 |
by (blast elim: equalityE subsetCE) |
162 |
||
163 |
lemma trivial_set: "{x. x:A} = A" |
|
164 |
by (blast intro: equalityI subsetI CollectI dest: CollectD) |
|
165 |
||
166 |
||
60770 | 167 |
subsection \<open>Rules for binary union\<close> |
20140 | 168 |
|
58977 | 169 |
lemma UnI1: "c:A \<Longrightarrow> c : A Un B" |
170 |
and UnI2: "c:B \<Longrightarrow> c : A Un B" |
|
20140 | 171 |
unfolding Un_def by (blast intro: CollectI)+ |
172 |
||
173 |
(*Classical introduction rule: no commitment to A vs B*) |
|
58977 | 174 |
lemma UnCI: "(\<not>c:B \<Longrightarrow> c:A) \<Longrightarrow> c : A Un B" |
20140 | 175 |
by (blast intro: UnI1 UnI2) |
176 |
||
58977 | 177 |
lemma UnE: "\<lbrakk>c : A Un B; c:A \<Longrightarrow> P; c:B \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P" |
20140 | 178 |
unfolding Un_def by (blast dest: CollectD) |
179 |
||
180 |
||
60770 | 181 |
subsection \<open>Rules for small intersection\<close> |
20140 | 182 |
|
58977 | 183 |
lemma IntI: "\<lbrakk>c:A; c:B\<rbrakk> \<Longrightarrow> c : A Int B" |
20140 | 184 |
unfolding Int_def by (blast intro: CollectI) |
185 |
||
58977 | 186 |
lemma IntD1: "c : A Int B \<Longrightarrow> c:A" |
187 |
and IntD2: "c : A Int B \<Longrightarrow> c:B" |
|
20140 | 188 |
unfolding Int_def by (blast dest: CollectD)+ |
189 |
||
58977 | 190 |
lemma IntE: "\<lbrakk>c : A Int B; \<lbrakk>c:A; c:B\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P" |
20140 | 191 |
by (blast dest: IntD1 IntD2) |
192 |
||
193 |
||
60770 | 194 |
subsection \<open>Rules for set complement\<close> |
20140 | 195 |
|
58977 | 196 |
lemma ComplI: "(c:A \<Longrightarrow> False) \<Longrightarrow> c : Compl(A)" |
20140 | 197 |
unfolding Compl_def by (blast intro: CollectI) |
198 |
||
199 |
(*This form, with negated conclusion, works well with the Classical prover. |
|
200 |
Negated assumptions behave like formulae on the right side of the notional |
|
201 |
turnstile...*) |
|
58977 | 202 |
lemma ComplD: "c : Compl(A) \<Longrightarrow> \<not>c:A" |
20140 | 203 |
unfolding Compl_def by (blast dest: CollectD) |
204 |
||
205 |
lemmas ComplE = ComplD [elim_format] |
|
206 |
||
207 |
||
60770 | 208 |
subsection \<open>Empty sets\<close> |
20140 | 209 |
|
210 |
lemma empty_eq: "{x. False} = {}" |
|
211 |
by (simp add: empty_def) |
|
212 |
||
58977 | 213 |
lemma emptyD: "a : {} \<Longrightarrow> P" |
20140 | 214 |
unfolding empty_def by (blast dest: CollectD) |
215 |
||
216 |
lemmas emptyE = emptyD [elim_format] |
|
217 |
||
218 |
lemma not_emptyD: |
|
58977 | 219 |
assumes "\<not> A={}" |
20140 | 220 |
shows "EX x. x:A" |
221 |
proof - |
|
222 |
have "\<not> (EX x. x:A) \<Longrightarrow> A = {}" |
|
223 |
by (rule equalityI) (blast intro!: subsetI elim!: emptyD)+ |
|
41526 | 224 |
with assms show ?thesis by blast |
20140 | 225 |
qed |
226 |
||
227 |
||
60770 | 228 |
subsection \<open>Singleton sets\<close> |
20140 | 229 |
|
230 |
lemma singletonI: "a : {a}" |
|
231 |
unfolding singleton_def by (blast intro: CollectI) |
|
232 |
||
58977 | 233 |
lemma singletonD: "b : {a} \<Longrightarrow> b=a" |
20140 | 234 |
unfolding singleton_def by (blast dest: CollectD) |
235 |
||
236 |
lemmas singletonE = singletonD [elim_format] |
|
237 |
||
238 |
||
60770 | 239 |
subsection \<open>Unions of families\<close> |
20140 | 240 |
|
241 |
(*The order of the premises presupposes that A is rigid; b may be flexible*) |
|
58977 | 242 |
lemma UN_I: "\<lbrakk>a:A; b: B(a)\<rbrakk> \<Longrightarrow> b: (UN x:A. B(x))" |
20140 | 243 |
unfolding UNION_def by (blast intro: bexI CollectI) |
244 |
||
58977 | 245 |
lemma UN_E: "\<lbrakk>b : (UN x:A. B(x)); \<And>x. \<lbrakk>x:A; b: B(x)\<rbrakk> \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R" |
20140 | 246 |
unfolding UNION_def by (blast dest: CollectD elim: bexE) |
247 |
||
58977 | 248 |
lemma UN_cong: "\<lbrakk>A = B; \<And>x. x:B \<Longrightarrow> C(x) = D(x)\<rbrakk> \<Longrightarrow> (UN x:A. C(x)) = (UN x:B. D(x))" |
20140 | 249 |
by (simp add: UNION_def cong: bex_cong) |
250 |
||
251 |
||
60770 | 252 |
subsection \<open>Intersections of families\<close> |
20140 | 253 |
|
58977 | 254 |
lemma INT_I: "(\<And>x. x:A \<Longrightarrow> b: B(x)) \<Longrightarrow> b : (INT x:A. B(x))" |
20140 | 255 |
unfolding INTER_def by (blast intro: CollectI ballI) |
256 |
||
58977 | 257 |
lemma INT_D: "\<lbrakk>b : (INT x:A. B(x)); a:A\<rbrakk> \<Longrightarrow> b: B(a)" |
20140 | 258 |
unfolding INTER_def by (blast dest: CollectD bspec) |
259 |
||
260 |
(*"Classical" elimination rule -- does not require proving X:C *) |
|
58977 | 261 |
lemma INT_E: "\<lbrakk>b : (INT x:A. B(x)); b: B(a) \<Longrightarrow> R; \<not> a:A \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R" |
20140 | 262 |
unfolding INTER_def by (blast dest: CollectD bspec) |
263 |
||
58977 | 264 |
lemma INT_cong: "\<lbrakk>A = B; \<And>x. x:B \<Longrightarrow> C(x) = D(x)\<rbrakk> \<Longrightarrow> (INT x:A. C(x)) = (INT x:B. D(x))" |
20140 | 265 |
by (simp add: INTER_def cong: ball_cong) |
266 |
||
267 |
||
60770 | 268 |
subsection \<open>Rules for Unions\<close> |
20140 | 269 |
|
270 |
(*The order of the premises presupposes that C is rigid; A may be flexible*) |
|
58977 | 271 |
lemma UnionI: "\<lbrakk>X:C; A:X\<rbrakk> \<Longrightarrow> A : Union(C)" |
20140 | 272 |
unfolding Union_def by (blast intro: UN_I) |
273 |
||
58977 | 274 |
lemma UnionE: "\<lbrakk>A : Union(C); \<And>X. \<lbrakk> A:X; X:C\<rbrakk> \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R" |
20140 | 275 |
unfolding Union_def by (blast elim: UN_E) |
276 |
||
277 |
||
60770 | 278 |
subsection \<open>Rules for Inter\<close> |
20140 | 279 |
|
58977 | 280 |
lemma InterI: "(\<And>X. X:C \<Longrightarrow> A:X) \<Longrightarrow> A : Inter(C)" |
20140 | 281 |
unfolding Inter_def by (blast intro: INT_I) |
282 |
||
283 |
(*A "destruct" rule -- every X in C contains A as an element, but |
|
284 |
A:X can hold when X:C does not! This rule is analogous to "spec". *) |
|
58977 | 285 |
lemma InterD: "\<lbrakk>A : Inter(C); X:C\<rbrakk> \<Longrightarrow> A:X" |
20140 | 286 |
unfolding Inter_def by (blast dest: INT_D) |
287 |
||
288 |
(*"Classical" elimination rule -- does not require proving X:C *) |
|
58977 | 289 |
lemma InterE: "\<lbrakk>A : Inter(C); A:X \<Longrightarrow> R; \<not> X:C \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R" |
20140 | 290 |
unfolding Inter_def by (blast elim: INT_E) |
291 |
||
292 |
||
60770 | 293 |
section \<open>Derived rules involving subsets; Union and Intersection as lattice operations\<close> |
20140 | 294 |
|
60770 | 295 |
subsection \<open>Big Union -- least upper bound of a set\<close> |
20140 | 296 |
|
58977 | 297 |
lemma Union_upper: "B:A \<Longrightarrow> B <= Union(A)" |
20140 | 298 |
by (blast intro: subsetI UnionI) |
299 |
||
58977 | 300 |
lemma Union_least: "(\<And>X. X:A \<Longrightarrow> X<=C) \<Longrightarrow> Union(A) <= C" |
20140 | 301 |
by (blast intro: subsetI dest: subsetD elim: UnionE) |
302 |
||
303 |
||
60770 | 304 |
subsection \<open>Big Intersection -- greatest lower bound of a set\<close> |
20140 | 305 |
|
58977 | 306 |
lemma Inter_lower: "B:A \<Longrightarrow> Inter(A) <= B" |
20140 | 307 |
by (blast intro: subsetI dest: InterD) |
308 |
||
58977 | 309 |
lemma Inter_greatest: "(\<And>X. X:A \<Longrightarrow> C<=X) \<Longrightarrow> C <= Inter(A)" |
20140 | 310 |
by (blast intro: subsetI InterI dest: subsetD) |
311 |
||
312 |
||
60770 | 313 |
subsection \<open>Finite Union -- the least upper bound of 2 sets\<close> |
20140 | 314 |
|
315 |
lemma Un_upper1: "A <= A Un B" |
|
316 |
by (blast intro: subsetI UnI1) |
|
317 |
||
318 |
lemma Un_upper2: "B <= A Un B" |
|
319 |
by (blast intro: subsetI UnI2) |
|
320 |
||
58977 | 321 |
lemma Un_least: "\<lbrakk>A<=C; B<=C\<rbrakk> \<Longrightarrow> A Un B <= C" |
20140 | 322 |
by (blast intro: subsetI elim: UnE dest: subsetD) |
323 |
||
324 |
||
60770 | 325 |
subsection \<open>Finite Intersection -- the greatest lower bound of 2 sets\<close> |
20140 | 326 |
|
327 |
lemma Int_lower1: "A Int B <= A" |
|
328 |
by (blast intro: subsetI elim: IntE) |
|
329 |
||
330 |
lemma Int_lower2: "A Int B <= B" |
|
331 |
by (blast intro: subsetI elim: IntE) |
|
332 |
||
58977 | 333 |
lemma Int_greatest: "\<lbrakk>C<=A; C<=B\<rbrakk> \<Longrightarrow> C <= A Int B" |
20140 | 334 |
by (blast intro: subsetI IntI dest: subsetD) |
335 |
||
336 |
||
60770 | 337 |
subsection \<open>Monotonicity\<close> |
20140 | 338 |
|
58977 | 339 |
lemma monoI: "(\<And>A B. A <= B \<Longrightarrow> f(A) <= f(B)) \<Longrightarrow> mono(f)" |
20140 | 340 |
unfolding mono_def by blast |
341 |
||
58977 | 342 |
lemma monoD: "\<lbrakk>mono(f); A <= B\<rbrakk> \<Longrightarrow> f(A) <= f(B)" |
20140 | 343 |
unfolding mono_def by blast |
344 |
||
58977 | 345 |
lemma mono_Un: "mono(f) \<Longrightarrow> f(A) Un f(B) <= f(A Un B)" |
20140 | 346 |
by (blast intro: Un_least dest: monoD intro: Un_upper1 Un_upper2) |
347 |
||
58977 | 348 |
lemma mono_Int: "mono(f) \<Longrightarrow> f(A Int B) <= f(A) Int f(B)" |
20140 | 349 |
by (blast intro: Int_greatest dest: monoD intro: Int_lower1 Int_lower2) |
350 |
||
351 |
||
60770 | 352 |
subsection \<open>Automated reasoning setup\<close> |
20140 | 353 |
|
354 |
lemmas [intro!] = ballI subsetI InterI INT_I CollectI ComplI IntI UnCI singletonI |
|
355 |
and [intro] = bexI UnionI UN_I |
|
356 |
and [elim!] = bexE UnionE UN_E CollectE ComplE IntE UnE emptyE singletonE |
|
357 |
and [elim] = ballE InterD InterE INT_D INT_E subsetD subsetCE |
|
358 |
||
359 |
lemma mem_rews: |
|
58977 | 360 |
"(a : A Un B) \<longleftrightarrow> (a:A | a:B)" |
361 |
"(a : A Int B) \<longleftrightarrow> (a:A \<and> a:B)" |
|
362 |
"(a : Compl(B)) \<longleftrightarrow> (\<not>a:B)" |
|
363 |
"(a : {b}) \<longleftrightarrow> (a=b)" |
|
364 |
"(a : {}) \<longleftrightarrow> False" |
|
365 |
"(a : {x. P(x)}) \<longleftrightarrow> P(a)" |
|
20140 | 366 |
by blast+ |
367 |
||
368 |
lemmas [simp] = trivial_set empty_eq mem_rews |
|
369 |
and [cong] = ball_cong bex_cong INT_cong UN_cong |
|
370 |
||
371 |
||
60770 | 372 |
section \<open>Equalities involving union, intersection, inclusion, etc.\<close> |
20140 | 373 |
|
60770 | 374 |
subsection \<open>Binary Intersection\<close> |
20140 | 375 |
|
376 |
lemma Int_absorb: "A Int A = A" |
|
377 |
by (blast intro: equalityI) |
|
378 |
||
379 |
lemma Int_commute: "A Int B = B Int A" |
|
380 |
by (blast intro: equalityI) |
|
381 |
||
382 |
lemma Int_assoc: "(A Int B) Int C = A Int (B Int C)" |
|
383 |
by (blast intro: equalityI) |
|
384 |
||
385 |
lemma Int_Un_distrib: "(A Un B) Int C = (A Int C) Un (B Int C)" |
|
386 |
by (blast intro: equalityI) |
|
387 |
||
58977 | 388 |
lemma subset_Int_eq: "(A<=B) \<longleftrightarrow> (A Int B = A)" |
20140 | 389 |
by (blast intro: equalityI elim: equalityE) |
390 |
||
391 |
||
60770 | 392 |
subsection \<open>Binary Union\<close> |
20140 | 393 |
|
394 |
lemma Un_absorb: "A Un A = A" |
|
395 |
by (blast intro: equalityI) |
|
396 |
||
397 |
lemma Un_commute: "A Un B = B Un A" |
|
398 |
by (blast intro: equalityI) |
|
399 |
||
400 |
lemma Un_assoc: "(A Un B) Un C = A Un (B Un C)" |
|
401 |
by (blast intro: equalityI) |
|
402 |
||
403 |
lemma Un_Int_distrib: "(A Int B) Un C = (A Un C) Int (B Un C)" |
|
404 |
by (blast intro: equalityI) |
|
405 |
||
406 |
lemma Un_Int_crazy: |
|
407 |
"(A Int B) Un (B Int C) Un (C Int A) = (A Un B) Int (B Un C) Int (C Un A)" |
|
408 |
by (blast intro: equalityI) |
|
409 |
||
58977 | 410 |
lemma subset_Un_eq: "(A<=B) \<longleftrightarrow> (A Un B = B)" |
20140 | 411 |
by (blast intro: equalityI elim: equalityE) |
412 |
||
413 |
||
60770 | 414 |
subsection \<open>Simple properties of @{text "Compl"} -- complement of a set\<close> |
20140 | 415 |
|
416 |
lemma Compl_disjoint: "A Int Compl(A) = {x. False}" |
|
417 |
by (blast intro: equalityI) |
|
418 |
||
419 |
lemma Compl_partition: "A Un Compl(A) = {x. True}" |
|
420 |
by (blast intro: equalityI) |
|
421 |
||
422 |
lemma double_complement: "Compl(Compl(A)) = A" |
|
423 |
by (blast intro: equalityI) |
|
424 |
||
425 |
lemma Compl_Un: "Compl(A Un B) = Compl(A) Int Compl(B)" |
|
426 |
by (blast intro: equalityI) |
|
427 |
||
428 |
lemma Compl_Int: "Compl(A Int B) = Compl(A) Un Compl(B)" |
|
429 |
by (blast intro: equalityI) |
|
430 |
||
431 |
lemma Compl_UN: "Compl(UN x:A. B(x)) = (INT x:A. Compl(B(x)))" |
|
432 |
by (blast intro: equalityI) |
|
433 |
||
434 |
lemma Compl_INT: "Compl(INT x:A. B(x)) = (UN x:A. Compl(B(x)))" |
|
435 |
by (blast intro: equalityI) |
|
436 |
||
437 |
(*Halmos, Naive Set Theory, page 16.*) |
|
58977 | 438 |
lemma Un_Int_assoc_eq: "((A Int B) Un C = A Int (B Un C)) \<longleftrightarrow> (C<=A)" |
20140 | 439 |
by (blast intro: equalityI elim: equalityE) |
440 |
||
441 |
||
60770 | 442 |
subsection \<open>Big Union and Intersection\<close> |
20140 | 443 |
|
444 |
lemma Union_Un_distrib: "Union(A Un B) = Union(A) Un Union(B)" |
|
445 |
by (blast intro: equalityI) |
|
446 |
||
447 |
lemma Union_disjoint: |
|
58977 | 448 |
"(Union(C) Int A = {x. False}) \<longleftrightarrow> (ALL B:C. B Int A = {x. False})" |
20140 | 449 |
by (blast intro: equalityI elim: equalityE) |
450 |
||
451 |
lemma Inter_Un_distrib: "Inter(A Un B) = Inter(A) Int Inter(B)" |
|
452 |
by (blast intro: equalityI) |
|
453 |
||
454 |
||
60770 | 455 |
subsection \<open>Unions and Intersections of Families\<close> |
20140 | 456 |
|
457 |
lemma UN_eq: "(UN x:A. B(x)) = Union({Y. EX x:A. Y=B(x)})" |
|
458 |
by (blast intro: equalityI) |
|
459 |
||
460 |
(*Look: it has an EXISTENTIAL quantifier*) |
|
461 |
lemma INT_eq: "(INT x:A. B(x)) = Inter({Y. EX x:A. Y=B(x)})" |
|
462 |
by (blast intro: equalityI) |
|
463 |
||
464 |
lemma Int_Union_image: "A Int Union(B) = (UN C:B. A Int C)" |
|
465 |
by (blast intro: equalityI) |
|
466 |
||
467 |
lemma Un_Inter_image: "A Un Inter(B) = (INT C:B. A Un C)" |
|
468 |
by (blast intro: equalityI) |
|
469 |
||
470 |
||
60770 | 471 |
section \<open>Monotonicity of various operations\<close> |
20140 | 472 |
|
58977 | 473 |
lemma Union_mono: "A<=B \<Longrightarrow> Union(A) <= Union(B)" |
20140 | 474 |
by blast |
475 |
||
58977 | 476 |
lemma Inter_anti_mono: "B <= A \<Longrightarrow> Inter(A) <= Inter(B)" |
20140 | 477 |
by blast |
478 |
||
58977 | 479 |
lemma UN_mono: "\<lbrakk>A <= B; \<And>x. x:A \<Longrightarrow> f(x)<=g(x)\<rbrakk> \<Longrightarrow> (UN x:A. f(x)) <= (UN x:B. g(x))" |
20140 | 480 |
by blast |
481 |
||
58977 | 482 |
lemma INT_anti_mono: "\<lbrakk>B <= A; \<And>x. x:A \<Longrightarrow> f(x) <= g(x)\<rbrakk> \<Longrightarrow> (INT x:A. f(x)) <= (INT x:A. g(x))" |
20140 | 483 |
by blast |
484 |
||
58977 | 485 |
lemma Un_mono: "\<lbrakk>A <= C; B <= D\<rbrakk> \<Longrightarrow> A Un B <= C Un D" |
20140 | 486 |
by blast |
487 |
||
58977 | 488 |
lemma Int_mono: "\<lbrakk>A <= C; B <= D\<rbrakk> \<Longrightarrow> A Int B <= C Int D" |
20140 | 489 |
by blast |
490 |
||
58977 | 491 |
lemma Compl_anti_mono: "A <= B \<Longrightarrow> Compl(B) <= Compl(A)" |
20140 | 492 |
by blast |
0 | 493 |
|
494 |
end |