src/HOL/Limits.thy
changeset 62368 106569399cd6
parent 62101 26c0a70f78a3
child 62369 acfc4ad7b76a
equal deleted inserted replaced
62367:d2bc8a7e5fec 62368:106569399cd6
   571 
   571 
   572 lemma tendsto_rabs_zero_iff:
   572 lemma tendsto_rabs_zero_iff:
   573   "((\<lambda>x. \<bar>f x\<bar>) \<longlongrightarrow> (0::real)) F \<longleftrightarrow> (f \<longlongrightarrow> 0) F"
   573   "((\<lambda>x. \<bar>f x\<bar>) \<longlongrightarrow> (0::real)) F \<longleftrightarrow> (f \<longlongrightarrow> 0) F"
   574   by (fold real_norm_def, rule tendsto_norm_zero_iff)
   574   by (fold real_norm_def, rule tendsto_norm_zero_iff)
   575 
   575 
   576 subsubsection \<open>Addition and subtraction\<close>
   576 subsection \<open>Topological Monoid\<close>
       
   577 
       
   578 class topological_monoid_add = topological_space + monoid_add +
       
   579   assumes tendsto_add_Pair: "LIM x (nhds a \<times>\<^sub>F nhds b). fst x + snd x :> nhds (a + b)"
       
   580 
       
   581 class topological_comm_monoid_add = topological_monoid_add + comm_monoid_add
   577 
   582 
   578 lemma tendsto_add [tendsto_intros]:
   583 lemma tendsto_add [tendsto_intros]:
   579   fixes a b :: "'a::real_normed_vector"
   584   fixes a b :: "'a::topological_monoid_add"
   580   shows "\<lbrakk>(f \<longlongrightarrow> a) F; (g \<longlongrightarrow> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) \<longlongrightarrow> a + b) F"
   585   shows "(f \<longlongrightarrow> a) F \<Longrightarrow> (g \<longlongrightarrow> b) F \<Longrightarrow> ((\<lambda>x. f x + g x) \<longlongrightarrow> a + b) F"
   581   by (simp only: tendsto_Zfun_iff add_diff_add Zfun_add)
   586   using filterlim_compose[OF tendsto_add_Pair, of "\<lambda>x. (f x, g x)" a b F]
       
   587   by (simp add: nhds_prod[symmetric] tendsto_Pair)
   582 
   588 
   583 lemma continuous_add [continuous_intros]:
   589 lemma continuous_add [continuous_intros]:
   584   fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
   590   fixes f g :: "_ \<Rightarrow> 'b::topological_monoid_add"
   585   shows "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. f x + g x)"
   591   shows "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. f x + g x)"
   586   unfolding continuous_def by (rule tendsto_add)
   592   unfolding continuous_def by (rule tendsto_add)
   587 
   593 
   588 lemma continuous_on_add [continuous_intros]:
   594 lemma continuous_on_add [continuous_intros]:
   589   fixes f g :: "_ \<Rightarrow> 'b::real_normed_vector"
   595   fixes f g :: "_ \<Rightarrow> 'b::topological_monoid_add"
   590   shows "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> continuous_on s (\<lambda>x. f x + g x)"
   596   shows "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> continuous_on s (\<lambda>x. f x + g x)"
   591   unfolding continuous_on_def by (auto intro: tendsto_add)
   597   unfolding continuous_on_def by (auto intro: tendsto_add)
   592 
   598 
   593 lemma tendsto_add_zero:
   599 lemma tendsto_add_zero:
   594   fixes f g :: "_ \<Rightarrow> 'b::real_normed_vector"
   600   fixes f g :: "_ \<Rightarrow> 'b::topological_monoid_add"
   595   shows "\<lbrakk>(f \<longlongrightarrow> 0) F; (g \<longlongrightarrow> 0) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) \<longlongrightarrow> 0) F"
   601   shows "\<lbrakk>(f \<longlongrightarrow> 0) F; (g \<longlongrightarrow> 0) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + g x) \<longlongrightarrow> 0) F"
   596   by (drule (1) tendsto_add, simp)
   602   by (drule (1) tendsto_add, simp)
   597 
   603 
   598 lemma tendsto_minus [tendsto_intros]:
       
   599   fixes a :: "'a::real_normed_vector"
       
   600   shows "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. - f x) \<longlongrightarrow> - a) F"
       
   601   by (simp only: tendsto_Zfun_iff minus_diff_minus Zfun_minus)
       
   602 
       
   603 lemma continuous_minus [continuous_intros]:
       
   604   fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
       
   605   shows "continuous F f \<Longrightarrow> continuous F (\<lambda>x. - f x)"
       
   606   unfolding continuous_def by (rule tendsto_minus)
       
   607 
       
   608 lemma continuous_on_minus [continuous_intros]:
       
   609   fixes f :: "_ \<Rightarrow> 'b::real_normed_vector"
       
   610   shows "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. - f x)"
       
   611   unfolding continuous_on_def by (auto intro: tendsto_minus)
       
   612 
       
   613 lemma tendsto_minus_cancel:
       
   614   fixes a :: "'a::real_normed_vector"
       
   615   shows "((\<lambda>x. - f x) \<longlongrightarrow> - a) F \<Longrightarrow> (f \<longlongrightarrow> a) F"
       
   616   by (drule tendsto_minus, simp)
       
   617 
       
   618 lemma tendsto_minus_cancel_left:
       
   619     "(f \<longlongrightarrow> - (y::_::real_normed_vector)) F \<longleftrightarrow> ((\<lambda>x. - f x) \<longlongrightarrow> y) F"
       
   620   using tendsto_minus_cancel[of f "- y" F]  tendsto_minus[of f "- y" F]
       
   621   by auto
       
   622 
       
   623 lemma tendsto_diff [tendsto_intros]:
       
   624   fixes a b :: "'a::real_normed_vector"
       
   625   shows "\<lbrakk>(f \<longlongrightarrow> a) F; (g \<longlongrightarrow> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x - g x) \<longlongrightarrow> a - b) F"
       
   626   using tendsto_add [of f a F "\<lambda>x. - g x" "- b"] by (simp add: tendsto_minus)
       
   627 
       
   628 lemma continuous_diff [continuous_intros]:
       
   629   fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
       
   630   shows "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. f x - g x)"
       
   631   unfolding continuous_def by (rule tendsto_diff)
       
   632 
       
   633 lemma continuous_on_diff [continuous_intros]:
       
   634   fixes f g :: "_ \<Rightarrow> 'b::real_normed_vector"
       
   635   shows "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> continuous_on s (\<lambda>x. f x - g x)"
       
   636   unfolding continuous_on_def by (auto intro: tendsto_diff)
       
   637 
       
   638 lemma continuous_on_op_minus: "continuous_on (s::'a::real_normed_vector set) (op - x)"
       
   639   by (rule continuous_intros | simp)+
       
   640 
       
   641 lemma tendsto_setsum [tendsto_intros]:
   604 lemma tendsto_setsum [tendsto_intros]:
   642   fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::real_normed_vector"
   605   fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> 'c::topological_comm_monoid_add"
   643   assumes "\<And>i. i \<in> S \<Longrightarrow> (f i \<longlongrightarrow> a i) F"
   606   assumes "\<And>i. i \<in> S \<Longrightarrow> (f i \<longlongrightarrow> a i) F"
   644   shows "((\<lambda>x. \<Sum>i\<in>S. f i x) \<longlongrightarrow> (\<Sum>i\<in>S. a i)) F"
   607   shows "((\<lambda>x. \<Sum>i\<in>S. f i x) \<longlongrightarrow> (\<Sum>i\<in>S. a i)) F"
   645 proof (cases "finite S")
   608 proof (cases "finite S")
   646   assume "finite S" thus ?thesis using assms
   609   assume "finite S" thus ?thesis using assms
   647     by (induct, simp, simp add: tendsto_add)
   610     by (induct, simp, simp add: tendsto_add)
   648 qed simp
   611 qed simp
   649 
   612 
   650 lemma continuous_setsum [continuous_intros]:
   613 lemma continuous_setsum [continuous_intros]:
   651   fixes f :: "'a \<Rightarrow> 'b::t2_space \<Rightarrow> 'c::real_normed_vector"
   614   fixes f :: "'a \<Rightarrow> 'b::t2_space \<Rightarrow> 'c::topological_comm_monoid_add"
   652   shows "(\<And>i. i \<in> S \<Longrightarrow> continuous F (f i)) \<Longrightarrow> continuous F (\<lambda>x. \<Sum>i\<in>S. f i x)"
   615   shows "(\<And>i. i \<in> S \<Longrightarrow> continuous F (f i)) \<Longrightarrow> continuous F (\<lambda>x. \<Sum>i\<in>S. f i x)"
   653   unfolding continuous_def by (rule tendsto_setsum)
   616   unfolding continuous_def by (rule tendsto_setsum)
   654 
   617 
   655 lemma continuous_on_setsum [continuous_intros]:
   618 lemma continuous_on_setsum [continuous_intros]:
   656   fixes f :: "'a \<Rightarrow> _ \<Rightarrow> 'c::real_normed_vector"
   619   fixes f :: "'a \<Rightarrow> 'b::topological_space \<Rightarrow> 'c::topological_comm_monoid_add"
   657   shows "(\<And>i. i \<in> S \<Longrightarrow> continuous_on s (f i)) \<Longrightarrow> continuous_on s (\<lambda>x. \<Sum>i\<in>S. f i x)"
   620   shows "(\<And>i. i \<in> S \<Longrightarrow> continuous_on s (f i)) \<Longrightarrow> continuous_on s (\<lambda>x. \<Sum>i\<in>S. f i x)"
   658   unfolding continuous_on_def by (auto intro: tendsto_setsum)
   621   unfolding continuous_on_def by (auto intro: tendsto_setsum)
       
   622 
       
   623 subsubsection \<open>Addition and subtraction\<close>
       
   624 
       
   625 instance real_normed_vector < topological_comm_monoid_add
       
   626 proof
       
   627   fix a b :: 'a show "((\<lambda>x. fst x + snd x) \<longlongrightarrow> a + b) (nhds a \<times>\<^sub>F nhds b)"
       
   628     unfolding tendsto_Zfun_iff add_diff_add
       
   629     using tendsto_fst[OF filterlim_ident, of "(a,b)"] tendsto_snd[OF filterlim_ident, of "(a,b)"]
       
   630     by (intro Zfun_add)
       
   631        (auto simp add: tendsto_Zfun_iff[symmetric] nhds_prod[symmetric] intro!: tendsto_fst)
       
   632 qed
       
   633 
       
   634 lemma tendsto_minus [tendsto_intros]:
       
   635   fixes a :: "'a::real_normed_vector"
       
   636   shows "(f \<longlongrightarrow> a) F \<Longrightarrow> ((\<lambda>x. - f x) \<longlongrightarrow> - a) F"
       
   637   by (simp only: tendsto_Zfun_iff minus_diff_minus Zfun_minus)
       
   638 
       
   639 lemma continuous_minus [continuous_intros]:
       
   640   fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
       
   641   shows "continuous F f \<Longrightarrow> continuous F (\<lambda>x. - f x)"
       
   642   unfolding continuous_def by (rule tendsto_minus)
       
   643 
       
   644 lemma continuous_on_minus [continuous_intros]:
       
   645   fixes f :: "_ \<Rightarrow> 'b::real_normed_vector"
       
   646   shows "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. - f x)"
       
   647   unfolding continuous_on_def by (auto intro: tendsto_minus)
       
   648 
       
   649 lemma tendsto_minus_cancel:
       
   650   fixes a :: "'a::real_normed_vector"
       
   651   shows "((\<lambda>x. - f x) \<longlongrightarrow> - a) F \<Longrightarrow> (f \<longlongrightarrow> a) F"
       
   652   by (drule tendsto_minus, simp)
       
   653 
       
   654 lemma tendsto_minus_cancel_left:
       
   655     "(f \<longlongrightarrow> - (y::_::real_normed_vector)) F \<longleftrightarrow> ((\<lambda>x. - f x) \<longlongrightarrow> y) F"
       
   656   using tendsto_minus_cancel[of f "- y" F]  tendsto_minus[of f "- y" F]
       
   657   by auto
       
   658 
       
   659 lemma tendsto_diff [tendsto_intros]:
       
   660   fixes a b :: "'a::real_normed_vector"
       
   661   shows "\<lbrakk>(f \<longlongrightarrow> a) F; (g \<longlongrightarrow> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x - g x) \<longlongrightarrow> a - b) F"
       
   662   using tendsto_add [of f a F "\<lambda>x. - g x" "- b"] by (simp add: tendsto_minus)
       
   663 
       
   664 lemma continuous_diff [continuous_intros]:
       
   665   fixes f g :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
       
   666   shows "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. f x - g x)"
       
   667   unfolding continuous_def by (rule tendsto_diff)
       
   668 
       
   669 lemma continuous_on_diff [continuous_intros]:
       
   670   fixes f g :: "_ \<Rightarrow> 'b::real_normed_vector"
       
   671   shows "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> continuous_on s (\<lambda>x. f x - g x)"
       
   672   unfolding continuous_on_def by (auto intro: tendsto_diff)
       
   673 
       
   674 lemma continuous_on_op_minus: "continuous_on (s::'a::real_normed_vector set) (op - x)"
       
   675   by (rule continuous_intros | simp)+
   659 
   676 
   660 lemmas real_tendsto_sandwich = tendsto_sandwich[where 'b=real]
   677 lemmas real_tendsto_sandwich = tendsto_sandwich[where 'b=real]
   661 
   678 
   662 subsubsection \<open>Linear operators and multiplication\<close>
   679 subsubsection \<open>Linear operators and multiplication\<close>
   663 
   680 
  1466 qed simp
  1483 qed simp
  1467 
  1484 
  1468 
  1485 
  1469 subsection \<open>Limits of Sequences\<close>
  1486 subsection \<open>Limits of Sequences\<close>
  1470 
  1487 
  1471 lemma [trans]: "X=Y ==> Y \<longlonglongrightarrow> z ==> X \<longlonglongrightarrow> z"
  1488 lemma [trans]: "X = Y \<Longrightarrow> Y \<longlonglongrightarrow> z \<Longrightarrow> X \<longlonglongrightarrow> z"
  1472   by simp
  1489   by simp
  1473 
  1490 
  1474 lemma LIMSEQ_iff:
  1491 lemma LIMSEQ_iff:
  1475   fixes L :: "'a::real_normed_vector"
  1492   fixes L :: "'a::real_normed_vector"
  1476   shows "(X \<longlonglongrightarrow> L) = (\<forall>r>0. \<exists>no. \<forall>n \<ge> no. norm (X n - L) < r)"
  1493   shows "(X \<longlonglongrightarrow> L) = (\<forall>r>0. \<exists>no. \<forall>n \<ge> no. norm (X n - L) < r)"
  2040   fixes f :: "'a::t2_space \<Rightarrow> real"
  2057   fixes f :: "'a::t2_space \<Rightarrow> real"
  2041   shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. \<bar>f x\<bar>) a"
  2058   shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. \<bar>f x\<bar>) a"
  2042   by (fact continuous_rabs)
  2059   by (fact continuous_rabs)
  2043 
  2060 
  2044 lemma isCont_add [simp]:
  2061 lemma isCont_add [simp]:
  2045   fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
  2062   fixes f :: "'a::t2_space \<Rightarrow> 'b::topological_monoid_add"
  2046   shows "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x + g x) a"
  2063   shows "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. f x + g x) a"
  2047   by (fact continuous_add)
  2064   by (fact continuous_add)
  2048 
  2065 
  2049 lemma isCont_minus [simp]:
  2066 lemma isCont_minus [simp]:
  2050   fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
  2067   fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_vector"
  2079   fixes f :: "'a::t2_space \<Rightarrow> 'b::{power,real_normed_algebra}"
  2096   fixes f :: "'a::t2_space \<Rightarrow> 'b::{power,real_normed_algebra}"
  2080   shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. f x ^ n) a"
  2097   shows "isCont f a \<Longrightarrow> isCont (\<lambda>x. f x ^ n) a"
  2081   by (fact continuous_power)
  2098   by (fact continuous_power)
  2082 
  2099 
  2083 lemma isCont_setsum [simp]:
  2100 lemma isCont_setsum [simp]:
  2084   fixes f :: "'a \<Rightarrow> 'b::t2_space \<Rightarrow> 'c::real_normed_vector"
  2101   fixes f :: "'a \<Rightarrow> 'b::t2_space \<Rightarrow> 'c::topological_comm_monoid_add"
  2085   shows "\<forall>i\<in>A. isCont (f i) a \<Longrightarrow> isCont (\<lambda>x. \<Sum>i\<in>A. f i x) a"
  2102   shows "\<forall>i\<in>A. isCont (f i) a \<Longrightarrow> isCont (\<lambda>x. \<Sum>i\<in>A. f i x) a"
  2086   by (auto intro: continuous_setsum)
  2103   by (auto intro: continuous_setsum)
  2087 
  2104 
  2088 subsection \<open>Uniform Continuity\<close>
  2105 subsection \<open>Uniform Continuity\<close>
  2089 
  2106 
  2399   fixes f :: "real \<Rightarrow> real"
  2416   fixes f :: "real \<Rightarrow> real"
  2400   shows "f \<midarrow>c\<rightarrow> l \<Longrightarrow> l \<noteq> 0 \<Longrightarrow> \<exists>r. 0 < r \<and> (\<forall>x. x \<noteq> c \<and> \<bar>c - x\<bar> < r \<longrightarrow> f x \<noteq> 0)"
  2417   shows "f \<midarrow>c\<rightarrow> l \<Longrightarrow> l \<noteq> 0 \<Longrightarrow> \<exists>r. 0 < r \<and> (\<forall>x. x \<noteq> c \<and> \<bar>c - x\<bar> < r \<longrightarrow> f x \<noteq> 0)"
  2401   using LIM_fun_gt_zero[of f l c] LIM_fun_less_zero[of f l c] by (auto simp add: neq_iff)
  2418   using LIM_fun_gt_zero[of f l c] LIM_fun_less_zero[of f l c] by (auto simp add: neq_iff)
  2402 
  2419 
  2403 end
  2420 end
  2404