src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
changeset 57447 87429bdecad5
parent 57418 6ab1c7cb0b8d
child 57448 159e45728ceb
--- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Mon Jun 30 15:45:03 2014 +0200
+++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Mon Jun 30 15:45:21 2014 +0200
@@ -825,6 +825,9 @@
 
 subsection {* Boxes *}
 
+abbreviation One :: "'a::euclidean_space"
+  where "One \<equiv> \<Sum>Basis"
+
 definition (in euclidean_space) eucl_less (infix "<e" 50)
   where "eucl_less a b \<longleftrightarrow> (\<forall>i\<in>Basis. a \<bullet> i < b \<bullet> i)"
 
@@ -847,6 +850,12 @@
   shows "box a b = {a <..< b}" "cbox a b = {a .. b}"
   by auto
 
+lemma box_Int_box:
+  fixes a :: "'a::euclidean_space"
+  shows "box a b \<inter> box c d =
+    box (\<Sum>i\<in>Basis. max (a\<bullet>i) (c\<bullet>i) *\<^sub>R i) (\<Sum>i\<in>Basis. min (b\<bullet>i) (d\<bullet>i) *\<^sub>R i)"
+  unfolding set_eq_iff and Int_iff and mem_box by auto
+
 lemma rational_boxes:
   fixes x :: "'a\<Colon>euclidean_space"
   assumes "e > 0"
@@ -1142,6 +1151,24 @@
   show ?th4 unfolding * by (intro **) auto
 qed
 
+lemma UN_box_eq_UNIV: "(\<Union>i::nat. box (- (real i *\<^sub>R One)) (real i *\<^sub>R One)) = UNIV"
+proof -
+  { fix x b :: 'a assume [simp]: "b \<in> Basis"
+    have "\<bar>x \<bullet> b\<bar> \<le> real (natceiling \<bar>x \<bullet> b\<bar>)"
+      by (rule real_natceiling_ge)
+    also have "\<dots> \<le> real (natceiling (Max ((\<lambda>b. \<bar>x \<bullet> b\<bar>)`Basis)))"
+      by (auto intro!: natceiling_mono)
+    also have "\<dots> < real (natceiling (Max ((\<lambda>b. \<bar>x \<bullet> b\<bar>)`Basis)) + 1)"
+      by simp
+    finally have "\<bar>x \<bullet> b\<bar> < real (natceiling (Max ((\<lambda>b. \<bar>x \<bullet> b\<bar>)`Basis)) + 1)" . }
+  then have "\<And>x::'a. \<exists>n::nat. \<forall>b\<in>Basis. \<bar>x \<bullet> b\<bar> < real n"
+    by auto
+  moreover have "\<And>x b::'a. \<And>n::nat.  \<bar>x \<bullet> b\<bar> < real n \<longleftrightarrow> - real n < x \<bullet> b \<and> x \<bullet> b < real n"
+    by auto
+  ultimately show ?thesis
+    by (auto simp: box_def inner_setsum_left inner_Basis setsum.If_cases)
+qed
+
 text {* Intervals in general, including infinite and mixtures of open and closed. *}
 
 definition "is_interval (s::('a::euclidean_space) set) \<longleftrightarrow>
@@ -4588,6 +4615,43 @@
   "continuous (at x) f \<longleftrightarrow> (\<forall>e > 0. \<exists>d > 0. \<forall>x'. dist x' x < d \<longrightarrow> dist (f x') (f x) < e)"
   using continuous_within_eps_delta [of x UNIV f] by simp
 
+lemma continuous_at_right_real_increasing:
+  assumes nondecF: "\<And> x y. x \<le> y \<Longrightarrow> f x \<le> ((f y) :: real)"
+  shows "(continuous (at_right (a :: real)) f) = (\<forall>e > 0. \<exists>delta > 0. f (a + delta) - f a < e)"
+  apply (auto simp add: continuous_within_eps_delta dist_real_def greaterThan_def)
+  apply (drule_tac x = e in spec, auto)
+  apply (drule_tac x = "a + d / 2" in spec)
+  apply (subst (asm) abs_of_nonneg)
+  apply (auto intro: nondecF simp add: field_simps)
+  apply (rule_tac x = "d / 2" in exI)
+  apply (auto simp add: field_simps)
+  apply (drule_tac x = e in spec, auto)
+  apply (rule_tac x = delta in exI, auto)
+  apply (subst abs_of_nonneg)
+  apply (auto intro: nondecF simp add: field_simps)
+  apply (rule le_less_trans)
+  prefer 2 apply assumption
+by (rule nondecF, auto)
+
+lemma continuous_at_left_real_increasing:
+  assumes nondecF: "\<And> x y. x \<le> y \<Longrightarrow> f x \<le> ((f y) :: real)"
+  shows "(continuous (at_left (a :: real)) f) = (\<forall>e > 0. \<exists>delta > 0. f a - f (a - delta) < e)"
+  apply (auto simp add: continuous_within_eps_delta dist_real_def lessThan_def)
+  apply (drule_tac x = e in spec, auto)
+  apply (drule_tac x = "a - d / 2" in spec)
+  apply (subst (asm) abs_of_nonpos)
+  apply (auto intro: nondecF simp add: field_simps)
+  apply (rule_tac x = "d / 2" in exI)
+  apply (auto simp add: field_simps)
+  apply (drule_tac x = e in spec, auto)
+  apply (rule_tac x = delta in exI, auto)
+  apply (subst abs_of_nonpos)
+  apply (auto intro: nondecF simp add: field_simps)
+  apply (rule less_le_trans)
+  apply assumption
+  apply auto
+by (rule nondecF, auto)
+
 text{* Versions in terms of open balls. *}
 
 lemma continuous_within_ball: