src/HOL/Complete_Lattice.thy
changeset 41082 9ff94e7cc3b3
parent 41080 294956ff285b
child 41971 a54e8e95fe96
     1.1 --- a/src/HOL/Complete_Lattice.thy	Wed Dec 08 14:52:23 2010 +0100
     1.2 +++ b/src/HOL/Complete_Lattice.thy	Wed Dec 08 15:05:46 2010 +0100
     1.3 @@ -82,21 +82,11 @@
     1.4    "\<Squnion>{a, b} = a \<squnion> b"
     1.5    by (simp add: Sup_empty Sup_insert)
     1.6  
     1.7 -lemma Sup_le_iff: "Sup A \<sqsubseteq> b \<longleftrightarrow> (\<forall>a\<in>A. a \<sqsubseteq> b)"
     1.8 -  by (auto intro: Sup_least dest: Sup_upper)
     1.9 -
    1.10  lemma le_Inf_iff: "b \<sqsubseteq> Inf A \<longleftrightarrow> (\<forall>a\<in>A. b \<sqsubseteq> a)"
    1.11    by (auto intro: Inf_greatest dest: Inf_lower)
    1.12  
    1.13 -lemma Sup_mono:
    1.14 -  assumes "\<And>a. a \<in> A \<Longrightarrow> \<exists>b\<in>B. a \<le> b"
    1.15 -  shows "Sup A \<le> Sup B"
    1.16 -proof (rule Sup_least)
    1.17 -  fix a assume "a \<in> A"
    1.18 -  with assms obtain b where "b \<in> B" and "a \<le> b" by blast
    1.19 -  from `b \<in> B` have "b \<le> Sup B" by (rule Sup_upper)
    1.20 -  with `a \<le> b` show "a \<le> Sup B" by auto
    1.21 -qed
    1.22 +lemma Sup_le_iff: "Sup A \<sqsubseteq> b \<longleftrightarrow> (\<forall>a\<in>A. a \<sqsubseteq> b)"
    1.23 +  by (auto intro: Sup_least dest: Sup_upper)
    1.24  
    1.25  lemma Inf_mono:
    1.26    assumes "\<And>b. b \<in> B \<Longrightarrow> \<exists>a\<in>A. a \<le> b"
    1.27 @@ -108,39 +98,49 @@
    1.28    with `a \<le> b` show "Inf A \<le> b" by auto
    1.29  qed
    1.30  
    1.31 -definition SUPR :: "'b set \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a" where
    1.32 -  "SUPR A f = \<Squnion> (f ` A)"
    1.33 +lemma Sup_mono:
    1.34 +  assumes "\<And>a. a \<in> A \<Longrightarrow> \<exists>b\<in>B. a \<le> b"
    1.35 +  shows "Sup A \<le> Sup B"
    1.36 +proof (rule Sup_least)
    1.37 +  fix a assume "a \<in> A"
    1.38 +  with assms obtain b where "b \<in> B" and "a \<le> b" by blast
    1.39 +  from `b \<in> B` have "b \<le> Sup B" by (rule Sup_upper)
    1.40 +  with `a \<le> b` show "a \<le> Sup B" by auto
    1.41 +qed
    1.42  
    1.43  definition INFI :: "'b set \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a" where
    1.44    "INFI A f = \<Sqinter> (f ` A)"
    1.45  
    1.46 +definition SUPR :: "'b set \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> 'a" where
    1.47 +  "SUPR A f = \<Squnion> (f ` A)"
    1.48 +
    1.49  end
    1.50  
    1.51  syntax
    1.52 +  "_INF1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3INF _./ _)" [0, 10] 10)
    1.53 +  "_INF"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3INF _:_./ _)" [0, 0, 10] 10)
    1.54    "_SUP1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3SUP _./ _)" [0, 10] 10)
    1.55    "_SUP"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3SUP _:_./ _)" [0, 0, 10] 10)
    1.56 -  "_INF1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3INF _./ _)" [0, 10] 10)
    1.57 -  "_INF"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3INF _:_./ _)" [0, 0, 10] 10)
    1.58  
    1.59  syntax (xsymbols)
    1.60 +  "_INF1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Sqinter>_./ _)" [0, 10] 10)
    1.61 +  "_INF"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Sqinter>_\<in>_./ _)" [0, 0, 10] 10)
    1.62    "_SUP1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Squnion>_./ _)" [0, 10] 10)
    1.63    "_SUP"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Squnion>_\<in>_./ _)" [0, 0, 10] 10)
    1.64 -  "_INF1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Sqinter>_./ _)" [0, 10] 10)
    1.65 -  "_INF"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Sqinter>_\<in>_./ _)" [0, 0, 10] 10)
    1.66  
    1.67  translations
    1.68 +  "INF x y. B"   == "INF x. INF y. B"
    1.69 +  "INF x. B"     == "CONST INFI CONST UNIV (%x. B)"
    1.70 +  "INF x. B"     == "INF x:CONST UNIV. B"
    1.71 +  "INF x:A. B"   == "CONST INFI A (%x. B)"
    1.72    "SUP x y. B"   == "SUP x. SUP y. B"
    1.73    "SUP x. B"     == "CONST SUPR CONST UNIV (%x. B)"
    1.74    "SUP x. B"     == "SUP x:CONST UNIV. B"
    1.75    "SUP x:A. B"   == "CONST SUPR A (%x. B)"
    1.76 -  "INF x y. B"   == "INF x. INF y. B"
    1.77 -  "INF x. B"     == "CONST INFI CONST UNIV (%x. B)"
    1.78 -  "INF x. B"     == "INF x:CONST UNIV. B"
    1.79 -  "INF x:A. B"   == "CONST INFI A (%x. B)"
    1.80  
    1.81  print_translation {*
    1.82 -  [Syntax.preserve_binder_abs2_tr' @{const_syntax SUPR} @{syntax_const "_SUP"},
    1.83 -    Syntax.preserve_binder_abs2_tr' @{const_syntax INFI} @{syntax_const "_INF"}]
    1.84 +  [Syntax.preserve_binder_abs2_tr' @{const_syntax INFI} @{syntax_const "_INF"},
    1.85 +    Syntax.preserve_binder_abs2_tr' @{const_syntax SUPR} @{syntax_const "_SUP"}]
    1.86  *} -- {* to avoid eta-contraction of body *}
    1.87  
    1.88  context complete_lattice
    1.89 @@ -164,54 +164,54 @@
    1.90  lemma le_INF_iff: "u \<sqsubseteq> (INF i:A. M i) \<longleftrightarrow> (\<forall>i \<in> A. u \<sqsubseteq> M i)"
    1.91    unfolding INFI_def by (auto simp add: le_Inf_iff)
    1.92  
    1.93 -lemma SUP_const[simp]: "A \<noteq> {} \<Longrightarrow> (SUP i:A. M) = M"
    1.94 -  by (auto intro: antisym SUP_leI le_SUPI)
    1.95 -
    1.96  lemma INF_const[simp]: "A \<noteq> {} \<Longrightarrow> (INF i:A. M) = M"
    1.97    by (auto intro: antisym INF_leI le_INFI)
    1.98  
    1.99 -lemma SUP_mono:
   1.100 -  "(\<And>n. n \<in> A \<Longrightarrow> \<exists>m\<in>B. f n \<le> g m) \<Longrightarrow> (SUP n:A. f n) \<le> (SUP n:B. g n)"
   1.101 -  by (force intro!: Sup_mono simp: SUPR_def)
   1.102 +lemma SUP_const[simp]: "A \<noteq> {} \<Longrightarrow> (SUP i:A. M) = M"
   1.103 +  by (auto intro: antisym SUP_leI le_SUPI)
   1.104  
   1.105  lemma INF_mono:
   1.106    "(\<And>m. m \<in> B \<Longrightarrow> \<exists>n\<in>A. f n \<le> g m) \<Longrightarrow> (INF n:A. f n) \<le> (INF n:B. g n)"
   1.107    by (force intro!: Inf_mono simp: INFI_def)
   1.108  
   1.109 -lemma SUP_subset:  "A \<subseteq> B \<Longrightarrow> SUPR A f \<le> SUPR B f"
   1.110 -  by (intro SUP_mono) auto
   1.111 +lemma SUP_mono:
   1.112 +  "(\<And>n. n \<in> A \<Longrightarrow> \<exists>m\<in>B. f n \<le> g m) \<Longrightarrow> (SUP n:A. f n) \<le> (SUP n:B. g n)"
   1.113 +  by (force intro!: Sup_mono simp: SUPR_def)
   1.114  
   1.115  lemma INF_subset:  "A \<subseteq> B \<Longrightarrow> INFI B f \<le> INFI A f"
   1.116    by (intro INF_mono) auto
   1.117  
   1.118 -lemma SUP_commute: "(SUP i:A. SUP j:B. f i j) = (SUP j:B. SUP i:A. f i j)"
   1.119 -  by (iprover intro: SUP_leI le_SUPI order_trans antisym)
   1.120 +lemma SUP_subset:  "A \<subseteq> B \<Longrightarrow> SUPR A f \<le> SUPR B f"
   1.121 +  by (intro SUP_mono) auto
   1.122  
   1.123  lemma INF_commute: "(INF i:A. INF j:B. f i j) = (INF j:B. INF i:A. f i j)"
   1.124    by (iprover intro: INF_leI le_INFI order_trans antisym)
   1.125  
   1.126 +lemma SUP_commute: "(SUP i:A. SUP j:B. f i j) = (SUP j:B. SUP i:A. f i j)"
   1.127 +  by (iprover intro: SUP_leI le_SUPI order_trans antisym)
   1.128 +
   1.129  end
   1.130  
   1.131 +lemma Inf_less_iff:
   1.132 +  fixes a :: "'a\<Colon>{complete_lattice,linorder}"
   1.133 +  shows "Inf S < a \<longleftrightarrow> (\<exists>x\<in>S. x < a)"
   1.134 +  unfolding not_le[symmetric] le_Inf_iff by auto
   1.135 +
   1.136  lemma less_Sup_iff:
   1.137    fixes a :: "'a\<Colon>{complete_lattice,linorder}"
   1.138    shows "a < Sup S \<longleftrightarrow> (\<exists>x\<in>S. a < x)"
   1.139    unfolding not_le[symmetric] Sup_le_iff by auto
   1.140  
   1.141 -lemma Inf_less_iff:
   1.142 -  fixes a :: "'a\<Colon>{complete_lattice,linorder}"
   1.143 -  shows "Inf S < a \<longleftrightarrow> (\<exists>x\<in>S. x < a)"
   1.144 -  unfolding not_le[symmetric] le_Inf_iff by auto
   1.145 +lemma INF_less_iff:
   1.146 +  fixes a :: "'a::{complete_lattice,linorder}"
   1.147 +  shows "(INF i:A. f i) < a \<longleftrightarrow> (\<exists>x\<in>A. f x < a)"
   1.148 +  unfolding INFI_def Inf_less_iff by auto
   1.149  
   1.150  lemma less_SUP_iff:
   1.151    fixes a :: "'a::{complete_lattice,linorder}"
   1.152    shows "a < (SUP i:A. f i) \<longleftrightarrow> (\<exists>x\<in>A. a < f x)"
   1.153    unfolding SUPR_def less_Sup_iff by auto
   1.154  
   1.155 -lemma INF_less_iff:
   1.156 -  fixes a :: "'a::{complete_lattice,linorder}"
   1.157 -  shows "(INF i:A. f i) < a \<longleftrightarrow> (\<exists>x\<in>A. f x < a)"
   1.158 -  unfolding INFI_def Inf_less_iff by auto
   1.159 -
   1.160  subsection {* @{typ bool} and @{typ "_ \<Rightarrow> _"} as complete lattice *}
   1.161  
   1.162  instantiation bool :: complete_lattice
   1.163 @@ -278,6 +278,200 @@
   1.164    by (auto intro: arg_cong [of _ _ Sup] simp add: SUPR_def Sup_apply)
   1.165  
   1.166  
   1.167 +subsection {* Inter *}
   1.168 +
   1.169 +abbreviation Inter :: "'a set set \<Rightarrow> 'a set" where
   1.170 +  "Inter S \<equiv> \<Sqinter>S"
   1.171 +  
   1.172 +notation (xsymbols)
   1.173 +  Inter  ("\<Inter>_" [90] 90)
   1.174 +
   1.175 +lemma Inter_eq:
   1.176 +  "\<Inter>A = {x. \<forall>B \<in> A. x \<in> B}"
   1.177 +proof (rule set_eqI)
   1.178 +  fix x
   1.179 +  have "(\<forall>Q\<in>{P. \<exists>B\<in>A. P \<longleftrightarrow> x \<in> B}. Q) \<longleftrightarrow> (\<forall>B\<in>A. x \<in> B)"
   1.180 +    by auto
   1.181 +  then show "x \<in> \<Inter>A \<longleftrightarrow> x \<in> {x. \<forall>B \<in> A. x \<in> B}"
   1.182 +    by (simp add: Inf_fun_def Inf_bool_def) (simp add: mem_def)
   1.183 +qed
   1.184 +
   1.185 +lemma Inter_iff [simp,no_atp]: "(A : Inter C) = (ALL X:C. A:X)"
   1.186 +  by (unfold Inter_eq) blast
   1.187 +
   1.188 +lemma InterI [intro!]: "(!!X. X:C ==> A:X) ==> A : Inter C"
   1.189 +  by (simp add: Inter_eq)
   1.190 +
   1.191 +text {*
   1.192 +  \medskip A ``destruct'' rule -- every @{term X} in @{term C}
   1.193 +  contains @{term A} as an element, but @{prop "A:X"} can hold when
   1.194 +  @{prop "X:C"} does not!  This rule is analogous to @{text spec}.
   1.195 +*}
   1.196 +
   1.197 +lemma InterD [elim, Pure.elim]: "A : Inter C ==> X:C ==> A:X"
   1.198 +  by auto
   1.199 +
   1.200 +lemma InterE [elim]: "A : Inter C ==> (X~:C ==> R) ==> (A:X ==> R) ==> R"
   1.201 +  -- {* ``Classical'' elimination rule -- does not require proving
   1.202 +    @{prop "X:C"}. *}
   1.203 +  by (unfold Inter_eq) blast
   1.204 +
   1.205 +lemma Inter_lower: "B \<in> A ==> Inter A \<subseteq> B"
   1.206 +  by blast
   1.207 +
   1.208 +lemma Inter_subset:
   1.209 +  "[| !!X. X \<in> A ==> X \<subseteq> B; A ~= {} |] ==> \<Inter>A \<subseteq> B"
   1.210 +  by blast
   1.211 +
   1.212 +lemma Inter_greatest: "(!!X. X \<in> A ==> C \<subseteq> X) ==> C \<subseteq> Inter A"
   1.213 +  by (iprover intro: InterI subsetI dest: subsetD)
   1.214 +
   1.215 +lemma Int_eq_Inter: "A \<inter> B = \<Inter>{A, B}"
   1.216 +  by blast
   1.217 +
   1.218 +lemma Inter_empty [simp]: "\<Inter>{} = UNIV"
   1.219 +  by (fact Inf_empty)
   1.220 +
   1.221 +lemma Inter_UNIV [simp]: "\<Inter>UNIV = {}"
   1.222 +  by blast
   1.223 +
   1.224 +lemma Inter_insert [simp]: "\<Inter>(insert a B) = a \<inter> \<Inter>B"
   1.225 +  by blast
   1.226 +
   1.227 +lemma Inter_Un_subset: "\<Inter>A \<union> \<Inter>B \<subseteq> \<Inter>(A \<inter> B)"
   1.228 +  by blast
   1.229 +
   1.230 +lemma Inter_Un_distrib: "\<Inter>(A \<union> B) = \<Inter>A \<inter> \<Inter>B"
   1.231 +  by blast
   1.232 +
   1.233 +lemma Inter_UNIV_conv [simp,no_atp]:
   1.234 +  "(\<Inter>A = UNIV) = (\<forall>x\<in>A. x = UNIV)"
   1.235 +  "(UNIV = \<Inter>A) = (\<forall>x\<in>A. x = UNIV)"
   1.236 +  by blast+
   1.237 +
   1.238 +lemma Inter_anti_mono: "B \<subseteq> A ==> \<Inter>A \<subseteq> \<Inter>B"
   1.239 +  by blast
   1.240 +
   1.241 +
   1.242 +subsection {* Intersections of families *}
   1.243 +
   1.244 +abbreviation INTER :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where
   1.245 +  "INTER \<equiv> INFI"
   1.246 +
   1.247 +syntax
   1.248 +  "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3INT _./ _)" [0, 10] 10)
   1.249 +  "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3INT _:_./ _)" [0, 0, 10] 10)
   1.250 +
   1.251 +syntax (xsymbols)
   1.252 +  "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>_./ _)" [0, 10] 10)
   1.253 +  "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Inter>_\<in>_./ _)" [0, 0, 10] 10)
   1.254 +
   1.255 +syntax (latex output)
   1.256 +  "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>(00\<^bsub>_\<^esub>)/ _)" [0, 10] 10)
   1.257 +  "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Inter>(00\<^bsub>_\<in>_\<^esub>)/ _)" [0, 0, 10] 10)
   1.258 +
   1.259 +translations
   1.260 +  "INT x y. B"  == "INT x. INT y. B"
   1.261 +  "INT x. B"    == "CONST INTER CONST UNIV (%x. B)"
   1.262 +  "INT x. B"    == "INT x:CONST UNIV. B"
   1.263 +  "INT x:A. B"  == "CONST INTER A (%x. B)"
   1.264 +
   1.265 +print_translation {*
   1.266 +  [Syntax.preserve_binder_abs2_tr' @{const_syntax INTER} @{syntax_const "_INTER"}]
   1.267 +*} -- {* to avoid eta-contraction of body *}
   1.268 +
   1.269 +lemma INTER_eq_Inter_image:
   1.270 +  "(\<Inter>x\<in>A. B x) = \<Inter>(B`A)"
   1.271 +  by (fact INFI_def)
   1.272 +  
   1.273 +lemma Inter_def:
   1.274 +  "\<Inter>S = (\<Inter>x\<in>S. x)"
   1.275 +  by (simp add: INTER_eq_Inter_image image_def)
   1.276 +
   1.277 +lemma INTER_def:
   1.278 +  "(\<Inter>x\<in>A. B x) = {y. \<forall>x\<in>A. y \<in> B x}"
   1.279 +  by (auto simp add: INTER_eq_Inter_image Inter_eq)
   1.280 +
   1.281 +lemma Inter_image_eq [simp]:
   1.282 +  "\<Inter>(B`A) = (\<Inter>x\<in>A. B x)"
   1.283 +  by (rule sym) (fact INTER_eq_Inter_image)
   1.284 +
   1.285 +lemma INT_iff [simp]: "(b: (INT x:A. B x)) = (ALL x:A. b: B x)"
   1.286 +  by (unfold INTER_def) blast
   1.287 +
   1.288 +lemma INT_I [intro!]: "(!!x. x:A ==> b: B x) ==> b : (INT x:A. B x)"
   1.289 +  by (unfold INTER_def) blast
   1.290 +
   1.291 +lemma INT_D [elim, Pure.elim]: "b : (INT x:A. B x) ==> a:A ==> b: B a"
   1.292 +  by auto
   1.293 +
   1.294 +lemma INT_E [elim]: "b : (INT x:A. B x) ==> (b: B a ==> R) ==> (a~:A ==> R) ==> R"
   1.295 +  -- {* "Classical" elimination -- by the Excluded Middle on @{prop "a:A"}. *}
   1.296 +  by (unfold INTER_def) blast
   1.297 +
   1.298 +lemma INT_cong [cong]:
   1.299 +    "A = B ==> (!!x. x:B ==> C x = D x) ==> (INT x:A. C x) = (INT x:B. D x)"
   1.300 +  by (simp add: INTER_def)
   1.301 +
   1.302 +lemma Collect_ball_eq: "{x. \<forall>y\<in>A. P x y} = (\<Inter>y\<in>A. {x. P x y})"
   1.303 +  by blast
   1.304 +
   1.305 +lemma Collect_all_eq: "{x. \<forall>y. P x y} = (\<Inter>y. {x. P x y})"
   1.306 +  by blast
   1.307 +
   1.308 +lemma INT_lower: "a \<in> A ==> (\<Inter>x\<in>A. B x) \<subseteq> B a"
   1.309 +  by (fact INF_leI)
   1.310 +
   1.311 +lemma INT_greatest: "(!!x. x \<in> A ==> C \<subseteq> B x) ==> C \<subseteq> (\<Inter>x\<in>A. B x)"
   1.312 +  by (fact le_INFI)
   1.313 +
   1.314 +lemma INT_empty [simp]: "(\<Inter>x\<in>{}. B x) = UNIV"
   1.315 +  by blast
   1.316 +
   1.317 +lemma INT_absorb: "k \<in> I ==> A k \<inter> (\<Inter>i\<in>I. A i) = (\<Inter>i\<in>I. A i)"
   1.318 +  by blast
   1.319 +
   1.320 +lemma INT_subset_iff: "(B \<subseteq> (\<Inter>i\<in>I. A i)) = (\<forall>i\<in>I. B \<subseteq> A i)"
   1.321 +  by (fact le_INF_iff)
   1.322 +
   1.323 +lemma INT_insert [simp]: "(\<Inter>x \<in> insert a A. B x) = B a \<inter> INTER A B"
   1.324 +  by blast
   1.325 +
   1.326 +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.327 +  by blast
   1.328 +
   1.329 +lemma INT_insert_distrib:
   1.330 +    "u \<in> A ==> (\<Inter>x\<in>A. insert a (B x)) = insert a (\<Inter>x\<in>A. B x)"
   1.331 +  by blast
   1.332 +
   1.333 +lemma INT_constant [simp]: "(\<Inter>y\<in>A. c) = (if A = {} then UNIV else c)"
   1.334 +  by auto
   1.335 +
   1.336 +lemma INT_eq: "(\<Inter>x\<in>A. B x) = \<Inter>({Y. \<exists>x\<in>A. Y = B x})"
   1.337 +  -- {* Look: it has an \emph{existential} quantifier *}
   1.338 +  by blast
   1.339 +
   1.340 +lemma INTER_UNIV_conv[simp]:
   1.341 + "(UNIV = (INT x:A. B x)) = (\<forall>x\<in>A. B x = UNIV)"
   1.342 + "((INT x:A. B x) = UNIV) = (\<forall>x\<in>A. B x = UNIV)"
   1.343 +by blast+
   1.344 +
   1.345 +lemma INT_bool_eq: "(\<Inter>b::bool. A b) = (A True \<inter> A False)"
   1.346 +  by (auto intro: bool_induct)
   1.347 +
   1.348 +lemma Pow_INT_eq: "Pow (\<Inter>x\<in>A. B x) = (\<Inter>x\<in>A. Pow (B x))"
   1.349 +  by blast
   1.350 +
   1.351 +lemma INT_anti_mono:
   1.352 +  "B \<subseteq> A ==> (!!x. x \<in> A ==> f x \<subseteq> g x) ==>
   1.353 +    (\<Inter>x\<in>A. f x) \<subseteq> (\<Inter>x\<in>A. g x)"
   1.354 +  -- {* The last inclusion is POSITIVE! *}
   1.355 +  by (blast dest: subsetD)
   1.356 +
   1.357 +lemma vimage_INT: "f-`(INT x:A. B x) = (INT x:A. f -` B x)"
   1.358 +  by blast
   1.359 +
   1.360 +
   1.361  subsection {* Union *}
   1.362  
   1.363  abbreviation Union :: "'a set set \<Rightarrow> 'a set" where
   1.364 @@ -514,200 +708,6 @@
   1.365  by blast
   1.366  
   1.367  
   1.368 -subsection {* Inter *}
   1.369 -
   1.370 -abbreviation Inter :: "'a set set \<Rightarrow> 'a set" where
   1.371 -  "Inter S \<equiv> \<Sqinter>S"
   1.372 -  
   1.373 -notation (xsymbols)
   1.374 -  Inter  ("\<Inter>_" [90] 90)
   1.375 -
   1.376 -lemma Inter_eq:
   1.377 -  "\<Inter>A = {x. \<forall>B \<in> A. x \<in> B}"
   1.378 -proof (rule set_eqI)
   1.379 -  fix x
   1.380 -  have "(\<forall>Q\<in>{P. \<exists>B\<in>A. P \<longleftrightarrow> x \<in> B}. Q) \<longleftrightarrow> (\<forall>B\<in>A. x \<in> B)"
   1.381 -    by auto
   1.382 -  then show "x \<in> \<Inter>A \<longleftrightarrow> x \<in> {x. \<forall>B \<in> A. x \<in> B}"
   1.383 -    by (simp add: Inf_fun_def Inf_bool_def) (simp add: mem_def)
   1.384 -qed
   1.385 -
   1.386 -lemma Inter_iff [simp,no_atp]: "(A : Inter C) = (ALL X:C. A:X)"
   1.387 -  by (unfold Inter_eq) blast
   1.388 -
   1.389 -lemma InterI [intro!]: "(!!X. X:C ==> A:X) ==> A : Inter C"
   1.390 -  by (simp add: Inter_eq)
   1.391 -
   1.392 -text {*
   1.393 -  \medskip A ``destruct'' rule -- every @{term X} in @{term C}
   1.394 -  contains @{term A} as an element, but @{prop "A:X"} can hold when
   1.395 -  @{prop "X:C"} does not!  This rule is analogous to @{text spec}.
   1.396 -*}
   1.397 -
   1.398 -lemma InterD [elim, Pure.elim]: "A : Inter C ==> X:C ==> A:X"
   1.399 -  by auto
   1.400 -
   1.401 -lemma InterE [elim]: "A : Inter C ==> (X~:C ==> R) ==> (A:X ==> R) ==> R"
   1.402 -  -- {* ``Classical'' elimination rule -- does not require proving
   1.403 -    @{prop "X:C"}. *}
   1.404 -  by (unfold Inter_eq) blast
   1.405 -
   1.406 -lemma Inter_lower: "B \<in> A ==> Inter A \<subseteq> B"
   1.407 -  by blast
   1.408 -
   1.409 -lemma Inter_subset:
   1.410 -  "[| !!X. X \<in> A ==> X \<subseteq> B; A ~= {} |] ==> \<Inter>A \<subseteq> B"
   1.411 -  by blast
   1.412 -
   1.413 -lemma Inter_greatest: "(!!X. X \<in> A ==> C \<subseteq> X) ==> C \<subseteq> Inter A"
   1.414 -  by (iprover intro: InterI subsetI dest: subsetD)
   1.415 -
   1.416 -lemma Int_eq_Inter: "A \<inter> B = \<Inter>{A, B}"
   1.417 -  by blast
   1.418 -
   1.419 -lemma Inter_empty [simp]: "\<Inter>{} = UNIV"
   1.420 -  by (fact Inf_empty)
   1.421 -
   1.422 -lemma Inter_UNIV [simp]: "\<Inter>UNIV = {}"
   1.423 -  by blast
   1.424 -
   1.425 -lemma Inter_insert [simp]: "\<Inter>(insert a B) = a \<inter> \<Inter>B"
   1.426 -  by blast
   1.427 -
   1.428 -lemma Inter_Un_subset: "\<Inter>A \<union> \<Inter>B \<subseteq> \<Inter>(A \<inter> B)"
   1.429 -  by blast
   1.430 -
   1.431 -lemma Inter_Un_distrib: "\<Inter>(A \<union> B) = \<Inter>A \<inter> \<Inter>B"
   1.432 -  by blast
   1.433 -
   1.434 -lemma Inter_UNIV_conv [simp,no_atp]:
   1.435 -  "(\<Inter>A = UNIV) = (\<forall>x\<in>A. x = UNIV)"
   1.436 -  "(UNIV = \<Inter>A) = (\<forall>x\<in>A. x = UNIV)"
   1.437 -  by blast+
   1.438 -
   1.439 -lemma Inter_anti_mono: "B \<subseteq> A ==> \<Inter>A \<subseteq> \<Inter>B"
   1.440 -  by blast
   1.441 -
   1.442 -
   1.443 -subsection {* Intersections of families *}
   1.444 -
   1.445 -abbreviation INTER :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where
   1.446 -  "INTER \<equiv> INFI"
   1.447 -
   1.448 -syntax
   1.449 -  "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3INT _./ _)" [0, 10] 10)
   1.450 -  "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3INT _:_./ _)" [0, 0, 10] 10)
   1.451 -
   1.452 -syntax (xsymbols)
   1.453 -  "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>_./ _)" [0, 10] 10)
   1.454 -  "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Inter>_\<in>_./ _)" [0, 0, 10] 10)
   1.455 -
   1.456 -syntax (latex output)
   1.457 -  "_INTER1"     :: "pttrns => 'b set => 'b set"           ("(3\<Inter>(00\<^bsub>_\<^esub>)/ _)" [0, 10] 10)
   1.458 -  "_INTER"      :: "pttrn => 'a set => 'b set => 'b set"  ("(3\<Inter>(00\<^bsub>_\<in>_\<^esub>)/ _)" [0, 0, 10] 10)
   1.459 -
   1.460 -translations
   1.461 -  "INT x y. B"  == "INT x. INT y. B"
   1.462 -  "INT x. B"    == "CONST INTER CONST UNIV (%x. B)"
   1.463 -  "INT x. B"    == "INT x:CONST UNIV. B"
   1.464 -  "INT x:A. B"  == "CONST INTER A (%x. B)"
   1.465 -
   1.466 -print_translation {*
   1.467 -  [Syntax.preserve_binder_abs2_tr' @{const_syntax INTER} @{syntax_const "_INTER"}]
   1.468 -*} -- {* to avoid eta-contraction of body *}
   1.469 -
   1.470 -lemma INTER_eq_Inter_image:
   1.471 -  "(\<Inter>x\<in>A. B x) = \<Inter>(B`A)"
   1.472 -  by (fact INFI_def)
   1.473 -  
   1.474 -lemma Inter_def:
   1.475 -  "\<Inter>S = (\<Inter>x\<in>S. x)"
   1.476 -  by (simp add: INTER_eq_Inter_image image_def)
   1.477 -
   1.478 -lemma INTER_def:
   1.479 -  "(\<Inter>x\<in>A. B x) = {y. \<forall>x\<in>A. y \<in> B x}"
   1.480 -  by (auto simp add: INTER_eq_Inter_image Inter_eq)
   1.481 -
   1.482 -lemma Inter_image_eq [simp]:
   1.483 -  "\<Inter>(B`A) = (\<Inter>x\<in>A. B x)"
   1.484 -  by (rule sym) (fact INTER_eq_Inter_image)
   1.485 -
   1.486 -lemma INT_iff [simp]: "(b: (INT x:A. B x)) = (ALL x:A. b: B x)"
   1.487 -  by (unfold INTER_def) blast
   1.488 -
   1.489 -lemma INT_I [intro!]: "(!!x. x:A ==> b: B x) ==> b : (INT x:A. B x)"
   1.490 -  by (unfold INTER_def) blast
   1.491 -
   1.492 -lemma INT_D [elim, Pure.elim]: "b : (INT x:A. B x) ==> a:A ==> b: B a"
   1.493 -  by auto
   1.494 -
   1.495 -lemma INT_E [elim]: "b : (INT x:A. B x) ==> (b: B a ==> R) ==> (a~:A ==> R) ==> R"
   1.496 -  -- {* "Classical" elimination -- by the Excluded Middle on @{prop "a:A"}. *}
   1.497 -  by (unfold INTER_def) blast
   1.498 -
   1.499 -lemma INT_cong [cong]:
   1.500 -    "A = B ==> (!!x. x:B ==> C x = D x) ==> (INT x:A. C x) = (INT x:B. D x)"
   1.501 -  by (simp add: INTER_def)
   1.502 -
   1.503 -lemma Collect_ball_eq: "{x. \<forall>y\<in>A. P x y} = (\<Inter>y\<in>A. {x. P x y})"
   1.504 -  by blast
   1.505 -
   1.506 -lemma Collect_all_eq: "{x. \<forall>y. P x y} = (\<Inter>y. {x. P x y})"
   1.507 -  by blast
   1.508 -
   1.509 -lemma INT_lower: "a \<in> A ==> (\<Inter>x\<in>A. B x) \<subseteq> B a"
   1.510 -  by (fact INF_leI)
   1.511 -
   1.512 -lemma INT_greatest: "(!!x. x \<in> A ==> C \<subseteq> B x) ==> C \<subseteq> (\<Inter>x\<in>A. B x)"
   1.513 -  by (fact le_INFI)
   1.514 -
   1.515 -lemma INT_empty [simp]: "(\<Inter>x\<in>{}. B x) = UNIV"
   1.516 -  by blast
   1.517 -
   1.518 -lemma INT_absorb: "k \<in> I ==> A k \<inter> (\<Inter>i\<in>I. A i) = (\<Inter>i\<in>I. A i)"
   1.519 -  by blast
   1.520 -
   1.521 -lemma INT_subset_iff: "(B \<subseteq> (\<Inter>i\<in>I. A i)) = (\<forall>i\<in>I. B \<subseteq> A i)"
   1.522 -  by (fact le_INF_iff)
   1.523 -
   1.524 -lemma INT_insert [simp]: "(\<Inter>x \<in> insert a A. B x) = B a \<inter> INTER A B"
   1.525 -  by blast
   1.526 -
   1.527 -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.528 -  by blast
   1.529 -
   1.530 -lemma INT_insert_distrib:
   1.531 -    "u \<in> A ==> (\<Inter>x\<in>A. insert a (B x)) = insert a (\<Inter>x\<in>A. B x)"
   1.532 -  by blast
   1.533 -
   1.534 -lemma INT_constant [simp]: "(\<Inter>y\<in>A. c) = (if A = {} then UNIV else c)"
   1.535 -  by auto
   1.536 -
   1.537 -lemma INT_eq: "(\<Inter>x\<in>A. B x) = \<Inter>({Y. \<exists>x\<in>A. Y = B x})"
   1.538 -  -- {* Look: it has an \emph{existential} quantifier *}
   1.539 -  by blast
   1.540 -
   1.541 -lemma INTER_UNIV_conv[simp]:
   1.542 - "(UNIV = (INT x:A. B x)) = (\<forall>x\<in>A. B x = UNIV)"
   1.543 - "((INT x:A. B x) = UNIV) = (\<forall>x\<in>A. B x = UNIV)"
   1.544 -by blast+
   1.545 -
   1.546 -lemma INT_bool_eq: "(\<Inter>b::bool. A b) = (A True \<inter> A False)"
   1.547 -  by (auto intro: bool_induct)
   1.548 -
   1.549 -lemma Pow_INT_eq: "Pow (\<Inter>x\<in>A. B x) = (\<Inter>x\<in>A. Pow (B x))"
   1.550 -  by blast
   1.551 -
   1.552 -lemma INT_anti_mono:
   1.553 -  "B \<subseteq> A ==> (!!x. x \<in> A ==> f x \<subseteq> g x) ==>
   1.554 -    (\<Inter>x\<in>A. f x) \<subseteq> (\<Inter>x\<in>A. g x)"
   1.555 -  -- {* The last inclusion is POSITIVE! *}
   1.556 -  by (blast dest: subsetD)
   1.557 -
   1.558 -lemma vimage_INT: "f-`(INT x:A. B x) = (INT x:A. f -` B x)"
   1.559 -  by blast
   1.560 -
   1.561 -
   1.562  subsection {* Distributive laws *}
   1.563  
   1.564  lemma Int_Union: "A \<inter> \<Union>B = (\<Union>C\<in>B. A \<inter> C)"
   1.565 @@ -858,18 +858,18 @@
   1.566  no_notation
   1.567    less_eq  (infix "\<sqsubseteq>" 50) and
   1.568    less (infix "\<sqsubset>" 50) and
   1.569 +  bot ("\<bottom>") and
   1.570 +  top ("\<top>") and
   1.571    inf  (infixl "\<sqinter>" 70) and
   1.572    sup  (infixl "\<squnion>" 65) and
   1.573    Inf  ("\<Sqinter>_" [900] 900) and
   1.574 -  Sup  ("\<Squnion>_" [900] 900) and
   1.575 -  top ("\<top>") and
   1.576 -  bot ("\<bottom>")
   1.577 +  Sup  ("\<Squnion>_" [900] 900)
   1.578  
   1.579  no_syntax (xsymbols)
   1.580 +  "_INF1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Sqinter>_./ _)" [0, 10] 10)
   1.581 +  "_INF"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Sqinter>_\<in>_./ _)" [0, 0, 10] 10)
   1.582    "_SUP1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Squnion>_./ _)" [0, 10] 10)
   1.583    "_SUP"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Squnion>_\<in>_./ _)" [0, 0, 10] 10)
   1.584 -  "_INF1"     :: "pttrns \<Rightarrow> 'b \<Rightarrow> 'b"           ("(3\<Sqinter>_./ _)" [0, 10] 10)
   1.585 -  "_INF"      :: "pttrn \<Rightarrow> 'a set \<Rightarrow> 'b \<Rightarrow> 'b"  ("(3\<Sqinter>_\<in>_./ _)" [0, 0, 10] 10)
   1.586  
   1.587  lemmas mem_simps =
   1.588    insert_iff empty_iff Un_iff Int_iff Compl_iff Diff_iff