src/HOL/Analysis/Uniform_Limit.thy
changeset 68838 5e013478bced
parent 67685 bdff8bf0a75b
child 69260 0a9688695a1b
equal deleted inserted replaced
68837:99f0aee4adbd 68838:5e013478bced
     7 
     7 
     8 theory Uniform_Limit
     8 theory Uniform_Limit
     9 imports Connected Summation_Tests
     9 imports Connected Summation_Tests
    10 begin
    10 begin
    11 
    11 
    12 definition uniformly_on :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b::metric_space) \<Rightarrow> ('a \<Rightarrow> 'b) filter"
    12 
       
    13 subsection \<open>Definition\<close>
       
    14 
       
    15 definition%important uniformly_on :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b::metric_space) \<Rightarrow> ('a \<Rightarrow> 'b) filter"
    13   where "uniformly_on S l = (INF e:{0 <..}. principal {f. \<forall>x\<in>S. dist (f x) (l x) < e})"
    16   where "uniformly_on S l = (INF e:{0 <..}. principal {f. \<forall>x\<in>S. dist (f x) (l x) < e})"
    14 
    17 
    15 abbreviation
    18 abbreviation%important
    16   "uniform_limit S f l \<equiv> filterlim f (uniformly_on S l)"
    19   "uniform_limit S f l \<equiv> filterlim f (uniformly_on S l)"
    17 
    20 
    18 definition uniformly_convergent_on where
    21 definition uniformly_convergent_on where
    19   "uniformly_convergent_on X f \<longleftrightarrow> (\<exists>l. uniform_limit X f l sequentially)"
    22   "uniformly_convergent_on X f \<longleftrightarrow> (\<exists>l. uniform_limit X f l sequentially)"
    20 
    23 
    21 definition uniformly_Cauchy_on where
    24 definition uniformly_Cauchy_on where
    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)"
    25   "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)"
    23 
    26 
    24 lemma uniform_limit_iff:
    27 proposition uniform_limit_iff:
    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)"
    28   "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)"
    26   unfolding filterlim_iff uniformly_on_def
    29   unfolding filterlim_iff uniformly_on_def
    27   by (subst eventually_INF_base)
    30   by (subst eventually_INF_base)
    28     (fastforce
    31     (fastforce
    29       simp: eventually_principal uniformly_on_def
    32       simp: eventually_principal uniformly_on_def
    62   from uniform_limitD[OF f this] le
    65   from uniform_limitD[OF f this] le
    63   show "\<forall>\<^sub>F x in F. \<forall>y\<in>S. dist (g x y) (b y) < e"
    66   show "\<forall>\<^sub>F x in F. \<forall>y\<in>S. dist (g x y) (b y) < e"
    64     by eventually_elim force
    67     by eventually_elim force
    65 qed
    68 qed
    66 
    69 
    67 lemma swap_uniform_limit:
    70 
       
    71 subsection \<open>Exchange limits\<close>
       
    72 
       
    73 proposition swap_uniform_limit:
    68   assumes f: "\<forall>\<^sub>F n in F. (f n \<longlongrightarrow> g n) (at x within S)"
    74   assumes f: "\<forall>\<^sub>F n in F. (f n \<longlongrightarrow> g n) (at x within S)"
    69   assumes g: "(g \<longlongrightarrow> l) F"
    75   assumes g: "(g \<longlongrightarrow> l) F"
    70   assumes uc: "uniform_limit S f h F"
    76   assumes uc: "uniform_limit S f h F"
    71   assumes "\<not>trivial_limit F"
    77   assumes "\<not>trivial_limit F"
    72   shows "(h \<longlongrightarrow> l) (at x within S)"
    78   shows "(h \<longlongrightarrow> l) (at x within S)"
   106   qed
   112   qed
   107   thus "\<forall>\<^sub>F x in at x within S. dist (h x) l < e"
   113   thus "\<forall>\<^sub>F x in at x within S. dist (h x) l < e"
   108     using eventually_happens by (metis \<open>\<not>trivial_limit F\<close>)
   114     using eventually_happens by (metis \<open>\<not>trivial_limit F\<close>)
   109 qed
   115 qed
   110 
   116 
       
   117 
       
   118 subsection \<open>Uniform limit theorem\<close>
       
   119 
   111 lemma tendsto_uniform_limitI:
   120 lemma tendsto_uniform_limitI:
   112   assumes "uniform_limit S f l F"
   121   assumes "uniform_limit S f l F"
   113   assumes "x \<in> S"
   122   assumes "x \<in> S"
   114   shows "((\<lambda>y. f y x) \<longlongrightarrow> l x) F"
   123   shows "((\<lambda>y. f y x) \<longlongrightarrow> l x) F"
   115   using assms
   124   using assms
   116   by (auto intro!: tendstoI simp: eventually_mono dest!: uniform_limitD)
   125   by (auto intro!: tendstoI simp: eventually_mono dest!: uniform_limitD)
   117 
   126 
   118 lemma uniform_limit_theorem:
   127 theorem uniform_limit_theorem:
   119   assumes c: "\<forall>\<^sub>F n in F. continuous_on A (f n)"
   128   assumes c: "\<forall>\<^sub>F n in F. continuous_on A (f n)"
   120   assumes ul: "uniform_limit A f l F"
   129   assumes ul: "uniform_limit A f l F"
   121   assumes "\<not> trivial_limit F"
   130   assumes "\<not> trivial_limit F"
   122   shows "continuous_on A l"
   131   shows "continuous_on A l"
   123   unfolding continuous_on_def
   132   unfolding continuous_on_def
   305 lemma uniformly_convergent_imp_convergent:
   314 lemma uniformly_convergent_imp_convergent:
   306   "uniformly_convergent_on X f \<Longrightarrow> x \<in> X \<Longrightarrow> convergent (\<lambda>n. f n x)"
   315   "uniformly_convergent_on X f \<Longrightarrow> x \<in> X \<Longrightarrow> convergent (\<lambda>n. f n x)"
   307   unfolding uniformly_convergent_on_def convergent_def
   316   unfolding uniformly_convergent_on_def convergent_def
   308   by (auto dest: tendsto_uniform_limitI)
   317   by (auto dest: tendsto_uniform_limitI)
   309 
   318 
   310 lemma weierstrass_m_test_ev:
   319 
       
   320 subsection \<open>Weierstrass M-Test\<close>
       
   321 
       
   322 proposition weierstrass_m_test_ev:
   311 fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
   323 fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
   312 assumes "eventually (\<lambda>n. \<forall>x\<in>A. norm (f n x) \<le> M n) sequentially"
   324 assumes "eventually (\<lambda>n. \<forall>x\<in>A. norm (f n x) \<le> M n) sequentially"
   313 assumes "summable M"
   325 assumes "summable M"
   314 shows "uniform_limit A (\<lambda>n x. \<Sum>i<n. f i x) (\<lambda>x. suminf (\<lambda>i. f i x)) sequentially"
   326 shows "uniform_limit A (\<lambda>n x. \<Sum>i<n. f i x) (\<lambda>x. suminf (\<lambda>i. f i x)) sequentially"
   315 proof (rule uniform_limitI)
   327 proof (rule uniform_limitI)
   352     qed
   364     qed
   353   qed
   365   qed
   354 qed
   366 qed
   355 
   367 
   356 text\<open>Alternative version, formulated as in HOL Light\<close>
   368 text\<open>Alternative version, formulated as in HOL Light\<close>
   357 corollary series_comparison_uniform:
   369 corollary%unimportant series_comparison_uniform:
   358   fixes f :: "_ \<Rightarrow> nat \<Rightarrow> _ :: banach"
   370   fixes f :: "_ \<Rightarrow> nat \<Rightarrow> _ :: banach"
   359   assumes g: "summable g" and le: "\<And>n x. N \<le> n \<and> x \<in> A \<Longrightarrow> norm(f x n) \<le> g n"
   371   assumes g: "summable g" and le: "\<And>n x. N \<le> n \<and> x \<in> A \<Longrightarrow> norm(f x n) \<le> g n"
   360     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)"
   372     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)"
   361 proof -
   373 proof -
   362   have 1: "\<forall>\<^sub>F n in sequentially. \<forall>x\<in>A. norm (f x n) \<le> g n"
   374   have 1: "\<forall>\<^sub>F n in sequentially. \<forall>x\<in>A. norm (f x n) \<le> g n"
   365     apply (rule_tac x="(\<lambda>x. \<Sum>i. f x i)" in exI)
   377     apply (rule_tac x="(\<lambda>x. \<Sum>i. f x i)" in exI)
   366     apply (metis (no_types, lifting) eventually_sequentially uniform_limitD [OF weierstrass_m_test_ev [OF 1 g]])
   378     apply (metis (no_types, lifting) eventually_sequentially uniform_limitD [OF weierstrass_m_test_ev [OF 1 g]])
   367     done
   379     done
   368 qed
   380 qed
   369 
   381 
   370 corollary weierstrass_m_test:
   382 corollary%unimportant weierstrass_m_test:
   371   fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
   383   fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
   372   assumes "\<And>n x. x \<in> A \<Longrightarrow> norm (f n x) \<le> M n"
   384   assumes "\<And>n x. x \<in> A \<Longrightarrow> norm (f n x) \<le> M n"
   373   assumes "summable M"
   385   assumes "summable M"
   374   shows "uniform_limit A (\<lambda>n x. \<Sum>i<n. f i x) (\<lambda>x. suminf (\<lambda>i. f i x)) sequentially"
   386   shows "uniform_limit A (\<lambda>n x. \<Sum>i<n. f i x) (\<lambda>x. suminf (\<lambda>i. f i x)) sequentially"
   375   using assms by (intro weierstrass_m_test_ev always_eventually) auto
   387   using assms by (intro weierstrass_m_test_ev always_eventually) auto
   376 
   388 
   377 corollary weierstrass_m_test'_ev:
   389 corollary%unimportant weierstrass_m_test'_ev:
   378   fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
   390   fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
   379   assumes "eventually (\<lambda>n. \<forall>x\<in>A. norm (f n x) \<le> M n) sequentially" "summable M"
   391   assumes "eventually (\<lambda>n. \<forall>x\<in>A. norm (f n x) \<le> M n) sequentially" "summable M"
   380   shows   "uniformly_convergent_on A (\<lambda>n x. \<Sum>i<n. f i x)"
   392   shows   "uniformly_convergent_on A (\<lambda>n x. \<Sum>i<n. f i x)"
   381   unfolding uniformly_convergent_on_def by (rule exI, rule weierstrass_m_test_ev[OF assms])
   393   unfolding uniformly_convergent_on_def by (rule exI, rule weierstrass_m_test_ev[OF assms])
   382 
   394 
   383 corollary weierstrass_m_test':
   395 corollary%unimportant weierstrass_m_test':
   384   fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
   396   fixes f :: "_ \<Rightarrow> _ \<Rightarrow> _ :: banach"
   385   assumes "\<And>n x. x \<in> A \<Longrightarrow> norm (f n x) \<le> M n" "summable M"
   397   assumes "\<And>n x. x \<in> A \<Longrightarrow> norm (f n x) \<le> M n" "summable M"
   386   shows   "uniformly_convergent_on A (\<lambda>n x. \<Sum>i<n. f i x)"
   398   shows   "uniformly_convergent_on A (\<lambda>n x. \<Sum>i<n. f i x)"
   387   unfolding uniformly_convergent_on_def by (rule exI, rule weierstrass_m_test[OF assms])
   399   unfolding uniformly_convergent_on_def by (rule exI, rule weierstrass_m_test[OF assms])
   388 
   400 
   389 lemma uniform_limit_eq_rhs: "uniform_limit X f l F \<Longrightarrow> l = m \<Longrightarrow> uniform_limit X f m F"
   401 lemma uniform_limit_eq_rhs: "uniform_limit X f l F \<Longrightarrow> l = m \<Longrightarrow> uniform_limit X f m F"
   390   by simp
   402   by simp
       
   403 
       
   404 
       
   405 subsection%unimportant \<open>Structural introduction rules\<close>
   391 
   406 
   392 named_theorems uniform_limit_intros "introduction rules for uniform_limit"
   407 named_theorems uniform_limit_intros "introduction rules for uniform_limit"
   393 setup \<open>
   408 setup \<open>
   394   Global_Theory.add_thms_dynamic (@{binding uniform_limit_eq_intros},
   409   Global_Theory.add_thms_dynamic (@{binding uniform_limit_eq_intros},
   395     fn context =>
   410     fn context =>