src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
changeset 51475 ebf9d4fd00ba
parent 51473 1210309fddab
child 51478 270b21f3ae0a
equal deleted inserted replaced
51474:1e9e68247ad1 51475:ebf9d4fd00ba
  1399     fix S assume S: "\<forall>n. S n \<noteq> x \<and> S n \<in> {x <..} \<inter> I" "S ----> x"
  1399     fix S assume S: "\<forall>n. S n \<noteq> x \<and> S n \<in> {x <..} \<inter> I" "S ----> x"
  1400     
  1400     
  1401     show "(\<lambda>n. f (S n)) ----> Inf (f ` ({x<..} \<inter> I))"
  1401     show "(\<lambda>n. f (S n)) ----> Inf (f ` ({x<..} \<inter> I))"
  1402     proof (rule LIMSEQ_I, rule ccontr)
  1402     proof (rule LIMSEQ_I, rule ccontr)
  1403       fix r :: real assume "0 < r"
  1403       fix r :: real assume "0 < r"
  1404       with Inf_close[of "f ` ({x<..} \<inter> I)" r]
  1404       with cInf_close[of "f ` ({x<..} \<inter> I)" r]
  1405       obtain y where y: "x < y" "y \<in> I" "f y < Inf (f ` ({x <..} \<inter> I)) + r" by auto
  1405       obtain y where y: "x < y" "y \<in> I" "f y < Inf (f ` ({x <..} \<inter> I)) + r" by auto
  1406       from `x < y` have "0 < y - x" by auto
  1406       from `x < y` have "0 < y - x" by auto
  1407       from S(2)[THEN LIMSEQ_D, OF this]
  1407       from S(2)[THEN LIMSEQ_D, OF this]
  1408       obtain N where N: "\<And>n. N \<le> n \<Longrightarrow> \<bar>S n - x\<bar> < y - x" by auto
  1408       obtain N where N: "\<And>n. N \<le> n \<Longrightarrow> \<bar>S n - x\<bar> < y - x" by auto
  1409       
  1409       
  1410       assume "\<not> (\<exists>N. \<forall>n\<ge>N. norm (f (S n) - Inf (f ` ({x<..} \<inter> I))) < r)"
  1410       assume "\<not> (\<exists>N. \<forall>n\<ge>N. norm (f (S n) - Inf (f ` ({x<..} \<inter> I))) < r)"
  1411       moreover have "\<And>n. Inf (f ` ({x<..} \<inter> I)) \<le> f (S n)"
  1411       moreover have "\<And>n. Inf (f ` ({x<..} \<inter> I)) \<le> f (S n)"
  1412         using S bnd by (intro Inf_lower[where z=K]) auto
  1412         using S bnd by (intro cInf_lower[where z=K]) auto
  1413       ultimately obtain n where n: "N \<le> n" "r + Inf (f ` ({x<..} \<inter> I)) \<le> f (S n)"
  1413       ultimately obtain n where n: "N \<le> n" "r + Inf (f ` ({x<..} \<inter> I)) \<le> f (S n)"
  1414         by (auto simp: not_less field_simps)
  1414         by (auto simp: not_less field_simps)
  1415       with N[OF n(1)] mono[OF _ `y \<in> I`, of "S n"] S(1)[THEN spec, of n] y
  1415       with N[OF n(1)] mono[OF _ `y \<in> I`, of "S n"] S(1)[THEN spec, of n] y
  1416       show False by auto
  1416       show False by auto
  1417     qed
  1417     qed
  1725   assumes "S \<noteq> {}" "\<forall>x\<in>S. B \<le> x"
  1725   assumes "S \<noteq> {}" "\<forall>x\<in>S. B \<le> x"
  1726   shows "Inf S \<in> closure S"
  1726   shows "Inf S \<in> closure S"
  1727   unfolding closure_approachable
  1727   unfolding closure_approachable
  1728 proof safe
  1728 proof safe
  1729   have *: "\<forall>x\<in>S. Inf S \<le> x"
  1729   have *: "\<forall>x\<in>S. Inf S \<le> x"
  1730     using Inf_lower_EX[of _ S] assms by metis
  1730     using cInf_lower_EX[of _ S] assms by metis
  1731 
  1731 
  1732   fix e :: real assume "0 < e"
  1732   fix e :: real assume "0 < e"
  1733   then obtain x where x: "x \<in> S" "x < Inf S + e"
  1733   then obtain x where x: "x \<in> S" "x < Inf S + e"
  1734     using Inf_close `S \<noteq> {}` by auto
  1734     using cInf_close `S \<noteq> {}` by auto
  1735   moreover then have "x > Inf S - e" using * by auto
  1735   moreover then have "x > Inf S - e" using * by auto
  1736   ultimately have "abs (x - Inf S) < e" by (simp add: abs_diff_less_iff)
  1736   ultimately have "abs (x - Inf S) < e" by (simp add: abs_diff_less_iff)
  1737   then show "\<exists>x\<in>S. dist x (Inf S) < e"
  1737   then show "\<exists>x\<in>S. dist x (Inf S) < e"
  1738     using x by (auto simp: dist_norm)
  1738     using x by (auto simp: dist_norm)
  1739 qed
  1739 qed
  1783 lemma infdist_notempty: "A \<noteq> {} \<Longrightarrow> infdist x A = Inf {dist x a|a. a \<in> A}"
  1783 lemma infdist_notempty: "A \<noteq> {} \<Longrightarrow> infdist x A = Inf {dist x a|a. a \<in> A}"
  1784   by (simp add: infdist_def)
  1784   by (simp add: infdist_def)
  1785 
  1785 
  1786 lemma infdist_nonneg:
  1786 lemma infdist_nonneg:
  1787   shows "0 \<le> infdist x A"
  1787   shows "0 \<le> infdist x A"
  1788   using assms by (auto simp add: infdist_def)
  1788   using assms by (auto simp add: infdist_def intro: cInf_greatest)
  1789 
  1789 
  1790 lemma infdist_le:
  1790 lemma infdist_le:
  1791   assumes "a \<in> A"
  1791   assumes "a \<in> A"
  1792   assumes "d = dist x a"
  1792   assumes "d = dist x a"
  1793   shows "infdist x A \<le> d"
  1793   shows "infdist x A \<le> d"
  1794   using assms by (auto intro!: SupInf.Inf_lower[where z=0] simp add: infdist_def)
  1794   using assms by (auto intro!: cInf_lower[where z=0] simp add: infdist_def)
  1795 
  1795 
  1796 lemma infdist_zero[simp]:
  1796 lemma infdist_zero[simp]:
  1797   assumes "a \<in> A" shows "infdist a A = 0"
  1797   assumes "a \<in> A" shows "infdist a A = 0"
  1798 proof -
  1798 proof -
  1799   from infdist_le[OF assms, of "dist a a"] have "infdist a A \<le> 0" by auto
  1799   from infdist_le[OF assms, of "dist a a"] have "infdist a A \<le> 0" by auto
  1805 proof cases
  1805 proof cases
  1806   assume "A = {}" thus ?thesis by (simp add: infdist_def)
  1806   assume "A = {}" thus ?thesis by (simp add: infdist_def)
  1807 next
  1807 next
  1808   assume "A \<noteq> {}" then obtain a where "a \<in> A" by auto
  1808   assume "A \<noteq> {}" then obtain a where "a \<in> A" by auto
  1809   have "infdist x A \<le> Inf {dist x y + dist y a |a. a \<in> A}"
  1809   have "infdist x A \<le> Inf {dist x y + dist y a |a. a \<in> A}"
  1810   proof
  1810   proof (rule cInf_greatest)
  1811     from `A \<noteq> {}` show "{dist x y + dist y a |a. a \<in> A} \<noteq> {}" by simp
  1811     from `A \<noteq> {}` show "{dist x y + dist y a |a. a \<in> A} \<noteq> {}" by simp
  1812     fix d assume "d \<in> {dist x y + dist y a |a. a \<in> A}"
  1812     fix d assume "d \<in> {dist x y + dist y a |a. a \<in> A}"
  1813     then obtain a where d: "d = dist x y + dist y a" "a \<in> A" by auto
  1813     then obtain a where d: "d = dist x y + dist y a" "a \<in> A" by auto
  1814     show "infdist x A \<le> d"
  1814     show "infdist x A \<le> d"
  1815       unfolding infdist_notempty[OF `A \<noteq> {}`]
  1815       unfolding infdist_notempty[OF `A \<noteq> {}`]
  1816     proof (rule Inf_lower2)
  1816     proof (rule cInf_lower2)
  1817       show "dist x a \<in> {dist x a |a. a \<in> A}" using `a \<in> A` by auto
  1817       show "dist x a \<in> {dist x a |a. a \<in> A}" using `a \<in> A` by auto
  1818       show "dist x a \<le> d" unfolding d by (rule dist_triangle)
  1818       show "dist x a \<le> d" unfolding d by (rule dist_triangle)
  1819       fix d assume "d \<in> {dist x a |a. a \<in> A}"
  1819       fix d assume "d \<in> {dist x a |a. a \<in> A}"
  1820       then obtain a where "a \<in> A" "d = dist x a" by auto
  1820       then obtain a where "a \<in> A" "d = dist x a" by auto
  1821       thus "infdist x A \<le> d" by (rule infdist_le)
  1821       thus "infdist x A \<le> d" by (rule infdist_le)
  1822     qed
  1822     qed
  1823   qed
  1823   qed
  1824   also have "\<dots> = dist x y + infdist y A"
  1824   also have "\<dots> = dist x y + infdist y A"
  1825   proof (rule Inf_eq, safe)
  1825   proof (rule cInf_eq, safe)
  1826     fix a assume "a \<in> A"
  1826     fix a assume "a \<in> A"
  1827     thus "dist x y + infdist y A \<le> dist x y + dist y a" by (auto intro: infdist_le)
  1827     thus "dist x y + infdist y A \<le> dist x y + dist y a" by (auto intro: infdist_le)
  1828   next
  1828   next
  1829     fix i assume inf: "\<And>d. d \<in> {dist x y + dist y a |a. a \<in> A} \<Longrightarrow> i \<le> d"
  1829     fix i assume inf: "\<And>d. d \<in> {dist x y + dist y a |a. a \<in> A} \<Longrightarrow> i \<le> d"
  1830     hence "i - dist x y \<le> infdist y A" unfolding infdist_notempty[OF `A \<noteq> {}`] using `a \<in> A`
  1830     hence "i - dist x y \<le> infdist y A" unfolding infdist_notempty[OF `A \<noteq> {}`] using `a \<in> A`
  1831       by (intro Inf_greatest) (auto simp: field_simps)
  1831       by (intro cInf_greatest) (auto simp: field_simps)
  1832     thus "i \<le> dist x y + infdist y A" by simp
  1832     thus "i \<le> dist x y + infdist y A" by simp
  1833   qed
  1833   qed
  1834   finally show ?thesis by simp
  1834   finally show ?thesis by simp
  1835 qed
  1835 qed
  1836 
  1836 
  1837 lemma
  1837 lemma in_closure_iff_infdist_zero:
  1838   in_closure_iff_infdist_zero:
       
  1839   assumes "A \<noteq> {}"
  1838   assumes "A \<noteq> {}"
  1840   shows "x \<in> closure A \<longleftrightarrow> infdist x A = 0"
  1839   shows "x \<in> closure A \<longleftrightarrow> infdist x A = 0"
  1841 proof
  1840 proof
  1842   assume "x \<in> closure A"
  1841   assume "x \<in> closure A"
  1843   show "infdist x A = 0"
  1842   show "infdist x A = 0"
  1857   proof (safe, rule ccontr)
  1856   proof (safe, rule ccontr)
  1858     fix e::real assume "0 < e"
  1857     fix e::real assume "0 < e"
  1859     assume "\<not> (\<exists>y\<in>A. dist y x < e)"
  1858     assume "\<not> (\<exists>y\<in>A. dist y x < e)"
  1860     hence "infdist x A \<ge> e" using `a \<in> A`
  1859     hence "infdist x A \<ge> e" using `a \<in> A`
  1861       unfolding infdist_def
  1860       unfolding infdist_def
  1862       by (force simp: dist_commute)
  1861       by (force simp: dist_commute intro: cInf_greatest)
  1863     with x `0 < e` show False by auto
  1862     with x `0 < e` show False by auto
  1864   qed
  1863   qed
  1865 qed
  1864 qed
  1866 
  1865 
  1867 lemma
  1866 lemma in_closed_iff_infdist_zero:
  1868   in_closed_iff_infdist_zero:
       
  1869   assumes "closed A" "A \<noteq> {}"
  1867   assumes "closed A" "A \<noteq> {}"
  1870   shows "x \<in> A \<longleftrightarrow> infdist x A = 0"
  1868   shows "x \<in> A \<longleftrightarrow> infdist x A = 0"
  1871 proof -
  1869 proof -
  1872   have "x \<in> closure A \<longleftrightarrow> infdist x A = 0"
  1870   have "x \<in> closure A \<longleftrightarrow> infdist x A = 0"
  1873     by (rule in_closure_iff_infdist_zero) fact
  1871     by (rule in_closure_iff_infdist_zero) fact
  2324   assumes "bounded S" "S \<noteq> {}"
  2322   assumes "bounded S" "S \<noteq> {}"
  2325   shows "\<forall>x\<in>S. x <= Sup S" and "\<forall>b. (\<forall>x\<in>S. x <= b) \<longrightarrow> Sup S <= b"
  2323   shows "\<forall>x\<in>S. x <= Sup S" and "\<forall>b. (\<forall>x\<in>S. x <= b) \<longrightarrow> Sup S <= b"
  2326 proof
  2324 proof
  2327   fix x assume "x\<in>S"
  2325   fix x assume "x\<in>S"
  2328   thus "x \<le> Sup S"
  2326   thus "x \<le> Sup S"
  2329     by (metis SupInf.Sup_upper abs_le_D1 assms(1) bounded_real)
  2327     by (metis cSup_upper abs_le_D1 assms(1) bounded_real)
  2330 next
  2328 next
  2331   show "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b" using assms
  2329   show "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b" using assms
  2332     by (metis SupInf.Sup_least)
  2330     by (metis cSup_least)
  2333 qed
  2331 qed
  2334 
  2332 
  2335 lemma Sup_insert:
  2333 lemma Sup_insert:
  2336   fixes S :: "real set"
  2334   fixes S :: "real set"
  2337   shows "bounded S ==> Sup(insert x S) = (if S = {} then x else max x (Sup S))" 
  2335   shows "bounded S ==> Sup(insert x S) = (if S = {} then x else max x (Sup S))" 
  2338 by auto (metis Int_absorb Sup_insert_nonempty assms bounded_has_Sup(1) disjoint_iff_not_equal) 
  2336   apply (subst cSup_insert_If)
       
  2337   apply (rule bounded_has_Sup(1)[of S, rule_format])
       
  2338   apply (auto simp: sup_max)
       
  2339   done
  2339 
  2340 
  2340 lemma Sup_insert_finite:
  2341 lemma Sup_insert_finite:
  2341   fixes S :: "real set"
  2342   fixes S :: "real set"
  2342   shows "finite S \<Longrightarrow> Sup(insert x S) = (if S = {} then x else max x (Sup S))"
  2343   shows "finite S \<Longrightarrow> Sup(insert x S) = (if S = {} then x else max x (Sup S))"
  2343   apply (rule Sup_insert)
  2344   apply (rule Sup_insert)
  2350   shows "\<forall>x\<in>S. x >= Inf S" and "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S >= b"
  2351   shows "\<forall>x\<in>S. x >= Inf S" and "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S >= b"
  2351 proof
  2352 proof
  2352   fix x assume "x\<in>S"
  2353   fix x assume "x\<in>S"
  2353   from assms(1) obtain a where a:"\<forall>x\<in>S. \<bar>x\<bar> \<le> a" unfolding bounded_real by auto
  2354   from assms(1) obtain a where a:"\<forall>x\<in>S. \<bar>x\<bar> \<le> a" unfolding bounded_real by auto
  2354   thus "x \<ge> Inf S" using `x\<in>S`
  2355   thus "x \<ge> Inf S" using `x\<in>S`
  2355     by (metis Inf_lower_EX abs_le_D2 minus_le_iff)
  2356     by (metis cInf_lower_EX abs_le_D2 minus_le_iff)
  2356 next
  2357 next
  2357   show "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S \<ge> b" using assms
  2358   show "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S \<ge> b" using assms
  2358     by (metis SupInf.Inf_greatest)
  2359     by (metis cInf_greatest)
  2359 qed
  2360 qed
  2360 
  2361 
  2361 lemma Inf_insert:
  2362 lemma Inf_insert:
  2362   fixes S :: "real set"
  2363   fixes S :: "real set"
  2363   shows "bounded S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))" 
  2364   shows "bounded S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))" 
  2364 by auto (metis Int_absorb Inf_insert_nonempty bounded_has_Inf(1) disjoint_iff_not_equal)
  2365   apply (subst cInf_insert_if)
       
  2366   apply (rule bounded_has_Inf(1)[of S, rule_format])
       
  2367   apply (auto simp: inf_min)
       
  2368   done
  2365 
  2369 
  2366 lemma Inf_insert_finite:
  2370 lemma Inf_insert_finite:
  2367   fixes S :: "real set"
  2371   fixes S :: "real set"
  2368   shows "finite S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))"
  2372   shows "finite S ==> Inf(insert x S) = (if S = {} then x else min x (Inf S))"
  2369   by (rule Inf_insert, rule finite_imp_bounded, simp)
  2373   by (rule Inf_insert, rule finite_imp_bounded, simp)
  3123 
  3127 
  3124 subsubsection{* Total boundedness *}
  3128 subsubsection{* Total boundedness *}
  3125 
  3129 
  3126 lemma cauchy_def:
  3130 lemma cauchy_def:
  3127   "Cauchy s \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m n. m \<ge> N \<and> n \<ge> N --> dist(s m)(s n) < e)"
  3131   "Cauchy s \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>m n. m \<ge> N \<and> n \<ge> N --> dist(s m)(s n) < e)"
  3128 unfolding Cauchy_def by blast
  3132 unfolding Cauchy_def by metis
  3129 
  3133 
  3130 fun helper_1::"('a::metric_space set) \<Rightarrow> real \<Rightarrow> nat \<Rightarrow> 'a" where
  3134 fun helper_1::"('a::metric_space set) \<Rightarrow> real \<Rightarrow> nat \<Rightarrow> 'a" where
  3131   "helper_1 s e n = (SOME y::'a. y \<in> s \<and> (\<forall>m<n. \<not> (dist (helper_1 s e m) y < e)))"
  3135   "helper_1 s e n = (SOME y::'a. y \<in> s \<and> (\<forall>m<n. \<not> (dist (helper_1 s e m) y < e)))"
  3132 declare helper_1.simps[simp del]
  3136 declare helper_1.simps[simp del]
  3133 
  3137 
  5195 proof -
  5199 proof -
  5196   let ?D = "{dist x y |x y. x \<in> s \<and> y \<in> s}"
  5200   let ?D = "{dist x y |x y. x \<in> s \<and> y \<in> s}"
  5197   from s obtain z d where z: "\<And>x. x \<in> s \<Longrightarrow> dist z x \<le> d"
  5201   from s obtain z d where z: "\<And>x. x \<in> s \<Longrightarrow> dist z x \<le> d"
  5198     unfolding bounded_def by auto
  5202     unfolding bounded_def by auto
  5199   have "dist x y \<le> Sup ?D"
  5203   have "dist x y \<le> Sup ?D"
  5200   proof (rule Sup_upper, safe)
  5204   proof (rule cSup_upper, safe)
  5201     fix a b assume "a \<in> s" "b \<in> s"
  5205     fix a b assume "a \<in> s" "b \<in> s"
  5202     with z[of a] z[of b] dist_triangle[of a b z]
  5206     with z[of a] z[of b] dist_triangle[of a b z]
  5203     show "dist a b \<le> 2 * d"
  5207     show "dist a b \<le> 2 * d"
  5204       by (simp add: dist_commute)
  5208       by (simp add: dist_commute)
  5205   qed (insert s, auto)
  5209   qed (insert s, auto)
  5217   moreover
  5221   moreover
  5218   from d have "s \<noteq> {}"
  5222   from d have "s \<noteq> {}"
  5219     by (auto simp: diameter_def)
  5223     by (auto simp: diameter_def)
  5220   then have "?D \<noteq> {}" by auto
  5224   then have "?D \<noteq> {}" by auto
  5221   ultimately have "Sup ?D \<le> d"
  5225   ultimately have "Sup ?D \<le> d"
  5222     by (intro Sup_least) (auto simp: not_less)
  5226     by (intro cSup_least) (auto simp: not_less)
  5223   with `d < diameter s` `s \<noteq> {}` show False
  5227   with `d < diameter s` `s \<noteq> {}` show False
  5224     by (auto simp: diameter_def)
  5228     by (auto simp: diameter_def)
  5225 qed
  5229 qed
  5226 
  5230 
  5227 lemma diameter_bounded:
  5231 lemma diameter_bounded:
  5237 proof -
  5241 proof -
  5238   have b:"bounded s" using assms(1) by (rule compact_imp_bounded)
  5242   have b:"bounded s" using assms(1) by (rule compact_imp_bounded)
  5239   then obtain x y where xys:"x\<in>s" "y\<in>s" and xy:"\<forall>u\<in>s. \<forall>v\<in>s. dist u v \<le> dist x y"
  5243   then obtain x y where xys:"x\<in>s" "y\<in>s" and xy:"\<forall>u\<in>s. \<forall>v\<in>s. dist u v \<le> dist x y"
  5240     using compact_sup_maxdistance[OF assms] by auto
  5244     using compact_sup_maxdistance[OF assms] by auto
  5241   hence "diameter s \<le> dist x y"
  5245   hence "diameter s \<le> dist x y"
  5242     unfolding diameter_def by clarsimp (rule Sup_least, fast+)
  5246     unfolding diameter_def by clarsimp (rule cSup_least, fast+)
  5243   thus ?thesis
  5247   thus ?thesis
  5244     by (metis b diameter_bounded_bound order_antisym xys)
  5248     by (metis b diameter_bounded_bound order_antisym xys)
  5245 qed
  5249 qed
  5246 
  5250 
  5247 text {* Related results with closure as the conclusion. *}
  5251 text {* Related results with closure as the conclusion. *}
  6673   ultimately show "\<exists>!x\<in>s. g x = x" using `a \<in> s` by blast
  6677   ultimately show "\<exists>!x\<in>s. g x = x" using `a \<in> s` by blast
  6674 qed
  6678 qed
  6675 
  6679 
  6676 declare tendsto_const [intro] (* FIXME: move *)
  6680 declare tendsto_const [intro] (* FIXME: move *)
  6677 
  6681 
  6678 
       
  6679 end
  6682 end