src/HOL/NSA/CLim.thy
changeset 61975 b4b11391c676
parent 61971 720fa884656e
child 61976 3a27957ac658
equal deleted inserted replaced
61974:5b067c681989 61975:b4b11391c676
     2     Author      : Jacques D. Fleuriot
     2     Author      : Jacques D. Fleuriot
     3     Copyright   : 2001 University of Edinburgh
     3     Copyright   : 2001 University of Edinburgh
     4     Conversion to Isar and new proofs by Lawrence C Paulson, 2004
     4     Conversion to Isar and new proofs by Lawrence C Paulson, 2004
     5 *)
     5 *)
     6 
     6 
     7 section{*Limits, Continuity and Differentiation for Complex Functions*}
     7 section\<open>Limits, Continuity and Differentiation for Complex Functions\<close>
     8 
     8 
     9 theory CLim
     9 theory CLim
    10 imports CStar
    10 imports CStar
    11 begin
    11 begin
    12 
    12 
    16 (*??generalize*)
    16 (*??generalize*)
    17 lemma lemma_complex_mult_inverse_squared [simp]:
    17 lemma lemma_complex_mult_inverse_squared [simp]:
    18      "x \<noteq> (0::complex) \<Longrightarrow> x * (inverse x)\<^sup>2 = inverse x"
    18      "x \<noteq> (0::complex) \<Longrightarrow> x * (inverse x)\<^sup>2 = inverse x"
    19 by (simp add: numeral_2_eq_2)
    19 by (simp add: numeral_2_eq_2)
    20 
    20 
    21 text{*Changing the quantified variable. Install earlier?*}
    21 text\<open>Changing the quantified variable. Install earlier?\<close>
    22 lemma all_shift: "(\<forall>x::'a::comm_ring_1. P x) = (\<forall>x. P (x-a))"
    22 lemma all_shift: "(\<forall>x::'a::comm_ring_1. P x) = (\<forall>x. P (x-a))"
    23 apply auto 
    23 apply auto 
    24 apply (drule_tac x="x+a" in spec) 
    24 apply (drule_tac x="x+a" in spec) 
    25 apply (simp add: add.assoc) 
    25 apply (simp add: add.assoc) 
    26 done
    26 done
    32 apply auto
    32 apply auto
    33 apply (drule sym [THEN diff_eq_eq [THEN iffD2]], auto)
    33 apply (drule sym [THEN diff_eq_eq [THEN iffD2]], auto)
    34 done
    34 done
    35 
    35 
    36 
    36 
    37 subsection{*Limit of Complex to Complex Function*}
    37 subsection\<open>Limit of Complex to Complex Function\<close>
    38 
    38 
    39 lemma NSLIM_Re: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L ==> (%x. Re(f x)) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S Re(L)"
    39 lemma NSLIM_Re: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S L ==> (%x. Re(f x)) \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S Re(L)"
    40 by (simp add: NSLIM_def starfunC_approx_Re_Im_iff 
    40 by (simp add: NSLIM_def starfunC_approx_Re_Im_iff 
    41               hRe_hcomplex_of_complex)
    41               hRe_hcomplex_of_complex)
    42 
    42 
   106   shows "(f -- a --> L) = ((%x. Re(f x)) -- a --> Re(L) &
   106   shows "(f -- a --> L) = ((%x. Re(f x)) -- a --> Re(L) &
   107                          (%x. Im(f x)) -- a --> Im(L))"
   107                          (%x. Im(f x)) -- a --> Im(L))"
   108 by (simp add: LIM_NSLIM_iff NSLIM_NSCRLIM_Re_Im_iff)
   108 by (simp add: LIM_NSLIM_iff NSLIM_NSCRLIM_Re_Im_iff)
   109 
   109 
   110 
   110 
   111 subsection{*Continuity*}
   111 subsection\<open>Continuity\<close>
   112 
   112 
   113 lemma NSLIM_isContc_iff:
   113 lemma NSLIM_isContc_iff:
   114      "(f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S f a) = ((%h. f(a + h)) \<midarrow>0\<rightarrow>\<^sub>N\<^sub>S f a)"
   114      "(f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S f a) = ((%h. f(a + h)) \<midarrow>0\<rightarrow>\<^sub>N\<^sub>S f a)"
   115 by (rule NSLIM_h_iff)
   115 by (rule NSLIM_h_iff)
   116 
   116 
   117 subsection{*Functions from Complex to Reals*}
   117 subsection\<open>Functions from Complex to Reals\<close>
   118 
   118 
   119 lemma isNSContCR_cmod [simp]: "isNSCont cmod (a)"
   119 lemma isNSContCR_cmod [simp]: "isNSCont cmod (a)"
   120 by (auto intro: approx_hnorm
   120 by (auto intro: approx_hnorm
   121          simp add: starfunCR_cmod hcmod_hcomplex_of_complex [symmetric] 
   121          simp add: starfunCR_cmod hcmod_hcomplex_of_complex [symmetric] 
   122                     isNSCont_def)
   122                     isNSCont_def)
   132 lemma isCont_Im:
   132 lemma isCont_Im:
   133   fixes f :: "'a::real_normed_vector \<Rightarrow> complex"
   133   fixes f :: "'a::real_normed_vector \<Rightarrow> complex"
   134   shows "isCont f a ==> isCont (%x. Im (f x)) a"
   134   shows "isCont f a ==> isCont (%x. Im (f x)) a"
   135 by (simp add: isCont_def LIM_Im)
   135 by (simp add: isCont_def LIM_Im)
   136 
   136 
   137 subsection{* Differentiation of Natural Number Powers*}
   137 subsection\<open>Differentiation of Natural Number Powers\<close>
   138 
   138 
   139 lemma CDERIV_pow [simp]:
   139 lemma CDERIV_pow [simp]:
   140      "DERIV (%x. x ^ n) x :> (complex_of_real (real n)) * (x ^ (n - Suc 0))"
   140      "DERIV (%x. x ^ n) x :> (complex_of_real (real n)) * (x ^ (n - Suc 0))"
   141 apply (induct n)
   141 apply (induct n)
   142 apply (drule_tac [2] DERIV_ident [THEN DERIV_mult])
   142 apply (drule_tac [2] DERIV_ident [THEN DERIV_mult])
   143 apply (auto simp add: distrib_right of_nat_Suc)
   143 apply (auto simp add: distrib_right of_nat_Suc)
   144 apply (case_tac "n")
   144 apply (case_tac "n")
   145 apply (auto simp add: ac_simps)
   145 apply (auto simp add: ac_simps)
   146 done
   146 done
   147 
   147 
   148 text{*Nonstandard version*}
   148 text\<open>Nonstandard version\<close>
   149 lemma NSCDERIV_pow: "NSDERIV (%x. x ^ n) x :> complex_of_real (real n) * (x ^ (n - 1))"
   149 lemma NSCDERIV_pow: "NSDERIV (%x. x ^ n) x :> complex_of_real (real n) * (x ^ (n - 1))"
   150     by (metis CDERIV_pow NSDERIV_DERIV_iff One_nat_def)
   150     by (metis CDERIV_pow NSDERIV_DERIV_iff One_nat_def)
   151 
   151 
   152 text{*Can't relax the premise @{term "x \<noteq> 0"}: it isn't continuous at zero*}
   152 text\<open>Can't relax the premise @{term "x \<noteq> 0"}: it isn't continuous at zero\<close>
   153 lemma NSCDERIV_inverse:
   153 lemma NSCDERIV_inverse:
   154      "(x::complex) \<noteq> 0 ==> NSDERIV (%x. inverse(x)) x :> (- ((inverse x)\<^sup>2))"
   154      "(x::complex) \<noteq> 0 ==> NSDERIV (%x. inverse(x)) x :> (- ((inverse x)\<^sup>2))"
   155 unfolding numeral_2_eq_2
   155 unfolding numeral_2_eq_2
   156 by (rule NSDERIV_inverse)
   156 by (rule NSDERIV_inverse)
   157 
   157 
   159      "(x::complex) \<noteq> 0 ==> DERIV (%x. inverse(x)) x :> (- ((inverse x)\<^sup>2))"
   159      "(x::complex) \<noteq> 0 ==> DERIV (%x. inverse(x)) x :> (- ((inverse x)\<^sup>2))"
   160 unfolding numeral_2_eq_2
   160 unfolding numeral_2_eq_2
   161 by (rule DERIV_inverse)
   161 by (rule DERIV_inverse)
   162 
   162 
   163 
   163 
   164 subsection{*Derivative of Reciprocals (Function @{term inverse})*}
   164 subsection\<open>Derivative of Reciprocals (Function @{term inverse})\<close>
   165 
   165 
   166 lemma CDERIV_inverse_fun:
   166 lemma CDERIV_inverse_fun:
   167      "[| DERIV f x :> d; f(x) \<noteq> (0::complex) |]
   167      "[| DERIV f x :> d; f(x) \<noteq> (0::complex) |]
   168       ==> DERIV (%x. inverse(f x)) x :> (- (d * inverse ((f x)\<^sup>2)))"
   168       ==> DERIV (%x. inverse(f x)) x :> (- (d * inverse ((f x)\<^sup>2)))"
   169 unfolding numeral_2_eq_2
   169 unfolding numeral_2_eq_2
   174       ==> NSDERIV (%x. inverse(f x)) x :> (- (d * inverse ((f x)\<^sup>2)))"
   174       ==> NSDERIV (%x. inverse(f x)) x :> (- (d * inverse ((f x)\<^sup>2)))"
   175 unfolding numeral_2_eq_2
   175 unfolding numeral_2_eq_2
   176 by (rule NSDERIV_inverse_fun)
   176 by (rule NSDERIV_inverse_fun)
   177 
   177 
   178 
   178 
   179 subsection{* Derivative of Quotient*}
   179 subsection\<open>Derivative of Quotient\<close>
   180 
   180 
   181 lemma CDERIV_quotient:
   181 lemma CDERIV_quotient:
   182      "[| DERIV f x :> d; DERIV g x :> e; g(x) \<noteq> (0::complex) |]
   182      "[| DERIV f x :> d; DERIV g x :> e; g(x) \<noteq> (0::complex) |]
   183        ==> DERIV (%y. f(y) / (g y)) x :> (d*g(x) - (e*f(x))) / ((g x)\<^sup>2)"
   183        ==> DERIV (%y. f(y) / (g y)) x :> (d*g(x) - (e*f(x))) / ((g x)\<^sup>2)"
   184 unfolding numeral_2_eq_2
   184 unfolding numeral_2_eq_2
   189        ==> NSDERIV (%y. f(y) / (g y)) x :> (d*g(x) - (e*f(x))) / ((g x)\<^sup>2)"
   189        ==> NSDERIV (%y. f(y) / (g y)) x :> (d*g(x) - (e*f(x))) / ((g x)\<^sup>2)"
   190 unfolding numeral_2_eq_2
   190 unfolding numeral_2_eq_2
   191 by (rule NSDERIV_quotient)
   191 by (rule NSDERIV_quotient)
   192 
   192 
   193 
   193 
   194 subsection{*Caratheodory Formulation of Derivative at a Point: Standard Proof*}
   194 subsection\<open>Caratheodory Formulation of Derivative at a Point: Standard Proof\<close>
   195 
   195 
   196 lemma CARAT_CDERIVD:
   196 lemma CARAT_CDERIVD:
   197      "(\<forall>z. f z - f x = g z * (z - x)) & isNSCont g x & g x = l
   197      "(\<forall>z. f z - f x = g z * (z - x)) & isNSCont g x & g x = l
   198       ==> NSDERIV f x :> l"
   198       ==> NSDERIV f x :> l"
   199 by clarify (rule CARAT_DERIVD)
   199 by clarify (rule CARAT_DERIVD)