src/HOL/Complete_Lattices.thy
changeset 56248 67dc9549fa15
parent 56218 1c3f1f2431f9
child 56741 2b3710a4fa94
equal deleted inserted replaced
56247:1ad01f98dc3e 56248:67dc9549fa15
    38 
    38 
    39 lemma INF_cong:
    39 lemma INF_cong:
    40   "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> INFIMUM A C = INFIMUM B D"
    40   "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> INFIMUM A C = INFIMUM B D"
    41   by (simp add: INF_def image_def)
    41   by (simp add: INF_def image_def)
    42 
    42 
       
    43 lemma strong_INF_cong [cong]:
       
    44   "A = B \<Longrightarrow> (\<And>x. x \<in> B =simp=> C x = D x) \<Longrightarrow> INFIMUM A C = INFIMUM B D"
       
    45   unfolding simp_implies_def by (fact INF_cong)
       
    46 
    43 end
    47 end
    44 
    48 
    45 class Sup =
    49 class Sup =
    46   fixes Sup :: "'a set \<Rightarrow> 'a" ("\<Squnion>_" [900] 900)
    50   fixes Sup :: "'a set \<Rightarrow> 'a" ("\<Squnion>_" [900] 900)
    47 begin
    51 begin
    66   by (simp add: id_def)
    70   by (simp add: id_def)
    67 
    71 
    68 lemma SUP_cong:
    72 lemma SUP_cong:
    69   "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> SUPREMUM A C = SUPREMUM B D"
    73   "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> SUPREMUM A C = SUPREMUM B D"
    70   by (simp add: SUP_def image_def)
    74   by (simp add: SUP_def image_def)
       
    75 
       
    76 lemma strong_SUP_cong [cong]:
       
    77   "A = B \<Longrightarrow> (\<And>x. x \<in> B =simp=> C x = D x) \<Longrightarrow> SUPREMUM A C = SUPREMUM B D"
       
    78   unfolding simp_implies_def by (fact SUP_cong)
    71 
    79 
    72 end
    80 end
    73 
    81 
    74 text {*
    82 text {*
    75   Note: must use names @{const INFIMUM} and @{const SUPREMUM} here instead of
    83   Note: must use names @{const INFIMUM} and @{const SUPREMUM} here instead of
   445   by (blast intro: Sup_upper2 Inf_lower ex_in_conv)
   453   by (blast intro: Sup_upper2 Inf_lower ex_in_conv)
   446 
   454 
   447 lemma INF_le_SUP: "A \<noteq> {} \<Longrightarrow> INFIMUM A f \<le> SUPREMUM A f"
   455 lemma INF_le_SUP: "A \<noteq> {} \<Longrightarrow> INFIMUM A f \<le> SUPREMUM A f"
   448   using Inf_le_Sup [of "f ` A"] by simp
   456   using Inf_le_Sup [of "f ` A"] by simp
   449 
   457 
       
   458 lemma INF_eq_const:
       
   459   "I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> f i = x) \<Longrightarrow> INFIMUM I f = x"
       
   460   by (auto intro: INF_eqI)
       
   461 
   450 lemma SUP_eq_const:
   462 lemma SUP_eq_const:
   451   "I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> f i = x) \<Longrightarrow> SUPREMUM I f = x"
   463   "I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> f i = x) \<Longrightarrow> SUPREMUM I f = x"
   452   by (auto intro: SUP_eqI)
   464   by (auto intro: SUP_eqI)
   453 
   465 
   454 lemma INF_eq_const:
   466 lemma INF_eq_iff:
   455   "I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> f i = x) \<Longrightarrow> INFIMUM I f = x"
   467   "I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> f i \<le> c) \<Longrightarrow> (INFIMUM I f = c) \<longleftrightarrow> (\<forall>i\<in>I. f i = c)"
   456   by (auto intro: INF_eqI)
   468   using INF_eq_const [of I f c] INF_lower [of _ I f]
       
   469   by (auto intro: antisym cong del: strong_INF_cong)
   457 
   470 
   458 lemma SUP_eq_iff:
   471 lemma SUP_eq_iff:
   459   "I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> c \<le> f i) \<Longrightarrow> (SUPREMUM I f = c) \<longleftrightarrow> (\<forall>i\<in>I. f i = c)"
   472   "I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> c \<le> f i) \<Longrightarrow> (SUPREMUM I f = c) \<longleftrightarrow> (\<forall>i\<in>I. f i = c)"
   460   using SUP_eq_const[of I f c] SUP_upper[of _ I f] by (auto intro: antisym)
   473   using SUP_eq_const [of I f c] SUP_upper [of _ I f]
   461 
   474   by (auto intro: antisym cong del: strong_SUP_cong)
   462 lemma INF_eq_iff:
       
   463   "I \<noteq> {} \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> f i \<le> c) \<Longrightarrow> (INFIMUM I f = c) \<longleftrightarrow> (\<forall>i\<in>I. f i = c)"
       
   464   using INF_eq_const[of I f c] INF_lower[of _ I f] by (auto intro: antisym)
       
   465 
   475 
   466 end
   476 end
   467 
   477 
   468 class complete_distrib_lattice = complete_lattice +
   478 class complete_distrib_lattice = complete_lattice +
   469   assumes sup_Inf: "a \<squnion> \<Sqinter>B = (\<Sqinter>b\<in>B. a \<squnion> b)"
   479   assumes sup_Inf: "a \<squnion> \<Sqinter>B = (\<Sqinter>b\<in>B. a \<squnion> b)"
   935 
   945 
   936 lemma INT_E [elim]: "b \<in> (\<Inter>x\<in>A. B x) \<Longrightarrow> (b \<in> B a \<Longrightarrow> R) \<Longrightarrow> (a \<notin> A \<Longrightarrow> R) \<Longrightarrow> R"
   946 lemma INT_E [elim]: "b \<in> (\<Inter>x\<in>A. B x) \<Longrightarrow> (b \<in> B a \<Longrightarrow> R) \<Longrightarrow> (a \<notin> A \<Longrightarrow> R) \<Longrightarrow> R"
   937   -- {* "Classical" elimination -- by the Excluded Middle on @{prop "a\<in>A"}. *}
   947   -- {* "Classical" elimination -- by the Excluded Middle on @{prop "a\<in>A"}. *}
   938   by (auto simp add: INF_def image_def)
   948   by (auto simp add: INF_def image_def)
   939 
   949 
   940 lemma INT_cong [cong]:
       
   941   "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)"
       
   942   by (fact INF_cong)
       
   943 
       
   944 lemma Collect_ball_eq: "{x. \<forall>y\<in>A. P x y} = (\<Inter>y\<in>A. {x. P x y})"
   950 lemma Collect_ball_eq: "{x. \<forall>y\<in>A. P x y} = (\<Inter>y\<in>A. {x. P x y})"
   945   by blast
   951   by blast
   946 
   952 
   947 lemma Collect_all_eq: "{x. \<forall>y. P x y} = (\<Inter>y. {x. P x y})"
   953 lemma Collect_all_eq: "{x. \<forall>y. P x y} = (\<Inter>y. {x. P x y})"
   948   by blast
   954   by blast
  1129     @{term b} may be flexible. *}
  1135     @{term b} may be flexible. *}
  1130   by auto
  1136   by auto
  1131 
  1137 
  1132 lemma UN_E [elim!]: "b \<in> (\<Union>x\<in>A. B x) \<Longrightarrow> (\<And>x. x\<in>A \<Longrightarrow> b \<in> B x \<Longrightarrow> R) \<Longrightarrow> R"
  1138 lemma UN_E [elim!]: "b \<in> (\<Union>x\<in>A. B x) \<Longrightarrow> (\<And>x. x\<in>A \<Longrightarrow> b \<in> B x \<Longrightarrow> R) \<Longrightarrow> R"
  1133   by (auto simp add: SUP_def image_def)
  1139   by (auto simp add: SUP_def image_def)
  1134 
       
  1135 lemma UN_cong [cong]:
       
  1136   "A = B \<Longrightarrow> (\<And>x. x \<in> B \<Longrightarrow> C x = D x) \<Longrightarrow> (\<Union>x\<in>A. C x) = (\<Union>x\<in>B. D x)"
       
  1137   by (fact SUP_cong)
       
  1138 
       
  1139 lemma strong_UN_cong:
       
  1140   "A = B \<Longrightarrow> (\<And>x. x \<in> B =simp=> C x = D x) \<Longrightarrow> (\<Union>x\<in>A. C x) = (\<Union>x\<in>B. D x)"
       
  1141   by (unfold simp_implies_def) (fact UN_cong)
       
  1142 
  1140 
  1143 lemma image_eq_UN: "f ` A = (\<Union>x\<in>A. {f x})"
  1141 lemma image_eq_UN: "f ` A = (\<Union>x\<in>A. {f x})"
  1144   by blast
  1142   by blast
  1145 
  1143 
  1146 lemma UN_upper: "a \<in> A \<Longrightarrow> B a \<subseteq> (\<Union>x\<in>A. B x)"
  1144 lemma UN_upper: "a \<in> A \<Longrightarrow> B a \<subseteq> (\<Union>x\<in>A. B x)"