src/HOL/Analysis/Uniform_Limit.thy
author paulson <lp15@cam.ac.uk>
Tue Feb 21 17:12:10 2017 +0000 (2017-02-21)
changeset 65037 2cf841ff23be
parent 65036 ab7e11730ad8
child 65204 d23eded35a33
permissions -rw-r--r--
some new material, also recasting some theorems using “obtains”
hoelzl@63627
     1
(*  Title:      HOL/Analysis/Uniform_Limit.thy
immler@60812
     2
    Author:     Christoph Traut, TU München
immler@60812
     3
    Author:     Fabian Immler, TU München
immler@60812
     4
*)
immler@60812
     5
immler@60812
     6
section \<open>Uniform Limit and Uniform Convergence\<close>
immler@60812
     7
immler@60812
     8
theory Uniform_Limit
hoelzl@63594
     9
imports Topology_Euclidean_Space Summation_Tests
immler@60812
    10
begin
immler@60812
    11
immler@60812
    12
definition uniformly_on :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b::metric_space) \<Rightarrow> ('a \<Rightarrow> 'b) filter"
immler@60812
    13
  where "uniformly_on S l = (INF e:{0 <..}. principal {f. \<forall>x\<in>S. dist (f x) (l x) < e})"
immler@60812
    14
immler@60812
    15
abbreviation
immler@60812
    16
  "uniform_limit S f l \<equiv> filterlim f (uniformly_on S l)"
immler@60812
    17
eberlm@61531
    18
definition uniformly_convergent_on where
eberlm@61531
    19
  "uniformly_convergent_on X f \<longleftrightarrow> (\<exists>l. uniform_limit X f l sequentially)"
eberlm@61531
    20
hoelzl@63594
    21
definition uniformly_Cauchy_on where
eberlm@61531
    22
  "uniformly_Cauchy_on X f \<longleftrightarrow> (\<forall>e>0. \<exists>M. \<forall>x\<in>X. \<forall>(m::nat)\<ge>M. \<forall>n\<ge>M. dist (f m x) (f n x) < e)"
hoelzl@63594
    23
immler@60812
    24
lemma uniform_limit_iff:
immler@60812
    25
  "uniform_limit S f l F \<longleftrightarrow> (\<forall>e>0. \<forall>\<^sub>F n in F. \<forall>x\<in>S. dist (f n x) (l x) < e)"
immler@60812
    26
  unfolding filterlim_iff uniformly_on_def
immler@60812
    27
  by (subst eventually_INF_base)
immler@60812
    28
    (fastforce
immler@60812
    29
      simp: eventually_principal uniformly_on_def
immler@60812
    30
      intro: bexI[where x="min a b" for a b]
lp15@61810
    31
      elim: eventually_mono)+
immler@60812
    32
immler@60812
    33
lemma uniform_limitD:
immler@60812
    34
  "uniform_limit S f l F \<Longrightarrow> e > 0 \<Longrightarrow> \<forall>\<^sub>F n in F. \<forall>x\<in>S. dist (f n x) (l x) < e"
immler@60812
    35
  by (simp add: uniform_limit_iff)
immler@60812
    36
immler@60812
    37
lemma uniform_limitI:
immler@60812
    38
  "(\<And>e. e > 0 \<Longrightarrow> \<forall>\<^sub>F n in F. \<forall>x\<in>S. dist (f n x) (l x) < e) \<Longrightarrow> uniform_limit S f l F"
immler@60812
    39
  by (simp add: uniform_limit_iff)
immler@60812
    40
immler@60812
    41
lemma uniform_limit_sequentially_iff:
immler@60812
    42
  "uniform_limit S f l sequentially \<longleftrightarrow> (\<forall>e>0. \<exists>N. \<forall>n\<ge>N. \<forall>x \<in> S. dist (f n x) (l x) < e)"
immler@60812
    43
  unfolding uniform_limit_iff eventually_sequentially ..
immler@60812
    44
immler@60812
    45
lemma uniform_limit_at_iff:
immler@60812
    46
  "uniform_limit S f l (at x) \<longleftrightarrow>
immler@60812
    47
    (\<forall>e>0. \<exists>d>0. \<forall>z. 0 < dist z x \<and> dist z x < d \<longrightarrow> (\<forall>x\<in>S. dist (f z x) (l x) < e))"
lp15@62381
    48
  unfolding uniform_limit_iff eventually_at by simp
immler@60812
    49
immler@60812
    50
lemma uniform_limit_at_le_iff:
immler@60812
    51
  "uniform_limit S f l (at x) \<longleftrightarrow>
immler@60812
    52
    (\<forall>e>0. \<exists>d>0. \<forall>z. 0 < dist z x \<and> dist z x < d \<longrightarrow> (\<forall>x\<in>S. dist (f z x) (l x) \<le> e))"
lp15@62381
    53
  unfolding uniform_limit_iff eventually_at
immler@60812
    54
  by (fastforce dest: spec[where x = "e / 2" for e])
immler@60812
    55
immler@62949
    56
lemma metric_uniform_limit_imp_uniform_limit:
immler@62949
    57
  assumes f: "uniform_limit S f a F"
immler@62949
    58
  assumes le: "eventually (\<lambda>x. \<forall>y\<in>S. dist (g x y) (b y) \<le> dist (f x y) (a y)) F"
immler@62949
    59
  shows "uniform_limit S g b F"
immler@62949
    60
proof (rule uniform_limitI)
immler@62949
    61
  fix e :: real assume "0 < e"
immler@62949
    62
  from uniform_limitD[OF f this] le
immler@62949
    63
  show "\<forall>\<^sub>F x in F. \<forall>y\<in>S. dist (g x y) (b y) < e"
immler@62949
    64
    by eventually_elim force
immler@62949
    65
qed
immler@62949
    66
immler@60812
    67
lemma swap_uniform_limit:
wenzelm@61973
    68
  assumes f: "\<forall>\<^sub>F n in F. (f n \<longlongrightarrow> g n) (at x within S)"
wenzelm@61973
    69
  assumes g: "(g \<longlongrightarrow> l) F"
immler@60812
    70
  assumes uc: "uniform_limit S f h F"
immler@60812
    71
  assumes "\<not>trivial_limit F"
wenzelm@61973
    72
  shows "(h \<longlongrightarrow> l) (at x within S)"
immler@60812
    73
proof (rule tendstoI)
immler@60812
    74
  fix e :: real
wenzelm@63040
    75
  define e' where "e' = e/3"
immler@60812
    76
  assume "0 < e"
immler@60812
    77
  then have "0 < e'" by (simp add: e'_def)
wenzelm@61222
    78
  from uniform_limitD[OF uc \<open>0 < e'\<close>]
immler@60812
    79
  have "\<forall>\<^sub>F n in F. \<forall>x\<in>S. dist (h x) (f n x) < e'"
immler@60812
    80
    by (simp add: dist_commute)
immler@60812
    81
  moreover
immler@60812
    82
  from f
immler@60812
    83
  have "\<forall>\<^sub>F n in F. \<forall>\<^sub>F x in at x within S. dist (g n) (f n x) < e'"
wenzelm@61222
    84
    by eventually_elim (auto dest!: tendstoD[OF _ \<open>0 < e'\<close>] simp: dist_commute)
immler@60812
    85
  moreover
wenzelm@61222
    86
  from tendstoD[OF g \<open>0 < e'\<close>] have "\<forall>\<^sub>F x in F. dist l (g x) < e'"
immler@60812
    87
    by (simp add: dist_commute)
immler@60812
    88
  ultimately
immler@60812
    89
  have "\<forall>\<^sub>F _ in F. \<forall>\<^sub>F x in at x within S. dist (h x) l < e"
immler@60812
    90
  proof eventually_elim
immler@60812
    91
    case (elim n)
immler@60812
    92
    note fh = elim(1)
immler@60812
    93
    note gl = elim(3)
immler@60812
    94
    have "\<forall>\<^sub>F x in at x within S. x \<in> S"
immler@60812
    95
      by (auto simp: eventually_at_filter)
immler@60812
    96
    with elim(2)
immler@60812
    97
    show ?case
immler@60812
    98
    proof eventually_elim
immler@60812
    99
      case (elim x)
wenzelm@61222
   100
      from fh[rule_format, OF \<open>x \<in> S\<close>] elim(1)
immler@60812
   101
      have "dist (h x) (g n) < e' + e'"
immler@60812
   102
        by (rule dist_triangle_lt[OF add_strict_mono])
immler@60812
   103
      from dist_triangle_lt[OF add_strict_mono, OF this gl]
immler@60812
   104
      show ?case by (simp add: e'_def)
immler@60812
   105
    qed
immler@60812
   106
  qed
immler@60812
   107
  thus "\<forall>\<^sub>F x in at x within S. dist (h x) l < e"
wenzelm@61222
   108
    using eventually_happens by (metis \<open>\<not>trivial_limit F\<close>)
immler@60812
   109
qed
immler@60812
   110
immler@60812
   111
lemma
immler@60812
   112
  tendsto_uniform_limitI:
immler@60812
   113
  assumes "uniform_limit S f l F"
immler@60812
   114
  assumes "x \<in> S"
wenzelm@61973
   115
  shows "((\<lambda>y. f y x) \<longlongrightarrow> l x) F"
immler@60812
   116
  using assms
lp15@61810
   117
  by (auto intro!: tendstoI simp: eventually_mono dest!: uniform_limitD)
immler@60812
   118
immler@60812
   119
lemma uniform_limit_theorem:
immler@60812
   120
  assumes c: "\<forall>\<^sub>F n in F. continuous_on A (f n)"
immler@60812
   121
  assumes ul: "uniform_limit A f l F"
immler@60812
   122
  assumes "\<not> trivial_limit F"
immler@60812
   123
  shows "continuous_on A l"
immler@60812
   124
  unfolding continuous_on_def
immler@60812
   125
proof safe
immler@60812
   126
  fix x assume "x \<in> A"
wenzelm@61973
   127
  then have "\<forall>\<^sub>F n in F. (f n \<longlongrightarrow> f n x) (at x within A)" "((\<lambda>n. f n x) \<longlongrightarrow> l x) F"
immler@60812
   128
    using c ul
lp15@61810
   129
    by (auto simp: continuous_on_def eventually_mono tendsto_uniform_limitI)
wenzelm@61973
   130
  then show "(l \<longlongrightarrow> l x) (at x within A)"
immler@60812
   131
    by (rule swap_uniform_limit) fact+
immler@60812
   132
qed
immler@60812
   133
eberlm@61531
   134
lemma uniformly_Cauchy_onI:
eberlm@61531
   135
  assumes "\<And>e. e > 0 \<Longrightarrow> \<exists>M. \<forall>x\<in>X. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (f m x) (f n x) < e"
eberlm@61531
   136
  shows   "uniformly_Cauchy_on X f"
eberlm@61531
   137
  using assms unfolding uniformly_Cauchy_on_def by blast
eberlm@61531
   138
eberlm@61531
   139
lemma uniformly_Cauchy_onI':
eberlm@61531
   140
  assumes "\<And>e. e > 0 \<Longrightarrow> \<exists>M. \<forall>x\<in>X. \<forall>m\<ge>M. \<forall>n>m. dist (f m x) (f n x) < e"
eberlm@61531
   141
  shows   "uniformly_Cauchy_on X f"
eberlm@61531
   142
proof (rule uniformly_Cauchy_onI)
eberlm@61531
   143
  fix e :: real assume e: "e > 0"
hoelzl@63594
   144
  from assms[OF this] obtain M
eberlm@61531
   145
    where M: "\<And>x m n. x \<in> X \<Longrightarrow> m \<ge> M \<Longrightarrow> n > m \<Longrightarrow> dist (f m x) (f n x) < e" by fast
eberlm@61531
   146
  {
eberlm@61531
   147
    fix x m n assume x: "x \<in> X" and m: "m \<ge> M" and n: "n \<ge> M"
eberlm@61531
   148
    with M[OF this(1,2), of n] M[OF this(1,3), of m] e have "dist (f m x) (f n x) < e"
eberlm@61531
   149
      by (cases m n rule: linorder_cases) (simp_all add: dist_commute)
eberlm@61531
   150
  }
eberlm@61531
   151
  thus "\<exists>M. \<forall>x\<in>X. \<forall>m\<ge>M. \<forall>n\<ge>M. dist (f m x) (f n x) < e" by fast
eberlm@61531
   152
qed
eberlm@61531
   153
hoelzl@63594
   154
lemma uniformly_Cauchy_imp_Cauchy:
eberlm@61531
   155
  "uniformly_Cauchy_on X f \<Longrightarrow> x \<in> X \<Longrightarrow> Cauchy (\<lambda>n. f n x)"
eberlm@61531
   156
  unfolding Cauchy_def uniformly_Cauchy_on_def by fast
eberlm@61531
   157
eberlm@61531
   158
lemma uniform_limit_cong:
eberlm@61531
   159
  fixes f g :: "'a \<Rightarrow> 'b \<Rightarrow> ('c :: metric_space)" and h i :: "'b \<Rightarrow> 'c"
eberlm@61531
   160
  assumes "eventually (\<lambda>y. \<forall>x\<in>X. f y x = g y x) F"
eberlm@61531
   161
  assumes "\<And>x. x \<in> X \<Longrightarrow> h x = i x"
eberlm@61531
   162
  shows   "uniform_limit X f h F \<longleftrightarrow> uniform_limit X g i F"
eberlm@61531
   163
proof -
eberlm@61531
   164
  {
eberlm@61531
   165
    fix f g :: "'a \<Rightarrow> 'b \<Rightarrow> 'c" and h i :: "'b \<Rightarrow> 'c"
eberlm@61531
   166
    assume C: "uniform_limit X f h F" and A: "eventually (\<lambda>y. \<forall>x\<in>X. f y x = g y x) F"
eberlm@61531
   167
       and B: "\<And>x. x \<in> X \<Longrightarrow> h x = i x"
eberlm@61531
   168
    {
eberlm@61531
   169
      fix e ::real assume "e > 0"
hoelzl@63594
   170
      with C have "eventually (\<lambda>y. \<forall>x\<in>X. dist (f y x) (h x) < e) F"
eberlm@61531
   171
        unfolding uniform_limit_iff by blast
eberlm@61531
   172
      with A have "eventually (\<lambda>y. \<forall>x\<in>X. dist (g y x) (i x) < e) F"
eberlm@61531
   173
        by eventually_elim (insert B, simp_all)
eberlm@61531
   174
    }
eberlm@61531
   175
    hence "uniform_limit X g i F" unfolding uniform_limit_iff by blast
eberlm@61531
   176
  } note A = this
eberlm@61531
   177
  show ?thesis by (rule iffI) (erule A; insert assms; simp add: eq_commute)+
eberlm@61531
   178
qed
eberlm@61531
   179
eberlm@61531
   180
lemma uniform_limit_cong':
eberlm@61531
   181
  fixes f g :: "'a \<Rightarrow> 'b \<Rightarrow> ('c :: metric_space)" and h i :: "'b \<Rightarrow> 'c"
eberlm@61531
   182
  assumes "\<And>y x. x \<in> X \<Longrightarrow> f y x = g y x"
eberlm@61531
   183
  assumes "\<And>x. x \<in> X \<Longrightarrow> h x = i x"
eberlm@61531
   184
  shows   "uniform_limit X f h F \<longleftrightarrow> uniform_limit X g i F"
eberlm@61531
   185
  using assms by (intro uniform_limit_cong always_eventually) blast+
eberlm@61531
   186
eberlm@61531
   187
lemma uniformly_convergent_uniform_limit_iff:
eberlm@61531
   188
  "uniformly_convergent_on X f \<longleftrightarrow> uniform_limit X f (\<lambda>x. lim (\<lambda>n. f n x)) sequentially"
eberlm@61531
   189
proof
eberlm@61531
   190
  assume "uniformly_convergent_on X f"
hoelzl@63594
   191
  then obtain l where l: "uniform_limit X f l sequentially"
eberlm@61531
   192
    unfolding uniformly_convergent_on_def by blast
eberlm@61531
   193
  from l have "uniform_limit X f (\<lambda>x. lim (\<lambda>n. f n x)) sequentially \<longleftrightarrow>
eberlm@61531
   194
                      uniform_limit X f l sequentially"
eberlm@61531
   195
    by (intro uniform_limit_cong' limI tendsto_uniform_limitI[of f X l]) simp_all
eberlm@61531
   196
  also note l
eberlm@61531
   197
  finally show "uniform_limit X f (\<lambda>x. lim (\<lambda>n. f n x)) sequentially" .
eberlm@61531
   198
qed (auto simp: uniformly_convergent_on_def)
eberlm@61531
   199
eberlm@61531
   200
lemma uniformly_convergentI: "uniform_limit X f l sequentially \<Longrightarrow> uniformly_convergent_on X f"
eberlm@61531
   201
  unfolding uniformly_convergent_on_def by blast
eberlm@61531
   202
lp15@62381
   203
lemma uniformly_convergent_on_empty [iff]: "uniformly_convergent_on {} f"
lp15@62381
   204
  by (simp add: uniformly_convergent_on_def uniform_limit_sequentially_iff)
lp15@62381
   205
eberlm@61531
   206
lemma Cauchy_uniformly_convergent:
eberlm@61531
   207
  fixes f :: "nat \<Rightarrow> 'a \<Rightarrow> 'b :: complete_space"
eberlm@61531
   208
  assumes "uniformly_Cauchy_on X f"
eberlm@61531
   209
  shows   "uniformly_convergent_on X f"
eberlm@61531
   210
unfolding uniformly_convergent_uniform_limit_iff uniform_limit_iff
eberlm@61531
   211
proof safe
eberlm@61531
   212
  let ?f = "\<lambda>x. lim (\<lambda>n. f n x)"
eberlm@61531
   213
  fix e :: real assume e: "e > 0"
eberlm@61531
   214
  hence "e/2 > 0" by simp
eberlm@61531
   215
  with assms obtain N where N: "\<And>x m n. x \<in> X \<Longrightarrow> m \<ge> N \<Longrightarrow> n \<ge> N \<Longrightarrow> dist (f m x) (f n x) < e/2"
eberlm@61531
   216
    unfolding uniformly_Cauchy_on_def by fast
eberlm@61531
   217
  show "eventually (\<lambda>n. \<forall>x\<in>X. dist (f n x) (?f x) < e) sequentially"
eberlm@61531
   218
    using eventually_ge_at_top[of N]
eberlm@61531
   219
  proof eventually_elim
eberlm@61531
   220
    fix n assume n: "n \<ge> N"
eberlm@61531
   221
    show "\<forall>x\<in>X. dist (f n x) (?f x) < e"
eberlm@61531
   222
    proof
eberlm@61531
   223
      fix x assume x: "x \<in> X"
hoelzl@63594
   224
      with assms have "(\<lambda>n. f n x) \<longlonglongrightarrow> ?f x"
eberlm@61531
   225
        by (auto dest!: Cauchy_convergent uniformly_Cauchy_imp_Cauchy simp: convergent_LIMSEQ_iff)
wenzelm@61808
   226
      with \<open>e/2 > 0\<close> have "eventually (\<lambda>m. m \<ge> N \<and> dist (f m x) (?f x) < e/2) sequentially"
eberlm@61531
   227
        by (intro tendstoD eventually_conj eventually_ge_at_top)
hoelzl@63594
   228
      then obtain m where m: "m \<ge> N" "dist (f m x) (?f x) < e/2"
eberlm@61531
   229
        unfolding eventually_at_top_linorder by blast
eberlm@61531
   230
      have "dist (f n x) (?f x) \<le> dist (f n x) (f m x) + dist (f m x) (?f x)"
eberlm@61531
   231
          by (rule dist_triangle)
eberlm@61531
   232
      also from x n have "... < e/2 + e/2" by (intro add_strict_mono N m)
eberlm@61531
   233
      finally show "dist (f n x) (?f x) < e" by simp
eberlm@61531
   234
    qed
eberlm@61531
   235
  qed
eberlm@61531
   236
qed
eberlm@61531
   237
eberlm@61531
   238
lemma uniformly_convergent_imp_convergent:
eberlm@61531
   239
  "uniformly_convergent_on X f \<Longrightarrow> x \<in> X \<Longrightarrow> convergent (\<lambda>n. f n x)"
eberlm@61531
   240
  unfolding uniformly_convergent_on_def convergent_def
eberlm@61531
   241
  by (auto dest: tendsto_uniform_limitI)
eberlm@61531
   242
eberlm@61531
   243
lemma weierstrass_m_test_ev:
immler@60812
   244
fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
eberlm@61531
   245
assumes "eventually (\<lambda>n. \<forall>x\<in>A. norm (f n x) \<le> M n) sequentially"
immler@60812
   246
assumes "summable M"
immler@60812
   247
shows "uniform_limit A (\<lambda>n x. \<Sum>i<n. f i x) (\<lambda>x. suminf (\<lambda>i. f i x)) sequentially"
immler@60812
   248
proof (rule uniform_limitI)
immler@60812
   249
  fix e :: real
immler@60812
   250
  assume "0 < e"
wenzelm@61222
   251
  from suminf_exist_split[OF \<open>0 < e\<close> \<open>summable M\<close>]
immler@60812
   252
  have "\<forall>\<^sub>F k in sequentially. norm (\<Sum>i. M (i + k)) < e"
immler@60812
   253
    by (auto simp: eventually_sequentially)
eberlm@61531
   254
  with eventually_all_ge_at_top[OF assms(1)]
eberlm@61531
   255
    show "\<forall>\<^sub>F n in sequentially. \<forall>x\<in>A. dist (\<Sum>i<n. f i x) (\<Sum>i. f i x) < e"
immler@60812
   256
  proof eventually_elim
immler@60812
   257
    case (elim k)
immler@60812
   258
    show ?case
immler@60812
   259
    proof safe
immler@60812
   260
      fix x assume "x \<in> A"
immler@60812
   261
      have "\<exists>N. \<forall>n\<ge>N. norm (f n x) \<le> M n"
eberlm@61531
   262
        using assms(1) \<open>x \<in> A\<close> by (force simp: eventually_at_top_linorder)
immler@60812
   263
      hence summable_norm_f: "summable (\<lambda>n. norm (f n x))"
wenzelm@61222
   264
        by(rule summable_norm_comparison_test[OF _ \<open>summable M\<close>])
immler@60812
   265
      have summable_f: "summable (\<lambda>n. f n x)"
immler@60812
   266
        using summable_norm_cancel[OF summable_norm_f] .
immler@60812
   267
      have summable_norm_f_plus_k: "summable (\<lambda>i. norm (f (i + k) x))"
immler@60812
   268
        using summable_ignore_initial_segment[OF summable_norm_f]
immler@60812
   269
        by auto
immler@60812
   270
      have summable_M_plus_k: "summable (\<lambda>i. M (i + k))"
wenzelm@61222
   271
        using summable_ignore_initial_segment[OF \<open>summable M\<close>]
immler@60812
   272
        by auto
immler@60812
   273
immler@60812
   274
      have "dist (\<Sum>i<k. f i x) (\<Sum>i. f i x) = norm ((\<Sum>i. f i x) - (\<Sum>i<k. f i x))"
immler@60812
   275
        using dist_norm dist_commute by (subst dist_commute)
immler@60812
   276
      also have "... = norm (\<Sum>i. f (i + k) x)"
immler@60812
   277
        using suminf_minus_initial_segment[OF summable_f, where k=k] by simp
immler@60812
   278
      also have "... \<le> (\<Sum>i. norm (f (i + k) x))"
immler@60812
   279
        using summable_norm[OF summable_norm_f_plus_k] .
immler@60812
   280
      also have "... \<le> (\<Sum>i. M (i + k))"
immler@60812
   281
        by (rule suminf_le[OF _ summable_norm_f_plus_k summable_M_plus_k])
eberlm@61531
   282
           (insert elim(1) \<open>x \<in> A\<close>, simp)
immler@60812
   283
      finally show "dist (\<Sum>i<k. f i x) (\<Sum>i. f i x) < e"
immler@60812
   284
        using elim by auto
immler@60812
   285
    qed
immler@60812
   286
  qed
immler@60812
   287
qed
immler@60812
   288
wenzelm@62175
   289
text\<open>Alternative version, formulated as in HOL Light\<close>
paulson@62131
   290
corollary series_comparison_uniform:
paulson@62131
   291
  fixes f :: "_ \<Rightarrow> nat \<Rightarrow> _ :: banach"
paulson@62131
   292
  assumes g: "summable g" and le: "\<And>n x. N \<le> n \<and> x \<in> A \<Longrightarrow> norm(f x n) \<le> g n"
nipkow@64267
   293
    shows "\<exists>l. \<forall>e. 0 < e \<longrightarrow> (\<exists>N. \<forall>n x. N \<le> n \<and> x \<in> A \<longrightarrow> dist(sum (f x) {..<n}) (l x) < e)"
paulson@62131
   294
proof -
paulson@62131
   295
  have 1: "\<forall>\<^sub>F n in sequentially. \<forall>x\<in>A. norm (f x n) \<le> g n"
paulson@62131
   296
    using le eventually_sequentially by auto
paulson@62131
   297
  show ?thesis
paulson@62131
   298
    apply (rule_tac x="(\<lambda>x. \<Sum>i. f x i)" in exI)
paulson@62131
   299
    apply (metis (no_types, lifting) eventually_sequentially uniform_limitD [OF weierstrass_m_test_ev [OF 1 g]])
paulson@62131
   300
    done
paulson@62131
   301
qed
paulson@62131
   302
paulson@62131
   303
corollary weierstrass_m_test:
paulson@62131
   304
  fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
paulson@62131
   305
  assumes "\<And>n x. x \<in> A \<Longrightarrow> norm (f n x) \<le> M n"
paulson@62131
   306
  assumes "summable M"
paulson@62131
   307
  shows "uniform_limit A (\<lambda>n x. \<Sum>i<n. f i x) (\<lambda>x. suminf (\<lambda>i. f i x)) sequentially"
eberlm@61531
   308
  using assms by (intro weierstrass_m_test_ev always_eventually) auto
hoelzl@63594
   309
paulson@62131
   310
corollary weierstrass_m_test'_ev:
eberlm@61531
   311
  fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
hoelzl@63594
   312
  assumes "eventually (\<lambda>n. \<forall>x\<in>A. norm (f n x) \<le> M n) sequentially" "summable M"
eberlm@61531
   313
  shows   "uniformly_convergent_on A (\<lambda>n x. \<Sum>i<n. f i x)"
eberlm@61531
   314
  unfolding uniformly_convergent_on_def by (rule exI, rule weierstrass_m_test_ev[OF assms])
eberlm@61531
   315
paulson@62131
   316
corollary weierstrass_m_test':
eberlm@61531
   317
  fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
hoelzl@63594
   318
  assumes "\<And>n x. x \<in> A \<Longrightarrow> norm (f n x) \<le> M n" "summable M"
eberlm@61531
   319
  shows   "uniformly_convergent_on A (\<lambda>n x. \<Sum>i<n. f i x)"
eberlm@61531
   320
  unfolding uniformly_convergent_on_def by (rule exI, rule weierstrass_m_test[OF assms])
eberlm@61531
   321
immler@60812
   322
lemma uniform_limit_eq_rhs: "uniform_limit X f l F \<Longrightarrow> l = m \<Longrightarrow> uniform_limit X f m F"
immler@60812
   323
  by simp
immler@60812
   324
immler@60812
   325
named_theorems uniform_limit_intros "introduction rules for uniform_limit"
wenzelm@61222
   326
setup \<open>
immler@60812
   327
  Global_Theory.add_thms_dynamic (@{binding uniform_limit_eq_intros},
immler@60812
   328
    fn context =>
immler@60812
   329
      Named_Theorems.get (Context.proof_of context) @{named_theorems uniform_limit_intros}
immler@60812
   330
      |> map_filter (try (fn thm => @{thm uniform_limit_eq_rhs} OF [thm])))
wenzelm@61222
   331
\<close>
immler@60812
   332
immler@60812
   333
lemma (in bounded_linear) uniform_limit[uniform_limit_intros]:
immler@60812
   334
  assumes "uniform_limit X g l F"
immler@60812
   335
  shows "uniform_limit X (\<lambda>a b. f (g a b)) (\<lambda>a. f (l a)) F"
immler@60812
   336
proof (rule uniform_limitI)
immler@60812
   337
  fix e::real
immler@60812
   338
  from pos_bounded obtain K
immler@60812
   339
    where K: "\<And>x y. dist (f x) (f y) \<le> K * dist x y" "K > 0"
immler@60812
   340
    by (auto simp: ac_simps dist_norm diff[symmetric])
wenzelm@61222
   341
  assume "0 < e" with \<open>K > 0\<close> have "e / K > 0" by simp
immler@60812
   342
  from uniform_limitD[OF assms this]
immler@60812
   343
  show "\<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (f (g n x)) (f (l x)) < e"
immler@60812
   344
    by eventually_elim (metis le_less_trans mult.commute pos_less_divide_eq K)
immler@60812
   345
qed
immler@60812
   346
immler@60812
   347
lemmas bounded_linear_uniform_limit_intros[uniform_limit_intros] =
immler@60812
   348
  bounded_linear.uniform_limit[OF bounded_linear_Im]
immler@60812
   349
  bounded_linear.uniform_limit[OF bounded_linear_Re]
immler@60812
   350
  bounded_linear.uniform_limit[OF bounded_linear_cnj]
immler@60812
   351
  bounded_linear.uniform_limit[OF bounded_linear_fst]
immler@60812
   352
  bounded_linear.uniform_limit[OF bounded_linear_snd]
immler@60812
   353
  bounded_linear.uniform_limit[OF bounded_linear_zero]
immler@60812
   354
  bounded_linear.uniform_limit[OF bounded_linear_of_real]
immler@60812
   355
  bounded_linear.uniform_limit[OF bounded_linear_inner_left]
immler@60812
   356
  bounded_linear.uniform_limit[OF bounded_linear_inner_right]
immler@60812
   357
  bounded_linear.uniform_limit[OF bounded_linear_divide]
immler@60812
   358
  bounded_linear.uniform_limit[OF bounded_linear_scaleR_right]
immler@60812
   359
  bounded_linear.uniform_limit[OF bounded_linear_mult_left]
immler@60812
   360
  bounded_linear.uniform_limit[OF bounded_linear_mult_right]
immler@60812
   361
  bounded_linear.uniform_limit[OF bounded_linear_scaleR_left]
immler@60812
   362
immler@60812
   363
lemmas uniform_limit_uminus[uniform_limit_intros] =
immler@60812
   364
  bounded_linear.uniform_limit[OF bounded_linear_minus[OF bounded_linear_ident]]
immler@60812
   365
immler@62949
   366
lemma uniform_limit_const[uniform_limit_intros]: "uniform_limit S (\<lambda>x y. c) (\<lambda>x. c) f"
immler@62949
   367
  by (auto intro!: uniform_limitI)
immler@62949
   368
immler@60812
   369
lemma uniform_limit_add[uniform_limit_intros]:
immler@60812
   370
  fixes f g::"'a \<Rightarrow> 'b \<Rightarrow> 'c::real_normed_vector"
immler@60812
   371
  assumes "uniform_limit X f l F"
immler@60812
   372
  assumes "uniform_limit X g m F"
immler@60812
   373
  shows "uniform_limit X (\<lambda>a b. f a b + g a b) (\<lambda>a. l a + m a) F"
immler@60812
   374
proof (rule uniform_limitI)
immler@60812
   375
  fix e::real
immler@60812
   376
  assume "0 < e"
immler@60812
   377
  hence "0 < e / 2" by simp
immler@60812
   378
  from
immler@60812
   379
    uniform_limitD[OF assms(1) this]
immler@60812
   380
    uniform_limitD[OF assms(2) this]
immler@60812
   381
  show "\<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (f n x + g n x) (l x + m x) < e"
immler@60812
   382
    by eventually_elim (simp add: dist_triangle_add_half)
immler@60812
   383
qed
immler@60812
   384
immler@60812
   385
lemma uniform_limit_minus[uniform_limit_intros]:
immler@60812
   386
  fixes f g::"'a \<Rightarrow> 'b \<Rightarrow> 'c::real_normed_vector"
immler@60812
   387
  assumes "uniform_limit X f l F"
immler@60812
   388
  assumes "uniform_limit X g m F"
immler@60812
   389
  shows "uniform_limit X (\<lambda>a b. f a b - g a b) (\<lambda>a. l a - m a) F"
immler@60812
   390
  unfolding diff_conv_add_uminus
immler@60812
   391
  by (rule uniform_limit_intros assms)+
immler@60812
   392
immler@62949
   393
lemma uniform_limit_norm[uniform_limit_intros]:
immler@62949
   394
  assumes "uniform_limit S g l f"
immler@62949
   395
  shows "uniform_limit S (\<lambda>x y. norm (g x y)) (\<lambda>x. norm (l x)) f"
immler@62949
   396
  using assms
immler@62949
   397
  apply (rule metric_uniform_limit_imp_uniform_limit)
immler@62949
   398
  apply (rule eventuallyI)
immler@62949
   399
  by (metis dist_norm norm_triangle_ineq3 real_norm_def)
immler@62949
   400
immler@60812
   401
lemma (in bounded_bilinear) bounded_uniform_limit[uniform_limit_intros]:
immler@60812
   402
  assumes "uniform_limit X f l F"
immler@60812
   403
  assumes "uniform_limit X g m F"
immler@60812
   404
  assumes "bounded (m ` X)"
immler@60812
   405
  assumes "bounded (l ` X)"
immler@60812
   406
  shows "uniform_limit X (\<lambda>a b. prod (f a b) (g a b)) (\<lambda>a. prod (l a) (m a)) F"
immler@60812
   407
proof (rule uniform_limitI)
immler@60812
   408
  fix e::real
immler@60812
   409
  from pos_bounded obtain K where K:
immler@60812
   410
    "0 < K" "\<And>a b. norm (prod a b) \<le> norm a * norm b * K"
immler@60812
   411
    by auto
immler@60812
   412
  hence "sqrt (K*4) > 0" by simp
immler@60812
   413
immler@60812
   414
  from assms obtain Km Kl
immler@60812
   415
  where Km: "Km > 0" "\<And>x. x \<in> X \<Longrightarrow> norm (m x) \<le> Km"
immler@60812
   416
    and Kl: "Kl > 0" "\<And>x. x \<in> X \<Longrightarrow> norm (l x) \<le> Kl"
immler@60812
   417
    by (auto simp: bounded_pos)
immler@60812
   418
  hence "K * Km * 4 > 0" "K * Kl * 4 > 0"
wenzelm@61222
   419
    using \<open>K > 0\<close>
immler@60812
   420
    by simp_all
immler@60812
   421
  assume "0 < e"
immler@60812
   422
immler@60812
   423
  hence "sqrt e > 0" by simp
wenzelm@61222
   424
  from uniform_limitD[OF assms(1) divide_pos_pos[OF this \<open>sqrt (K*4) > 0\<close>]]
wenzelm@61222
   425
    uniform_limitD[OF assms(2) divide_pos_pos[OF this \<open>sqrt (K*4) > 0\<close>]]
wenzelm@61222
   426
    uniform_limitD[OF assms(1) divide_pos_pos[OF \<open>e > 0\<close> \<open>K * Km * 4 > 0\<close>]]
wenzelm@61222
   427
    uniform_limitD[OF assms(2) divide_pos_pos[OF \<open>e > 0\<close> \<open>K * Kl * 4 > 0\<close>]]
immler@60812
   428
  show "\<forall>\<^sub>F n in F. \<forall>x\<in>X. dist (prod (f n x) (g n x)) (prod (l x) (m x)) < e"
immler@60812
   429
  proof eventually_elim
immler@60812
   430
    case (elim n)
immler@60812
   431
    show ?case
immler@60812
   432
    proof safe
immler@60812
   433
      fix x assume "x \<in> X"
immler@60812
   434
      have "dist (prod (f n x) (g n x)) (prod (l x) (m x)) \<le>
immler@60812
   435
        norm (prod (f n x - l x) (g n x - m x)) +
immler@60812
   436
        norm (prod (f n x - l x) (m x)) +
immler@60812
   437
        norm (prod (l x) (g n x - m x))"
immler@60812
   438
        by (auto simp: dist_norm prod_diff_prod intro: order_trans norm_triangle_ineq add_mono)
immler@60812
   439
      also note K(2)[of "f n x - l x" "g n x - m x"]
wenzelm@61222
   440
      also from elim(1)[THEN bspec, OF \<open>_ \<in> X\<close>, unfolded dist_norm]
immler@60812
   441
      have "norm (f n x - l x) \<le> sqrt e / sqrt (K * 4)"
immler@60812
   442
        by simp
wenzelm@61222
   443
      also from elim(2)[THEN bspec, OF \<open>_ \<in> X\<close>, unfolded dist_norm]
immler@60812
   444
      have "norm (g n x - m x) \<le> sqrt e / sqrt (K * 4)"
immler@60812
   445
        by simp
immler@60812
   446
      also have "sqrt e / sqrt (K * 4) * (sqrt e / sqrt (K * 4)) * K = e / 4"
wenzelm@61222
   447
        using \<open>K > 0\<close> \<open>e > 0\<close> by auto
immler@60812
   448
      also note K(2)[of "f n x - l x" "m x"]
immler@60812
   449
      also note K(2)[of "l x" "g n x - m x"]
wenzelm@61222
   450
      also from elim(3)[THEN bspec, OF \<open>_ \<in> X\<close>, unfolded dist_norm]
immler@60812
   451
      have "norm (f n x - l x) \<le> e / (K * Km * 4)"
immler@60812
   452
        by simp
wenzelm@61222
   453
      also from elim(4)[THEN bspec, OF \<open>_ \<in> X\<close>, unfolded dist_norm]
immler@60812
   454
      have "norm (g n x - m x) \<le> e / (K * Kl * 4)"
immler@60812
   455
        by simp
wenzelm@61222
   456
      also note Kl(2)[OF \<open>_ \<in> X\<close>]
wenzelm@61222
   457
      also note Km(2)[OF \<open>_ \<in> X\<close>]
immler@60812
   458
      also have "e / (K * Km * 4) * Km * K = e / 4"
wenzelm@61222
   459
        using \<open>K > 0\<close> \<open>Km > 0\<close> by simp
immler@60812
   460
      also have " Kl * (e / (K * Kl * 4)) * K = e / 4"
wenzelm@61222
   461
        using \<open>K > 0\<close> \<open>Kl > 0\<close> by simp
wenzelm@61222
   462
      also have "e / 4 + e / 4 + e / 4 < e" using \<open>e > 0\<close> by simp
immler@60812
   463
      finally show "dist (prod (f n x) (g n x)) (prod (l x) (m x)) < e"
wenzelm@61222
   464
        using \<open>K > 0\<close> \<open>Kl > 0\<close> \<open>Km > 0\<close> \<open>e > 0\<close>
immler@60812
   465
        by (simp add: algebra_simps mult_right_mono divide_right_mono)
immler@60812
   466
    qed
immler@60812
   467
  qed
immler@60812
   468
qed
immler@60812
   469
immler@60812
   470
lemmas bounded_bilinear_bounded_uniform_limit_intros[uniform_limit_intros] =
immler@60812
   471
  bounded_bilinear.bounded_uniform_limit[OF Inner_Product.bounded_bilinear_inner]
immler@60812
   472
  bounded_bilinear.bounded_uniform_limit[OF Real_Vector_Spaces.bounded_bilinear_mult]
immler@60812
   473
  bounded_bilinear.bounded_uniform_limit[OF Real_Vector_Spaces.bounded_bilinear_scaleR]
immler@60812
   474
lp15@65036
   475
lemma uniform_lim_mult:
lp15@65036
   476
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::real_normed_algebra"
lp15@65036
   477
  assumes f: "uniform_limit S f l F"
lp15@65036
   478
      and g: "uniform_limit S g m F"
lp15@65036
   479
      and l: "bounded (l ` S)"
lp15@65036
   480
      and m: "bounded (m ` S)"
lp15@65036
   481
    shows "uniform_limit S (\<lambda>a b. f a b * g a b) (\<lambda>a. l a * m a) F"
lp15@65036
   482
  by (intro bounded_bilinear_bounded_uniform_limit_intros assms)
lp15@65036
   483
lp15@65036
   484
lemma uniform_lim_inverse:
lp15@65036
   485
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::real_normed_field"
lp15@65036
   486
  assumes f: "uniform_limit S f l F"
lp15@65036
   487
      and b: "\<And>x. x \<in> S \<Longrightarrow> b \<le> norm(l x)"
lp15@65036
   488
      and "b > 0"
lp15@65036
   489
    shows "uniform_limit S (\<lambda>x y. inverse (f x y)) (inverse \<circ> l) F"
lp15@65036
   490
proof (rule uniform_limitI)
lp15@65036
   491
  fix e::real
lp15@65036
   492
  assume "e > 0"
lp15@65036
   493
  have lte: "dist (inverse (f x y)) ((inverse \<circ> l) y) < e"
lp15@65036
   494
           if "b/2 \<le> norm (f x y)" "norm (f x y - l y) < e * b\<^sup>2 / 2" "y \<in> S"
lp15@65036
   495
           for x y
lp15@65036
   496
  proof -
lp15@65036
   497
    have [simp]: "l y \<noteq> 0" "f x y \<noteq> 0"
lp15@65036
   498
      using \<open>b > 0\<close> that b [OF \<open>y \<in> S\<close>] by fastforce+
lp15@65036
   499
    have "norm (l y - f x y) <  e * b\<^sup>2 / 2"
lp15@65036
   500
      by (metis norm_minus_commute that(2))
lp15@65036
   501
    also have "... \<le> e * (norm (f x y) * norm (l y))"
lp15@65036
   502
      using \<open>e > 0\<close> that b [OF \<open>y \<in> S\<close>] apply (simp add: power2_eq_square)
lp15@65036
   503
      by (metis \<open>b > 0\<close> less_eq_real_def mult.left_commute mult_mono')
lp15@65036
   504
    finally show ?thesis
lp15@65036
   505
      by (auto simp: dist_norm divide_simps norm_mult norm_divide)
lp15@65036
   506
  qed
lp15@65036
   507
  have "\<forall>\<^sub>F n in F. \<forall>x\<in>S. dist (f n x) (l x) < b/2"
lp15@65036
   508
    using uniform_limitD [OF f, of "b/2"] by (simp add: \<open>b > 0\<close>)
lp15@65036
   509
  then have "\<forall>\<^sub>F x in F. \<forall>y\<in>S. b/2 \<le> norm (f x y)"
lp15@65036
   510
    apply (rule eventually_mono)
lp15@65036
   511
    using b apply (simp only: dist_norm)
lp15@65036
   512
    by (metis (no_types, hide_lams) diff_zero dist_commute dist_norm norm_triangle_half_l not_less)
lp15@65036
   513
  then have "\<forall>\<^sub>F x in F. \<forall>y\<in>S. b/2 \<le> norm (f x y) \<and> norm (f x y - l y) < e * b\<^sup>2 / 2"
lp15@65036
   514
    apply (simp only: ball_conj_distrib dist_norm [symmetric])
lp15@65036
   515
    apply (rule eventually_conj, assumption)
lp15@65036
   516
      apply (rule uniform_limitD [OF f, of "e * b ^ 2 / 2"])
lp15@65036
   517
    using \<open>b > 0\<close> \<open>e > 0\<close> by auto
lp15@65036
   518
  then show "\<forall>\<^sub>F x in F. \<forall>y\<in>S. dist (inverse (f x y)) ((inverse \<circ> l) y) < e"
lp15@65036
   519
    using lte by (force intro: eventually_mono)
lp15@65036
   520
qed
lp15@65036
   521
lp15@65037
   522
lemma uniform_lim_divide:
lp15@65036
   523
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::real_normed_field"
lp15@65036
   524
  assumes f: "uniform_limit S f l F"
lp15@65036
   525
      and g: "uniform_limit S g m F"
lp15@65036
   526
      and l: "bounded (l ` S)"
lp15@65036
   527
      and b: "\<And>x. x \<in> S \<Longrightarrow> b \<le> norm(m x)"
lp15@65036
   528
      and "b > 0"
lp15@65036
   529
    shows "uniform_limit S (\<lambda>a b. f a b / g a b) (\<lambda>a. l a / m a) F"
lp15@65036
   530
proof -
lp15@65036
   531
  have m: "bounded ((inverse \<circ> m) ` S)"
lp15@65036
   532
    using b \<open>b > 0\<close>
lp15@65036
   533
    apply (simp add: bounded_iff)
lp15@65036
   534
    by (metis le_imp_inverse_le norm_inverse)
lp15@65036
   535
  have "uniform_limit S (\<lambda>a b. f a b * inverse (g a b))
lp15@65036
   536
         (\<lambda>a. l a * (inverse \<circ> m) a) F"
lp15@65036
   537
    by (rule uniform_lim_mult [OF f uniform_lim_inverse [OF g b \<open>b > 0\<close>] l m])
lp15@65036
   538
  then show ?thesis
lp15@65036
   539
    by (simp add: field_class.field_divide_inverse)
lp15@65036
   540
qed
lp15@65036
   541
immler@60812
   542
lemma uniform_limit_null_comparison:
immler@60812
   543
  assumes "\<forall>\<^sub>F x in F. \<forall>a\<in>S. norm (f x a) \<le> g x a"
immler@60812
   544
  assumes "uniform_limit S g (\<lambda>_. 0) F"
immler@60812
   545
  shows "uniform_limit S f (\<lambda>_. 0) F"
immler@60812
   546
  using assms(2)
immler@60812
   547
proof (rule metric_uniform_limit_imp_uniform_limit)
immler@60812
   548
  show "\<forall>\<^sub>F x in F. \<forall>y\<in>S. dist (f x y) 0 \<le> dist (g x y) 0"
lp15@61810
   549
    using assms(1) by (rule eventually_mono) (force simp add: dist_norm)
immler@60812
   550
qed
immler@60812
   551
lp15@65036
   552
lemma uniform_limit_on_Un:
immler@60812
   553
  "uniform_limit I f g F \<Longrightarrow> uniform_limit J f g F \<Longrightarrow> uniform_limit (I \<union> J) f g F"
immler@60812
   554
  by (auto intro!: uniform_limitI dest!: uniform_limitD elim: eventually_elim2)
immler@60812
   555
lp15@62381
   556
lemma uniform_limit_on_empty [iff]:
immler@60812
   557
  "uniform_limit {} f g F"
immler@60812
   558
  by (auto intro!: uniform_limitI)
immler@60812
   559
immler@60812
   560
lemma uniform_limit_on_UNION:
immler@60812
   561
  assumes "finite S"
immler@60812
   562
  assumes "\<And>s. s \<in> S \<Longrightarrow> uniform_limit (h s) f g F"
immler@60812
   563
  shows "uniform_limit (UNION S h) f g F"
immler@60812
   564
  using assms
lp15@65036
   565
  by induct (auto intro: uniform_limit_on_empty uniform_limit_on_Un)
immler@60812
   566
immler@60812
   567
lemma uniform_limit_on_Union:
immler@60812
   568
  assumes "finite I"
immler@60812
   569
  assumes "\<And>J. J \<in> I \<Longrightarrow> uniform_limit J f g F"
immler@60812
   570
  shows "uniform_limit (Union I) f g F"
immler@60812
   571
  by (metis SUP_identity_eq assms uniform_limit_on_UNION)
immler@60812
   572
immler@60812
   573
lemma uniform_limit_on_subset:
immler@60812
   574
  "uniform_limit J f g F \<Longrightarrow> I \<subseteq> J \<Longrightarrow> uniform_limit I f g F"
lp15@61810
   575
  by (auto intro!: uniform_limitI dest!: uniform_limitD intro: eventually_mono)
eberlm@61552
   576
eberlm@61552
   577
lemma uniformly_convergent_add:
eberlm@61552
   578
  "uniformly_convergent_on A f \<Longrightarrow> uniformly_convergent_on A g\<Longrightarrow>
eberlm@61552
   579
      uniformly_convergent_on A (\<lambda>k x. f k x + g k x :: 'a :: {real_normed_algebra})"
eberlm@61552
   580
  unfolding uniformly_convergent_on_def by (blast dest: uniform_limit_add)
eberlm@61552
   581
eberlm@61552
   582
lemma uniformly_convergent_minus:
eberlm@61552
   583
  "uniformly_convergent_on A f \<Longrightarrow> uniformly_convergent_on A g\<Longrightarrow>
eberlm@61552
   584
      uniformly_convergent_on A (\<lambda>k x. f k x - g k x :: 'a :: {real_normed_algebra})"
eberlm@61552
   585
  unfolding uniformly_convergent_on_def by (blast dest: uniform_limit_minus)
eberlm@61552
   586
eberlm@61552
   587
lemma uniformly_convergent_mult:
hoelzl@63594
   588
  "uniformly_convergent_on A f \<Longrightarrow>
eberlm@61552
   589
      uniformly_convergent_on A (\<lambda>k x. c * f k x :: 'a :: {real_normed_algebra})"
eberlm@61552
   590
  unfolding uniformly_convergent_on_def
eberlm@61552
   591
  by (blast dest: bounded_linear_uniform_limit_intros(13))
eberlm@61552
   592
lp15@62381
   593
subsection\<open>Power series and uniform convergence\<close>
lp15@62381
   594
lp15@62381
   595
proposition powser_uniformly_convergent:
lp15@62381
   596
  fixes a :: "nat \<Rightarrow> 'a::{real_normed_div_algebra,banach}"
lp15@62381
   597
  assumes "r < conv_radius a"
lp15@62381
   598
  shows "uniformly_convergent_on (cball \<xi> r) (\<lambda>n x. \<Sum>i<n. a i * (x - \<xi>) ^ i)"
lp15@62381
   599
proof (cases "0 \<le> r")
lp15@62381
   600
  case True
lp15@62381
   601
  then have *: "summable (\<lambda>n. norm (a n) * r ^ n)"
lp15@62381
   602
    using abs_summable_in_conv_radius [of "of_real r" a] assms
lp15@62381
   603
    by (simp add: norm_mult norm_power)
lp15@62381
   604
  show ?thesis
lp15@62381
   605
    by (simp add: weierstrass_m_test'_ev [OF _ *] norm_mult norm_power
lp15@62381
   606
              mult_left_mono power_mono dist_norm norm_minus_commute)
lp15@62381
   607
next
lp15@62381
   608
  case False then show ?thesis by (simp add: not_le)
lp15@62381
   609
qed
lp15@62381
   610
lp15@62381
   611
lemma powser_uniform_limit:
lp15@62381
   612
  fixes a :: "nat \<Rightarrow> 'a::{real_normed_div_algebra,banach}"
lp15@62381
   613
  assumes "r < conv_radius a"
lp15@62381
   614
  shows "uniform_limit (cball \<xi> r) (\<lambda>n x. \<Sum>i<n. a i * (x - \<xi>) ^ i) (\<lambda>x. suminf (\<lambda>i. a i * (x - \<xi>) ^ i)) sequentially"
lp15@62381
   615
using powser_uniformly_convergent [OF assms]
lp15@62381
   616
by (simp add: Uniform_Limit.uniformly_convergent_uniform_limit_iff Series.suminf_eq_lim)
lp15@62381
   617
lp15@62381
   618
lemma powser_continuous_suminf:
lp15@62381
   619
  fixes a :: "nat \<Rightarrow> 'a::{real_normed_div_algebra,banach}"
lp15@62381
   620
  assumes "r < conv_radius a"
lp15@62381
   621
  shows "continuous_on (cball \<xi> r) (\<lambda>x. suminf (\<lambda>i. a i * (x - \<xi>) ^ i))"
lp15@62381
   622
apply (rule uniform_limit_theorem [OF _ powser_uniform_limit])
lp15@62381
   623
apply (rule eventuallyI continuous_intros assms)+
lp15@62381
   624
apply (simp add:)
lp15@62381
   625
done
lp15@62381
   626
lp15@62381
   627
lemma powser_continuous_sums:
lp15@62381
   628
  fixes a :: "nat \<Rightarrow> 'a::{real_normed_div_algebra,banach}"
lp15@62381
   629
  assumes r: "r < conv_radius a"
lp15@62381
   630
      and sm: "\<And>x. x \<in> cball \<xi> r \<Longrightarrow> (\<lambda>n. a n * (x - \<xi>) ^ n) sums (f x)"
lp15@62381
   631
  shows "continuous_on (cball \<xi> r) f"
lp15@62381
   632
apply (rule continuous_on_cong [THEN iffD1, OF refl _ powser_continuous_suminf [OF r]])
lp15@62381
   633
using sm sums_unique by fastforce
lp15@62381
   634
nipkow@62390
   635
end
nipkow@62393
   636