src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
changeset 53640 3170b5eb9f5a
parent 53597 ea99a7964174
child 53813 0a62ad289c4d
     1.1 --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Sat Sep 14 22:50:15 2013 +0200
     1.2 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy	Sat Sep 14 23:52:36 2013 +0200
     1.3 @@ -25,7 +25,7 @@
     1.4    using dist_triangle[of y z x] by (simp add: dist_commute)
     1.5  
     1.6  (* LEGACY *)
     1.7 -lemma lim_subseq: "subseq r \<Longrightarrow> s ----> l \<Longrightarrow> (s o r) ----> l"
     1.8 +lemma lim_subseq: "subseq r \<Longrightarrow> s ----> l \<Longrightarrow> (s \<circ> r) ----> l"
     1.9    by (rule LIMSEQ_subseq_LIMSEQ)
    1.10  
    1.11  lemmas real_isGlb_unique = isGlb_unique[where 'a=real]
    1.12 @@ -85,7 +85,7 @@
    1.13    show "topological_basis B"
    1.14      using assms unfolding topological_basis_def
    1.15    proof safe
    1.16 -    fix O'::"'a set"
    1.17 +    fix O' :: "'a set"
    1.18      assume "open O'"
    1.19      with H obtain f where "\<forall>x\<in>O'. f x \<in> B \<and> x \<in> f x \<and> f x \<subseteq> O'"
    1.20        by (force intro: bchoice simp: Bex_def)
    1.21 @@ -138,14 +138,14 @@
    1.22  qed
    1.23  
    1.24  lemma basis_dense:
    1.25 -  fixes B::"'a set set"
    1.26 -    and f::"'a set \<Rightarrow> 'a"
    1.27 +  fixes B :: "'a set set"
    1.28 +    and f :: "'a set \<Rightarrow> 'a"
    1.29    assumes "topological_basis B"
    1.30      and choosefrom_basis: "\<And>B'. B' \<noteq> {} \<Longrightarrow> f B' \<in> B'"
    1.31    shows "(\<forall>X. open X \<longrightarrow> X \<noteq> {} \<longrightarrow> (\<exists>B' \<in> B. f B' \<in> X))"
    1.32  proof (intro allI impI)
    1.33 -  fix X::"'a set"
    1.34 -  assume "open X" "X \<noteq> {}"
    1.35 +  fix X :: "'a set"
    1.36 +  assume "open X" and "X \<noteq> {}"
    1.37    from topological_basisE[OF `topological_basis B` `open X` choosefrom_basis[OF `X \<noteq> {}`]]
    1.38    guess B' . note B' = this
    1.39    then show "\<exists>B'\<in>B. f B' \<in> X"
    1.40 @@ -180,7 +180,7 @@
    1.41  subsection {* Countable Basis *}
    1.42  
    1.43  locale countable_basis =
    1.44 -  fixes B::"'a::topological_space set set"
    1.45 +  fixes B :: "'a::topological_space set set"
    1.46    assumes is_basis: "topological_basis B"
    1.47      and countable_basis: "countable B"
    1.48  begin
    1.49 @@ -283,8 +283,9 @@
    1.50    proof (rule first_countableI[of "(\<lambda>(a, b). a \<times> b) ` (A \<times> B)"], safe)
    1.51      fix a b
    1.52      assume x: "a \<in> A" "b \<in> B"
    1.53 -    with A(2, 3)[of a] B(2, 3)[of b] show "x \<in> a \<times> b" "open (a \<times> b)"
    1.54 -      unfolding mem_Times_iff by (auto intro: open_Times)
    1.55 +    with A(2, 3)[of a] B(2, 3)[of b] show "x \<in> a \<times> b" and "open (a \<times> b)"
    1.56 +      unfolding mem_Times_iff
    1.57 +      by (auto intro: open_Times)
    1.58    next
    1.59      fix S
    1.60      assume "open S" "x \<in> S"
    1.61 @@ -418,7 +419,7 @@
    1.62  
    1.63  text{* Infer the "universe" from union of all sets in the topology. *}
    1.64  
    1.65 -definition "topspace T =  \<Union>{S. openin T S}"
    1.66 +definition "topspace T = \<Union>{S. openin T S}"
    1.67  
    1.68  subsubsection {* Main properties of open sets *}
    1.69  
    1.70 @@ -1007,7 +1008,7 @@
    1.71  
    1.72  lemma islimpt_approachable_le:
    1.73    fixes x :: "'a::metric_space"
    1.74 -  shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> S. x' \<noteq> x \<and> dist x' x <= e)"
    1.75 +  shows "x islimpt S \<longleftrightarrow> (\<forall>e>0. \<exists>x'\<in> S. x' \<noteq> x \<and> dist x' x \<le> e)"
    1.76    unfolding islimpt_approachable
    1.77    using approachable_lt_le [where f="\<lambda>y. dist y x" and P="\<lambda>y. y \<notin> S \<or> y = x",
    1.78      THEN arg_cong [where f=Not]]
    1.79 @@ -1043,7 +1044,7 @@
    1.80  lemma finite_set_avoid:
    1.81    fixes a :: "'a::metric_space"
    1.82    assumes fS: "finite S"
    1.83 -  shows  "\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<longrightarrow> d <= dist a x"
    1.84 +  shows  "\<exists>d>0. \<forall>x\<in>S. x \<noteq> a \<longrightarrow> d \<le> dist a x"
    1.85  proof (induct rule: finite_induct[OF fS])
    1.86    case 1
    1.87    then show ?case by (auto intro: zero_less_one)
    1.88 @@ -1423,8 +1424,9 @@
    1.89    apply (drule_tac x=UNIV in spec, simp)
    1.90    done
    1.91  
    1.92 -lemma not_trivial_limit_within: "~trivial_limit (at x within S) = (x:closure(S-{x}))"
    1.93 -  using islimpt_in_closure by (metis trivial_limit_within)
    1.94 +lemma not_trivial_limit_within: "\<not> trivial_limit (at x within S) = (x \<in> closure (S - {x}))"
    1.95 +  using islimpt_in_closure
    1.96 +  by (metis trivial_limit_within)
    1.97  
    1.98  text {* Some property holds "sufficiently close" to the limit point. *}
    1.99  
   1.100 @@ -1463,19 +1465,19 @@
   1.101  text{* Show that they yield usual definitions in the various cases. *}
   1.102  
   1.103  lemma Lim_within_le: "(f ---> l)(at a within S) \<longleftrightarrow>
   1.104 -           (\<forall>e>0. \<exists>d>0. \<forall>x\<in>S. 0 < dist x a  \<and> dist x a  <= d \<longrightarrow> dist (f x) l < e)"
   1.105 +    (\<forall>e>0. \<exists>d>0. \<forall>x\<in>S. 0 < dist x a \<and> dist x a \<le> d \<longrightarrow> dist (f x) l < e)"
   1.106    by (auto simp add: tendsto_iff eventually_at_le dist_nz)
   1.107  
   1.108  lemma Lim_within: "(f ---> l) (at a within S) \<longleftrightarrow>
   1.109 -        (\<forall>e >0. \<exists>d>0. \<forall>x \<in> S. 0 < dist x a  \<and> dist x a  < d  \<longrightarrow> dist (f x) l < e)"
   1.110 +    (\<forall>e >0. \<exists>d>0. \<forall>x \<in> S. 0 < dist x a \<and> dist x a  < d \<longrightarrow> dist (f x) l < e)"
   1.111    by (auto simp add: tendsto_iff eventually_at dist_nz)
   1.112  
   1.113  lemma Lim_at: "(f ---> l) (at a) \<longleftrightarrow>
   1.114 -        (\<forall>e >0. \<exists>d>0. \<forall>x. 0 < dist x a  \<and> dist x a  < d  \<longrightarrow> dist (f x) l < e)"
   1.115 +    (\<forall>e >0. \<exists>d>0. \<forall>x. 0 < dist x a \<and> dist x a < d  \<longrightarrow> dist (f x) l < e)"
   1.116    by (auto simp add: tendsto_iff eventually_at2)
   1.117  
   1.118  lemma Lim_at_infinity:
   1.119 -  "(f ---> l) at_infinity \<longleftrightarrow> (\<forall>e>0. \<exists>b. \<forall>x. norm x >= b \<longrightarrow> dist (f x) l < e)"
   1.120 +  "(f ---> l) at_infinity \<longleftrightarrow> (\<forall>e>0. \<exists>b. \<forall>x. norm x \<ge> b \<longrightarrow> dist (f x) l < e)"
   1.121    by (auto simp add: tendsto_iff eventually_at_infinity)
   1.122  
   1.123  lemma Lim_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> (f ---> l) net"
   1.124 @@ -1489,7 +1491,8 @@
   1.125  lemma Lim_Un:
   1.126    assumes "(f ---> l) (at x within S)" "(f ---> l) (at x within T)"
   1.127    shows "(f ---> l) (at x within (S \<union> T))"
   1.128 -  using assms unfolding tendsto_def eventually_at_filter
   1.129 +  using assms
   1.130 +  unfolding tendsto_def eventually_at_filter
   1.131    apply clarify
   1.132    apply (drule spec, drule (1) mp, drule (1) mp)
   1.133    apply (drule spec, drule (1) mp, drule (1) mp)
   1.134 @@ -1515,10 +1518,10 @@
   1.135    from assms obtain T where T: "open T" "x \<in> T" "T \<subseteq> S" ..
   1.136    {
   1.137      assume "?lhs"
   1.138 -    then obtain A where "open A" "x \<in> A" "\<forall>y\<in>A. y \<noteq> x \<longrightarrow> y \<in> S \<longrightarrow> P y"
   1.139 +    then obtain A where "open A" and "x \<in> A" and "\<forall>y\<in>A. y \<noteq> x \<longrightarrow> y \<in> S \<longrightarrow> P y"
   1.140        unfolding eventually_at_topological
   1.141        by auto
   1.142 -    with T have "open (A \<inter> T)" "x \<in> A \<inter> T" "\<forall>y\<in>(A \<inter> T). y \<noteq> x \<longrightarrow> P y"
   1.143 +    with T have "open (A \<inter> T)" and "x \<in> A \<inter> T" and "\<forall>y \<in> A \<inter> T. y \<noteq> x \<longrightarrow> P y"
   1.144        by auto
   1.145      then show "?rhs"
   1.146        unfolding eventually_at_topological by auto
   1.147 @@ -1546,11 +1549,11 @@
   1.148    assumes mono: "\<And>a b. a \<in> I \<Longrightarrow> b \<in> I \<Longrightarrow> x < a \<Longrightarrow> a \<le> b \<Longrightarrow> f a \<le> f b"
   1.149      and bnd: "\<And>a. a \<in> I \<Longrightarrow> x < a \<Longrightarrow> K \<le> f a"
   1.150    shows "(f ---> Inf (f ` ({x<..} \<inter> I))) (at x within ({x<..} \<inter> I))"
   1.151 -proof cases
   1.152 -  assume "{x<..} \<inter> I = {}"
   1.153 +proof (cases "{x<..} \<inter> I = {}")
   1.154 +  case True
   1.155    then show ?thesis by (simp add: Lim_within_empty)
   1.156  next
   1.157 -  assume e: "{x<..} \<inter> I \<noteq> {}"
   1.158 +  case False
   1.159    show ?thesis
   1.160    proof (rule order_tendstoI)
   1.161      fix a
   1.162 @@ -1558,7 +1561,7 @@
   1.163      {
   1.164        fix y
   1.165        assume "y \<in> {x<..} \<inter> I"
   1.166 -      with e bnd have "Inf (f ` ({x<..} \<inter> I)) \<le> f y"
   1.167 +      with False bnd have "Inf (f ` ({x<..} \<inter> I)) \<le> f y"
   1.168          by (auto intro: cInf_lower)
   1.169        with a have "a < f y"
   1.170          by (blast intro: less_le_trans)
   1.171 @@ -1568,7 +1571,7 @@
   1.172    next
   1.173      fix a
   1.174      assume "Inf (f ` ({x<..} \<inter> I)) < a"
   1.175 -    from cInf_lessD[OF _ this] e obtain y where y: "x < y" "y \<in> I" "f y < a"
   1.176 +    from cInf_lessD[OF _ this] False obtain y where y: "x < y" "y \<in> I" "f y < a"
   1.177        by auto
   1.178      then have "eventually (\<lambda>x. x \<in> I \<longrightarrow> f x < a) (at_right x)"
   1.179        unfolding eventually_at_right by (metis less_imp_le le_less_trans mono)
   1.180 @@ -1625,7 +1628,7 @@
   1.181      and A :: "'a filter"
   1.182    assumes "(f ---> l) A"
   1.183      and "l \<noteq> 0"
   1.184 -  shows "((inverse o f) ---> inverse l) A"
   1.185 +  shows "((inverse \<circ> f) ---> inverse l) A"
   1.186    unfolding o_def using assms by (rule tendsto_inverse)
   1.187  
   1.188  lemma Lim_null:
   1.189 @@ -1646,7 +1649,7 @@
   1.190  lemma Lim_transform_bound:
   1.191    fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
   1.192      and g :: "'a \<Rightarrow> 'c::real_normed_vector"
   1.193 -  assumes "eventually (\<lambda>n. norm(f n) <= norm(g n)) net"
   1.194 +  assumes "eventually (\<lambda>n. norm (f n) \<le> norm (g n)) net"
   1.195      and "(g ---> 0) net"
   1.196    shows "(f ---> 0) net"
   1.197    using assms(1) tendsto_norm_zero [OF assms(2)]
   1.198 @@ -1657,7 +1660,7 @@
   1.199  lemma Lim_in_closed_set:
   1.200    assumes "closed S"
   1.201      and "eventually (\<lambda>x. f(x) \<in> S) net"
   1.202 -    and "\<not>(trivial_limit net)" "(f ---> l) net"
   1.203 +    and "\<not> trivial_limit net" "(f ---> l) net"
   1.204    shows "l \<in> S"
   1.205  proof (rule ccontr)
   1.206    assume "l \<notin> S"
   1.207 @@ -1676,8 +1679,8 @@
   1.208  lemma Lim_dist_ubound:
   1.209    assumes "\<not>(trivial_limit net)"
   1.210      and "(f ---> l) net"
   1.211 -    and "eventually (\<lambda>x. dist a (f x) <= e) net"
   1.212 -  shows "dist a l <= e"
   1.213 +    and "eventually (\<lambda>x. dist a (f x) \<le> e) net"
   1.214 +  shows "dist a l \<le> e"
   1.215  proof -
   1.216    have "dist a l \<in> {..e}"
   1.217    proof (rule Lim_in_closed_set)
   1.218 @@ -1714,7 +1717,9 @@
   1.219  
   1.220  lemma Lim_norm_lbound:
   1.221    fixes f :: "'a \<Rightarrow> 'b::real_normed_vector"
   1.222 -  assumes "\<not> (trivial_limit net)"  "(f ---> l) net"  "eventually (\<lambda>x. e <= norm(f x)) net"
   1.223 +  assumes "\<not> trivial_limit net"
   1.224 +    and "(f ---> l) net"
   1.225 +    and "eventually (\<lambda>x. e \<le> norm (f x)) net"
   1.226    shows "e \<le> norm l"
   1.227  proof -
   1.228    have "norm l \<in> {e..}"
   1.229 @@ -1946,7 +1951,7 @@
   1.230  
   1.231  
   1.232  lemma not_trivial_limit_within_ball:
   1.233 -  "(\<not> trivial_limit (at x within S)) = (\<forall>e>0. S \<inter> ball x e - {x} \<noteq> {})"
   1.234 +  "\<not> trivial_limit (at x within S) \<longleftrightarrow> (\<forall>e>0. S \<inter> ball x e - {x} \<noteq> {})"
   1.235    (is "?lhs = ?rhs")
   1.236  proof -
   1.237    {
   1.238 @@ -1954,12 +1959,12 @@
   1.239      {
   1.240        fix e :: real
   1.241        assume "e > 0"
   1.242 -      then obtain y where "y:(S-{x}) & dist y x < e"
   1.243 +      then obtain y where "y \<in> S - {x}" and "dist y x < e"
   1.244          using `?lhs` not_trivial_limit_within[of x S] closure_approachable[of x "S - {x}"]
   1.245          by auto
   1.246 -      then have "y : (S Int ball x e - {x})"
   1.247 +      then have "y \<in> S \<inter> ball x e - {x}"
   1.248          unfolding ball_def by (simp add: dist_commute)
   1.249 -      then have "S Int ball x e - {x} ~= {}" by blast
   1.250 +      then have "S \<inter> ball x e - {x} \<noteq> {}" by blast
   1.251      }
   1.252      then have "?rhs" by auto
   1.253    }
   1.254 @@ -1969,11 +1974,11 @@
   1.255      {
   1.256        fix e :: real
   1.257        assume "e > 0"
   1.258 -      then obtain y where "y : (S Int ball x e - {x})"
   1.259 +      then obtain y where "y \<in> S \<inter> ball x e - {x}"
   1.260          using `?rhs` by blast
   1.261 -      then have "y:(S-{x}) & dist y x < e"
   1.262 -        unfolding ball_def by (simp add: dist_commute)
   1.263 -      then have "EX y:(S-{x}). dist y x < e"
   1.264 +      then have "y \<in> S - {x}" and "dist y x < e"
   1.265 +        unfolding ball_def by (simp_all add: dist_commute)
   1.266 +      then have "\<exists>y \<in> S - {x}. dist y x < e"
   1.267          by auto
   1.268      }
   1.269      then have "?lhs"
   1.270 @@ -2004,16 +2009,18 @@
   1.271    assumes "a \<in> A"
   1.272    shows "infdist a A = 0"
   1.273  proof -
   1.274 -  from infdist_le[OF assms, of "dist a a"] have "infdist a A \<le> 0" by auto
   1.275 -  with infdist_nonneg[of a A] assms show "infdist a A = 0" by auto
   1.276 +  from infdist_le[OF assms, of "dist a a"] have "infdist a A \<le> 0"
   1.277 +    by auto
   1.278 +  with infdist_nonneg[of a A] assms show "infdist a A = 0"
   1.279 +    by auto
   1.280  qed
   1.281  
   1.282  lemma infdist_triangle: "infdist x A \<le> infdist y A + dist x y"
   1.283 -proof cases
   1.284 -  assume "A = {}"
   1.285 +proof (cases "A = {}")
   1.286 +  case True
   1.287    then show ?thesis by (simp add: infdist_def)
   1.288  next
   1.289 -  assume "A \<noteq> {}"
   1.290 +  case False
   1.291    then obtain a where "a \<in> A" by auto
   1.292    have "infdist x A \<le> Inf {dist x y + dist y a |a. a \<in> A}"
   1.293    proof (rule cInf_greatest)
   1.294 @@ -2202,7 +2209,7 @@
   1.295    ultimately show "?rhs" by auto
   1.296  next
   1.297    assume "?rhs"
   1.298 -  then have "e>0" by auto
   1.299 +  then have "e > 0" by auto
   1.300    {
   1.301      fix d :: real
   1.302      assume "d > 0"
   1.303 @@ -2340,7 +2347,7 @@
   1.304  lemma interior_cball:
   1.305    fixes x :: "'a::{real_normed_vector, perfect_space}"
   1.306    shows "interior (cball x e) = ball x e"
   1.307 -proof (cases "e\<ge>0")
   1.308 +proof (cases "e \<ge> 0")
   1.309    case False note cs = this
   1.310    from cs have "ball x e = {}"
   1.311      using ball_empty[of e x] by auto
   1.312 @@ -2409,7 +2416,9 @@
   1.313    then have "\<forall>S \<subseteq> cball x e. open S \<longrightarrow> S \<subseteq> ball x e"
   1.314      by auto
   1.315    ultimately show ?thesis
   1.316 -    using interior_unique[of "ball x e" "cball x e"] using open_ball[of x e] by auto
   1.317 +    using interior_unique[of "ball x e" "cball x e"]
   1.318 +    using open_ball[of x e]
   1.319 +    by auto
   1.320  qed
   1.321  
   1.322  lemma frontier_ball:
   1.323 @@ -2422,13 +2431,13 @@
   1.324  
   1.325  lemma frontier_cball:
   1.326    fixes a :: "'a::{real_normed_vector, perfect_space}"
   1.327 -  shows "frontier(cball a e) = {x. dist a x = e}"
   1.328 +  shows "frontier (cball a e) = {x. dist a x = e}"
   1.329    apply (simp add: frontier_def interior_cball closed_cball order_less_imp_le)
   1.330    apply (simp add: set_eq_iff)
   1.331    apply arith
   1.332    done
   1.333  
   1.334 -lemma cball_eq_empty: "(cball x e = {}) \<longleftrightarrow> e < 0"
   1.335 +lemma cball_eq_empty: "cball x e = {} \<longleftrightarrow> e < 0"
   1.336    apply (simp add: set_eq_iff not_le)
   1.337    apply (metis zero_le_dist dist_self order_less_le_trans)
   1.338    done
   1.339 @@ -2438,7 +2447,7 @@
   1.340  
   1.341  lemma cball_eq_sing:
   1.342    fixes x :: "'a::{metric_space,perfect_space}"
   1.343 -  shows "(cball x e = {x}) \<longleftrightarrow> e = 0"
   1.344 +  shows "cball x e = {x} \<longleftrightarrow> e = 0"
   1.345  proof (rule linorder_cases)
   1.346    assume e: "0 < e"
   1.347    obtain a where "a \<noteq> x" "dist a x < e"
   1.348 @@ -2466,7 +2475,8 @@
   1.349  lemma bounded_any_center: "bounded S \<longleftrightarrow> (\<exists>e. \<forall>y\<in>S. dist a y \<le> e)"
   1.350    unfolding bounded_def
   1.351    apply safe
   1.352 -  apply (rule_tac x="dist a x + e" in exI, clarify)
   1.353 +  apply (rule_tac x="dist a x + e" in exI)
   1.354 +  apply clarify
   1.355    apply (drule (1) bspec)
   1.356    apply (erule order_trans [OF dist_triangle add_left_mono])
   1.357    apply auto
   1.358 @@ -2526,7 +2536,7 @@
   1.359    apply auto
   1.360    done
   1.361  
   1.362 -lemma bounded_ball[simp,intro]: "bounded(ball x e)"
   1.363 +lemma bounded_ball[simp,intro]: "bounded (ball x e)"
   1.364    by (metis ball_subset_cball bounded_cball bounded_subset)
   1.365  
   1.366  lemma bounded_Un[simp]: "bounded (S \<union> T) \<longleftrightarrow> bounded S \<and> bounded T"
   1.367 @@ -2534,14 +2544,16 @@
   1.368    apply (rename_tac x y r s)
   1.369    apply (rule_tac x=x in exI)
   1.370    apply (rule_tac x="max r (dist x y + s)" in exI)
   1.371 -  apply (rule ballI, rename_tac z, safe)
   1.372 -  apply (drule (1) bspec, simp)
   1.373 +  apply (rule ballI)
   1.374 +  apply safe
   1.375 +  apply (drule (1) bspec)
   1.376 +  apply simp
   1.377    apply (drule (1) bspec)
   1.378    apply (rule min_max.le_supI2)
   1.379    apply (erule order_trans [OF dist_triangle add_left_mono])
   1.380    done
   1.381  
   1.382 -lemma bounded_Union[intro]: "finite F \<Longrightarrow> (\<forall>S\<in>F. bounded S) \<Longrightarrow> bounded(\<Union>F)"
   1.383 +lemma bounded_Union[intro]: "finite F \<Longrightarrow> \<forall>S\<in>F. bounded S \<Longrightarrow> bounded (\<Union>F)"
   1.384    by (induct rule: finite_induct[of F]) auto
   1.385  
   1.386  lemma bounded_UN [intro]: "finite A \<Longrightarrow> \<forall>x\<in>A. bounded (B x) \<Longrightarrow> bounded (\<Union>x\<in>A. B x)"
   1.387 @@ -2549,22 +2561,27 @@
   1.388  
   1.389  lemma bounded_insert [simp]: "bounded (insert x S) \<longleftrightarrow> bounded S"
   1.390  proof -
   1.391 -  have "\<forall>y\<in>{x}. dist x y \<le> 0" by simp
   1.392 -  then have "bounded {x}" unfolding bounded_def by fast
   1.393 -  then show ?thesis by (metis insert_is_Un bounded_Un)
   1.394 +  have "\<forall>y\<in>{x}. dist x y \<le> 0"
   1.395 +    by simp
   1.396 +  then have "bounded {x}"
   1.397 +    unfolding bounded_def by fast
   1.398 +  then show ?thesis
   1.399 +    by (metis insert_is_Un bounded_Un)
   1.400  qed
   1.401  
   1.402  lemma finite_imp_bounded [intro]: "finite S \<Longrightarrow> bounded S"
   1.403    by (induct set: finite) simp_all
   1.404  
   1.405 -lemma bounded_pos: "bounded S \<longleftrightarrow> (\<exists>b>0. \<forall>x\<in> S. norm x <= b)"
   1.406 +lemma bounded_pos: "bounded S \<longleftrightarrow> (\<exists>b>0. \<forall>x\<in> S. norm x \<le> b)"
   1.407    apply (simp add: bounded_iff)
   1.408 -  apply (subgoal_tac "\<And>x (y::real). 0 < 1 + abs y \<and> (x <= y \<longrightarrow> x <= 1 + abs y)")
   1.409 +  apply (subgoal_tac "\<And>x (y::real). 0 < 1 + abs y \<and> (x \<le> y \<longrightarrow> x \<le> 1 + abs y)")
   1.410    apply metis
   1.411    apply arith
   1.412    done
   1.413  
   1.414 -lemma Bseq_eq_bounded: "Bseq f \<longleftrightarrow> bounded (range f::_::real_normed_vector set)"
   1.415 +lemma Bseq_eq_bounded:
   1.416 +  fixes f :: "nat \<Rightarrow> 'a::real_normed_vector"
   1.417 +  shows "Bseq f \<longleftrightarrow> bounded (range f)"
   1.418    unfolding Bseq_def bounded_pos by auto
   1.419  
   1.420  lemma bounded_Int[intro]: "bounded S \<or> bounded T \<Longrightarrow> bounded (S \<inter> T)"
   1.421 @@ -2575,11 +2592,13 @@
   1.422  
   1.423  lemma not_bounded_UNIV[simp, intro]:
   1.424    "\<not> bounded (UNIV :: 'a::{real_normed_vector, perfect_space} set)"
   1.425 -proof(auto simp add: bounded_pos not_le)
   1.426 +proof (auto simp add: bounded_pos not_le)
   1.427    obtain x :: 'a where "x \<noteq> 0"
   1.428      using perfect_choose_dist [OF zero_less_one] by fast
   1.429 -  fix b::real  assume b: "b >0"
   1.430 -  have b1: "b +1 \<ge> 0" using b by simp
   1.431 +  fix b :: real
   1.432 +  assume b: "b >0"
   1.433 +  have b1: "b +1 \<ge> 0"
   1.434 +    using b by simp
   1.435    with `x \<noteq> 0` have "b < norm (scaleR (b + 1) (sgn x))"
   1.436      by (simp add: norm_sgn)
   1.437    then show "\<exists>x::'a. b < norm x" ..
   1.438 @@ -2590,15 +2609,17 @@
   1.439      and "bounded_linear f"
   1.440    shows "bounded (f ` S)"
   1.441  proof -
   1.442 -  from assms(1) obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b"
   1.443 +  from assms(1) obtain b where b: "b > 0" "\<forall>x\<in>S. norm x \<le> b"
   1.444      unfolding bounded_pos by auto
   1.445 -  from assms(2) obtain B where B:"B>0" "\<forall>x. norm (f x) \<le> B * norm x"
   1.446 +  from assms(2) obtain B where B: "B > 0" "\<forall>x. norm (f x) \<le> B * norm x"
   1.447      using bounded_linear.pos_bounded by (auto simp add: mult_ac)
   1.448    {
   1.449      fix x
   1.450 -    assume "x\<in>S"
   1.451 -    then have "norm x \<le> b" using b by auto
   1.452 -    then have "norm (f x) \<le> B * b" using B(2)
   1.453 +    assume "x \<in> S"
   1.454 +    then have "norm x \<le> b"
   1.455 +      using b by auto
   1.456 +    then have "norm (f x) \<le> B * b"
   1.457 +      using B(2)
   1.458        apply (erule_tac x=x in allE)
   1.459        apply (metis B(1) B(2) order_trans mult_le_cancel_left_pos)
   1.460        done
   1.461 @@ -2624,11 +2645,11 @@
   1.462    assumes "bounded S"
   1.463    shows "bounded ((\<lambda>x. a + x) ` S)"
   1.464  proof -
   1.465 -  from assms obtain b where b:"b>0" "\<forall>x\<in>S. norm x \<le> b"
   1.466 +  from assms obtain b where b: "b > 0" "\<forall>x\<in>S. norm x \<le> b"
   1.467      unfolding bounded_pos by auto
   1.468    {
   1.469      fix x
   1.470 -    assume "x\<in>S"
   1.471 +    assume "x \<in> S"
   1.472      then have "norm (a + x) \<le> b + norm a"
   1.473        using norm_triangle_ineq[of a x] b by auto
   1.474    }
   1.475 @@ -2648,7 +2669,8 @@
   1.476  
   1.477  lemma bounded_has_Sup:
   1.478    fixes S :: "real set"
   1.479 -  assumes "bounded S" "S \<noteq> {}"
   1.480 +  assumes "bounded S"
   1.481 +    and "S \<noteq> {}"
   1.482    shows "\<forall>x\<in>S. x \<le> Sup S"
   1.483      and "\<forall>b. (\<forall>x\<in>S. x \<le> b) \<longrightarrow> Sup S \<le> b"
   1.484  proof
   1.485 @@ -2679,18 +2701,19 @@
   1.486  
   1.487  lemma bounded_has_Inf:
   1.488    fixes S :: "real set"
   1.489 -  assumes "bounded S"  "S \<noteq> {}"
   1.490 +  assumes "bounded S"
   1.491 +    and "S \<noteq> {}"
   1.492    shows "\<forall>x\<in>S. x \<ge> Inf S"
   1.493      and "\<forall>b. (\<forall>x\<in>S. x \<ge> b) \<longrightarrow> Inf S \<ge> b"
   1.494  proof
   1.495    fix x
   1.496 -  assume "x\<in>S"
   1.497 +  assume "x \<in> S"
   1.498    from assms(1) obtain a where a: "\<forall>x\<in>S. \<bar>x\<bar> \<le> a"
   1.499      unfolding bounded_real by auto
   1.500 -  then show "x \<ge> Inf S" using `x\<in>S`
   1.501 +  then show "x \<ge> Inf S" using `x \<in> S`
   1.502      by (metis cInf_lower_EX abs_le_D2 minus_le_iff)
   1.503  next
   1.504 -  show "\<forall>b. (\<forall>x\<in>S. x >= b) \<longrightarrow> Inf S \<ge> b"
   1.505 +  show "\<forall>b. (\<forall>x\<in>S. x \<ge> b) \<longrightarrow> Inf S \<ge> b"
   1.506      using assms by (metis cInf_greatest)
   1.507  qed
   1.508  
   1.509 @@ -2715,25 +2738,29 @@
   1.510  subsubsection {* Bolzano-Weierstrass property *}
   1.511  
   1.512  lemma heine_borel_imp_bolzano_weierstrass:
   1.513 -  assumes "compact s" and "infinite t" and "t \<subseteq> s"
   1.514 +  assumes "compact s"
   1.515 +    and "infinite t"
   1.516 +    and "t \<subseteq> s"
   1.517    shows "\<exists>x \<in> s. x islimpt t"
   1.518  proof (rule ccontr)
   1.519    assume "\<not> (\<exists>x \<in> s. x islimpt t)"
   1.520 -  then obtain f where f:"\<forall>x\<in>s. x \<in> f x \<and> open (f x) \<and> (\<forall>y\<in>t. y \<in> f x \<longrightarrow> y = x)"
   1.521 +  then obtain f where f: "\<forall>x\<in>s. x \<in> f x \<and> open (f x) \<and> (\<forall>y\<in>t. y \<in> f x \<longrightarrow> y = x)"
   1.522      unfolding islimpt_def
   1.523      using bchoice[of s "\<lambda> x T. x \<in> T \<and> open T \<and> (\<forall>y\<in>t. y \<in> T \<longrightarrow> y = x)"]
   1.524      by auto
   1.525 -  obtain g where g: "g\<subseteq>{t. \<exists>x. x \<in> s \<and> t = f x}" "finite g" "s \<subseteq> \<Union>g"
   1.526 +  obtain g where g: "g \<subseteq> {t. \<exists>x. x \<in> s \<and> t = f x}" "finite g" "s \<subseteq> \<Union>g"
   1.527      using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="{t. \<exists>x. x\<in>s \<and> t = f x}"]]
   1.528      using f by auto
   1.529 -  from g(1,3) have g':"\<forall>x\<in>g. \<exists>xa \<in> s. x = f xa" by auto
   1.530 +  from g(1,3) have g':"\<forall>x\<in>g. \<exists>xa \<in> s. x = f xa"
   1.531 +    by auto
   1.532    {
   1.533      fix x y
   1.534 -    assume "x\<in>t" "y\<in>t" "f x = f y"
   1.535 +    assume "x \<in> t" "y \<in> t" "f x = f y"
   1.536      then have "x \<in> f x"  "y \<in> f x \<longrightarrow> y = x"
   1.537 -      using f[THEN bspec[where x=x]] and `t\<subseteq>s` by auto
   1.538 +      using f[THEN bspec[where x=x]] and `t \<subseteq> s` by auto
   1.539      then have "x = y"
   1.540 -      using `f x = f y` and f[THEN bspec[where x=y]] and `y\<in>t` and `t\<subseteq>s` by auto
   1.541 +      using `f x = f y` and f[THEN bspec[where x=y]] and `y \<in> t` and `t \<subseteq> s`
   1.542 +      by auto
   1.543    }
   1.544    then have "inj_on f t"
   1.545      unfolding inj_on_def by simp
   1.546 @@ -2742,14 +2769,17 @@
   1.547    moreover
   1.548    {
   1.549      fix x
   1.550 -    assume "x\<in>t" "f x \<notin> g"
   1.551 -    from g(3) assms(3) `x\<in>t` obtain h where "h\<in>g" and "x\<in>h" by auto
   1.552 -    then obtain y where "y\<in>s" "h = f y"
   1.553 +    assume "x \<in> t" "f x \<notin> g"
   1.554 +    from g(3) assms(3) `x \<in> t` obtain h where "h \<in> g" and "x \<in> h"
   1.555 +      by auto
   1.556 +    then obtain y where "y \<in> s" "h = f y"
   1.557        using g'[THEN bspec[where x=h]] by auto
   1.558      then have "y = x"
   1.559 -      using f[THEN bspec[where x=y]] and `x\<in>t` and `x\<in>h`[unfolded `h = f y`] by auto
   1.560 +      using f[THEN bspec[where x=y]] and `x\<in>t` and `x\<in>h`[unfolded `h = f y`]
   1.561 +      by auto
   1.562      then have False
   1.563 -      using `f x \<notin> g` `h\<in>g` unfolding `h = f y` by auto
   1.564 +      using `f x \<notin> g` `h \<in> g` unfolding `h = f y`
   1.565 +      by auto
   1.566    }
   1.567    then have "f ` t \<subseteq> g" by auto
   1.568    ultimately show False
   1.569 @@ -2786,7 +2816,8 @@
   1.570    proof (rule topological_tendstoI)
   1.571      fix S
   1.572      assume "open S" "l \<in> S"
   1.573 -    with A(3) have "eventually (\<lambda>i. A i \<subseteq> S) sequentially" by auto
   1.574 +    with A(3) have "eventually (\<lambda>i. A i \<subseteq> S) sequentially"
   1.575 +      by auto
   1.576      moreover
   1.577      {
   1.578        fix i
   1.579 @@ -2810,12 +2841,18 @@
   1.580    shows "infinite (range f)"
   1.581  proof
   1.582    assume "finite (range f)"
   1.583 -  then have "closed (range f)" by (rule finite_imp_closed)
   1.584 -  then have "open (- range f)" by (rule open_Compl)
   1.585 -  from assms(1) have "l \<in> - range f" by auto
   1.586 +  then have "closed (range f)"
   1.587 +    by (rule finite_imp_closed)
   1.588 +  then have "open (- range f)"
   1.589 +    by (rule open_Compl)
   1.590 +  from assms(1) have "l \<in> - range f"
   1.591 +    by auto
   1.592    from assms(2) have "eventually (\<lambda>n. f n \<in> - range f) sequentially"
   1.593 -    using `open (- range f)` `l \<in> - range f` by (rule topological_tendstoD)
   1.594 -  then show False unfolding eventually_sequentially by auto
   1.595 +    using `open (- range f)` `l \<in> - range f`
   1.596 +    by (rule topological_tendstoD)
   1.597 +  then show False
   1.598 +    unfolding eventually_sequentially
   1.599 +    by auto
   1.600  qed
   1.601  
   1.602  lemma closure_insert:
   1.603 @@ -2928,7 +2965,7 @@
   1.604  qed
   1.605  
   1.606  lemma bolzano_weierstrass_imp_closed:
   1.607 -  fixes s :: "'a::{first_countable_topology, t2_space} set"
   1.608 +  fixes s :: "'a::{first_countable_topology,t2_space} set"
   1.609    assumes "\<forall>t. infinite t \<and> t \<subseteq> s --> (\<exists>x \<in> s. x islimpt t)"
   1.610    shows "closed s"
   1.611  proof -
   1.612 @@ -3276,7 +3313,7 @@
   1.613  
   1.614  definition seq_compact :: "'a::topological_space set \<Rightarrow> bool"
   1.615    where "seq_compact S \<longleftrightarrow>
   1.616 -    (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> (\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially))"
   1.617 +    (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> (\<exists>l\<in>S. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially))"
   1.618  
   1.619  lemma seq_compact_imp_countably_compact:
   1.620    fixes U :: "'a :: first_countable_topology set"
   1.621 @@ -3391,7 +3428,7 @@
   1.622  qed
   1.623  
   1.624  lemma seq_compactI:
   1.625 -  assumes "\<And>f. \<forall>n. f n \<in> S \<Longrightarrow> \<exists>l\<in>S. \<exists>r. subseq r \<and> ((f o r) ---> l) sequentially"
   1.626 +  assumes "\<And>f. \<forall>n. f n \<in> S \<Longrightarrow> \<exists>l\<in>S. \<exists>r. subseq r \<and> ((f \<circ> r) ---> l) sequentially"
   1.627    shows "seq_compact S"
   1.628    unfolding seq_compact_def using assms by fast
   1.629  
   1.630 @@ -3611,7 +3648,7 @@
   1.631  
   1.632  lemma compact_def:
   1.633    "compact (S :: 'a::metric_space set) \<longleftrightarrow>
   1.634 -   (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> (\<exists>l\<in>S. \<exists>r. subseq r \<and> (f o r) ----> l))"
   1.635 +   (\<forall>f. (\<forall>n. f n \<in> S) \<longrightarrow> (\<exists>l\<in>S. \<exists>r. subseq r \<and> (f \<circ> r) ----> l))"
   1.636    unfolding compact_eq_seq_compact_metric seq_compact_def by auto
   1.637  
   1.638  subsubsection {* Complete the chain of compactness variants *}
   1.639 @@ -4514,7 +4551,7 @@
   1.640    fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space"
   1.641    shows "continuous (at a within s) f \<longleftrightarrow>
   1.642      (\<forall>x. (\<forall>n::nat. x n \<in> s) \<and> (x ---> a) sequentially
   1.643 -         \<longrightarrow> ((f o x) ---> f a) sequentially)"
   1.644 +         \<longrightarrow> ((f \<circ> x) ---> f a) sequentially)"
   1.645    (is "?lhs = ?rhs")
   1.646  proof
   1.647    assume ?lhs
   1.648 @@ -4546,14 +4583,14 @@
   1.649  lemma continuous_at_sequentially:
   1.650    fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space"
   1.651    shows "continuous (at a) f \<longleftrightarrow>
   1.652 -    (\<forall>x. (x ---> a) sequentially --> ((f o x) ---> f a) sequentially)"
   1.653 +    (\<forall>x. (x ---> a) sequentially --> ((f \<circ> x) ---> f a) sequentially)"
   1.654    using continuous_within_sequentially[of a UNIV f] by simp
   1.655  
   1.656  lemma continuous_on_sequentially:
   1.657    fixes f :: "'a::metric_space \<Rightarrow> 'b::topological_space"
   1.658    shows "continuous_on s f \<longleftrightarrow>
   1.659      (\<forall>x. \<forall>a \<in> s. (\<forall>n. x(n) \<in> s) \<and> (x ---> a) sequentially
   1.660 -      --> ((f o x) ---> f(a)) sequentially)"
   1.661 +      --> ((f \<circ> x) ---> f a) sequentially)"
   1.662    (is "?lhs = ?rhs")
   1.663  proof
   1.664    assume ?rhs
   1.665 @@ -4804,8 +4841,8 @@
   1.666  
   1.667  lemma uniformly_continuous_on_compose[continuous_on_intros]:
   1.668    assumes "uniformly_continuous_on s f"  "uniformly_continuous_on (f ` s) g"
   1.669 -  shows "uniformly_continuous_on s (g o f)"
   1.670 -proof-
   1.671 +  shows "uniformly_continuous_on s (g \<circ> f)"
   1.672 +proof -
   1.673    {
   1.674      fix e :: real
   1.675      assume "e > 0"
   1.676 @@ -6818,7 +6855,7 @@
   1.677  
   1.678  lemma Lim_component_eq:
   1.679    fixes f :: "'a \<Rightarrow> 'b::euclidean_space"
   1.680 -  assumes net: "(f ---> l) net" "~(trivial_limit net)"
   1.681 +  assumes net: "(f ---> l) net" "\<not> trivial_limit net"
   1.682      and ev:"eventually (\<lambda>x. f(x)\<bullet>i = b) net"
   1.683    shows "l\<bullet>i = b"
   1.684    using ev[unfolded order_eq_iff eventually_conj_iff]
   1.685 @@ -6887,8 +6924,7 @@
   1.686    (\<forall>x\<in>s. (g(f x) = x)) \<and> (f ` s = t) \<and> continuous_on s f \<and>
   1.687    (\<forall>y\<in>t. (f(g y) = y)) \<and> (g ` t = s) \<and> continuous_on t g"
   1.688  
   1.689 -definition
   1.690 -  homeomorphic :: "'a::topological_space set \<Rightarrow> 'b::topological_space set \<Rightarrow> bool"
   1.691 +definition homeomorphic :: "'a::topological_space set \<Rightarrow> 'b::topological_space set \<Rightarrow> bool"
   1.692      (infixr "homeomorphic" 60)
   1.693    where "s homeomorphic t \<equiv> (\<exists>f g. homeomorphism s t f g)"
   1.694  
   1.695 @@ -7099,12 +7135,12 @@
   1.696  
   1.697  lemma cauchy_isometric:
   1.698    fixes x :: "nat \<Rightarrow> 'a::euclidean_space"
   1.699 -  assumes e: "0 < e"
   1.700 +  assumes e: "e > 0"
   1.701      and s: "subspace s"
   1.702      and f: "bounded_linear f"
   1.703 -    and normf: "\<forall>x\<in>s. norm(f x) \<ge> e * norm(x)"
   1.704 -    and xs: "\<forall>n::nat. x n \<in> s"
   1.705 -    and cf: "Cauchy(f o x)"
   1.706 +    and normf: "\<forall>x\<in>s. norm (f x) \<ge> e * norm x"
   1.707 +    and xs: "\<forall>n. x n \<in> s"
   1.708 +    and cf: "Cauchy (f \<circ> x)"
   1.709    shows "Cauchy x"
   1.710  proof -
   1.711    interpret f: bounded_linear f by fact
   1.712 @@ -7145,24 +7181,31 @@
   1.713      fix g
   1.714      assume as:"\<forall>n::nat. g n \<in> f ` s" and cfg:"Cauchy g"
   1.715      then obtain x where "\<forall>n. x n \<in> s \<and> g n = f (x n)"
   1.716 -      using choice[of "\<lambda> n xa. xa \<in> s \<and> g n = f xa"] by auto
   1.717 -    then have x:"\<forall>n. x n \<in> s"  "\<forall>n. g n = f (x n)" by auto
   1.718 -    then have "f \<circ> x = g" unfolding fun_eq_iff by auto
   1.719 +      using choice[of "\<lambda> n xa. xa \<in> s \<and> g n = f xa"]
   1.720 +      by auto
   1.721 +    then have x:"\<forall>n. x n \<in> s"  "\<forall>n. g n = f (x n)"
   1.722 +      by auto
   1.723 +    then have "f \<circ> x = g"
   1.724 +      unfolding fun_eq_iff
   1.725 +      by auto
   1.726      then obtain l where "l\<in>s" and l:"(x ---> l) sequentially"
   1.727        using cs[unfolded complete_def, THEN spec[where x="x"]]
   1.728 -      using cauchy_isometric[OF `0<e` s f normf] and cfg and x(1) by auto
   1.729 +      using cauchy_isometric[OF `0<e` s f normf] and cfg and x(1)
   1.730 +      by auto
   1.731      then have "\<exists>l\<in>f ` s. (g ---> l) sequentially"
   1.732        using linear_continuous_at[OF f, unfolded continuous_at_sequentially, THEN spec[where x=x], of l]
   1.733 -      unfolding `f \<circ> x = g` by auto
   1.734 +      unfolding `f \<circ> x = g`
   1.735 +      by auto
   1.736    }
   1.737 -  then show ?thesis unfolding complete_def by auto
   1.738 +  then show ?thesis
   1.739 +    unfolding complete_def by auto
   1.740  qed
   1.741  
   1.742  lemma injective_imp_isometric:
   1.743    fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
   1.744    assumes s: "closed s" "subspace s"
   1.745 -    and f: "bounded_linear f" "\<forall>x\<in>s. (f x = 0) \<longrightarrow> (x = 0)"
   1.746 -  shows "\<exists>e>0. \<forall>x\<in>s. norm (f x) \<ge> e * norm(x)"
   1.747 +    and f: "bounded_linear f" "\<forall>x\<in>s. f x = 0 \<longrightarrow> x = 0"
   1.748 +  shows "\<exists>e>0. \<forall>x\<in>s. norm (f x) \<ge> e * norm x"
   1.749  proof (cases "s \<subseteq> {0::'a}")
   1.750    case True
   1.751    {
   1.752 @@ -7175,8 +7218,10 @@
   1.753  next
   1.754    interpret f: bounded_linear f by fact
   1.755    case False
   1.756 -  then obtain a where a:"a\<noteq>0" "a\<in>s" by auto
   1.757 -  from False have "s \<noteq> {}" by auto
   1.758 +  then obtain a where a: "a \<noteq> 0" "a \<in> s"
   1.759 +    by auto
   1.760 +  from False have "s \<noteq> {}"
   1.761 +    by auto
   1.762    let ?S = "{f x| x. (x \<in> s \<and> norm x = norm a)}"
   1.763    let ?S' = "{x::'a. x\<in>s \<and> norm x = norm a}"
   1.764    let ?S'' = "{x::'a. norm x = norm a}"