author  wenzelm 
Sat, 01 May 2004 22:04:14 +0200  
changeset 14692  b8d6c395c9e2 
parent 14565  c6dc17aab88a 
child 14742  dde816115d6a 
permissions  rwrr 
923  1 
(* Title: HOL/Set.thy 
2 
ID: $Id$ 

12257  3 
Author: Tobias Nipkow, Lawrence C Paulson and Markus Wenzel 
12020  4 
License: GPL (GNU GENERAL PUBLIC LICENSE) 
923  5 
*) 
6 

11979  7 
header {* Set theory for higherorder logic *} 
8 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

9 
theory Set = HOL: 
11979  10 

11 
text {* A set in HOL is simply a predicate. *} 

923  12 

2261  13 

11979  14 
subsection {* Basic syntax *} 
2261  15 

3947  16 
global 
17 

11979  18 
typedecl 'a set 
12338
de0f4a63baa5
renamed class "term" to "type" (actually "HOL.type");
wenzelm
parents:
12257
diff
changeset

19 
arities set :: (type) type 
3820  20 

923  21 
consts 
11979  22 
"{}" :: "'a set" ("{}") 
23 
UNIV :: "'a set" 

24 
insert :: "'a => 'a set => 'a set" 

25 
Collect :: "('a => bool) => 'a set"  "comprehension" 

26 
Int :: "'a set => 'a set => 'a set" (infixl 70) 

27 
Un :: "'a set => 'a set => 'a set" (infixl 65) 

28 
UNION :: "'a set => ('a => 'b set) => 'b set"  "general union" 

29 
INTER :: "'a set => ('a => 'b set) => 'b set"  "general intersection" 

30 
Union :: "'a set set => 'a set"  "union of a set" 

31 
Inter :: "'a set set => 'a set"  "intersection of a set" 

32 
Pow :: "'a set => 'a set set"  "powerset" 

33 
Ball :: "'a set => ('a => bool) => bool"  "bounded universal quantifiers" 

34 
Bex :: "'a set => ('a => bool) => bool"  "bounded existential quantifiers" 

35 
image :: "('a => 'b) => 'a set => 'b set" (infixr "`" 90) 

36 

37 
syntax 

38 
"op :" :: "'a => 'a set => bool" ("op :") 

39 
consts 

40 
"op :" :: "'a => 'a set => bool" ("(_/ : _)" [50, 51] 50)  "membership" 

41 

42 
local 

43 

14692  44 
instance set :: (type) "{ord, minus}" .. 
923  45 

46 

11979  47 
subsection {* Additional concrete syntax *} 
2261  48 

923  49 
syntax 
11979  50 
range :: "('a => 'b) => 'b set"  "of function" 
923  51 

11979  52 
"op ~:" :: "'a => 'a set => bool" ("op ~:")  "nonmembership" 
53 
"op ~:" :: "'a => 'a set => bool" ("(_/ ~: _)" [50, 51] 50) 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
5931
diff
changeset

54 

11979  55 
"@Finset" :: "args => 'a set" ("{(_)}") 
56 
"@Coll" :: "pttrn => bool => 'a set" ("(1{_./ _})") 

57 
"@SetCompr" :: "'a => idts => bool => 'a set" ("(1{_ /_./ _})") 

923  58 

11979  59 
"@INTER1" :: "pttrns => 'b set => 'b set" ("(3INT _./ _)" 10) 
60 
"@UNION1" :: "pttrns => 'b set => 'b set" ("(3UN _./ _)" 10) 

61 
"@INTER" :: "pttrn => 'a set => 'b set => 'b set" ("(3INT _:_./ _)" 10) 

62 
"@UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3UN _:_./ _)" 10) 

923  63 

11979  64 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3ALL _:_./ _)" [0, 0, 10] 10) 
65 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3EX _:_./ _)" [0, 0, 10] 10) 

923  66 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
5931
diff
changeset

67 
syntax (HOL) 
11979  68 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3! _:_./ _)" [0, 0, 10] 10) 
69 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3? _:_./ _)" [0, 0, 10] 10) 

923  70 

71 
translations 

10832  72 
"range f" == "f`UNIV" 
923  73 
"x ~: y" == "~ (x : y)" 
74 
"{x, xs}" == "insert x {xs}" 

75 
"{x}" == "insert x {}" 

13764  76 
"{x. P}" == "Collect (%x. P)" 
4159
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4151
diff
changeset

77 
"UN x y. B" == "UN x. UN y. B" 
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4151
diff
changeset

78 
"UN x. B" == "UNION UNIV (%x. B)" 
13858  79 
"UN x. B" == "UN x:UNIV. B" 
7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
5931
diff
changeset

80 
"INT x y. B" == "INT x. INT y. B" 
4159
4aff9b7e5597
UNIV now a constant; UNION1, INTER1 now translations and no longer have
paulson
parents:
4151
diff
changeset

81 
"INT x. B" == "INTER UNIV (%x. B)" 
13858  82 
"INT x. B" == "INT x:UNIV. B" 
13764  83 
"UN x:A. B" == "UNION A (%x. B)" 
84 
"INT x:A. B" == "INTER A (%x. B)" 

85 
"ALL x:A. P" == "Ball A (%x. P)" 

86 
"EX x:A. P" == "Bex A (%x. P)" 

923  87 

12633  88 
syntax (output) 
11979  89 
"_setle" :: "'a set => 'a set => bool" ("op <=") 
90 
"_setle" :: "'a set => 'a set => bool" ("(_/ <= _)" [50, 51] 50) 

91 
"_setless" :: "'a set => 'a set => bool" ("op <") 

92 
"_setless" :: "'a set => 'a set => bool" ("(_/ < _)" [50, 51] 50) 

923  93 

12114
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents:
12023
diff
changeset

94 
syntax (xsymbols) 
11979  95 
"_setle" :: "'a set => 'a set => bool" ("op \<subseteq>") 
96 
"_setle" :: "'a set => 'a set => bool" ("(_/ \<subseteq> _)" [50, 51] 50) 

97 
"_setless" :: "'a set => 'a set => bool" ("op \<subset>") 

98 
"_setless" :: "'a set => 'a set => bool" ("(_/ \<subset> _)" [50, 51] 50) 

99 
"op Int" :: "'a set => 'a set => 'a set" (infixl "\<inter>" 70) 

100 
"op Un" :: "'a set => 'a set => 'a set" (infixl "\<union>" 65) 

101 
"op :" :: "'a => 'a set => bool" ("op \<in>") 

102 
"op :" :: "'a => 'a set => bool" ("(_/ \<in> _)" [50, 51] 50) 

103 
"op ~:" :: "'a => 'a set => bool" ("op \<notin>") 

104 
"op ~:" :: "'a => 'a set => bool" ("(_/ \<notin> _)" [50, 51] 50) 

14381
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

105 
Union :: "'a set set => 'a set" ("\<Union>_" [90] 90) 
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

106 
Inter :: "'a set set => 'a set" ("\<Inter>_" [90] 90) 
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

107 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3\<forall>_\<in>_./ _)" [0, 0, 10] 10) 
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

108 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3\<exists>_\<in>_./ _)" [0, 0, 10] 10) 
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

109 

14565  110 
syntax (HTML output) 
111 
"_setle" :: "'a set => 'a set => bool" ("op \<subseteq>") 

112 
"_setle" :: "'a set => 'a set => bool" ("(_/ \<subseteq> _)" [50, 51] 50) 

113 
"_setless" :: "'a set => 'a set => bool" ("op \<subset>") 

114 
"_setless" :: "'a set => 'a set => bool" ("(_/ \<subset> _)" [50, 51] 50) 

115 
"op Int" :: "'a set => 'a set => 'a set" (infixl "\<inter>" 70) 

116 
"op Un" :: "'a set => 'a set => 'a set" (infixl "\<union>" 65) 

117 
"op :" :: "'a => 'a set => bool" ("op \<in>") 

118 
"op :" :: "'a => 'a set => bool" ("(_/ \<in> _)" [50, 51] 50) 

119 
"op ~:" :: "'a => 'a set => bool" ("op \<notin>") 

120 
"op ~:" :: "'a => 'a set => bool" ("(_/ \<notin> _)" [50, 51] 50) 

121 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3\<forall>_\<in>_./ _)" [0, 0, 10] 10) 

122 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3\<exists>_\<in>_./ _)" [0, 0, 10] 10) 

123 

14381
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

124 
syntax (input) 
11979  125 
"@UNION1" :: "pttrns => 'b set => 'b set" ("(3\<Union>_./ _)" 10) 
126 
"@INTER1" :: "pttrns => 'b set => 'b set" ("(3\<Inter>_./ _)" 10) 

127 
"@UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Union>_\<in>_./ _)" 10) 

128 
"@INTER" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Inter>_\<in>_./ _)" 10) 

14381
1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

129 

1189a8212a12
Modified UN and INT xsymbol syntax: made index subscript
nipkow
parents:
14335
diff
changeset

130 
syntax (xsymbols) 
14692  131 
"@UNION1" :: "pttrns => 'b set => 'b set" ("(3\<Union>()\<^bsub>_\<^esub>/ _)" 10) 
132 
"@INTER1" :: "pttrns => 'b set => 'b set" ("(3\<Inter>()\<^bsub>_\<^esub>/ _)" 10) 

133 
"@UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Union>()\<^bsub>_\<in>_\<^esub>/ _)" 10) 

134 
"@INTER" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Inter>()\<^bsub>_\<in>_\<^esub>/ _)" 10) 

2261  135 

14565  136 

2412  137 
translations 
11979  138 
"op \<subseteq>" => "op <= :: _ set => _ set => bool" 
139 
"op \<subset>" => "op < :: _ set => _ set => bool" 

2261  140 

141 

11979  142 
typed_print_translation {* 
143 
let 

144 
fun le_tr' _ (Type ("fun", (Type ("set", _) :: _))) ts = 

145 
list_comb (Syntax.const "_setle", ts) 

146 
 le_tr' _ _ _ = raise Match; 

147 

148 
fun less_tr' _ (Type ("fun", (Type ("set", _) :: _))) ts = 

149 
list_comb (Syntax.const "_setless", ts) 

150 
 less_tr' _ _ _ = raise Match; 

151 
in [("op <=", le_tr'), ("op <", less_tr')] end 

152 
*} 

2261  153 

11979  154 
text {* 
155 
\medskip Translate between @{text "{e  x1...xn. P}"} and @{text 

156 
"{u. EX x1..xn. u = e & P}"}; @{text "{y. EX x1..xn. y = e & P}"} is 

157 
only translated if @{text "[0..n] subset bvs(e)"}. 

158 
*} 

159 

160 
parse_translation {* 

161 
let 

162 
val ex_tr = snd (mk_binder_tr ("EX ", "Ex")); 

3947  163 

11979  164 
fun nvars (Const ("_idts", _) $ _ $ idts) = nvars idts + 1 
165 
 nvars _ = 1; 

166 

167 
fun setcompr_tr [e, idts, b] = 

168 
let 

169 
val eq = Syntax.const "op =" $ Bound (nvars idts) $ e; 

170 
val P = Syntax.const "op &" $ eq $ b; 

171 
val exP = ex_tr [idts, P]; 

172 
in Syntax.const "Collect" $ Abs ("", dummyT, exP) end; 

173 

174 
in [("@SetCompr", setcompr_tr)] end; 

175 
*} 

923  176 

13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

177 
(* To avoid etacontraction of body: *) 
11979  178 
print_translation {* 
13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

179 
let 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

180 
fun btr' syn [A,Abs abs] = 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

181 
let val (x,t) = atomic_abs_tr' abs 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

182 
in Syntax.const syn $ x $ A $ t end 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

183 
in 
13858  184 
[("Ball", btr' "_Ball"),("Bex", btr' "_Bex"), 
185 
("UNION", btr' "@UNION"),("INTER", btr' "@INTER")] 

13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

186 
end 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

187 
*} 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

188 

f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

189 
print_translation {* 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

190 
let 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

191 
val ex_tr' = snd (mk_binder_tr' ("Ex", "DUMMY")); 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

192 

f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

193 
fun setcompr_tr' [Abs (abs as (_, _, P))] = 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

194 
let 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

195 
fun check (Const ("Ex", _) $ Abs (_, _, P), n) = check (P, n + 1) 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

196 
 check (Const ("op &", _) $ (Const ("op =", _) $ Bound m $ e) $ P, n) = 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

197 
n > 0 andalso m = n andalso not (loose_bvar1 (P, n)) andalso 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

198 
((0 upto (n  1)) subset add_loose_bnos (e, 0, [])) 
13764  199 
 check _ = false 
923  200 

11979  201 
fun tr' (_ $ abs) = 
202 
let val _ $ idts $ (_ $ (_ $ _ $ e) $ Q) = ex_tr' [abs] 

203 
in Syntax.const "@SetCompr" $ e $ idts $ Q end; 

13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

204 
in if check (P, 0) then tr' P 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

205 
else let val (x,t) = atomic_abs_tr' abs 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

206 
in Syntax.const "@Coll" $ x $ t end 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

207 
end; 
11979  208 
in [("Collect", setcompr_tr')] end; 
209 
*} 

210 

211 

212 
subsection {* Rules and definitions *} 

213 

214 
text {* Isomorphisms between predicates and sets. *} 

923  215 

11979  216 
axioms 
217 
mem_Collect_eq [iff]: "(a : {x. P(x)}) = P(a)" 

218 
Collect_mem_eq [simp]: "{x. x:A} = A" 

219 

220 
defs 

221 
Ball_def: "Ball A P == ALL x. x:A > P(x)" 

222 
Bex_def: "Bex A P == EX x. x:A & P(x)" 

223 

224 
defs (overloaded) 

225 
subset_def: "A <= B == ALL x:A. x:B" 

226 
psubset_def: "A < B == (A::'a set) <= B & ~ A=B" 

227 
Compl_def: " A == {x. ~x:A}" 

12257  228 
set_diff_def: "A  B == {x. x:A & ~x:B}" 
923  229 

230 
defs 

11979  231 
Un_def: "A Un B == {x. x:A  x:B}" 
232 
Int_def: "A Int B == {x. x:A & x:B}" 

233 
INTER_def: "INTER A B == {y. ALL x:A. y: B(x)}" 

234 
UNION_def: "UNION A B == {y. EX x:A. y: B(x)}" 

235 
Inter_def: "Inter S == (INT x:S. x)" 

236 
Union_def: "Union S == (UN x:S. x)" 

237 
Pow_def: "Pow A == {B. B <= A}" 

238 
empty_def: "{} == {x. False}" 

239 
UNIV_def: "UNIV == {x. True}" 

240 
insert_def: "insert a B == {x. x=a} Un B" 

241 
image_def: "f`A == {y. EX x:A. y = f(x)}" 

242 

243 

244 
subsection {* Lemmas and proof tool setup *} 

245 

246 
subsubsection {* Relating predicates and sets *} 

247 

12257  248 
lemma CollectI: "P(a) ==> a : {x. P(x)}" 
11979  249 
by simp 
250 

251 
lemma CollectD: "a : {x. P(x)} ==> P(a)" 

252 
by simp 

253 

254 
lemma Collect_cong: "(!!x. P x = Q x) ==> {x. P(x)} = {x. Q(x)}" 

255 
by simp 

256 

12257  257 
lemmas CollectE = CollectD [elim_format] 
11979  258 

259 

260 
subsubsection {* Bounded quantifiers *} 

261 

262 
lemma ballI [intro!]: "(!!x. x:A ==> P x) ==> ALL x:A. P x" 

263 
by (simp add: Ball_def) 

264 

265 
lemmas strip = impI allI ballI 

266 

267 
lemma bspec [dest?]: "ALL x:A. P x ==> x:A ==> P x" 

268 
by (simp add: Ball_def) 

269 

270 
lemma ballE [elim]: "ALL x:A. P x ==> (P x ==> Q) ==> (x ~: A ==> Q) ==> Q" 

271 
by (unfold Ball_def) blast 

14098  272 
ML {* bind_thm("rev_ballE",permute_prems 1 1 (thm "ballE")) *} 
11979  273 

274 
text {* 

275 
\medskip This tactic takes assumptions @{prop "ALL x:A. P x"} and 

276 
@{prop "a:A"}; creates assumption @{prop "P a"}. 

277 
*} 

278 

279 
ML {* 

280 
local val ballE = thm "ballE" 

281 
in fun ball_tac i = etac ballE i THEN contr_tac (i + 1) end; 

282 
*} 

283 

284 
text {* 

285 
Gives better instantiation for bound: 

286 
*} 

287 

288 
ML_setup {* 

289 
claset_ref() := claset() addbefore ("bspec", datac (thm "bspec") 1); 

290 
*} 

291 

292 
lemma bexI [intro]: "P x ==> x:A ==> EX x:A. P x" 

293 
 {* Normally the best argument order: @{prop "P x"} constrains the 

294 
choice of @{prop "x:A"}. *} 

295 
by (unfold Bex_def) blast 

296 

13113  297 
lemma rev_bexI [intro?]: "x:A ==> P x ==> EX x:A. P x" 
11979  298 
 {* The best argument order when there is only one @{prop "x:A"}. *} 
299 
by (unfold Bex_def) blast 

300 

301 
lemma bexCI: "(ALL x:A. ~P x ==> P a) ==> a:A ==> EX x:A. P x" 

302 
by (unfold Bex_def) blast 

303 

304 
lemma bexE [elim!]: "EX x:A. P x ==> (!!x. x:A ==> P x ==> Q) ==> Q" 

305 
by (unfold Bex_def) blast 

306 

307 
lemma ball_triv [simp]: "(ALL x:A. P) = ((EX x. x:A) > P)" 

308 
 {* Trival rewrite rule. *} 

309 
by (simp add: Ball_def) 

310 

311 
lemma bex_triv [simp]: "(EX x:A. P) = ((EX x. x:A) & P)" 

312 
 {* Dual form for existentials. *} 

313 
by (simp add: Bex_def) 

314 

315 
lemma bex_triv_one_point1 [simp]: "(EX x:A. x = a) = (a:A)" 

316 
by blast 

317 

318 
lemma bex_triv_one_point2 [simp]: "(EX x:A. a = x) = (a:A)" 

319 
by blast 

320 

321 
lemma bex_one_point1 [simp]: "(EX x:A. x = a & P x) = (a:A & P a)" 

322 
by blast 

323 

324 
lemma bex_one_point2 [simp]: "(EX x:A. a = x & P x) = (a:A & P a)" 

325 
by blast 

326 

327 
lemma ball_one_point1 [simp]: "(ALL x:A. x = a > P x) = (a:A > P a)" 

328 
by blast 

329 

330 
lemma ball_one_point2 [simp]: "(ALL x:A. a = x > P x) = (a:A > P a)" 

331 
by blast 

332 

333 
ML_setup {* 

13462  334 
local 
11979  335 
val Ball_def = thm "Ball_def"; 
336 
val Bex_def = thm "Bex_def"; 

337 

338 
val prove_bex_tac = 

339 
rewrite_goals_tac [Bex_def] THEN Quantifier1.prove_one_point_ex_tac; 

340 
val rearrange_bex = Quantifier1.rearrange_bex prove_bex_tac; 

341 

342 
val prove_ball_tac = 

343 
rewrite_goals_tac [Ball_def] THEN Quantifier1.prove_one_point_all_tac; 

344 
val rearrange_ball = Quantifier1.rearrange_ball prove_ball_tac; 

345 
in 

13462  346 
val defBEX_regroup = Simplifier.simproc (Theory.sign_of (the_context ())) 
347 
"defined BEX" ["EX x:A. P x & Q x"] rearrange_bex; 

348 
val defBALL_regroup = Simplifier.simproc (Theory.sign_of (the_context ())) 

349 
"defined BALL" ["ALL x:A. P x > Q x"] rearrange_ball; 

11979  350 
end; 
13462  351 

352 
Addsimprocs [defBALL_regroup, defBEX_regroup]; 

11979  353 
*} 
354 

355 

356 
subsubsection {* Congruence rules *} 

357 

358 
lemma ball_cong [cong]: 

359 
"A = B ==> (!!x. x:B ==> P x = Q x) ==> 

360 
(ALL x:A. P x) = (ALL x:B. Q x)" 

361 
by (simp add: Ball_def) 

362 

363 
lemma bex_cong [cong]: 

364 
"A = B ==> (!!x. x:B ==> P x = Q x) ==> 

365 
(EX x:A. P x) = (EX x:B. Q x)" 

366 
by (simp add: Bex_def cong: conj_cong) 

1273  367 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
5931
diff
changeset

368 

11979  369 
subsubsection {* Subsets *} 
370 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

371 
lemma subsetI [intro!]: "(!!x. x:A ==> x:B) ==> A \<subseteq> B" 
11979  372 
by (simp add: subset_def) 
373 

374 
text {* 

375 
\medskip Map the type @{text "'a set => anything"} to just @{typ 

376 
'a}; for overloading constants whose first argument has type @{typ 

377 
"'a set"}. 

378 
*} 

379 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

380 
lemma subsetD [elim]: "A \<subseteq> B ==> c \<in> A ==> c \<in> B" 
11979  381 
 {* Rule in Modus Ponens style. *} 
382 
by (unfold subset_def) blast 

383 

384 
declare subsetD [intro?]  FIXME 

385 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

386 
lemma rev_subsetD: "c \<in> A ==> A \<subseteq> B ==> c \<in> B" 
11979  387 
 {* The same, with reversed premises for use with @{text erule}  
388 
cf @{text rev_mp}. *} 

389 
by (rule subsetD) 

390 

391 
declare rev_subsetD [intro?]  FIXME 

392 

393 
text {* 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

394 
\medskip Converts @{prop "A \<subseteq> B"} to @{prop "x \<in> A ==> x \<in> B"}. 
11979  395 
*} 
396 

397 
ML {* 

398 
local val rev_subsetD = thm "rev_subsetD" 

399 
in fun impOfSubs th = th RSN (2, rev_subsetD) end; 

400 
*} 

401 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

402 
lemma subsetCE [elim]: "A \<subseteq> B ==> (c \<notin> A ==> P) ==> (c \<in> B ==> P) ==> P" 
11979  403 
 {* Classical elimination rule. *} 
404 
by (unfold subset_def) blast 

405 

406 
text {* 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

407 
\medskip Takes assumptions @{prop "A \<subseteq> B"}; @{prop "c \<in> A"} and 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

408 
creates the assumption @{prop "c \<in> B"}. 
11979  409 
*} 
410 

411 
ML {* 

412 
local val subsetCE = thm "subsetCE" 

413 
in fun set_mp_tac i = etac subsetCE i THEN mp_tac i end; 

414 
*} 

415 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

416 
lemma contra_subsetD: "A \<subseteq> B ==> c \<notin> B ==> c \<notin> A" 
11979  417 
by blast 
418 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

419 
lemma subset_refl: "A \<subseteq> A" 
11979  420 
by fast 
421 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

422 
lemma subset_trans: "A \<subseteq> B ==> B \<subseteq> C ==> A \<subseteq> C" 
11979  423 
by blast 
923  424 

2261  425 

11979  426 
subsubsection {* Equality *} 
427 

13865  428 
lemma set_ext: assumes prem: "(!!x. (x:A) = (x:B))" shows "A = B" 
429 
apply (rule prem [THEN ext, THEN arg_cong, THEN box_equals]) 

430 
apply (rule Collect_mem_eq) 

431 
apply (rule Collect_mem_eq) 

432 
done 

433 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

434 
lemma subset_antisym [intro!]: "A \<subseteq> B ==> B \<subseteq> A ==> A = B" 
11979  435 
 {* Antisymmetry of the subset relation. *} 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

436 
by (rules intro: set_ext subsetD) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

437 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

438 
lemmas equalityI [intro!] = subset_antisym 
11979  439 

440 
text {* 

441 
\medskip Equality rules from ZF set theory  are they appropriate 

442 
here? 

443 
*} 

444 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

445 
lemma equalityD1: "A = B ==> A \<subseteq> B" 
11979  446 
by (simp add: subset_refl) 
447 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

448 
lemma equalityD2: "A = B ==> B \<subseteq> A" 
11979  449 
by (simp add: subset_refl) 
450 

451 
text {* 

452 
\medskip Be careful when adding this to the claset as @{text 

453 
subset_empty} is in the simpset: @{prop "A = {}"} goes to @{prop "{} 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

454 
\<subseteq> A"} and @{prop "A \<subseteq> {}"} and then back to @{prop "A = {}"}! 
11979  455 
*} 
456 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

457 
lemma equalityE: "A = B ==> (A \<subseteq> B ==> B \<subseteq> A ==> P) ==> P" 
11979  458 
by (simp add: subset_refl) 
923  459 

11979  460 
lemma equalityCE [elim]: 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

461 
"A = B ==> (c \<in> A ==> c \<in> B ==> P) ==> (c \<notin> A ==> c \<notin> B ==> P) ==> P" 
11979  462 
by blast 
463 

464 
text {* 

465 
\medskip Lemma for creating induction formulae  for "pattern 

466 
matching" on @{text p}. To make the induction hypotheses usable, 

467 
apply @{text spec} or @{text bspec} to put universal quantifiers over the free 

468 
variables in @{text p}. 

469 
*} 

470 

471 
lemma setup_induction: "p:A ==> (!!z. z:A ==> p = z > R) ==> R" 

472 
by simp 

923  473 

11979  474 
lemma eqset_imp_iff: "A = B ==> (x : A) = (x : B)" 
475 
by simp 

476 

13865  477 
lemma eqelem_imp_iff: "x = y ==> (x : A) = (y : A)" 
478 
by simp 

479 

11979  480 

481 
subsubsection {* The universal set  UNIV *} 

482 

483 
lemma UNIV_I [simp]: "x : UNIV" 

484 
by (simp add: UNIV_def) 

485 

486 
declare UNIV_I [intro]  {* unsafe makes it less likely to cause problems *} 

487 

488 
lemma UNIV_witness [intro?]: "EX x. x : UNIV" 

489 
by simp 

490 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

491 
lemma subset_UNIV: "A \<subseteq> UNIV" 
11979  492 
by (rule subsetI) (rule UNIV_I) 
2388  493 

11979  494 
text {* 
495 
\medskip Etacontracting these two rules (to remove @{text P}) 

496 
causes them to be ignored because of their interaction with 

497 
congruence rules. 

498 
*} 

499 

500 
lemma ball_UNIV [simp]: "Ball UNIV P = All P" 

501 
by (simp add: Ball_def) 

502 

503 
lemma bex_UNIV [simp]: "Bex UNIV P = Ex P" 

504 
by (simp add: Bex_def) 

505 

506 

507 
subsubsection {* The empty set *} 

508 

509 
lemma empty_iff [simp]: "(c : {}) = False" 

510 
by (simp add: empty_def) 

511 

512 
lemma emptyE [elim!]: "a : {} ==> P" 

513 
by simp 

514 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

515 
lemma empty_subsetI [iff]: "{} \<subseteq> A" 
11979  516 
 {* One effect is to delete the ASSUMPTION @{prop "{} <= A"} *} 
517 
by blast 

518 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

519 
lemma equals0I: "(!!y. y \<in> A ==> False) ==> A = {}" 
11979  520 
by blast 
2388  521 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

522 
lemma equals0D: "A = {} ==> a \<notin> A" 
11979  523 
 {* Use for reasoning about disjointness: @{prop "A Int B = {}"} *} 
524 
by blast 

525 

526 
lemma ball_empty [simp]: "Ball {} P = True" 

527 
by (simp add: Ball_def) 

528 

529 
lemma bex_empty [simp]: "Bex {} P = False" 

530 
by (simp add: Bex_def) 

531 

532 
lemma UNIV_not_empty [iff]: "UNIV ~= {}" 

533 
by (blast elim: equalityE) 

534 

535 

12023  536 
subsubsection {* The Powerset operator  Pow *} 
11979  537 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

538 
lemma Pow_iff [iff]: "(A \<in> Pow B) = (A \<subseteq> B)" 
11979  539 
by (simp add: Pow_def) 
540 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

541 
lemma PowI: "A \<subseteq> B ==> A \<in> Pow B" 
11979  542 
by (simp add: Pow_def) 
543 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

544 
lemma PowD: "A \<in> Pow B ==> A \<subseteq> B" 
11979  545 
by (simp add: Pow_def) 
546 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

547 
lemma Pow_bottom: "{} \<in> Pow B" 
11979  548 
by simp 
549 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

550 
lemma Pow_top: "A \<in> Pow A" 
11979  551 
by (simp add: subset_refl) 
2684  552 

2388  553 

11979  554 
subsubsection {* Set complement *} 
555 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

556 
lemma Compl_iff [simp]: "(c \<in> A) = (c \<notin> A)" 
11979  557 
by (unfold Compl_def) blast 
558 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

559 
lemma ComplI [intro!]: "(c \<in> A ==> False) ==> c \<in> A" 
11979  560 
by (unfold Compl_def) blast 
561 

562 
text {* 

563 
\medskip This form, with negated conclusion, works well with the 

564 
Classical prover. Negated assumptions behave like formulae on the 

565 
right side of the notional turnstile ... *} 

566 

567 
lemma ComplD: "c : A ==> c~:A" 

568 
by (unfold Compl_def) blast 

569 

570 
lemmas ComplE [elim!] = ComplD [elim_format] 

571 

572 

573 
subsubsection {* Binary union  Un *} 

923  574 

11979  575 
lemma Un_iff [simp]: "(c : A Un B) = (c:A  c:B)" 
576 
by (unfold Un_def) blast 

577 

578 
lemma UnI1 [elim?]: "c:A ==> c : A Un B" 

579 
by simp 

580 

581 
lemma UnI2 [elim?]: "c:B ==> c : A Un B" 

582 
by simp 

923  583 

11979  584 
text {* 
585 
\medskip Classical introduction rule: no commitment to @{prop A} vs 

586 
@{prop B}. 

587 
*} 

588 

589 
lemma UnCI [intro!]: "(c~:B ==> c:A) ==> c : A Un B" 

590 
by auto 

591 

592 
lemma UnE [elim!]: "c : A Un B ==> (c:A ==> P) ==> (c:B ==> P) ==> P" 

593 
by (unfold Un_def) blast 

594 

595 

12023  596 
subsubsection {* Binary intersection  Int *} 
923  597 

11979  598 
lemma Int_iff [simp]: "(c : A Int B) = (c:A & c:B)" 
599 
by (unfold Int_def) blast 

600 

601 
lemma IntI [intro!]: "c:A ==> c:B ==> c : A Int B" 

602 
by simp 

603 

604 
lemma IntD1: "c : A Int B ==> c:A" 

605 
by simp 

606 

607 
lemma IntD2: "c : A Int B ==> c:B" 

608 
by simp 

609 

610 
lemma IntE [elim!]: "c : A Int B ==> (c:A ==> c:B ==> P) ==> P" 

611 
by simp 

612 

613 

12023  614 
subsubsection {* Set difference *} 
11979  615 

616 
lemma Diff_iff [simp]: "(c : A  B) = (c:A & c~:B)" 

617 
by (unfold set_diff_def) blast 

923  618 

11979  619 
lemma DiffI [intro!]: "c : A ==> c ~: B ==> c : A  B" 
620 
by simp 

621 

622 
lemma DiffD1: "c : A  B ==> c : A" 

623 
by simp 

624 

625 
lemma DiffD2: "c : A  B ==> c : B ==> P" 

626 
by simp 

627 

628 
lemma DiffE [elim!]: "c : A  B ==> (c:A ==> c~:B ==> P) ==> P" 

629 
by simp 

630 

631 

632 
subsubsection {* Augmenting a set  insert *} 

633 

634 
lemma insert_iff [simp]: "(a : insert b A) = (a = b  a:A)" 

635 
by (unfold insert_def) blast 

636 

637 
lemma insertI1: "a : insert a B" 

638 
by simp 

639 

640 
lemma insertI2: "a : B ==> a : insert b B" 

641 
by simp 

923  642 

11979  643 
lemma insertE [elim!]: "a : insert b A ==> (a = b ==> P) ==> (a:A ==> P) ==> P" 
644 
by (unfold insert_def) blast 

645 

646 
lemma insertCI [intro!]: "(a~:B ==> a = b) ==> a: insert b B" 

647 
 {* Classical introduction rule. *} 

648 
by auto 

649 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

650 
lemma subset_insert_iff: "(A \<subseteq> insert x B) = (if x:A then A  {x} \<subseteq> B else A \<subseteq> B)" 
11979  651 
by auto 
652 

653 

654 
subsubsection {* Singletons, using insert *} 

655 

656 
lemma singletonI [intro!]: "a : {a}" 

657 
 {* Redundant? But unlike @{text insertCI}, it proves the subgoal immediately! *} 

658 
by (rule insertI1) 

659 

660 
lemma singletonD: "b : {a} ==> b = a" 

661 
by blast 

662 

663 
lemmas singletonE [elim!] = singletonD [elim_format] 

664 

665 
lemma singleton_iff: "(b : {a}) = (b = a)" 

666 
by blast 

667 

668 
lemma singleton_inject [dest!]: "{a} = {b} ==> a = b" 

669 
by blast 

670 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

671 
lemma singleton_insert_inj_eq [iff]: "({b} = insert a A) = (a = b & A \<subseteq> {b})" 
11979  672 
by blast 
673 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

674 
lemma singleton_insert_inj_eq' [iff]: "(insert a A = {b}) = (a = b & A \<subseteq> {b})" 
11979  675 
by blast 
676 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

677 
lemma subset_singletonD: "A \<subseteq> {x} ==> A = {}  A = {x}" 
11979  678 
by fast 
679 

680 
lemma singleton_conv [simp]: "{x. x = a} = {a}" 

681 
by blast 

682 

683 
lemma singleton_conv2 [simp]: "{x. a = x} = {a}" 

684 
by blast 

923  685 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

686 
lemma diff_single_insert: "A  {x} \<subseteq> B ==> x \<in> A ==> A \<subseteq> insert x B" 
11979  687 
by blast 
688 

689 

690 
subsubsection {* Unions of families *} 

691 

692 
text {* 

693 
@{term [source] "UN x:A. B x"} is @{term "Union (B`A)"}. 

694 
*} 

695 

696 
lemma UN_iff [simp]: "(b: (UN x:A. B x)) = (EX x:A. b: B x)" 

697 
by (unfold UNION_def) blast 

698 

699 
lemma UN_I [intro]: "a:A ==> b: B a ==> b: (UN x:A. B x)" 

700 
 {* The order of the premises presupposes that @{term A} is rigid; 

701 
@{term b} may be flexible. *} 

702 
by auto 

703 

704 
lemma UN_E [elim!]: "b : (UN x:A. B x) ==> (!!x. x:A ==> b: B x ==> R) ==> R" 

705 
by (unfold UNION_def) blast 

923  706 

11979  707 
lemma UN_cong [cong]: 
708 
"A = B ==> (!!x. x:B ==> C x = D x) ==> (UN x:A. C x) = (UN x:B. D x)" 

709 
by (simp add: UNION_def) 

710 

711 

712 
subsubsection {* Intersections of families *} 

713 

714 
text {* @{term [source] "INT x:A. B x"} is @{term "Inter (B`A)"}. *} 

715 

716 
lemma INT_iff [simp]: "(b: (INT x:A. B x)) = (ALL x:A. b: B x)" 

717 
by (unfold INTER_def) blast 

923  718 

11979  719 
lemma INT_I [intro!]: "(!!x. x:A ==> b: B x) ==> b : (INT x:A. B x)" 
720 
by (unfold INTER_def) blast 

721 

722 
lemma INT_D [elim]: "b : (INT x:A. B x) ==> a:A ==> b: B a" 

723 
by auto 

724 

725 
lemma INT_E [elim]: "b : (INT x:A. B x) ==> (b: B a ==> R) ==> (a~:A ==> R) ==> R" 

726 
 {* "Classical" elimination  by the Excluded Middle on @{prop "a:A"}. *} 

727 
by (unfold INTER_def) blast 

728 

729 
lemma INT_cong [cong]: 

730 
"A = B ==> (!!x. x:B ==> C x = D x) ==> (INT x:A. C x) = (INT x:B. D x)" 

731 
by (simp add: INTER_def) 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
5931
diff
changeset

732 

923  733 

11979  734 
subsubsection {* Union *} 
735 

736 
lemma Union_iff [simp]: "(A : Union C) = (EX X:C. A:X)" 

737 
by (unfold Union_def) blast 

738 

739 
lemma UnionI [intro]: "X:C ==> A:X ==> A : Union C" 

740 
 {* The order of the premises presupposes that @{term C} is rigid; 

741 
@{term A} may be flexible. *} 

742 
by auto 

743 

744 
lemma UnionE [elim!]: "A : Union C ==> (!!X. A:X ==> X:C ==> R) ==> R" 

745 
by (unfold Union_def) blast 

746 

747 

748 
subsubsection {* Inter *} 

749 

750 
lemma Inter_iff [simp]: "(A : Inter C) = (ALL X:C. A:X)" 

751 
by (unfold Inter_def) blast 

752 

753 
lemma InterI [intro!]: "(!!X. X:C ==> A:X) ==> A : Inter C" 

754 
by (simp add: Inter_def) 

755 

756 
text {* 

757 
\medskip A ``destruct'' rule  every @{term X} in @{term C} 

758 
contains @{term A} as an element, but @{prop "A:X"} can hold when 

759 
@{prop "X:C"} does not! This rule is analogous to @{text spec}. 

760 
*} 

761 

762 
lemma InterD [elim]: "A : Inter C ==> X:C ==> A:X" 

763 
by auto 

764 

765 
lemma InterE [elim]: "A : Inter C ==> (X~:C ==> R) ==> (A:X ==> R) ==> R" 

766 
 {* ``Classical'' elimination rule  does not require proving 

767 
@{prop "X:C"}. *} 

768 
by (unfold Inter_def) blast 

769 

770 
text {* 

771 
\medskip Image of a set under a function. Frequently @{term b} does 

772 
not have the syntactic form of @{term "f x"}. 

773 
*} 

774 

775 
lemma image_eqI [simp, intro]: "b = f x ==> x:A ==> b : f`A" 

776 
by (unfold image_def) blast 

777 

778 
lemma imageI: "x : A ==> f x : f ` A" 

779 
by (rule image_eqI) (rule refl) 

780 

781 
lemma rev_image_eqI: "x:A ==> b = f x ==> b : f`A" 

782 
 {* This version's more effective when we already have the 

783 
required @{term x}. *} 

784 
by (unfold image_def) blast 

785 

786 
lemma imageE [elim!]: 

787 
"b : (%x. f x)`A ==> (!!x. b = f x ==> x:A ==> P) ==> P" 

788 
 {* The etaexpansion gives variablename preservation. *} 

789 
by (unfold image_def) blast 

790 

791 
lemma image_Un: "f`(A Un B) = f`A Un f`B" 

792 
by blast 

793 

794 
lemma image_iff: "(z : f`A) = (EX x:A. z = f x)" 

795 
by blast 

796 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

797 
lemma image_subset_iff: "(f`A \<subseteq> B) = (\<forall>x\<in>A. f x \<in> B)" 
11979  798 
 {* This rewrite rule would confuse users if made default. *} 
799 
by blast 

800 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

801 
lemma subset_image_iff: "(B \<subseteq> f`A) = (EX AA. AA \<subseteq> A & B = f`AA)" 
11979  802 
apply safe 
803 
prefer 2 apply fast 

14208  804 
apply (rule_tac x = "{a. a : A & f a : B}" in exI, fast) 
11979  805 
done 
806 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

807 
lemma image_subsetI: "(!!x. x \<in> A ==> f x \<in> B) ==> f`A \<subseteq> B" 
11979  808 
 {* Replaces the three steps @{text subsetI}, @{text imageE}, 
809 
@{text hypsubst}, but breaks too many existing proofs. *} 

810 
by blast 

811 

812 
text {* 

813 
\medskip Range of a function  just a translation for image! 

814 
*} 

815 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

816 
lemma range_eqI: "b = f x ==> b \<in> range f" 
11979  817 
by simp 
818 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

819 
lemma rangeI: "f x \<in> range f" 
11979  820 
by simp 
821 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

822 
lemma rangeE [elim?]: "b \<in> range (\<lambda>x. f x) ==> (!!x. b = f x ==> P) ==> P" 
11979  823 
by blast 
824 

825 

826 
subsubsection {* Set reasoning tools *} 

827 

828 
text {* 

829 
Rewrite rules for boolean casesplitting: faster than @{text 

830 
"split_if [split]"}. 

831 
*} 

832 

833 
lemma split_if_eq1: "((if Q then x else y) = b) = ((Q > x = b) & (~ Q > y = b))" 

834 
by (rule split_if) 

835 

836 
lemma split_if_eq2: "(a = (if Q then x else y)) = ((Q > a = x) & (~ Q > a = y))" 

837 
by (rule split_if) 

838 

839 
text {* 

840 
Split ifs on either side of the membership relation. Not for @{text 

841 
"[simp]"}  can cause goals to blow up! 

842 
*} 

843 

844 
lemma split_if_mem1: "((if Q then x else y) : b) = ((Q > x : b) & (~ Q > y : b))" 

845 
by (rule split_if) 

846 

847 
lemma split_if_mem2: "(a : (if Q then x else y)) = ((Q > a : x) & (~ Q > a : y))" 

848 
by (rule split_if) 

849 

850 
lemmas split_ifs = if_bool_eq_conj split_if_eq1 split_if_eq2 split_if_mem1 split_if_mem2 

851 

852 
lemmas mem_simps = 

853 
insert_iff empty_iff Un_iff Int_iff Compl_iff Diff_iff 

854 
mem_Collect_eq UN_iff Union_iff INT_iff Inter_iff 

855 
 {* Each of these has ALREADY been added @{text "[simp]"} above. *} 

856 

857 
(*Would like to add these, but the existing code only searches for the 

858 
outerlevel constant, which in this case is just "op :"; we instead need 

859 
to use termnets to associate patterns with rules. Also, if a rule fails to 

860 
apply, then the formula should be kept. 

861 
[("uminus", Compl_iff RS iffD1), ("op ", [Diff_iff RS iffD1]), 

862 
("op Int", [IntD1,IntD2]), 

863 
("Collect", [CollectD]), ("Inter", [InterD]), ("INTER", [INT_D])] 

864 
*) 

865 

866 
ML_setup {* 

867 
val mksimps_pairs = [("Ball", [thm "bspec"])] @ mksimps_pairs; 

868 
simpset_ref() := simpset() setmksimps (mksimps mksimps_pairs); 

869 
*} 

870 

871 
declare subset_UNIV [simp] subset_refl [simp] 

872 

873 

874 
subsubsection {* The ``proper subset'' relation *} 

875 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

876 
lemma psubsetI [intro!]: "A \<subseteq> B ==> A \<noteq> B ==> A \<subset> B" 
11979  877 
by (unfold psubset_def) blast 
878 

13624  879 
lemma psubsetE [elim!]: 
880 
"[A \<subset> B; [A \<subseteq> B; ~ (B\<subseteq>A)] ==> R] ==> R" 

881 
by (unfold psubset_def) blast 

882 

11979  883 
lemma psubset_insert_iff: 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

884 
"(A \<subset> insert x B) = (if x \<in> B then A \<subset> B else if x \<in> A then A  {x} \<subset> B else A \<subseteq> B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

885 
by (auto simp add: psubset_def subset_insert_iff) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

886 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

887 
lemma psubset_eq: "(A \<subset> B) = (A \<subseteq> B & A \<noteq> B)" 
11979  888 
by (simp only: psubset_def) 
889 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

890 
lemma psubset_imp_subset: "A \<subset> B ==> A \<subseteq> B" 
11979  891 
by (simp add: psubset_eq) 
892 

14335  893 
lemma psubset_trans: "[ A \<subset> B; B \<subset> C ] ==> A \<subset> C" 
894 
apply (unfold psubset_def) 

895 
apply (auto dest: subset_antisym) 

896 
done 

897 

898 
lemma psubsetD: "[ A \<subset> B; c \<in> A ] ==> c \<in> B" 

899 
apply (unfold psubset_def) 

900 
apply (auto dest: subsetD) 

901 
done 

902 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

903 
lemma psubset_subset_trans: "A \<subset> B ==> B \<subseteq> C ==> A \<subset> C" 
11979  904 
by (auto simp add: psubset_eq) 
905 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

906 
lemma subset_psubset_trans: "A \<subseteq> B ==> B \<subset> C ==> A \<subset> C" 
11979  907 
by (auto simp add: psubset_eq) 
908 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

909 
lemma psubset_imp_ex_mem: "A \<subset> B ==> \<exists>b. b \<in> (B  A)" 
11979  910 
by (unfold psubset_def) blast 
911 

912 
lemma atomize_ball: 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

913 
"(!!x. x \<in> A ==> P x) == Trueprop (\<forall>x\<in>A. P x)" 
11979  914 
by (simp only: Ball_def atomize_all atomize_imp) 
915 

916 
declare atomize_ball [symmetric, rulify] 

917 

918 

919 
subsection {* Further settheory lemmas *} 

920 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

921 
subsubsection {* Derived rules involving subsets. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

922 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

923 
text {* @{text insert}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

924 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

925 
lemma subset_insertI: "B \<subseteq> insert a B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

926 
apply (rule subsetI) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

927 
apply (erule insertI2) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

928 
done 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

929 

14302  930 
lemma subset_insertI2: "A \<subseteq> B \<Longrightarrow> A \<subseteq> insert b B" 
931 
by blast 

932 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

933 
lemma subset_insert: "x \<notin> A ==> (A \<subseteq> insert x B) = (A \<subseteq> B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

934 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

935 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

936 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

937 
text {* \medskip Big Union  least upper bound of a set. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

938 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

939 
lemma Union_upper: "B \<in> A ==> B \<subseteq> Union A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

940 
by (rules intro: subsetI UnionI) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

941 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

942 
lemma Union_least: "(!!X. X \<in> A ==> X \<subseteq> C) ==> Union A \<subseteq> C" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

943 
by (rules intro: subsetI elim: UnionE dest: subsetD) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

944 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

945 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

946 
text {* \medskip General union. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

947 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

948 
lemma UN_upper: "a \<in> A ==> B a \<subseteq> (\<Union>x\<in>A. B x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

949 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

950 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

951 
lemma UN_least: "(!!x. x \<in> A ==> B x \<subseteq> C) ==> (\<Union>x\<in>A. B x) \<subseteq> C" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

952 
by (rules intro: subsetI elim: UN_E dest: subsetD) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

953 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

954 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

955 
text {* \medskip Big Intersection  greatest lower bound of a set. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

956 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

957 
lemma Inter_lower: "B \<in> A ==> Inter A \<subseteq> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

958 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

959 

14551  960 
lemma Inter_subset: 
961 
"[ !!X. X \<in> A ==> X \<subseteq> B; A ~= {} ] ==> \<Inter>A \<subseteq> B" 

962 
by blast 

963 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

964 
lemma Inter_greatest: "(!!X. X \<in> A ==> C \<subseteq> X) ==> C \<subseteq> Inter A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

965 
by (rules intro: InterI subsetI dest: subsetD) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

966 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

967 
lemma INT_lower: "a \<in> A ==> (\<Inter>x\<in>A. B x) \<subseteq> B a" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

968 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

969 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

970 
lemma INT_greatest: "(!!x. x \<in> A ==> C \<subseteq> B x) ==> C \<subseteq> (\<Inter>x\<in>A. B x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

971 
by (rules intro: INT_I subsetI dest: subsetD) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

972 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

973 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

974 
text {* \medskip Finite Union  the least upper bound of two sets. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

975 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

976 
lemma Un_upper1: "A \<subseteq> A \<union> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

977 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

978 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

979 
lemma Un_upper2: "B \<subseteq> A \<union> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

980 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

981 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

982 
lemma Un_least: "A \<subseteq> C ==> B \<subseteq> C ==> A \<union> B \<subseteq> C" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

983 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

984 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

985 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

986 
text {* \medskip Finite Intersection  the greatest lower bound of two sets. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

987 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

988 
lemma Int_lower1: "A \<inter> B \<subseteq> A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

989 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

990 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

991 
lemma Int_lower2: "A \<inter> B \<subseteq> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

992 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

993 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

994 
lemma Int_greatest: "C \<subseteq> A ==> C \<subseteq> B ==> C \<subseteq> A \<inter> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

995 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

996 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

997 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

998 
text {* \medskip Set difference. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

999 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1000 
lemma Diff_subset: "A  B \<subseteq> A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1001 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1002 

14302  1003 
lemma Diff_subset_conv: "(A  B \<subseteq> C) = (A \<subseteq> B \<union> C)" 
1004 
by blast 

1005 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1006 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1007 
text {* \medskip Monotonicity. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1008 

13421  1009 
lemma mono_Un: includes mono shows "f A \<union> f B \<subseteq> f (A \<union> B)" 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1010 
apply (rule Un_least) 
13421  1011 
apply (rule Un_upper1 [THEN mono]) 
1012 
apply (rule Un_upper2 [THEN mono]) 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1013 
done 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1014 

13421  1015 
lemma mono_Int: includes mono shows "f (A \<inter> B) \<subseteq> f A \<inter> f B" 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1016 
apply (rule Int_greatest) 
13421  1017 
apply (rule Int_lower1 [THEN mono]) 
1018 
apply (rule Int_lower2 [THEN mono]) 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1019 
done 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1020 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1021 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1022 
subsubsection {* Equalities involving union, intersection, inclusion, etc. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1023 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1024 
text {* @{text "{}"}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1025 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1026 
lemma Collect_const [simp]: "{s. P} = (if P then UNIV else {})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1027 
 {* supersedes @{text "Collect_False_empty"} *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1028 
by auto 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1029 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1030 
lemma subset_empty [simp]: "(A \<subseteq> {}) = (A = {})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1031 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1032 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1033 
lemma not_psubset_empty [iff]: "\<not> (A < {})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1034 
by (unfold psubset_def) blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1035 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1036 
lemma Collect_empty_eq [simp]: "(Collect P = {}) = (\<forall>x. \<not> P x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1037 
by auto 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1038 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1039 
lemma Collect_neg_eq: "{x. \<not> P x} =  {x. P x}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1040 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1041 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1042 
lemma Collect_disj_eq: "{x. P x  Q x} = {x. P x} \<union> {x. Q x}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1043 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1044 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1045 
lemma Collect_conj_eq: "{x. P x & Q x} = {x. P x} \<inter> {x. Q x}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1046 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1047 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1048 
lemma Collect_all_eq: "{x. \<forall>y. P x y} = (\<Inter>y. {x. P x y})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1049 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1050 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1051 
lemma Collect_ball_eq: "{x. \<forall>y\<in>A. P x y} = (\<Inter>y\<in>A. {x. P x y})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1052 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1053 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1054 
lemma Collect_ex_eq: "{x. \<exists>y. P x y} = (\<Union>y. {x. P x y})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1055 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1056 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1057 
lemma Collect_bex_eq: "{x. \<exists>y\<in>A. P x y} = (\<Union>y\<in>A. {x. P x y})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1058 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1059 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1060 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1061 
text {* \medskip @{text insert}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1062 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1063 
lemma insert_is_Un: "insert a A = {a} Un A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1064 
 {* NOT SUITABLE FOR REWRITING since @{text "{a} == insert a {}"} *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1065 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1066 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1067 
lemma insert_not_empty [simp]: "insert a A \<noteq> {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1068 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1069 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1070 
lemmas empty_not_insert [simp] = insert_not_empty [symmetric, standard] 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1071 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1072 
lemma insert_absorb: "a \<in> A ==> insert a A = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1073 
 {* @{text "[simp]"} causes recursive calls when there are nested inserts *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1074 
 {* with \emph{quadratic} running time *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1075 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1076 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1077 
lemma insert_absorb2 [simp]: "insert x (insert x A) = insert x A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1078 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1079 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1080 
lemma insert_commute: "insert x (insert y A) = insert y (insert x A)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1081 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1082 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1083 
lemma insert_subset [simp]: "(insert x A \<subseteq> B) = (x \<in> B & A \<subseteq> B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1084 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1085 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1086 
lemma mk_disjoint_insert: "a \<in> A ==> \<exists>B. A = insert a B & a \<notin> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1087 
 {* use new @{text B} rather than @{text "A  {a}"} to avoid infinite unfolding *} 
14208  1088 
apply (rule_tac x = "A  {a}" in exI, blast) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1089 
done 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1090 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1091 
lemma insert_Collect: "insert a (Collect P) = {u. u \<noteq> a > P u}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1092 
by auto 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1093 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1094 
lemma UN_insert_distrib: "u \<in> A ==> (\<Union>x\<in>A. insert a (B x)) = insert a (\<Union>x\<in>A. B x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1095 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1096 

14302  1097 
lemma insert_inter_insert[simp]: "insert a A \<inter> insert a B = insert a (A \<inter> B)" 
1098 
by blast 

1099 

13103
66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1100 
lemma insert_disjoint[simp]: 
66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1101 
"(insert a A \<inter> B = {}) = (a \<notin> B \<and> A \<inter> B = {})" 
66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1102 
by blast 
66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1103 

66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1104 
lemma disjoint_insert[simp]: 
66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1105 
"(B \<inter> insert a A = {}) = (a \<notin> B \<and> B \<inter> A = {})" 
66659a4b16f6
Added insert_disjoint and disjoint_insert [simp], and simplified proofs
nipkow
parents:
12937
diff
changeset

1106 
by blast 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1107 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1108 
text {* \medskip @{text image}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1109 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1110 
lemma image_empty [simp]: "f`{} = {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1111 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1112 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1113 
lemma image_insert [simp]: "f ` insert a B = insert (f a) (f`B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1114 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1115 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1116 
lemma image_constant: "x \<in> A ==> (\<lambda>x. c) ` A = {c}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1117 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1118 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1119 
lemma image_image: "f ` (g ` A) = (\<lambda>x. f (g x)) ` A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1120 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1121 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1122 
lemma insert_image [simp]: "x \<in> A ==> insert (f x) (f`A) = f`A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1123 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1124 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1125 
lemma image_is_empty [iff]: "(f`A = {}) = (A = {})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1126 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1127 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1128 
lemma image_Collect: "f ` {x. P x} = {f x  x. P x}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1129 
 {* NOT suitable as a default simprule: the RHS isn't simpler than the LHS, *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1130 
 {* with its implicit quantifier and conjunction. Also image enjoys better *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1131 
 {* equational properties than does the RHS. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1132 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1133 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1134 
lemma if_image_distrib [simp]: 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1135 
"(\<lambda>x. if P x then f x else g x) ` S 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1136 
= (f ` (S \<inter> {x. P x})) \<union> (g ` (S \<inter> {x. \<not> P x}))" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1137 
by (auto simp add: image_def) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1138 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1139 
lemma image_cong: "M = N ==> (!!x. x \<in> N ==> f x = g x) ==> f`M = g`N" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1140 
by (simp add: image_def) 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1141 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1142 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1143 
text {* \medskip @{text range}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1144 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1145 
lemma full_SetCompr_eq: "{u. \<exists>x. u = f x} = range f" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1146 
by auto 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1147 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1148 
lemma range_composition [simp]: "range (\<lambda>x. f (g x)) = f`range g" 
14208  1149 
by (subst image_image, simp) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1150 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1151 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1152 
text {* \medskip @{text Int} *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1153 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1154 
lemma Int_absorb [simp]: "A \<inter> A = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1155 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1156 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1157 
lemma Int_left_absorb: "A \<inter> (A \<inter> B) = A \<inter> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1158 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1159 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1160 
lemma Int_commute: "A \<inter> B = B \<inter> A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1161 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1162 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1163 
lemma Int_left_commute: "A \<inter> (B \<inter> C) = B \<inter> (A \<inter> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1164 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1165 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1166 
lemma Int_assoc: "(A \<inter> B) \<inter> C = A \<inter> (B \<inter> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1167 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1168 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1169 
lemmas Int_ac = Int_assoc Int_left_absorb Int_commute Int_left_commute 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1170 
 {* Intersection is an ACoperator *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1171 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1172 
lemma Int_absorb1: "B \<subseteq> A ==> A \<inter> B = B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1173 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1174 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1175 
lemma Int_absorb2: "A \<subseteq> B ==> A \<inter> B = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1176 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1177 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1178 
lemma Int_empty_left [simp]: "{} \<inter> B = {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1179 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1180 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1181 
lemma Int_empty_right [simp]: "A \<inter> {} = {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1182 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1183 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1184 
lemma disjoint_eq_subset_Compl: "(A \<inter> B = {}) = (A \<subseteq> B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1185 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1186 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1187 
lemma disjoint_iff_not_equal: "(A \<inter> B = {}) = (\<forall>x\<in>A. \<forall>y\<in>B. x \<noteq> y)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1188 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1189 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1190 
lemma Int_UNIV_left [simp]: "UNIV \<inter> B = B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1191 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1192 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1193 
lemma Int_UNIV_right [simp]: "A \<inter> UNIV = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1194 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1195 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1196 
lemma Int_eq_Inter: "A \<inter> B = \<Inter>{A, B}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1197 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1198 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1199 
lemma Int_Un_distrib: "A \<inter> (B \<union> C) = (A \<inter> B) \<union> (A \<inter> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1200 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1201 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1202 
lemma Int_Un_distrib2: "(B \<union> C) \<inter> A = (B \<inter> A) \<union> (C \<inter> A)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1203 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1204 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1205 
lemma Int_UNIV [simp]: "(A \<inter> B = UNIV) = (A = UNIV & B = UNIV)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1206 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1207 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1208 
lemma Int_subset_iff: "(C \<subseteq> A \<inter> B) = (C \<subseteq> A & C \<subseteq> B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1209 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1210 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1211 
lemma Int_Collect: "(x \<in> A \<inter> {x. P x}) = (x \<in> A & P x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1212 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1213 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1214 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1215 
text {* \medskip @{text Un}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1216 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1217 
lemma Un_absorb [simp]: "A \<union> A = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1218 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1219 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1220 
lemma Un_left_absorb: "A \<union> (A \<union> B) = A \<union> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1221 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1222 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1223 
lemma Un_commute: "A \<union> B = B \<union> A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1224 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1225 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1226 
lemma Un_left_commute: "A \<union> (B \<union> C) = B \<union> (A \<union> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1227 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1228 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1229 
lemma Un_assoc: "(A \<union> B) \<union> C = A \<union> (B \<union> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1230 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1231 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1232 
lemmas Un_ac = Un_assoc Un_left_absorb Un_commute Un_left_commute 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1233 
 {* Union is an ACoperator *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1234 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1235 
lemma Un_absorb1: "A \<subseteq> B ==> A \<union> B = B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1236 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1237 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1238 
lemma Un_absorb2: "B \<subseteq> A ==> A \<union> B = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1239 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1240 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1241 
lemma Un_empty_left [simp]: "{} \<union> B = B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1242 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1243 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1244 
lemma Un_empty_right [simp]: "A \<union> {} = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1245 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1246 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1247 
lemma Un_UNIV_left [simp]: "UNIV \<union> B = UNIV" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1248 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1249 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1250 
lemma Un_UNIV_right [simp]: "A \<union> UNIV = UNIV" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1251 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1252 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1253 
lemma Un_eq_Union: "A \<union> B = \<Union>{A, B}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1254 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1255 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1256 
lemma Un_insert_left [simp]: "(insert a B) \<union> C = insert a (B \<union> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1257 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1258 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1259 
lemma Un_insert_right [simp]: "A \<union> (insert a B) = insert a (A \<union> B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1260 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1261 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1262 
lemma Int_insert_left: 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1263 
"(insert a B) Int C = (if a \<in> C then insert a (B \<inter> C) else B \<inter> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1264 
by auto 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1265 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1266 
lemma Int_insert_right: 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1267 
"A \<inter> (insert a B) = (if a \<in> A then insert a (A \<inter> B) else A \<inter> B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1268 
by auto 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1269 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1270 
lemma Un_Int_distrib: "A \<union> (B \<inter> C) = (A \<union> B) \<inter> (A \<union> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1271 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1272 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1273 
lemma Un_Int_distrib2: "(B \<inter> C) \<union> A = (B \<union> A) \<inter> (C \<union> A)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1274 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1275 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1276 
lemma Un_Int_crazy: 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1277 
"(A \<inter> B) \<union> (B \<inter> C) \<union> (C \<inter> A) = (A \<union> B) \<inter> (B \<union> C) \<inter> (C \<union> A)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1278 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1279 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1280 
lemma subset_Un_eq: "(A \<subseteq> B) = (A \<union> B = B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1281 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1282 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1283 
lemma Un_empty [iff]: "(A \<union> B = {}) = (A = {} & B = {})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1284 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1285 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1286 
lemma Un_subset_iff: "(A \<union> B \<subseteq> C) = (A \<subseteq> C & B \<subseteq> C)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1287 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1288 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1289 
lemma Un_Diff_Int: "(A  B) \<union> (A \<inter> B) = A" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1290 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1291 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1292 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1293 
text {* \medskip Set complement *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1294 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1295 
lemma Compl_disjoint [simp]: "A \<inter> A = {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1296 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1297 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1298 
lemma Compl_disjoint2 [simp]: "A \<inter> A = {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1299 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1300 

13818  1301 
lemma Compl_partition: "A \<union> A = UNIV" 
1302 
by blast 

1303 

1304 
lemma Compl_partition2: "A \<union> A = UNIV" 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1305 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1306 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1307 
lemma double_complement [simp]: " (A) = (A::'a set)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1308 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1309 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1310 
lemma Compl_Un [simp]: "(A \<union> B) = (A) \<inter> (B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1311 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1312 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1313 
lemma Compl_Int [simp]: "(A \<inter> B) = (A) \<union> (B)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1314 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1315 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1316 
lemma Compl_UN [simp]: "(\<Union>x\<in>A. B x) = (\<Inter>x\<in>A. B x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1317 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1318 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1319 
lemma Compl_INT [simp]: "(\<Inter>x\<in>A. B x) = (\<Union>x\<in>A. B x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1320 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1321 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1322 
lemma subset_Compl_self_eq: "(A \<subseteq> A) = (A = {})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1323 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1324 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1325 
lemma Un_Int_assoc_eq: "((A \<inter> B) \<union> C = A \<inter> (B \<union> C)) = (C \<subseteq> A)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1326 
 {* Halmos, Naive Set Theory, page 16. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1327 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1328 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1329 
lemma Compl_UNIV_eq [simp]: "UNIV = {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1330 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1331 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1332 
lemma Compl_empty_eq [simp]: "{} = UNIV" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1333 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1334 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1335 
lemma Compl_subset_Compl_iff [iff]: "(A \<subseteq> B) = (B \<subseteq> A)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1336 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1337 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1338 
lemma Compl_eq_Compl_iff [iff]: "(A = B) = (A = (B::'a set))" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1339 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1340 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1341 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1342 
text {* \medskip @{text Union}. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1343 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1344 
lemma Union_empty [simp]: "Union({}) = {}" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1345 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1346 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1347 
lemma Union_UNIV [simp]: "Union UNIV = UNIV" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1348 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1349 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1350 
lemma Union_insert [simp]: "Union (insert a B) = a \<union> \<Union>B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1351 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1352 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1353 
lemma Union_Un_distrib [simp]: "\<Union>(A Un B) = \<Union>A \<union> \<Union>B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1354 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1355 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1356 
lemma Union_Int_subset: "\<Union>(A \<inter> B) \<subseteq> \<Union>A \<inter> \<Union>B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1357 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1358 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1359 
lemma Union_empty_conv [iff]: "(\<Union>A = {}) = (\<forall>x\<in>A. x = {})" 
13653  1360 
by blast 