src/HOL/Multivariate_Analysis/Integration.thy
changeset 60621 bfb14ff43491
parent 60615 e5fa1d5d3952
child 60762 bf0c76ccee8d
equal deleted inserted replaced
60620:41e180848d02 60621:bfb14ff43491
  6053   thus ?thesis
  6053   thus ?thesis
  6054     using assms
  6054     using assms
  6055     by (auto intro!: derivative_eq_intros has_vector_derivative)
  6055     by (auto intro!: derivative_eq_intros has_vector_derivative)
  6056 qed (auto intro!: derivative_eq_intros has_vector_derivative)
  6056 qed (auto intro!: derivative_eq_intros has_vector_derivative)
  6057 
  6057 
  6058 lemma taylor_integral:
  6058 lemma
  6059   fixes f::"real\<Rightarrow>'a::banach"
  6059   fixes f::"real\<Rightarrow>'a::banach"
  6060   assumes "p>0"
  6060   assumes "p>0"
  6061   and f0: "Df 0 = f"
  6061   and f0: "Df 0 = f"
  6062   and Df: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
  6062   and Df: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
  6063     (Df m has_vector_derivative Df (Suc m) t) (at t within {a .. b})"
  6063     (Df m has_vector_derivative Df (Suc m) t) (at t within {a .. b})"
  6064   and ivl: "a \<le> b"
  6064   and ivl: "a \<le> b"
  6065   shows "f b = (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a) +
  6065   defines "i \<equiv> \<lambda>x. ((b - x) ^ (p - 1) / fact (p - 1)) *\<^sub>R Df p x"
  6066     integral {a..b} (\<lambda>x. ((b - x) ^ (p - 1) / fact (p - 1)) *\<^sub>R Df p x)"
  6066   shows taylor_has_integral:
  6067 proof -
  6067     "(i has_integral f b - (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a)) {a..b}"
       
  6068   and taylor_integral:
       
  6069     "f b = (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a) + integral {a..b} i"
       
  6070   and taylor_integrable:
       
  6071     "i integrable_on {a .. b}"
       
  6072 proof goals
       
  6073   case 1
  6068   interpret bounded_bilinear "scaleR::real\<Rightarrow>'a\<Rightarrow>'a"
  6074   interpret bounded_bilinear "scaleR::real\<Rightarrow>'a\<Rightarrow>'a"
  6069     by (rule bounded_bilinear_scaleR)
  6075     by (rule bounded_bilinear_scaleR)
  6070   def g \<equiv> "\<lambda>s. (b - s)^(p - 1)/fact (p - 1)"
  6076   def g \<equiv> "\<lambda>s. (b - s)^(p - 1)/fact (p - 1)"
  6071   def Dg \<equiv> "\<lambda>n s. if n < p then (-1)^n * (b - s)^(p - 1 - n) / fact (p - 1 - n) else 0"
  6077   def Dg \<equiv> "\<lambda>n s. if n < p then (-1)^n * (b - s)^(p - 1 - n) / fact (p - 1 - n) else 0"
  6072   have g0: "Dg 0 = g"
  6078   have g0: "Dg 0 = g"
  6083   have Dg: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
  6089   have Dg: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
  6084     (Dg m has_vector_derivative Dg (Suc m) t) (at t within {a .. b})"
  6090     (Dg m has_vector_derivative Dg (Suc m) t) (at t within {a .. b})"
  6085     unfolding Dg_def
  6091     unfolding Dg_def
  6086     by (auto intro!: derivative_eq_intros simp: has_vector_derivative_def
  6092     by (auto intro!: derivative_eq_intros simp: has_vector_derivative_def
  6087       fact_eq real_eq_of_nat[symmetric] divide_simps)
  6093       fact_eq real_eq_of_nat[symmetric] divide_simps)
       
  6094   let ?sum = "\<lambda>t. \<Sum>i<p. (- 1) ^ i *\<^sub>R Dg i t *\<^sub>R Df (p - Suc i) t"
  6088   from setsum_prod_derivatives_has_vector_derivative[of _ Dg _ _ _ Df,
  6095   from setsum_prod_derivatives_has_vector_derivative[of _ Dg _ _ _ Df,
  6089       OF \<open>p > 0\<close> g0 Dg f0 Df]
  6096       OF \<open>p > 0\<close> g0 Dg f0 Df]
  6090   have deriv: "\<And>t. a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
  6097   have deriv: "\<And>t. a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
  6091     ((\<lambda>t. \<Sum>i<p. (- 1) ^ i *\<^sub>R Dg i t *\<^sub>R Df (p - Suc i) t) has_vector_derivative
  6098     (?sum has_vector_derivative
  6092       g t *\<^sub>R Df p t - (- 1) ^ p *\<^sub>R Dg p t *\<^sub>R f t) (at t within {a..b})"
  6099       g t *\<^sub>R Df p t - (- 1) ^ p *\<^sub>R Dg p t *\<^sub>R f t) (at t within {a..b})"
  6093     by auto
  6100     by auto
  6094   from fundamental_theorem_of_calculus[rule_format, OF \<open>a \<le> b\<close> deriv]
  6101   from fundamental_theorem_of_calculus[rule_format, OF \<open>a \<le> b\<close> deriv]
  6095   have ftc: "integral {a..b} (\<lambda>x. g x *\<^sub>R Df p x - (- 1) ^ p *\<^sub>R Dg p x *\<^sub>R f x) =
  6102   have "(i has_integral ?sum b - ?sum a) {a .. b}"
  6096     (\<Sum>i<p. (- 1) ^ i *\<^sub>R Dg i b *\<^sub>R Df (p - Suc i) b) -
  6103     by (simp add: i_def g_def Dg_def)
  6097     (\<Sum>i<p. (- 1) ^ i *\<^sub>R Dg i a *\<^sub>R Df (p - Suc i) a)"
  6104   also
  6098     unfolding atLeastAtMost_iff by (auto dest!: integral_unique)
  6105   have one: "(- 1) ^ p' * (- 1) ^ p' = (1::real)"
  6099   def p' \<equiv> "p - 1"
  6106     and "{..<p} \<inter> {i. p = Suc i} = {p - 1}"
  6100   have p': "p = Suc p'" using \<open>p > 0\<close> by (simp add: p'_def)
  6107     for p'
  6101   have Dgp': "Dg p' = (\<lambda>_. (- 1) ^ p')"
  6108     using `p > 0`
  6102     by (auto simp: Dg_def p')
  6109     by (auto simp: power_mult_distrib[symmetric])
  6103   have one: "\<And>p'. (- 1::real) ^ p' * (- 1) ^ p' = 1"
  6110   then have "?sum b = f b"
  6104     "\<And>p' k. (- 1::real) ^ p' * ((- 1) ^ p' * k) = k"
  6111     using Suc_pred'[OF `p > 0`]
  6105     by (simp_all add: power_mult_distrib[symmetric] )
  6112     by (simp add: diff_eq_eq Dg_def power_0_left le_Suc_eq if_distrib
  6106   from ftc
  6113         cond_application_beta setsum.If_cases f0)
  6107   have "f b =
       
  6108     (\<Sum>i<p. ((b - a) ^ (p' - i) / fact (p' - i)) *\<^sub>R Df (p' - i) a) +
       
  6109      integral {a..b} (\<lambda>x. ((b - x) ^ (p - 1) / fact (p - 1)) *\<^sub>R Df p x)"
       
  6110     by (simp add: p' assms Dgp' one Dg_def g_def zero_power)
       
  6111   also
  6114   also
  6112   have "{..<p} = (\<lambda>x. p - x - 1) ` {..<p}"
  6115   have "{..<p} = (\<lambda>x. p - x - 1) ` {..<p}"
  6113   proof safe
  6116   proof safe
  6114     fix x
  6117     fix x
  6115     assume "x < p"
  6118     assume "x < p"
  6116     thus "x \<in> (\<lambda>x. p - x - 1) ` {..<p}"
  6119     thus "x \<in> (\<lambda>x. p - x - 1) ` {..<p}"
  6117       by (auto intro!: image_eqI[where x = "p - x - 1"])
  6120       by (auto intro!: image_eqI[where x = "p - x - 1"])
  6118   qed simp
  6121   qed simp
  6119   from _ this have "(\<Sum>i<p. ((b - a) ^ (p' - i) / fact (p' - i)) *\<^sub>R Df (p' - i) a) =
  6122   from _ this
  6120     (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a)"
  6123   have "?sum a = (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a)"
  6121     by (rule setsum.reindex_cong) (auto simp add: p' inj_on_def)
  6124     by (rule setsum.reindex_cong) (auto simp add: inj_on_def Dg_def one)
  6122   finally show "f b = (\<Sum>i<p. ((b - a) ^ i / fact i) *\<^sub>R Df i a) +
  6125   finally show c: ?case .
  6123     integral {a..b} (\<lambda>x. ((b - x) ^ (p - 1) / fact (p - 1)) *\<^sub>R Df p x)" .
  6126   case 2 show ?case using c integral_unique by force
       
  6127   case 3 show ?case using c by force
  6124 qed
  6128 qed
  6125 
  6129 
  6126 
  6130 
  6127 subsection \<open>Attempt a systematic general set of "offset" results for components.\<close>
  6131 subsection \<open>Attempt a systematic general set of "offset" results for components.\<close>
  6128 
  6132