src/HOL/Complete_Lattice.thy
changeset 43865 db18f4d0cc7d
parent 43854 f1d23df1adde
child 43866 8a50dc70cbff
     1.1 --- a/src/HOL/Complete_Lattice.thy	Sun Jul 17 08:45:06 2011 +0200
     1.2 +++ b/src/HOL/Complete_Lattice.thy	Sun Jul 17 15:15:58 2011 +0200
     1.3 @@ -152,66 +152,74 @@
     1.4  context complete_lattice
     1.5  begin
     1.6  
     1.7 -lemma SUP_cong: "(\<And>x. x \<in> A \<Longrightarrow> f x = g x) \<Longrightarrow> SUPR A f = SUPR A g"
     1.8 -  by (simp add: SUPR_def cong: image_cong)
     1.9 -
    1.10 -lemma INF_cong: "(\<And>x. x \<in> A \<Longrightarrow> f x = g x) \<Longrightarrow> INFI A f = INFI A g"
    1.11 -  by (simp add: INFI_def cong: image_cong)
    1.12 +lemma INF_empty: "(\<Sqinter>x\<in>{}. f x) = \<top>"
    1.13 +  by (simp add: INFI_def)
    1.14  
    1.15 -lemma le_SUPI: "i \<in> A \<Longrightarrow> M i \<sqsubseteq> (\<Squnion>i\<in>A. M i)"
    1.16 -  by (auto simp add: SUPR_def intro: Sup_upper)
    1.17 +lemma INF_insert: "(\<Sqinter>x\<in>insert a A. f x) = f a \<sqinter> INFI A f"
    1.18 +  by (simp add: INFI_def Inf_insert)
    1.19  
    1.20 -lemma le_SUPI2: "i \<in> A \<Longrightarrow> u \<sqsubseteq> M i \<Longrightarrow> u \<sqsubseteq> (\<Squnion>i\<in>A. M i)"
    1.21 -  using le_SUPI[of i A M] by auto
    1.22 -
    1.23 -lemma SUP_leI: "(\<And>i. i \<in> A \<Longrightarrow> M i \<sqsubseteq> u) \<Longrightarrow> (\<Squnion>i\<in>A. M i) \<sqsubseteq> u"
    1.24 -  by (auto simp add: SUPR_def intro: Sup_least)
    1.25 -
    1.26 -lemma INF_leI: "i \<in> A \<Longrightarrow> (\<Sqinter>i\<in>A. M i) \<sqsubseteq> M i"
    1.27 +lemma INF_leI: "i \<in> A \<Longrightarrow> (\<Sqinter>i\<in>A. f i) \<sqsubseteq> f i"
    1.28    by (auto simp add: INFI_def intro: Inf_lower)
    1.29  
    1.30 -lemma INF_leI2: "i \<in> A \<Longrightarrow> M i \<sqsubseteq> u \<Longrightarrow> (\<Sqinter>i\<in>A. M i) \<sqsubseteq> u"
    1.31 -  using INF_leI[of i A M] by auto
    1.32 +lemma INF_leI2: "i \<in> A \<Longrightarrow> f i \<sqsubseteq> u \<Longrightarrow> (\<Sqinter>i\<in>A. f i) \<sqsubseteq> u"
    1.33 +  using INF_leI [of i A f] by auto
    1.34  
    1.35 -lemma le_INFI: "(\<And>i. i \<in> A \<Longrightarrow> u \<sqsubseteq> M i) \<Longrightarrow> u \<sqsubseteq> (\<Sqinter>i\<in>A. M i)"
    1.36 +lemma le_INFI: "(\<And>i. i \<in> A \<Longrightarrow> u \<sqsubseteq> f i) \<Longrightarrow> u \<sqsubseteq> (\<Sqinter>i\<in>A. f i)"
    1.37    by (auto simp add: INFI_def intro: Inf_greatest)
    1.38  
    1.39 -lemma SUP_le_iff: "(\<Squnion>i\<in>A. M i) \<sqsubseteq> u \<longleftrightarrow> (\<forall>i \<in> A. M i \<sqsubseteq> u)"
    1.40 -  unfolding SUPR_def by (auto simp add: Sup_le_iff)
    1.41 +lemma le_INF_iff: "u \<sqsubseteq> (\<Sqinter>i\<in>A. f i) \<longleftrightarrow> (\<forall>i \<in> A. u \<sqsubseteq> f i)"
    1.42 +  by (auto simp add: INFI_def le_Inf_iff)
    1.43  
    1.44 -lemma le_INF_iff: "u \<sqsubseteq> (\<Sqinter>i\<in>A. M i) \<longleftrightarrow> (\<forall>i \<in> A. u \<sqsubseteq> M i)"
    1.45 -  unfolding INFI_def by (auto simp add: le_Inf_iff)
    1.46 -
    1.47 -lemma INF_const[simp]: "A \<noteq> {} \<Longrightarrow> (\<Sqinter>i\<in>A. M) = M"
    1.48 +lemma INF_const [simp]: "A \<noteq> {} \<Longrightarrow> (\<Sqinter>i\<in>A. f) = f"
    1.49    by (auto intro: antisym INF_leI le_INFI)
    1.50  
    1.51 -lemma SUP_const[simp]: "A \<noteq> {} \<Longrightarrow> (\<Squnion>i\<in>A. M) = M"
    1.52 -  by (auto intro: antisym SUP_leI le_SUPI)
    1.53 +lemma INF_cong:
    1.54 +  "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> (\<Sqinter>x\<in>A. C x) = (\<Sqinter>x\<in>B. D x)"
    1.55 +  by (simp add: INFI_def image_def)
    1.56  
    1.57  lemma INF_mono:
    1.58    "(\<And>m. m \<in> B \<Longrightarrow> \<exists>n\<in>A. f n \<sqsubseteq> g m) \<Longrightarrow> (\<Sqinter>n\<in>A. f n) \<sqsubseteq> (\<Sqinter>n\<in>B. g n)"
    1.59    by (force intro!: Inf_mono simp: INFI_def)
    1.60  
    1.61 +lemma INF_subset:  "A \<subseteq> B \<Longrightarrow> INFI B f \<sqsubseteq> INFI A f"
    1.62 +  by (intro INF_mono) auto
    1.63 +
    1.64 +lemma INF_commute: "(\<Sqinter>i\<in>A. \<Sqinter>j\<in>B. f i j) = (\<Sqinter>j\<in>B. \<Sqinter>i\<in>A. f i j)"
    1.65 +  by (iprover intro: INF_leI le_INFI order_trans antisym)
    1.66 +
    1.67 +lemma SUP_cong:
    1.68 +  "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> (\<Squnion>x\<in>A. C x) = (\<Squnion>x\<in>B. D x)"
    1.69 +  by (simp add: SUPR_def image_def)
    1.70 +
    1.71 +lemma le_SUPI: "i \<in> A \<Longrightarrow> f i \<sqsubseteq> (\<Squnion>i\<in>A. f i)"
    1.72 +  by (auto simp add: SUPR_def intro: Sup_upper)
    1.73 +
    1.74 +lemma le_SUPI2: "i \<in> A \<Longrightarrow> u \<sqsubseteq> f i \<Longrightarrow> u \<sqsubseteq> (\<Squnion>i\<in>A. f i)"
    1.75 +  using le_SUPI [of i A f] by auto
    1.76 +
    1.77 +lemma SUP_leI: "(\<And>i. i \<in> A \<Longrightarrow> f i \<sqsubseteq> u) \<Longrightarrow> (\<Squnion>i\<in>A. f i) \<sqsubseteq> u"
    1.78 +  by (auto simp add: SUPR_def intro: Sup_least)
    1.79 +
    1.80 +lemma SUP_le_iff: "(\<Squnion>i\<in>A. f i) \<sqsubseteq> u \<longleftrightarrow> (\<forall>i \<in> A. f i \<sqsubseteq> u)"
    1.81 +  unfolding SUPR_def by (auto simp add: Sup_le_iff)
    1.82 +
    1.83 +lemma SUP_const [simp]: "A \<noteq> {} \<Longrightarrow> (\<Squnion>i\<in>A. f) = f"
    1.84 +  by (auto intro: antisym SUP_leI le_SUPI)
    1.85 +
    1.86  lemma SUP_mono:
    1.87    "(\<And>n. n \<in> A \<Longrightarrow> \<exists>m\<in>B. f n \<sqsubseteq> g m) \<Longrightarrow> (\<Squnion>n\<in>A. f n) \<sqsubseteq> (\<Squnion>n\<in>B. g n)"
    1.88    by (force intro!: Sup_mono simp: SUPR_def)
    1.89  
    1.90 -lemma INF_subset:  "A \<subseteq> B \<Longrightarrow> INFI B f \<sqsubseteq> INFI A f"
    1.91 -  by (intro INF_mono) auto
    1.92 -
    1.93  lemma SUP_subset:  "A \<subseteq> B \<Longrightarrow> SUPR A f \<sqsubseteq> SUPR B f"
    1.94    by (intro SUP_mono) auto
    1.95  
    1.96 -lemma INF_commute: "(\<Sqinter>i\<in>A. \<Sqinter>j\<in>B. f i j) = (\<Sqinter>j\<in>B. \<Sqinter>i\<in>A. f i j)"
    1.97 -  by (iprover intro: INF_leI le_INFI order_trans antisym)
    1.98 -
    1.99  lemma SUP_commute: "(\<Squnion>i\<in>A. \<Squnion>j\<in>B. f i j) = (\<Squnion>j\<in>B. \<Squnion>i\<in>A. f i j)"
   1.100    by (iprover intro: SUP_leI le_SUPI order_trans antisym)
   1.101  
   1.102 -lemma INFI_insert: "(\<Sqinter>x\<in>insert a A. B x) = B a \<sqinter> INFI A B"
   1.103 -  by (simp add: INFI_def Inf_insert)
   1.104 +lemma SUP_empty: "(\<Squnion>x\<in>{}. f x) = \<bottom>"
   1.105 +  by (simp add: SUPR_def)
   1.106  
   1.107 -lemma SUPR_insert: "(\<Squnion>x\<in>insert a A. B x) = B a \<squnion> SUPR A B"
   1.108 +lemma SUP_insert: "(\<Squnion>x\<in>insert a A. f x) = f a \<squnion> SUPR A f"
   1.109    by (simp add: SUPR_def Sup_insert)
   1.110  
   1.111  end
   1.112 @@ -221,16 +229,16 @@
   1.113    shows "\<Sqinter>S \<sqsubset> a \<longleftrightarrow> (\<exists>x\<in>S. x \<sqsubset> a)"
   1.114    unfolding not_le [symmetric] le_Inf_iff by auto
   1.115  
   1.116 +lemma INF_less_iff:
   1.117 +  fixes a :: "'a::{complete_lattice,linorder}"
   1.118 +  shows "(\<Sqinter>i\<in>A. f i) \<sqsubset> a \<longleftrightarrow> (\<exists>x\<in>A. f x \<sqsubset> a)"
   1.119 +  unfolding INFI_def Inf_less_iff by auto
   1.120 +
   1.121  lemma less_Sup_iff:
   1.122    fixes a :: "'a\<Colon>{complete_lattice,linorder}"
   1.123    shows "a \<sqsubset> \<Squnion>S \<longleftrightarrow> (\<exists>x\<in>S. a \<sqsubset> x)"
   1.124    unfolding not_le [symmetric] Sup_le_iff by auto
   1.125  
   1.126 -lemma INF_less_iff:
   1.127 -  fixes a :: "'a::{complete_lattice,linorder}"
   1.128 -  shows "(\<Sqinter>i\<in>A. f i) \<sqsubset> a \<longleftrightarrow> (\<exists>x\<in>A. f x \<sqsubset> a)"
   1.129 -  unfolding INFI_def Inf_less_iff by auto
   1.130 -
   1.131  lemma less_SUP_iff:
   1.132    fixes a :: "'a::{complete_lattice,linorder}"
   1.133    shows "a \<sqsubset> (\<Squnion>i\<in>A. f i) \<longleftrightarrow> (\<exists>x\<in>A. a \<sqsubset> f x)"
   1.134 @@ -474,13 +482,9 @@
   1.135    -- {* "Classical" elimination -- by the Excluded Middle on @{prop "a\<in>A"}. *}
   1.136    by (unfold INTER_def) blast
   1.137  
   1.138 -lemma (in complete_lattice) INFI_cong:
   1.139 -  "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> (\<Sqinter>x\<in>A. C x) = (\<Sqinter>x\<in>B. D x)"
   1.140 -  by (simp add: INFI_def image_def)
   1.141 -
   1.142  lemma INT_cong [cong]:
   1.143    "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> (\<Inter>x\<in>A. C x) = (\<Inter>x\<in>B. D x)"
   1.144 -  by (fact INFI_cong)
   1.145 +  by (fact INF_cong)
   1.146  
   1.147  lemma Collect_ball_eq: "{x. \<forall>y\<in>A. P x y} = (\<Inter>y\<in>A. {x. P x y})"
   1.148    by blast
   1.149 @@ -506,7 +510,7 @@
   1.150    shows "A k \<sqinter> (\<Sqinter>i\<in>I. A i) = (\<Sqinter>i\<in>I. A i)"
   1.151  proof -
   1.152    from assms obtain J where "I = insert k J" by blast
   1.153 -  then show ?thesis by (simp add: INFI_insert)
   1.154 +  then show ?thesis by (simp add: INF_insert)
   1.155  qed
   1.156  
   1.157  lemma INT_absorb: "k \<in> I \<Longrightarrow> A k \<inter> (\<Inter>i\<in>I. A i) = (\<Inter>i\<in>I. A i)"
   1.158 @@ -516,41 +520,74 @@
   1.159    by (fact le_INF_iff)
   1.160  
   1.161  lemma INT_insert [simp]: "(\<Inter>x \<in> insert a A. B x) = B a \<inter> INTER A B"
   1.162 -  by (fact INFI_insert)
   1.163 +  by (fact INF_insert)
   1.164 +
   1.165 +lemma (in complete_lattice) INF_union:
   1.166 +  "(\<Sqinter>i \<in> A \<union> B. M i) = (\<Sqinter>i \<in> A. M i) \<sqinter> (\<Sqinter>i\<in>B. M i)"
   1.167 +  by (auto intro!: antisym INF_mono intro: le_infI1 le_infI2 le_INFI INF_leI)
   1.168 +
   1.169 +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.170 +  by (fact INF_union)
   1.171 +
   1.172 +lemma INT_insert_distrib:
   1.173 +  "u \<in> A \<Longrightarrow> (\<Inter>x\<in>A. insert a (B x)) = insert a (\<Inter>x\<in>A. B x)"
   1.174 +  by blast
   1.175  
   1.176  -- {* continue generalization from here *}
   1.177  
   1.178 -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.179 -  by blast
   1.180 -
   1.181 -lemma INT_insert_distrib:
   1.182 -    "u \<in> A \<Longrightarrow> (\<Inter>x\<in>A. insert a (B x)) = insert a (\<Inter>x\<in>A. B x)"
   1.183 -  by blast
   1.184 +lemma (in complete_lattice) INF_constant:
   1.185 +  "(\<Sqinter>y\<in>A. c) = (if A = {} then \<top> else c)"
   1.186 +  by (simp add: INF_empty)
   1.187  
   1.188  lemma INT_constant [simp]: "(\<Inter>y\<in>A. c) = (if A = {} then UNIV else c)"
   1.189 -  by auto
   1.190 +  by (fact INF_constant)
   1.191 +
   1.192 +lemma (in complete_lattice) INF_eq:
   1.193 +  "(\<Sqinter>x\<in>A. B x) = \<Sqinter>({Y. \<exists>x\<in>A. Y = B x})"
   1.194 +  by (simp add: INFI_def image_def)
   1.195  
   1.196  lemma INT_eq: "(\<Inter>x\<in>A. B x) = \<Inter>({Y. \<exists>x\<in>A. Y = B x})"
   1.197    -- {* Look: it has an \emph{existential} quantifier *}
   1.198 -  by blast
   1.199 +  by (fact INF_eq)
   1.200 +
   1.201 +lemma (in complete_lattice) INF_top_conv:
   1.202 + "\<top> = (\<Sqinter>x\<in>A. B x) \<longleftrightarrow> (\<forall>x\<in>A. B x = \<top>)"
   1.203 + "(\<Sqinter>x\<in>A. B x) = \<top> \<longleftrightarrow> (\<forall>x\<in>A. B x = \<top>)"
   1.204 +  by (auto simp add: INFI_def Inf_top_conv)
   1.205  
   1.206  lemma INTER_UNIV_conv [simp]:
   1.207   "(UNIV = (\<Inter>x\<in>A. B x)) = (\<forall>x\<in>A. B x = UNIV)"
   1.208   "((\<Inter>x\<in>A. B x) = UNIV) = (\<forall>x\<in>A. B x = UNIV)"
   1.209 -  by blast+
   1.210 +  by (fact INF_top_conv)+
   1.211 +
   1.212 +lemma (in complete_lattice) INFI_UNIV_range:
   1.213 +  "(\<Sqinter>x\<in>UNIV. f x) = \<Sqinter>range f"
   1.214 +  by (simp add: INFI_def)
   1.215 +
   1.216 +lemma UNIV_bool [no_atp]: -- "FIXME move"
   1.217 +  "UNIV = {False, True}"
   1.218 +  by auto
   1.219  
   1.220 -lemma INT_bool_eq: "(\<Inter>b. A b) = (A True \<inter> A False)"
   1.221 -  by (auto intro: bool_induct)
   1.222 +lemma (in complete_lattice) INF_bool_eq:
   1.223 +  "(\<Sqinter>b. A b) = A True \<sqinter> A False"
   1.224 +  by (simp add: UNIV_bool INF_empty INF_insert inf_commute)
   1.225 +
   1.226 +lemma INT_bool_eq: "(\<Inter>b. A b) = A True \<inter> A False"
   1.227 +  by (fact INF_bool_eq)
   1.228 +
   1.229 +lemma (in complete_lattice) INF_anti_mono:
   1.230 +  "B \<subseteq> A \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x \<subseteq> g x) \<Longrightarrow> (\<Inter>x\<in>A. f x) \<subseteq> (\<Inter>x\<in>A. g x)"
   1.231 +  -- {* The last inclusion is POSITIVE! *}
   1.232 +  by (blast dest: subsetD)
   1.233 +
   1.234 +lemma INT_anti_mono:
   1.235 +  "B \<subseteq> A \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x \<subseteq> g x) \<Longrightarrow> (\<Inter>x\<in>A. f x) \<subseteq> (\<Inter>x\<in>A. g x)"
   1.236 +  -- {* The last inclusion is POSITIVE! *}
   1.237 +  by (blast dest: subsetD)
   1.238  
   1.239  lemma Pow_INT_eq: "Pow (\<Inter>x\<in>A. B x) = (\<Inter>x\<in>A. Pow (B x))"
   1.240    by blast
   1.241  
   1.242 -lemma INT_anti_mono:
   1.243 -  "B \<subseteq> A \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x \<subseteq> g x) \<Longrightarrow>
   1.244 -    (\<Inter>x\<in>A. f x) \<subseteq> (\<Inter>x\<in>A. g x)"
   1.245 -  -- {* The last inclusion is POSITIVE! *}
   1.246 -  by (blast dest: subsetD)
   1.247 -
   1.248  lemma vimage_INT: "f -` (\<Inter>x\<in>A. B x) = (\<Inter>x\<in>A. f -` B x)"
   1.249    by blast
   1.250