src/HOL/Set.thy
changeset 32139 e271a64f03ff
parent 32135 f645b51e8e54
child 32264 0be31453f698
     1.1 --- a/src/HOL/Set.thy	Wed Jul 22 14:21:52 2009 +0200
     1.2 +++ b/src/HOL/Set.thy	Wed Jul 22 18:02:10 2009 +0200
     1.3 @@ -1,6 +1,4 @@
     1.4 -(*  Title:      HOL/Set.thy
     1.5 -    Author:     Tobias Nipkow, Lawrence C Paulson and Markus Wenzel
     1.6 -*)
     1.7 +(*  Author:     Tobias Nipkow, Lawrence C Paulson and Markus Wenzel *)
     1.8  
     1.9  header {* Set theory for higher-order logic *}
    1.10  
    1.11 @@ -1733,789 +1731,4 @@
    1.12  val vimage_Un = @{thm vimage_Un}
    1.13  *}
    1.14  
    1.15 -
    1.16 -subsection {* Complete lattices *}
    1.17 -
    1.18 -notation
    1.19 -  less_eq  (infix "\<sqsubseteq>" 50) and
    1.20 -  less (infix "\<sqsubset>" 50) and
    1.21 -  inf  (infixl "\<sqinter>" 70) and
    1.22 -  sup  (infixl "\<squnion>" 65)
    1.23 -
    1.24 -class complete_lattice = lattice + bot + top +
    1.25 -  fixes Inf :: "'a set \<Rightarrow> 'a" ("\<Sqinter>_" [900] 900)
    1.26 -    and Sup :: "'a set \<Rightarrow> 'a" ("\<Squnion>_" [900] 900)
    1.27 -  assumes Inf_lower: "x \<in> A \<Longrightarrow> \<Sqinter>A \<sqsubseteq> x"
    1.28 -     and Inf_greatest: "(\<And>x. x \<in> A \<Longrightarrow> z \<sqsubseteq> x) \<Longrightarrow> z \<sqsubseteq> \<Sqinter>A"
    1.29 -  assumes Sup_upper: "x \<in> A \<Longrightarrow> x \<sqsubseteq> \<Squnion>A"
    1.30 -     and Sup_least: "(\<And>x. x \<in> A \<Longrightarrow> x \<sqsubseteq> z) \<Longrightarrow> \<Squnion>A \<sqsubseteq> z"
    1.31 -begin
    1.32 -
    1.33 -lemma Inf_Sup: "\<Sqinter>A = \<Squnion>{b. \<forall>a \<in> A. b \<le> a}"
    1.34 -  by (auto intro: antisym Inf_lower Inf_greatest Sup_upper Sup_least)
    1.35 -
    1.36 -lemma Sup_Inf:  "\<Squnion>A = \<Sqinter>{b. \<forall>a \<in> A. a \<le> b}"
    1.37 -  by (auto intro: antisym Inf_lower Inf_greatest Sup_upper Sup_least)
    1.38 -
    1.39 -lemma Inf_Univ: "\<Sqinter>UNIV = \<Squnion>{}"
    1.40 -  unfolding Sup_Inf by auto
    1.41 -
    1.42 -lemma Sup_Univ: "\<Squnion>UNIV = \<Sqinter>{}"
    1.43 -  unfolding Inf_Sup by auto
    1.44 -
    1.45 -lemma Inf_insert: "\<Sqinter>insert a A = a \<sqinter> \<Sqinter>A"
    1.46 -  by (auto intro: le_infI le_infI1 le_infI2 antisym Inf_greatest Inf_lower)
    1.47 -
    1.48 -lemma Sup_insert: "\<Squnion>insert a A = a \<squnion> \<Squnion>A"
    1.49 -  by (auto intro: le_supI le_supI1 le_supI2 antisym Sup_least Sup_upper)
    1.50 -
    1.51 -lemma Inf_singleton [simp]:
    1.52 -  "\<Sqinter>{a} = a"
    1.53 -  by (auto intro: antisym Inf_lower Inf_greatest)
    1.54 -
    1.55 -lemma Sup_singleton [simp]:
    1.56 -  "\<Squnion>{a} = a"
    1.57 -  by (auto intro: antisym Sup_upper Sup_least)
    1.58 -
    1.59 -lemma Inf_insert_simp:
    1.60 -  "\<Sqinter>insert a A = (if A = {} then a else a \<sqinter> \<Sqinter>A)"
    1.61 -  by (cases "A = {}") (simp_all, simp add: Inf_insert)
    1.62 -
    1.63 -lemma Sup_insert_simp:
    1.64 -  "\<Squnion>insert a A = (if A = {} then a else a \<squnion> \<Squnion>A)"
    1.65 -  by (cases "A = {}") (simp_all, simp add: Sup_insert)
    1.66 -
    1.67 -lemma Inf_binary:
    1.68 -  "\<Sqinter>{a, b} = a \<sqinter> b"
    1.69 -  by (auto simp add: Inf_insert_simp)
    1.70 -
    1.71 -lemma Sup_binary:
    1.72 -  "\<Squnion>{a, b} = a \<squnion> b"
    1.73 -  by (auto simp add: Sup_insert_simp)
    1.74 -
    1.75 -lemma bot_def:
    1.76 -  "bot = \<Squnion>{}"
    1.77 -  by (auto intro: antisym Sup_least)
    1.78 -
    1.79 -lemma top_def:
    1.80 -  "top = \<Sqinter>{}"
    1.81 -  by (auto intro: antisym Inf_greatest)
    1.82 -
    1.83 -lemma sup_bot [simp]:
    1.84 -  "x \<squnion> bot = x"
    1.85 -  using bot_least [of x] by (simp add: le_iff_sup sup_commute)
    1.86 -
    1.87 -lemma inf_top [simp]:
    1.88 -  "x \<sqinter> top = x"
    1.89 -  using top_greatest [of x] by (simp add: le_iff_inf inf_commute)
    1.90 -
    1.91 -definition SUPR :: "'b set \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a" where
    1.92 -  "SUPR A f = \<Squnion> (f ` A)"
    1.93 -
    1.94 -definition INFI :: "'b set \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a" where
    1.95 -  "INFI A f = \<Sqinter> (f ` A)"
    1.96 -
    1.97  end
    1.98 -
    1.99 -syntax
   1.100 -  "_SUP1"     :: "pttrns => 'b => 'b"           ("(3SUP _./ _)" [0, 10] 10)
   1.101 -  "_SUP"      :: "pttrn => 'a set => 'b => 'b"  ("(3SUP _:_./ _)" [0, 10] 10)
   1.102 -  "_INF1"     :: "pttrns => 'b => 'b"           ("(3INF _./ _)" [0, 10] 10)
   1.103 -  "_INF"      :: "pttrn => 'a set => 'b => 'b"  ("(3INF _:_./ _)" [0, 10] 10)
   1.104 -
   1.105 -translations
   1.106 -  "SUP x y. B"   == "SUP x. SUP y. B"
   1.107 -  "SUP x. B"     == "CONST SUPR CONST UNIV (%x. B)"
   1.108 -  "SUP x. B"     == "SUP x:CONST UNIV. B"
   1.109 -  "SUP x:A. B"   == "CONST SUPR A (%x. B)"
   1.110 -  "INF x y. B"   == "INF x. INF y. B"
   1.111 -  "INF x. B"     == "CONST INFI CONST UNIV (%x. B)"
   1.112 -  "INF x. B"     == "INF x:CONST UNIV. B"
   1.113 -  "INF x:A. B"   == "CONST INFI A (%x. B)"
   1.114 -
   1.115 -print_translation {* [
   1.116 -Syntax.preserve_binder_abs2_tr' @{const_syntax SUPR} "_SUP",
   1.117 -Syntax.preserve_binder_abs2_tr' @{const_syntax INFI} "_INF"
   1.118 -] *} -- {* to avoid eta-contraction of body *}
   1.119 -
   1.120 -context complete_lattice
   1.121 -begin
   1.122 -
   1.123 -lemma le_SUPI: "i : A \<Longrightarrow> M i \<le> (SUP i:A. M i)"
   1.124 -  by (auto simp add: SUPR_def intro: Sup_upper)
   1.125 -
   1.126 -lemma SUP_leI: "(\<And>i. i : A \<Longrightarrow> M i \<le> u) \<Longrightarrow> (SUP i:A. M i) \<le> u"
   1.127 -  by (auto simp add: SUPR_def intro: Sup_least)
   1.128 -
   1.129 -lemma INF_leI: "i : A \<Longrightarrow> (INF i:A. M i) \<le> M i"
   1.130 -  by (auto simp add: INFI_def intro: Inf_lower)
   1.131 -
   1.132 -lemma le_INFI: "(\<And>i. i : A \<Longrightarrow> u \<le> M i) \<Longrightarrow> u \<le> (INF i:A. M i)"
   1.133 -  by (auto simp add: INFI_def intro: Inf_greatest)
   1.134 -
   1.135 -lemma SUP_const[simp]: "A \<noteq> {} \<Longrightarrow> (SUP i:A. M) = M"
   1.136 -  by (auto intro: antisym SUP_leI le_SUPI)
   1.137 -
   1.138 -lemma INF_const[simp]: "A \<noteq> {} \<Longrightarrow> (INF i:A. M) = M"
   1.139 -  by (auto intro: antisym INF_leI le_INFI)
   1.140 -
   1.141 -end
   1.142 -
   1.143 -
   1.144 -subsubsection {* @{typ bool} and @{typ "_ \<Rightarrow> _"} as complete lattice *}
   1.145 -
   1.146 -instantiation bool :: complete_lattice
   1.147 -begin
   1.148 -
   1.149 -definition
   1.150 -  Inf_bool_def: "\<Sqinter>A \<longleftrightarrow> (\<forall>x\<in>A. x)"
   1.151 -
   1.152 -definition
   1.153 -  Sup_bool_def: "\<Squnion>A \<longleftrightarrow> (\<exists>x\<in>A. x)"
   1.154 -
   1.155 -instance proof
   1.156 -qed (auto simp add: Inf_bool_def Sup_bool_def le_bool_def)
   1.157 -
   1.158 -end
   1.159 -
   1.160 -lemma Inf_empty_bool [simp]:
   1.161 -  "\<Sqinter>{}"
   1.162 -  unfolding Inf_bool_def by auto
   1.163 -
   1.164 -lemma not_Sup_empty_bool [simp]:
   1.165 -  "\<not> \<Squnion>{}"
   1.166 -  unfolding Sup_bool_def by auto
   1.167 -
   1.168 -lemma INFI_bool_eq:
   1.169 -  "INFI = Ball"
   1.170 -proof (rule ext)+
   1.171 -  fix A :: "'a set"
   1.172 -  fix P :: "'a \<Rightarrow> bool"
   1.173 -  show "(INF x:A. P x) \<longleftrightarrow> (\<forall>x \<in> A. P x)"
   1.174 -    by (auto simp add: Ball_def INFI_def Inf_bool_def)
   1.175 -qed
   1.176 -
   1.177 -lemma SUPR_bool_eq:
   1.178 -  "SUPR = Bex"
   1.179 -proof (rule ext)+
   1.180 -  fix A :: "'a set"
   1.181 -  fix P :: "'a \<Rightarrow> bool"
   1.182 -  show "(SUP x:A. P x) \<longleftrightarrow> (\<exists>x \<in> A. P x)"
   1.183 -    by (auto simp add: Bex_def SUPR_def Sup_bool_def)
   1.184 -qed
   1.185 -
   1.186 -instantiation "fun" :: (type, complete_lattice) complete_lattice
   1.187 -begin
   1.188 -
   1.189 -definition
   1.190 -  Inf_fun_def [code del]: "\<Sqinter>A = (\<lambda>x. \<Sqinter>{y. \<exists>f\<in>A. y = f x})"
   1.191 -
   1.192 -definition
   1.193 -  Sup_fun_def [code del]: "\<Squnion>A = (\<lambda>x. \<Squnion>{y. \<exists>f\<in>A. y = f x})"
   1.194 -
   1.195 -instance proof
   1.196 -qed (auto simp add: Inf_fun_def Sup_fun_def le_fun_def
   1.197 -  intro: Inf_lower Sup_upper Inf_greatest Sup_least)
   1.198 -
   1.199 -end
   1.200 -
   1.201 -lemma Inf_empty_fun:
   1.202 -  "\<Sqinter>{} = (\<lambda>_. \<Sqinter>{})"
   1.203 -  by (simp add: Inf_fun_def)
   1.204 -
   1.205 -lemma Sup_empty_fun:
   1.206 -  "\<Squnion>{} = (\<lambda>_. \<Squnion>{})"
   1.207 -  by (simp add: Sup_fun_def)
   1.208 -
   1.209 -
   1.210 -subsubsection {* Union *}
   1.211 -
   1.212 -definition Union :: "'a set set \<Rightarrow> 'a set" where
   1.213 -  Sup_set_eq [symmetric]: "Union S = \<Squnion>S"
   1.214 -
   1.215 -notation (xsymbols)
   1.216 -  Union  ("\<Union>_" [90] 90)
   1.217 -
   1.218 -lemma Union_eq:
   1.219 -  "\<Union>A = {x. \<exists>B \<in> A. x \<in> B}"
   1.220 -proof (rule set_ext)
   1.221 -  fix x
   1.222 -  have "(\<exists>Q\<in>{P. \<exists>B\<in>A. P \<longleftrightarrow> x \<in> B}. Q) \<longleftrightarrow> (\<exists>B\<in>A. x \<in> B)"
   1.223 -    by auto
   1.224 -  then show "x \<in> \<Union>A \<longleftrightarrow> x \<in> {x. \<exists>B\<in>A. x \<in> B}"
   1.225 -    by (simp add: Sup_set_eq [symmetric] Sup_fun_def Sup_bool_def) (simp add: mem_def)
   1.226 -qed
   1.227 -
   1.228 -lemma Union_iff [simp, noatp]:
   1.229 -  "A \<in> \<Union>C \<longleftrightarrow> (\<exists>X\<in>C. A\<in>X)"
   1.230 -  by (unfold Union_eq) blast
   1.231 -
   1.232 -lemma UnionI [intro]:
   1.233 -  "X \<in> C \<Longrightarrow> A \<in> X \<Longrightarrow> A \<in> \<Union>C"
   1.234 -  -- {* The order of the premises presupposes that @{term C} is rigid;
   1.235 -    @{term A} may be flexible. *}
   1.236 -  by auto
   1.237 -
   1.238 -lemma UnionE [elim!]:
   1.239 -  "A \<in> \<Union>C \<Longrightarrow> (\<And>X. A\<in>X \<Longrightarrow> X\<in>C \<Longrightarrow> R) \<Longrightarrow> R"
   1.240 -  by auto
   1.241 -
   1.242 -lemma Union_upper: "B \<in> A ==> B \<subseteq> Union A"
   1.243 -  by (iprover intro: subsetI UnionI)
   1.244 -
   1.245 -lemma Union_least: "(!!X. X \<in> A ==> X \<subseteq> C) ==> Union A \<subseteq> C"
   1.246 -  by (iprover intro: subsetI elim: UnionE dest: subsetD)
   1.247 -
   1.248 -lemma Un_eq_Union: "A \<union> B = \<Union>{A, B}"
   1.249 -  by blast
   1.250 -
   1.251 -lemma Union_empty [simp]: "Union({}) = {}"
   1.252 -  by blast
   1.253 -
   1.254 -lemma Union_UNIV [simp]: "Union UNIV = UNIV"
   1.255 -  by blast
   1.256 -
   1.257 -lemma Union_insert [simp]: "Union (insert a B) = a \<union> \<Union>B"
   1.258 -  by blast
   1.259 -
   1.260 -lemma Union_Un_distrib [simp]: "\<Union>(A Un B) = \<Union>A \<union> \<Union>B"
   1.261 -  by blast
   1.262 -
   1.263 -lemma Union_Int_subset: "\<Union>(A \<inter> B) \<subseteq> \<Union>A \<inter> \<Union>B"
   1.264 -  by blast
   1.265 -
   1.266 -lemma Union_empty_conv [simp,noatp]: "(\<Union>A = {}) = (\<forall>x\<in>A. x = {})"
   1.267 -  by blast
   1.268 -
   1.269 -lemma empty_Union_conv [simp,noatp]: "({} = \<Union>A) = (\<forall>x\<in>A. x = {})"
   1.270 -  by blast
   1.271 -
   1.272 -lemma Union_disjoint: "(\<Union>C \<inter> A = {}) = (\<forall>B\<in>C. B \<inter> A = {})"
   1.273 -  by blast
   1.274 -
   1.275 -lemma subset_Pow_Union: "A \<subseteq> Pow (\<Union>A)"
   1.276 -  by blast
   1.277 -
   1.278 -lemma Union_Pow_eq [simp]: "\<Union>(Pow A) = A"
   1.279 -  by blast
   1.280 -
   1.281 -lemma Union_mono: "A \<subseteq> B ==> \<Union>A \<subseteq> \<Union>B"
   1.282 -  by blast
   1.283 -
   1.284 -
   1.285 -subsubsection {* Unions of families *}
   1.286 -
   1.287 -definition UNION :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where
   1.288 -  SUPR_set_eq [symmetric]: "UNION S f = (SUP x:S. f x)"
   1.289 -
   1.290 -syntax
   1.291 -  "@UNION1"     :: "pttrns => 'b set => 'b set"           ("(3UN _./ _)" [0, 10] 10)
   1.292 -  "@UNION"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3UN _:_./ _)" [0, 10] 10)
   1.293 -
   1.294 -syntax (xsymbols)
   1.295 -  "@UNION1"     :: "pttrns => 'b set => 'b set"           ("(3\<Union>_./ _)" [0, 10] 10)
   1.296 -  "@UNION"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Union>_\<in>_./ _)" [0, 10] 10)
   1.297 -
   1.298 -syntax (latex output)
   1.299 -  "@UNION1"     :: "pttrns => 'b set => 'b set"           ("(3\<Union>(00\<^bsub>_\<^esub>)/ _)" [0, 10] 10)
   1.300 -  "@UNION"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Union>(00\<^bsub>_\<in>_\<^esub>)/ _)" [0, 10] 10)
   1.301 -
   1.302 -translations
   1.303 -  "UN x y. B"   == "UN x. UN y. B"
   1.304 -  "UN x. B"     == "CONST UNION CONST UNIV (%x. B)"
   1.305 -  "UN x. B"     == "UN x:CONST UNIV. B"
   1.306 -  "UN x:A. B"   == "CONST UNION A (%x. B)"
   1.307 -
   1.308 -text {*
   1.309 -  Note the difference between ordinary xsymbol syntax of indexed
   1.310 -  unions and intersections (e.g.\ @{text"\<Union>a\<^isub>1\<in>A\<^isub>1. B"})
   1.311 -  and their \LaTeX\ rendition: @{term"\<Union>a\<^isub>1\<in>A\<^isub>1. B"}. The
   1.312 -  former does not make the index expression a subscript of the
   1.313 -  union/intersection symbol because this leads to problems with nested
   1.314 -  subscripts in Proof General.
   1.315 -*}
   1.316 -
   1.317 -print_translation {* [
   1.318 -Syntax.preserve_binder_abs2_tr' @{const_syntax UNION} "@UNION"
   1.319 -] *} -- {* to avoid eta-contraction of body *}
   1.320 -
   1.321 -lemma UNION_eq_Union_image:
   1.322 -  "(\<Union>x\<in>A. B x) = \<Union>(B`A)"
   1.323 -  by (simp add: SUPR_def SUPR_set_eq [symmetric] Sup_set_eq)
   1.324 -
   1.325 -lemma Union_def:
   1.326 -  "\<Union>S = (\<Union>x\<in>S. x)"
   1.327 -  by (simp add: UNION_eq_Union_image image_def)
   1.328 -
   1.329 -lemma UNION_def [noatp]:
   1.330 -  "(\<Union>x\<in>A. B x) = {y. \<exists>x\<in>A. y \<in> B x}"
   1.331 -  by (auto simp add: UNION_eq_Union_image Union_eq)
   1.332 -  
   1.333 -lemma Union_image_eq [simp]:
   1.334 -  "\<Union>(B`A) = (\<Union>x\<in>A. B x)"
   1.335 -  by (rule sym) (fact UNION_eq_Union_image)
   1.336 -  
   1.337 -lemma UN_iff [simp]: "(b: (UN x:A. B x)) = (EX x:A. b: B x)"
   1.338 -  by (unfold UNION_def) blast
   1.339 -
   1.340 -lemma UN_I [intro]: "a:A ==> b: B a ==> b: (UN x:A. B x)"
   1.341 -  -- {* The order of the premises presupposes that @{term A} is rigid;
   1.342 -    @{term b} may be flexible. *}
   1.343 -  by auto
   1.344 -
   1.345 -lemma UN_E [elim!]: "b : (UN x:A. B x) ==> (!!x. x:A ==> b: B x ==> R) ==> R"
   1.346 -  by (unfold UNION_def) blast
   1.347 -
   1.348 -lemma UN_cong [cong]:
   1.349 -    "A = B ==> (!!x. x:B ==> C x = D x) ==> (UN x:A. C x) = (UN x:B. D x)"
   1.350 -  by (simp add: UNION_def)
   1.351 -
   1.352 -lemma strong_UN_cong:
   1.353 -    "A = B ==> (!!x. x:B =simp=> C x = D x) ==> (UN x:A. C x) = (UN x:B. D x)"
   1.354 -  by (simp add: UNION_def simp_implies_def)
   1.355 -
   1.356 -lemma image_eq_UN: "f`A = (UN x:A. {f x})"
   1.357 -  by blast
   1.358 -
   1.359 -lemma UN_upper: "a \<in> A ==> B a \<subseteq> (\<Union>x\<in>A. B x)"
   1.360 -  by blast
   1.361 -
   1.362 -lemma UN_least: "(!!x. x \<in> A ==> B x \<subseteq> C) ==> (\<Union>x\<in>A. B x) \<subseteq> C"
   1.363 -  by (iprover intro: subsetI elim: UN_E dest: subsetD)
   1.364 -
   1.365 -lemma Collect_bex_eq [noatp]: "{x. \<exists>y\<in>A. P x y} = (\<Union>y\<in>A. {x. P x y})"
   1.366 -  by blast
   1.367 -
   1.368 -lemma UN_insert_distrib: "u \<in> A ==> (\<Union>x\<in>A. insert a (B x)) = insert a (\<Union>x\<in>A. B x)"
   1.369 -  by blast
   1.370 -
   1.371 -lemma UN_empty [simp,noatp]: "(\<Union>x\<in>{}. B x) = {}"
   1.372 -  by blast
   1.373 -
   1.374 -lemma UN_empty2 [simp]: "(\<Union>x\<in>A. {}) = {}"
   1.375 -  by blast
   1.376 -
   1.377 -lemma UN_singleton [simp]: "(\<Union>x\<in>A. {x}) = A"
   1.378 -  by blast
   1.379 -
   1.380 -lemma UN_absorb: "k \<in> I ==> A k \<union> (\<Union>i\<in>I. A i) = (\<Union>i\<in>I. A i)"
   1.381 -  by auto
   1.382 -
   1.383 -lemma UN_insert [simp]: "(\<Union>x\<in>insert a A. B x) = B a \<union> UNION A B"
   1.384 -  by blast
   1.385 -
   1.386 -lemma UN_Un[simp]: "(\<Union>i \<in> A \<union> B. M i) = (\<Union>i\<in>A. M i) \<union> (\<Union>i\<in>B. M i)"
   1.387 -  by blast
   1.388 -
   1.389 -lemma UN_UN_flatten: "(\<Union>x \<in> (\<Union>y\<in>A. B y). C x) = (\<Union>y\<in>A. \<Union>x\<in>B y. C x)"
   1.390 -  by blast
   1.391 -
   1.392 -lemma UN_subset_iff: "((\<Union>i\<in>I. A i) \<subseteq> B) = (\<forall>i\<in>I. A i \<subseteq> B)"
   1.393 -  by blast
   1.394 -
   1.395 -lemma image_Union: "f ` \<Union>S = (\<Union>x\<in>S. f ` x)"
   1.396 -  by blast
   1.397 -
   1.398 -lemma UN_constant [simp]: "(\<Union>y\<in>A. c) = (if A = {} then {} else c)"
   1.399 -  by auto
   1.400 -
   1.401 -lemma UN_eq: "(\<Union>x\<in>A. B x) = \<Union>({Y. \<exists>x\<in>A. Y = B x})"
   1.402 -  by blast
   1.403 -
   1.404 -lemma UNION_empty_conv[simp]:
   1.405 -  "({} = (UN x:A. B x)) = (\<forall>x\<in>A. B x = {})"
   1.406 -  "((UN x:A. B x) = {}) = (\<forall>x\<in>A. B x = {})"
   1.407 -by blast+
   1.408 -
   1.409 -lemma Collect_ex_eq [noatp]: "{x. \<exists>y. P x y} = (\<Union>y. {x. P x y})"
   1.410 -  by blast
   1.411 -
   1.412 -lemma ball_UN: "(\<forall>z \<in> UNION A B. P z) = (\<forall>x\<in>A. \<forall>z \<in> B x. P z)"
   1.413 -  by blast
   1.414 -
   1.415 -lemma bex_UN: "(\<exists>z \<in> UNION A B. P z) = (\<exists>x\<in>A. \<exists>z\<in>B x. P z)"
   1.416 -  by blast
   1.417 -
   1.418 -lemma Un_eq_UN: "A \<union> B = (\<Union>b. if b then A else B)"
   1.419 -  by (auto simp add: split_if_mem2)
   1.420 -
   1.421 -lemma UN_bool_eq: "(\<Union>b::bool. A b) = (A True \<union> A False)"
   1.422 -  by (auto intro: bool_contrapos)
   1.423 -
   1.424 -lemma UN_Pow_subset: "(\<Union>x\<in>A. Pow (B x)) \<subseteq> Pow (\<Union>x\<in>A. B x)"
   1.425 -  by blast
   1.426 -
   1.427 -lemma UN_mono:
   1.428 -  "A \<subseteq> B ==> (!!x. x \<in> A ==> f x \<subseteq> g x) ==>
   1.429 -    (\<Union>x\<in>A. f x) \<subseteq> (\<Union>x\<in>B. g x)"
   1.430 -  by (blast dest: subsetD)
   1.431 -
   1.432 -lemma vimage_Union: "f -` (Union A) = (UN X:A. f -` X)"
   1.433 -  by blast
   1.434 -
   1.435 -lemma vimage_UN: "f-`(UN x:A. B x) = (UN x:A. f -` B x)"
   1.436 -  by blast
   1.437 -
   1.438 -lemma vimage_eq_UN: "f-`B = (UN y: B. f-`{y})"
   1.439 -  -- {* NOT suitable for rewriting *}
   1.440 -  by blast
   1.441 -
   1.442 -lemma image_UN: "(f ` (UNION A B)) = (UN x:A.(f ` (B x)))"
   1.443 -by blast
   1.444 -
   1.445 -
   1.446 -subsubsection {* Inter *}
   1.447 -
   1.448 -definition Inter :: "'a set set \<Rightarrow> 'a set" where
   1.449 -  Inf_set_eq [symmetric]: "Inter S = \<Sqinter>S"
   1.450 -  
   1.451 -notation (xsymbols)
   1.452 -  Inter  ("\<Inter>_" [90] 90)
   1.453 -
   1.454 -lemma Inter_eq [code del]:
   1.455 -  "\<Inter>A = {x. \<forall>B \<in> A. x \<in> B}"
   1.456 -proof (rule set_ext)
   1.457 -  fix x
   1.458 -  have "(\<forall>Q\<in>{P. \<exists>B\<in>A. P \<longleftrightarrow> x \<in> B}. Q) \<longleftrightarrow> (\<forall>B\<in>A. x \<in> B)"
   1.459 -    by auto
   1.460 -  then show "x \<in> \<Inter>A \<longleftrightarrow> x \<in> {x. \<forall>B \<in> A. x \<in> B}"
   1.461 -    by (simp add: Inf_fun_def Inf_bool_def Inf_set_eq [symmetric]) (simp add: mem_def)
   1.462 -qed
   1.463 -
   1.464 -lemma Inter_iff [simp,noatp]: "(A : Inter C) = (ALL X:C. A:X)"
   1.465 -  by (unfold Inter_eq) blast
   1.466 -
   1.467 -lemma InterI [intro!]: "(!!X. X:C ==> A:X) ==> A : Inter C"
   1.468 -  by (simp add: Inter_eq)
   1.469 -
   1.470 -text {*
   1.471 -  \medskip A ``destruct'' rule -- every @{term X} in @{term C}
   1.472 -  contains @{term A} as an element, but @{prop "A:X"} can hold when
   1.473 -  @{prop "X:C"} does not!  This rule is analogous to @{text spec}.
   1.474 -*}
   1.475 -
   1.476 -lemma InterD [elim]: "A : Inter C ==> X:C ==> A:X"
   1.477 -  by auto
   1.478 -
   1.479 -lemma InterE [elim]: "A : Inter C ==> (X~:C ==> R) ==> (A:X ==> R) ==> R"
   1.480 -  -- {* ``Classical'' elimination rule -- does not require proving
   1.481 -    @{prop "X:C"}. *}
   1.482 -  by (unfold Inter_eq) blast
   1.483 -
   1.484 -lemma Inter_lower: "B \<in> A ==> Inter A \<subseteq> B"
   1.485 -  by blast
   1.486 -
   1.487 -lemma Inter_subset:
   1.488 -  "[| !!X. X \<in> A ==> X \<subseteq> B; A ~= {} |] ==> \<Inter>A \<subseteq> B"
   1.489 -  by blast
   1.490 -
   1.491 -lemma Inter_greatest: "(!!X. X \<in> A ==> C \<subseteq> X) ==> C \<subseteq> Inter A"
   1.492 -  by (iprover intro: InterI subsetI dest: subsetD)
   1.493 -
   1.494 -lemma Int_eq_Inter: "A \<inter> B = \<Inter>{A, B}"
   1.495 -  by blast
   1.496 -
   1.497 -lemma Inter_empty [simp]: "\<Inter>{} = UNIV"
   1.498 -  by blast
   1.499 -
   1.500 -lemma Inter_UNIV [simp]: "\<Inter>UNIV = {}"
   1.501 -  by blast
   1.502 -
   1.503 -lemma Inter_insert [simp]: "\<Inter>(insert a B) = a \<inter> \<Inter>B"
   1.504 -  by blast
   1.505 -
   1.506 -lemma Inter_Un_subset: "\<Inter>A \<union> \<Inter>B \<subseteq> \<Inter>(A \<inter> B)"
   1.507 -  by blast
   1.508 -
   1.509 -lemma Inter_Un_distrib: "\<Inter>(A \<union> B) = \<Inter>A \<inter> \<Inter>B"
   1.510 -  by blast
   1.511 -
   1.512 -lemma Inter_UNIV_conv [simp,noatp]:
   1.513 -  "(\<Inter>A = UNIV) = (\<forall>x\<in>A. x = UNIV)"
   1.514 -  "(UNIV = \<Inter>A) = (\<forall>x\<in>A. x = UNIV)"
   1.515 -  by blast+
   1.516 -
   1.517 -lemma Inter_anti_mono: "B \<subseteq> A ==> \<Inter>A \<subseteq> \<Inter>B"
   1.518 -  by blast
   1.519 -
   1.520 -
   1.521 -subsubsection {* Intersections of families *}
   1.522 -
   1.523 -definition INTER :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where
   1.524 -  INFI_set_eq [symmetric]: "INTER S f = (INF x:S. f x)"
   1.525 -
   1.526 -syntax
   1.527 -  "@INTER1"     :: "pttrns => 'b set => 'b set"           ("(3INT _./ _)" [0, 10] 10)
   1.528 -  "@INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3INT _:_./ _)" [0, 10] 10)
   1.529 -
   1.530 -syntax (xsymbols)
   1.531 -  "@INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>_./ _)" [0, 10] 10)
   1.532 -  "@INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Inter>_\<in>_./ _)" [0, 10] 10)
   1.533 -
   1.534 -syntax (latex output)
   1.535 -  "@INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>(00\<^bsub>_\<^esub>)/ _)" [0, 10] 10)
   1.536 -  "@INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Inter>(00\<^bsub>_\<in>_\<^esub>)/ _)" [0, 10] 10)
   1.537 -
   1.538 -translations
   1.539 -  "INT x y. B"  == "INT x. INT y. B"
   1.540 -  "INT x. B"    == "CONST INTER CONST UNIV (%x. B)"
   1.541 -  "INT x. B"    == "INT x:CONST UNIV. B"
   1.542 -  "INT x:A. B"  == "CONST INTER A (%x. B)"
   1.543 -
   1.544 -print_translation {* [
   1.545 -Syntax.preserve_binder_abs2_tr' @{const_syntax INTER} "@INTER"
   1.546 -] *} -- {* to avoid eta-contraction of body *}
   1.547 -
   1.548 -lemma INTER_eq_Inter_image:
   1.549 -  "(\<Inter>x\<in>A. B x) = \<Inter>(B`A)"
   1.550 -  by (simp add: INFI_def INFI_set_eq [symmetric] Inf_set_eq)
   1.551 -  
   1.552 -lemma Inter_def:
   1.553 -  "\<Inter>S = (\<Inter>x\<in>S. x)"
   1.554 -  by (simp add: INTER_eq_Inter_image image_def)
   1.555 -
   1.556 -lemma INTER_def:
   1.557 -  "(\<Inter>x\<in>A. B x) = {y. \<forall>x\<in>A. y \<in> B x}"
   1.558 -  by (auto simp add: INTER_eq_Inter_image Inter_eq)
   1.559 -
   1.560 -lemma Inter_image_eq [simp]:
   1.561 -  "\<Inter>(B`A) = (\<Inter>x\<in>A. B x)"
   1.562 -  by (rule sym) (fact INTER_eq_Inter_image)
   1.563 -
   1.564 -lemma INT_iff [simp]: "(b: (INT x:A. B x)) = (ALL x:A. b: B x)"
   1.565 -  by (unfold INTER_def) blast
   1.566 -
   1.567 -lemma INT_I [intro!]: "(!!x. x:A ==> b: B x) ==> b : (INT x:A. B x)"
   1.568 -  by (unfold INTER_def) blast
   1.569 -
   1.570 -lemma INT_D [elim]: "b : (INT x:A. B x) ==> a:A ==> b: B a"
   1.571 -  by auto
   1.572 -
   1.573 -lemma INT_E [elim]: "b : (INT x:A. B x) ==> (b: B a ==> R) ==> (a~:A ==> R) ==> R"
   1.574 -  -- {* "Classical" elimination -- by the Excluded Middle on @{prop "a:A"}. *}
   1.575 -  by (unfold INTER_def) blast
   1.576 -
   1.577 -lemma INT_cong [cong]:
   1.578 -    "A = B ==> (!!x. x:B ==> C x = D x) ==> (INT x:A. C x) = (INT x:B. D x)"
   1.579 -  by (simp add: INTER_def)
   1.580 -
   1.581 -lemma Collect_ball_eq: "{x. \<forall>y\<in>A. P x y} = (\<Inter>y\<in>A. {x. P x y})"
   1.582 -  by blast
   1.583 -
   1.584 -lemma Collect_all_eq: "{x. \<forall>y. P x y} = (\<Inter>y. {x. P x y})"
   1.585 -  by blast
   1.586 -
   1.587 -lemma INT_lower: "a \<in> A ==> (\<Inter>x\<in>A. B x) \<subseteq> B a"
   1.588 -  by blast
   1.589 -
   1.590 -lemma INT_greatest: "(!!x. x \<in> A ==> C \<subseteq> B x) ==> C \<subseteq> (\<Inter>x\<in>A. B x)"
   1.591 -  by (iprover intro: INT_I subsetI dest: subsetD)
   1.592 -
   1.593 -lemma INT_empty [simp]: "(\<Inter>x\<in>{}. B x) = UNIV"
   1.594 -  by blast
   1.595 -
   1.596 -lemma INT_absorb: "k \<in> I ==> A k \<inter> (\<Inter>i\<in>I. A i) = (\<Inter>i\<in>I. A i)"
   1.597 -  by blast
   1.598 -
   1.599 -lemma INT_subset_iff: "(B \<subseteq> (\<Inter>i\<in>I. A i)) = (\<forall>i\<in>I. B \<subseteq> A i)"
   1.600 -  by blast
   1.601 -
   1.602 -lemma INT_insert [simp]: "(\<Inter>x \<in> insert a A. B x) = B a \<inter> INTER A B"
   1.603 -  by blast
   1.604 -
   1.605 -lemma INT_Un: "(\<Inter>i \<in> A \<union> B. M i) = (\<Inter>i \<in> A. M i) \<inter> (\<Inter>i\<in>B. M i)"
   1.606 -  by blast
   1.607 -
   1.608 -lemma INT_insert_distrib:
   1.609 -    "u \<in> A ==> (\<Inter>x\<in>A. insert a (B x)) = insert a (\<Inter>x\<in>A. B x)"
   1.610 -  by blast
   1.611 -
   1.612 -lemma INT_constant [simp]: "(\<Inter>y\<in>A. c) = (if A = {} then UNIV else c)"
   1.613 -  by auto
   1.614 -
   1.615 -lemma INT_eq: "(\<Inter>x\<in>A. B x) = \<Inter>({Y. \<exists>x\<in>A. Y = B x})"
   1.616 -  -- {* Look: it has an \emph{existential} quantifier *}
   1.617 -  by blast
   1.618 -
   1.619 -lemma INTER_UNIV_conv[simp]:
   1.620 - "(UNIV = (INT x:A. B x)) = (\<forall>x\<in>A. B x = UNIV)"
   1.621 - "((INT x:A. B x) = UNIV) = (\<forall>x\<in>A. B x = UNIV)"
   1.622 -by blast+
   1.623 -
   1.624 -lemma INT_bool_eq: "(\<Inter>b::bool. A b) = (A True \<inter> A False)"
   1.625 -  by (auto intro: bool_induct)
   1.626 -
   1.627 -lemma Pow_INT_eq: "Pow (\<Inter>x\<in>A. B x) = (\<Inter>x\<in>A. Pow (B x))"
   1.628 -  by blast
   1.629 -
   1.630 -lemma INT_anti_mono:
   1.631 -  "B \<subseteq> A ==> (!!x. x \<in> A ==> f x \<subseteq> g x) ==>
   1.632 -    (\<Inter>x\<in>A. f x) \<subseteq> (\<Inter>x\<in>A. g x)"
   1.633 -  -- {* The last inclusion is POSITIVE! *}
   1.634 -  by (blast dest: subsetD)
   1.635 -
   1.636 -lemma vimage_INT: "f-`(INT x:A. B x) = (INT x:A. f -` B x)"
   1.637 -  by blast
   1.638 -
   1.639 -
   1.640 -subsubsection {* Distributive laws *}
   1.641 -
   1.642 -lemma Int_Union: "A \<inter> \<Union>B = (\<Union>C\<in>B. A \<inter> C)"
   1.643 -  by blast
   1.644 -
   1.645 -lemma Int_Union2: "\<Union>B \<inter> A = (\<Union>C\<in>B. C \<inter> A)"
   1.646 -  by blast
   1.647 -
   1.648 -lemma Un_Union_image: "(\<Union>x\<in>C. A x \<union> B x) = \<Union>(A`C) \<union> \<Union>(B`C)"
   1.649 -  -- {* Devlin, Fundamentals of Contemporary Set Theory, page 12, exercise 5: *}
   1.650 -  -- {* Union of a family of unions *}
   1.651 -  by blast
   1.652 -
   1.653 -lemma UN_Un_distrib: "(\<Union>i\<in>I. A i \<union> B i) = (\<Union>i\<in>I. A i) \<union> (\<Union>i\<in>I. B i)"
   1.654 -  -- {* Equivalent version *}
   1.655 -  by blast
   1.656 -
   1.657 -lemma Un_Inter: "A \<union> \<Inter>B = (\<Inter>C\<in>B. A \<union> C)"
   1.658 -  by blast
   1.659 -
   1.660 -lemma Int_Inter_image: "(\<Inter>x\<in>C. A x \<inter> B x) = \<Inter>(A`C) \<inter> \<Inter>(B`C)"
   1.661 -  by blast
   1.662 -
   1.663 -lemma INT_Int_distrib: "(\<Inter>i\<in>I. A i \<inter> B i) = (\<Inter>i\<in>I. A i) \<inter> (\<Inter>i\<in>I. B i)"
   1.664 -  -- {* Equivalent version *}
   1.665 -  by blast
   1.666 -
   1.667 -lemma Int_UN_distrib: "B \<inter> (\<Union>i\<in>I. A i) = (\<Union>i\<in>I. B \<inter> A i)"
   1.668 -  -- {* Halmos, Naive Set Theory, page 35. *}
   1.669 -  by blast
   1.670 -
   1.671 -lemma Un_INT_distrib: "B \<union> (\<Inter>i\<in>I. A i) = (\<Inter>i\<in>I. B \<union> A i)"
   1.672 -  by blast
   1.673 -
   1.674 -lemma Int_UN_distrib2: "(\<Union>i\<in>I. A i) \<inter> (\<Union>j\<in>J. B j) = (\<Union>i\<in>I. \<Union>j\<in>J. A i \<inter> B j)"
   1.675 -  by blast
   1.676 -
   1.677 -lemma Un_INT_distrib2: "(\<Inter>i\<in>I. A i) \<union> (\<Inter>j\<in>J. B j) = (\<Inter>i\<in>I. \<Inter>j\<in>J. A i \<union> B j)"
   1.678 -  by blast
   1.679 -
   1.680 -
   1.681 -subsubsection {* Complement *}
   1.682 -
   1.683 -lemma Compl_UN [simp]: "-(\<Union>x\<in>A. B x) = (\<Inter>x\<in>A. -B x)"
   1.684 -  by blast
   1.685 -
   1.686 -lemma Compl_INT [simp]: "-(\<Inter>x\<in>A. B x) = (\<Union>x\<in>A. -B x)"
   1.687 -  by blast
   1.688 -
   1.689 -
   1.690 -subsubsection {* Miniscoping and maxiscoping *}
   1.691 -
   1.692 -text {* \medskip Miniscoping: pushing in quantifiers and big Unions
   1.693 -           and Intersections. *}
   1.694 -
   1.695 -lemma UN_simps [simp]:
   1.696 -  "!!a B C. (UN x:C. insert a (B x)) = (if C={} then {} else insert a (UN x:C. B x))"
   1.697 -  "!!A B C. (UN x:C. A x Un B)   = ((if C={} then {} else (UN x:C. A x) Un B))"
   1.698 -  "!!A B C. (UN x:C. A Un B x)   = ((if C={} then {} else A Un (UN x:C. B x)))"
   1.699 -  "!!A B C. (UN x:C. A x Int B)  = ((UN x:C. A x) Int B)"
   1.700 -  "!!A B C. (UN x:C. A Int B x)  = (A Int (UN x:C. B x))"
   1.701 -  "!!A B C. (UN x:C. A x - B)    = ((UN x:C. A x) - B)"
   1.702 -  "!!A B C. (UN x:C. A - B x)    = (A - (INT x:C. B x))"
   1.703 -  "!!A B. (UN x: Union A. B x) = (UN y:A. UN x:y. B x)"
   1.704 -  "!!A B C. (UN z: UNION A B. C z) = (UN  x:A. UN z: B(x). C z)"
   1.705 -  "!!A B f. (UN x:f`A. B x)     = (UN a:A. B (f a))"
   1.706 -  by auto
   1.707 -
   1.708 -lemma INT_simps [simp]:
   1.709 -  "!!A B C. (INT x:C. A x Int B) = (if C={} then UNIV else (INT x:C. A x) Int B)"
   1.710 -  "!!A B C. (INT x:C. A Int B x) = (if C={} then UNIV else A Int (INT x:C. B x))"
   1.711 -  "!!A B C. (INT x:C. A x - B)   = (if C={} then UNIV else (INT x:C. A x) - B)"
   1.712 -  "!!A B C. (INT x:C. A - B x)   = (if C={} then UNIV else A - (UN x:C. B x))"
   1.713 -  "!!a B C. (INT x:C. insert a (B x)) = insert a (INT x:C. B x)"
   1.714 -  "!!A B C. (INT x:C. A x Un B)  = ((INT x:C. A x) Un B)"
   1.715 -  "!!A B C. (INT x:C. A Un B x)  = (A Un (INT x:C. B x))"
   1.716 -  "!!A B. (INT x: Union A. B x) = (INT y:A. INT x:y. B x)"
   1.717 -  "!!A B C. (INT z: UNION A B. C z) = (INT x:A. INT z: B(x). C z)"
   1.718 -  "!!A B f. (INT x:f`A. B x)    = (INT a:A. B (f a))"
   1.719 -  by auto
   1.720 -
   1.721 -lemma ball_simps [simp,noatp]:
   1.722 -  "!!A P Q. (ALL x:A. P x | Q) = ((ALL x:A. P x) | Q)"
   1.723 -  "!!A P Q. (ALL x:A. P | Q x) = (P | (ALL x:A. Q x))"
   1.724 -  "!!A P Q. (ALL x:A. P --> Q x) = (P --> (ALL x:A. Q x))"
   1.725 -  "!!A P Q. (ALL x:A. P x --> Q) = ((EX x:A. P x) --> Q)"
   1.726 -  "!!P. (ALL x:{}. P x) = True"
   1.727 -  "!!P. (ALL x:UNIV. P x) = (ALL x. P x)"
   1.728 -  "!!a B P. (ALL x:insert a B. P x) = (P a & (ALL x:B. P x))"
   1.729 -  "!!A P. (ALL x:Union A. P x) = (ALL y:A. ALL x:y. P x)"
   1.730 -  "!!A B P. (ALL x: UNION A B. P x) = (ALL a:A. ALL x: B a. P x)"
   1.731 -  "!!P Q. (ALL x:Collect Q. P x) = (ALL x. Q x --> P x)"
   1.732 -  "!!A P f. (ALL x:f`A. P x) = (ALL x:A. P (f x))"
   1.733 -  "!!A P. (~(ALL x:A. P x)) = (EX x:A. ~P x)"
   1.734 -  by auto
   1.735 -
   1.736 -lemma bex_simps [simp,noatp]:
   1.737 -  "!!A P Q. (EX x:A. P x & Q) = ((EX x:A. P x) & Q)"
   1.738 -  "!!A P Q. (EX x:A. P & Q x) = (P & (EX x:A. Q x))"
   1.739 -  "!!P. (EX x:{}. P x) = False"
   1.740 -  "!!P. (EX x:UNIV. P x) = (EX x. P x)"
   1.741 -  "!!a B P. (EX x:insert a B. P x) = (P(a) | (EX x:B. P x))"
   1.742 -  "!!A P. (EX x:Union A. P x) = (EX y:A. EX x:y. P x)"
   1.743 -  "!!A B P. (EX x: UNION A B. P x) = (EX a:A. EX x:B a. P x)"
   1.744 -  "!!P Q. (EX x:Collect Q. P x) = (EX x. Q x & P x)"
   1.745 -  "!!A P f. (EX x:f`A. P x) = (EX x:A. P (f x))"
   1.746 -  "!!A P. (~(EX x:A. P x)) = (ALL x:A. ~P x)"
   1.747 -  by auto
   1.748 -
   1.749 -lemma ball_conj_distrib:
   1.750 -  "(ALL x:A. P x & Q x) = ((ALL x:A. P x) & (ALL x:A. Q x))"
   1.751 -  by blast
   1.752 -
   1.753 -lemma bex_disj_distrib:
   1.754 -  "(EX x:A. P x | Q x) = ((EX x:A. P x) | (EX x:A. Q x))"
   1.755 -  by blast
   1.756 -
   1.757 -
   1.758 -text {* \medskip Maxiscoping: pulling out big Unions and Intersections. *}
   1.759 -
   1.760 -lemma UN_extend_simps:
   1.761 -  "!!a B C. insert a (UN x:C. B x) = (if C={} then {a} else (UN x:C. insert a (B x)))"
   1.762 -  "!!A B C. (UN x:C. A x) Un B    = (if C={} then B else (UN x:C. A x Un B))"
   1.763 -  "!!A B C. A Un (UN x:C. B x)   = (if C={} then A else (UN x:C. A Un B x))"
   1.764 -  "!!A B C. ((UN x:C. A x) Int B) = (UN x:C. A x Int B)"
   1.765 -  "!!A B C. (A Int (UN x:C. B x)) = (UN x:C. A Int B x)"
   1.766 -  "!!A B C. ((UN x:C. A x) - B) = (UN x:C. A x - B)"
   1.767 -  "!!A B C. (A - (INT x:C. B x)) = (UN x:C. A - B x)"
   1.768 -  "!!A B. (UN y:A. UN x:y. B x) = (UN x: Union A. B x)"
   1.769 -  "!!A B C. (UN  x:A. UN z: B(x). C z) = (UN z: UNION A B. C z)"
   1.770 -  "!!A B f. (UN a:A. B (f a)) = (UN x:f`A. B x)"
   1.771 -  by auto
   1.772 -
   1.773 -lemma INT_extend_simps:
   1.774 -  "!!A B C. (INT x:C. A x) Int B = (if C={} then B else (INT x:C. A x Int B))"
   1.775 -  "!!A B C. A Int (INT x:C. B x) = (if C={} then A else (INT x:C. A Int B x))"
   1.776 -  "!!A B C. (INT x:C. A x) - B   = (if C={} then UNIV-B else (INT x:C. A x - B))"
   1.777 -  "!!A B C. A - (UN x:C. B x)   = (if C={} then A else (INT x:C. A - B x))"
   1.778 -  "!!a B C. insert a (INT x:C. B x) = (INT x:C. insert a (B x))"
   1.779 -  "!!A B C. ((INT x:C. A x) Un B)  = (INT x:C. A x Un B)"
   1.780 -  "!!A B C. A Un (INT x:C. B x)  = (INT x:C. A Un B x)"
   1.781 -  "!!A B. (INT y:A. INT x:y. B x) = (INT x: Union A. B x)"
   1.782 -  "!!A B C. (INT x:A. INT z: B(x). C z) = (INT z: UNION A B. C z)"
   1.783 -  "!!A B f. (INT a:A. B (f a))    = (INT x:f`A. B x)"
   1.784 -  by auto
   1.785 -
   1.786 -
   1.787 -no_notation
   1.788 -  less_eq  (infix "\<sqsubseteq>" 50) and
   1.789 -  less (infix "\<sqsubset>" 50) and
   1.790 -  inf  (infixl "\<sqinter>" 70) and
   1.791 -  sup  (infixl "\<squnion>" 65) and
   1.792 -  Inf  ("\<Sqinter>_" [900] 900) and
   1.793 -  Sup  ("\<Squnion>_" [900] 900)
   1.794 -
   1.795 -lemmas mem_simps =
   1.796 -  insert_iff empty_iff Un_iff Int_iff Compl_iff Diff_iff
   1.797 -  mem_Collect_eq UN_iff Union_iff INT_iff Inter_iff
   1.798 -  -- {* Each of these has ALREADY been added @{text "[simp]"} above. *}
   1.799 -
   1.800 -end