src/HOL/Set_Interval.thy
changeset 73411 1f1366966296
parent 73139 be9b73dfd3e0
child 73555 92783562ab78
equal deleted inserted replaced
73410:7b59d2945e54 73411:1f1366966296
   298 
   298 
   299 lemma atLeastAtMost_singleton': "a = b \<Longrightarrow> {a .. b} = {a}" by simp
   299 lemma atLeastAtMost_singleton': "a = b \<Longrightarrow> {a .. b} = {a}" by simp
   300 
   300 
   301 lemma Icc_eq_Icc[simp]:
   301 lemma Icc_eq_Icc[simp]:
   302   "{l..h} = {l'..h'} = (l=l' \<and> h=h' \<or> \<not> l\<le>h \<and> \<not> l'\<le>h')"
   302   "{l..h} = {l'..h'} = (l=l' \<and> h=h' \<or> \<not> l\<le>h \<and> \<not> l'\<le>h')"
   303   by(simp add: order_class.eq_iff)(auto intro: order_trans)
   303   by (simp add: order_class.order.eq_iff) (auto intro: order_trans)
   304 
   304 
   305 lemma atLeastAtMost_singleton_iff[simp]:
   305 lemma atLeastAtMost_singleton_iff[simp]:
   306   "{a .. b} = {c} \<longleftrightarrow> a = b \<and> b = c"
   306   "{a .. b} = {c} \<longleftrightarrow> a = b \<and> b = c"
   307 proof
   307 proof
   308   assume "{a..b} = {c}"
   308   assume "{a..b} = {c}"
   475   fixes a b c d :: "'a::linorder"
   475   fixes a b c d :: "'a::linorder"
   476   assumes "a < b" "c < d"
   476   assumes "a < b" "c < d"
   477   shows "{a ..< b} = {c ..< d} \<longleftrightarrow> a = c \<and> b = d"
   477   shows "{a ..< b} = {c ..< d} \<longleftrightarrow> a = c \<and> b = d"
   478   using atLeastLessThan_inj assms by auto
   478   using atLeastLessThan_inj assms by auto
   479 
   479 
   480 lemma (in linorder) Ioc_inj: "{a <.. b} = {c <.. d} \<longleftrightarrow> (b \<le> a \<and> d \<le> c) \<or> a = c \<and> b = d"
   480 lemma (in linorder) Ioc_inj: 
   481   by (metis eq_iff greaterThanAtMost_empty_iff2 greaterThanAtMost_iff le_cases not_le)
   481   \<open>{a <.. b} = {c <.. d} \<longleftrightarrow> (b \<le> a \<and> d \<le> c) \<or> a = c \<and> b = d\<close> (is \<open>?P \<longleftrightarrow> ?Q\<close>)
       
   482 proof
       
   483   assume ?Q
       
   484   then show ?P
       
   485     by auto
       
   486 next
       
   487   assume ?P
       
   488   then have \<open>a < x \<and> x \<le> b \<longleftrightarrow> c < x \<and> x \<le> d\<close> for x
       
   489     by (simp add: set_eq_iff)
       
   490   from this [of a] this [of b] this [of c] this [of d] show ?Q
       
   491     by auto
       
   492 qed
   482 
   493 
   483 lemma (in order) Iio_Int_singleton: "{..<k} \<inter> {x} = (if x < k then {x} else {})"
   494 lemma (in order) Iio_Int_singleton: "{..<k} \<inter> {x} = (if x < k then {x} else {})"
   484   by auto
   495   by auto
   485 
   496 
   486 lemma (in linorder) Ioc_subset_iff: "{a<..b} \<subseteq> {c<..d} \<longleftrightarrow> (b \<le> a \<or> c \<le> a \<and> b \<le> d)"
   497 lemma (in linorder) Ioc_subset_iff: "{a<..b} \<subseteq> {c<..d} \<longleftrightarrow> (b \<le> a \<or> c \<le> a \<and> b \<le> d)"