src/HOL/Multivariate_Analysis/Integration.thy
changeset 62182 9ca00b65d36c
parent 61973 0c7e865fa7cb
child 62207 45eee631ea4f
equal deleted inserted replaced
62181:4025b5ce1901 62182:9ca00b65d36c
 11623     by (force intro!: choice)
 11623     by (force intro!: choice)
 11624   ultimately show ?thesis
 11624   ultimately show ?thesis
 11625     by (force intro!: exI[where x="\<Inter>C\<in>CC. X0 (c C)"])
 11625     by (force intro!: exI[where x="\<Inter>C\<in>CC. X0 (c C)"])
 11626 qed
 11626 qed
 11627 
 11627 
       
 11628 lemma continuous_on_prod_compactE:
       
 11629   fixes fx::"'a::topological_space \<times> 'b::topological_space \<Rightarrow> 'c::metric_space"
       
 11630     and e::real
       
 11631   assumes cont_fx: "continuous_on (U \<times> C) fx"
       
 11632   assumes "compact C"
       
 11633   assumes [intro]: "x0 \<in> U"
       
 11634   notes [continuous_intros] = continuous_on_compose2[OF cont_fx]
       
 11635   assumes "e > 0"
       
 11636   obtains X0 where "x0 \<in> X0" "open X0"
       
 11637     "\<forall>x\<in>X0 \<inter> U. \<forall>t \<in> C. dist (fx (x, t)) (fx (x0, t)) \<le> e"
       
 11638 proof -
       
 11639   def psi \<equiv> "\<lambda>(x, t). dist (fx (x, t)) (fx (x0, t))"
       
 11640   def W0 \<equiv> "{(x, t) \<in> U \<times> C. psi (x, t) < e}"
       
 11641   have W0_eq: "W0 = psi -` {..<e} \<inter> U \<times> C"
       
 11642     by (auto simp: vimage_def W0_def)
       
 11643   have "open {..<e}" by simp
       
 11644   have "continuous_on (U \<times> C) psi"
       
 11645     by (auto intro!: continuous_intros simp: psi_def split_beta')
       
 11646   from this[unfolded continuous_on_open_invariant, rule_format, OF \<open>open {..<e}\<close>]
       
 11647   obtain W where W: "open W" "W \<inter> U \<times> C = W0 \<inter> U \<times> C"
       
 11648     unfolding W0_eq by blast
       
 11649   have "{x0} \<times> C \<subseteq> W \<inter> U \<times> C"
       
 11650     unfolding W
       
 11651     by (auto simp: W0_def psi_def \<open>0 < e\<close>)
       
 11652   then have "{x0} \<times> C \<subseteq> W" by blast
       
 11653   from tube_lemma[OF \<open>compact C\<close> \<open>open W\<close> this]
       
 11654   obtain X0 where X0: "x0 \<in> X0" "open X0" "X0 \<times> C \<subseteq> W"
       
 11655     by blast
       
 11656 
       
 11657   have "\<forall>x\<in>X0 \<inter> U. \<forall>t \<in> C. dist (fx (x, t)) (fx (x0, t)) \<le> e"
       
 11658   proof safe
       
 11659     fix x assume x: "x \<in> X0" "x \<in> U"
       
 11660     fix t assume t: "t \<in> C"
       
 11661     have "dist (fx (x, t)) (fx (x0, t)) = psi (x, t)"
       
 11662       by (auto simp: psi_def)
       
 11663     also
       
 11664     {
       
 11665       have "(x, t) \<in> X0 \<times> C"
       
 11666         using t x
       
 11667         by auto
       
 11668       also note \<open>\<dots> \<subseteq> W\<close>
       
 11669       finally have "(x, t) \<in> W" .
       
 11670       with t x have "(x, t) \<in> W \<inter> U \<times> C"
       
 11671         by blast
       
 11672       also note \<open>W \<inter> U \<times> C = W0 \<inter> U \<times> C\<close>
       
 11673       finally  have "psi (x, t) < e"
       
 11674         by (auto simp: W0_def)
       
 11675     }
       
 11676     finally show "dist (fx (x, t)) (fx (x0, t)) \<le> e" by simp
       
 11677   qed
       
 11678   from X0(1,2) this show ?thesis ..
       
 11679 qed
       
 11680 
       
 11681 lemma integral_continuous_on_param:
       
 11682   fixes f::"'a::topological_space \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach"
       
 11683   assumes cont_fx: "continuous_on (U \<times> cbox a b) (\<lambda>(x, t). f x t)"
       
 11684   shows "continuous_on U (\<lambda>x. integral (cbox a b) (f x))"
       
 11685 proof cases
       
 11686   assume "content (cbox a b) \<noteq> 0"
       
 11687   then have ne: "cbox a b \<noteq> {}" by auto
       
 11688 
       
 11689   note [continuous_intros] =
       
 11690     continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x,
       
 11691       unfolded split_beta fst_conv snd_conv]
       
 11692 
       
 11693   show ?thesis
       
 11694     unfolding continuous_on_def
       
 11695   proof (safe intro!: tendstoI)
       
 11696     fix e'::real and x
       
 11697     assume "e' > 0"
       
 11698     def e \<equiv> "e' / (content (cbox a b) + 1)"
       
 11699     have "e > 0" using \<open>e' > 0\<close> by (auto simp: e_def intro!: divide_pos_pos add_nonneg_pos)
       
 11700     assume "x \<in> U"
       
 11701     from continuous_on_prod_compactE[OF cont_fx compact_cbox \<open>x \<in> U\<close> \<open>0 < e\<close>]
       
 11702     obtain X0 where X0: "x \<in> X0" "open X0"
       
 11703       and fx_bound: "\<And>y t. y \<in> X0 \<inter> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> norm (f y t - f x t) \<le> e"
       
 11704       unfolding split_beta fst_conv snd_conv dist_norm
       
 11705       by metis
       
 11706     have "\<forall>\<^sub>F y in at x within U. y \<in> X0 \<inter> U"
       
 11707       using X0(1) X0(2) eventually_at_topological by auto
       
 11708     then show "\<forall>\<^sub>F y in at x within U. dist (integral (cbox a b) (f y)) (integral (cbox a b) (f x)) < e'"
       
 11709     proof eventually_elim
       
 11710       case (elim y)
       
 11711       have "dist (integral (cbox a b) (f y)) (integral (cbox a b) (f x)) =
       
 11712         norm (integral (cbox a b) (\<lambda>t. f y t - f x t))"
       
 11713         using elim \<open>x \<in> U\<close>
       
 11714         unfolding dist_norm
       
 11715         by (subst integral_diff)
       
 11716            (auto intro!: integrable_continuous continuous_intros)
       
 11717       also have "\<dots> \<le> e * content (cbox a b)"
       
 11718         using elim \<open>x \<in> U\<close>
       
 11719         by (intro integrable_bound)
       
 11720            (auto intro!: fx_bound \<open>x \<in> U \<close> less_imp_le[OF \<open>0 < e\<close>]
       
 11721               integrable_continuous continuous_intros)
       
 11722       also have "\<dots> < e'"
       
 11723         using \<open>0 < e'\<close> \<open>e > 0\<close>
       
 11724         by (auto simp: e_def divide_simps)
       
 11725       finally show "dist (integral (cbox a b) (f y)) (integral (cbox a b) (f x)) < e'" .
       
 11726     qed
       
 11727   qed
       
 11728 qed (auto intro!: continuous_on_const)
       
 11729 
 11628 lemma eventually_closed_segment:
 11730 lemma eventually_closed_segment:
 11629   fixes x0::"'a::real_normed_vector"
 11731   fixes x0::"'a::real_normed_vector"
 11630   assumes "open X0" "x0 \<in> X0"
 11732   assumes "open X0" "x0 \<in> X0"
 11631   shows "\<forall>\<^sub>F x in at x0 within U. closed_segment x0 x \<subseteq> X0"
 11733   shows "\<forall>\<^sub>F x in at x0 within U. closed_segment x0 x \<subseteq> X0"
 11632 proof -
 11734 proof -
 11644     finally show ?case .
 11746     finally show ?case .
 11645   qed
 11747   qed
 11646 qed
 11748 qed
 11647 
 11749 
 11648 lemma leibniz_rule:
 11750 lemma leibniz_rule:
 11649   fixes f::"'a::banach \<times> 'b::euclidean_space \<Rightarrow> 'c::banach"
 11751   fixes f::"'a::banach \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach"
 11650   assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> (cbox a b) \<Longrightarrow>
 11752   assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow>
 11651     ((\<lambda>x. f (x, t)) has_derivative blinfun_apply (fx (x, t))) (at x within U)"
 11753     ((\<lambda>x. f x t) has_derivative blinfun_apply (fx x t)) (at x within U)"
 11652   assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> (\<lambda>t. f (x, t)) integrable_on cbox a b"
 11754   assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> f x integrable_on cbox a b"
 11653   assumes cont_fx: "continuous_on (U \<times> (cbox a b)) fx"
 11755   assumes cont_fx: "continuous_on (U \<times> (cbox a b)) (\<lambda>(x, t). fx x t)"
 11654   assumes [intro]: "x0 \<in> U"
 11756   assumes [intro]: "x0 \<in> U"
 11655   assumes "convex U"
 11757   assumes "convex U"
 11656   notes [continuous_intros] = continuous_on_compose2[OF cont_fx]
       
 11657   shows
 11758   shows
 11658     "((\<lambda>x. integral (cbox a b) (\<lambda>t. f (x, t))) has_derivative integral (cbox a b) (\<lambda>t. fx (x0, t)))
 11759     "((\<lambda>x. integral (cbox a b) (f x)) has_derivative integral (cbox a b) (fx x0)) (at x0 within U)"
 11659       (at x0 within U)"
       
 11660     (is "(?F has_derivative ?dF) _")
 11760     (is "(?F has_derivative ?dF) _")
 11661 proof cases
 11761 proof cases
 11662   assume "content (cbox a b) \<noteq> 0"
 11762   assume "content (cbox a b) \<noteq> 0"
 11663   then have ne: "cbox a b \<noteq> {}" by auto
 11763   then have ne: "cbox a b \<noteq> {}" by auto
       
 11764   note [continuous_intros] =
       
 11765     continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x,
       
 11766       unfolded split_beta fst_conv snd_conv]
 11664   show ?thesis
 11767   show ?thesis
 11665   proof (intro has_derivativeI bounded_linear_scaleR_left tendstoI, fold norm_conv_dist)
 11768   proof (intro has_derivativeI bounded_linear_scaleR_left tendstoI, fold norm_conv_dist)
 11666     have cont_f1: "\<And>t. t \<in> cbox a b \<Longrightarrow> continuous_on U (\<lambda>x. f (x, t))"
 11769     have cont_f1: "\<And>t. t \<in> cbox a b \<Longrightarrow> continuous_on U (\<lambda>x. f x t)"
 11667       by (auto simp: continuous_on_eq_continuous_within intro!: has_derivative_continuous fx)
 11770       by (auto simp: continuous_on_eq_continuous_within intro!: has_derivative_continuous fx)
 11668     note [continuous_intros] = continuous_on_compose2[OF cont_f1]
 11771     note [continuous_intros] = continuous_on_compose2[OF cont_f1]
 11669     fix e'::real
 11772     fix e'::real
 11670     assume "e' > 0"
 11773     assume "e' > 0"
 11671     def e \<equiv> "e' / (content (cbox a b) + 1)"
 11774     def e \<equiv> "e' / (content (cbox a b) + 1)"
 11672     have "e > 0" using \<open>e' > 0\<close> by (auto simp: e_def intro!: divide_pos_pos add_nonneg_pos)
 11775     have "e > 0" using \<open>e' > 0\<close> by (auto simp: e_def intro!: divide_pos_pos add_nonneg_pos)
 11673     def psi \<equiv> "\<lambda>(x, t). fx (x, t) - fx (x0, t)"
 11776     from continuous_on_prod_compactE[OF cont_fx compact_cbox \<open>x0 \<in> U\<close> \<open>e > 0\<close>]
 11674     def W0 \<equiv> "{(x, t) \<in> U \<times> (cbox a b). norm (psi (x, t)) < e}"
 11777     obtain X0 where X0: "x0 \<in> X0" "open X0"
 11675     have W0_eq: "W0 = (\<lambda>(x, t). norm (psi (x, t))) -` {..<e} \<inter> U \<times> (cbox a b)"
 11778       and fx_bound: "\<And>x t. x \<in> X0 \<inter> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> norm (fx x t - fx x0 t) \<le> e"
 11676       by (auto simp: vimage_def W0_def)
 11779       unfolding split_beta fst_conv snd_conv
 11677     have "open {..<e}" by simp
 11780       by (metis dist_norm)
 11678     have "continuous_on (U \<times> (cbox a b)) (\<lambda>(x, t). norm (psi (x, t)))"
       
 11679       by (auto intro!: continuous_intros simp: psi_def split_beta')
       
 11680     from this[unfolded continuous_on_open_invariant, rule_format, OF \<open>open {..<e}\<close>]
       
 11681     obtain W where W: "open W" "W \<inter> U \<times> (cbox a b) = W0 \<inter> U \<times> (cbox a b)"
       
 11682       unfolding W0_eq by blast
       
 11683     have "{x0} \<times> (cbox a b) \<subseteq> W \<inter> U \<times> (cbox a b)"
       
 11684       unfolding W
       
 11685       by (auto simp: W0_def psi_def \<open>0 < e\<close>)
       
 11686     then have "{x0} \<times> cbox a b \<subseteq> W" by blast
       
 11687     from tube_lemma[OF compact_cbox[of a b] \<open>open W\<close> this]
       
 11688     obtain X0 where X0: "x0 \<in> X0" "open X0" "X0 \<times> cbox a b \<subseteq> W"
       
 11689       by blast
       
 11690 
 11781 
 11691     note eventually_closed_segment[OF \<open>open X0\<close> \<open>x0 \<in> X0\<close>, of U]
 11782     note eventually_closed_segment[OF \<open>open X0\<close> \<open>x0 \<in> X0\<close>, of U]
 11692     moreover
 11783     moreover
 11693     have "\<forall>\<^sub>F x in at x0 within U. x \<in> X0"
 11784     have "\<forall>\<^sub>F x in at x0 within U. x \<in> X0"
 11694       using \<open>open X0\<close> \<open>x0 \<in> X0\<close> eventually_at_topological by blast
 11785       using \<open>open X0\<close> \<open>x0 \<in> X0\<close> eventually_at_topological by blast
 11704       have "closed_segment x0 x \<subseteq> U"
 11795       have "closed_segment x0 x \<subseteq> U"
 11705         by (rule \<open>convex U\<close>[unfolded convex_contains_segment, rule_format, OF \<open>x0 \<in> U\<close> \<open>x \<in> U\<close>])
 11796         by (rule \<open>convex U\<close>[unfolded convex_contains_segment, rule_format, OF \<open>x0 \<in> U\<close> \<open>x \<in> U\<close>])
 11706       from elim have [intro]: "x \<in> U" by auto
 11797       from elim have [intro]: "x \<in> U" by auto
 11707 
 11798 
 11708       have "?F x - ?F x0 - ?dF (x - x0) =
 11799       have "?F x - ?F x0 - ?dF (x - x0) =
 11709         integral (cbox a b) (\<lambda>xa. f (x, xa) - f (x0, xa) - fx (x0, xa) (x - x0))"
 11800         integral (cbox a b) (\<lambda>y. f x y - f x0 y - fx x0 y (x - x0))"
 11710         (is "_ = ?id")
 11801         (is "_ = ?id")
 11711         using \<open>x \<noteq> x0\<close>
 11802         using \<open>x \<noteq> x0\<close>
 11712         by (subst blinfun_apply_integral integral_diff,
 11803         by (subst blinfun_apply_integral integral_diff,
 11713             auto intro!: integrable_diff integrable_f2 continuous_intros
 11804             auto intro!: integrable_diff integrable_f2 continuous_intros
 11714               intro: integrable_continuous)+
 11805               intro: integrable_continuous)+
 11715       also
 11806       also
 11716       {
 11807       {
 11717         fix t assume t: "t \<in> (cbox a b)"
 11808         fix t assume t: "t \<in> (cbox a b)"
 11718         have seg: "\<And>t. t \<in> {0..1} \<Longrightarrow> x0 + t *\<^sub>R (x - x0) \<in> closed_segment x0 x \<inter> U"
 11809         have seg: "\<And>t. t \<in> {0..1} \<Longrightarrow> x0 + t *\<^sub>R (x - x0) \<in> X0 \<inter> U"
 11719           using \<open>closed_segment x0 x \<subseteq> U\<close>
 11810           using \<open>closed_segment x0 x \<subseteq> U\<close>
       
 11811             \<open>closed_segment x0 x \<subseteq> X0\<close>
 11720           by (force simp: closed_segment_def algebra_simps)
 11812           by (force simp: closed_segment_def algebra_simps)
 11721         from t have deriv:
 11813         from t have deriv:
 11722           "((\<lambda>x. f (x, t)) has_derivative (fx (y, t))) (at y within closed_segment x0 x \<inter> U)"
 11814           "((\<lambda>x. f x t) has_derivative (fx y t)) (at y within X0 \<inter> U)"
 11723           if "y \<in> closed_segment x0 x \<inter> U" for y
 11815           if "y \<in> X0 \<inter> U" for y
 11724           unfolding has_vector_derivative_def[symmetric]
 11816           unfolding has_vector_derivative_def[symmetric]
 11725           using that \<open>x \<in> X0\<close>
 11817           using that \<open>x \<in> X0\<close>
 11726           by (intro has_derivative_within_subset[OF fx]) auto
 11818           by (intro has_derivative_within_subset[OF fx]) auto
 11727         have "\<forall>x\<in>closed_segment x0 x \<inter> U. norm (fx (x, t) - fx (x0, t)) \<le> e"
 11819         have "\<forall>x \<in> X0 \<inter> U. onorm (blinfun_apply (fx x t) - (fx x0 t)) \<le> e"
 11728         proof
 11820           using fx_bound t
 11729           fix y assume y: "y \<in> closed_segment x0 x \<inter> U"
 11821           by (auto simp add: norm_blinfun_def fun_diff_def blinfun.bilinear_simps[symmetric])
 11730           have "norm (fx (y, t) - fx (x0, t)) = norm (psi (y, t))"
 11822         from differentiable_bound_linearization[OF seg deriv this] X0
 11731             by (auto simp: psi_def)
 11823         have "norm (f x t - f x0 t - fx x0 t (x - x0)) \<le> e * norm (x - x0)"
 11732           also
       
 11733           {
       
 11734             have "(y, t) \<in> X0 \<times> (cbox a b)"
       
 11735               using t \<open>closed_segment x0 x \<subseteq> X0\<close> y
       
 11736               by auto
       
 11737             also note \<open>\<dots> \<subseteq> W\<close>
       
 11738             finally have "(y, t) \<in> W" .
       
 11739             with t y have "(y, t) \<in> W \<inter> U \<times> (cbox a b)"
       
 11740               by blast
       
 11741             also note \<open>W \<inter> U \<times> (cbox a b) = W0 \<inter> U \<times> (cbox a b)\<close>
       
 11742             finally  have "norm (psi (y, t)) < e"
       
 11743               by (auto simp: W0_def)
       
 11744           }
       
 11745           finally show "norm (fx (y, t) - fx (x0, t)) \<le> e" by simp
       
 11746         qed
       
 11747         then have onorm:
       
 11748           "\<forall>x\<in>closed_segment x0 x \<inter> U.
       
 11749             onorm (blinfun_apply (fx (x, t)) - blinfun_apply (fx (x0, t))) \<le> e"
       
 11750           by (auto simp: norm_blinfun.rep_eq blinfun.diff_left[abs_def] fun_diff_def)
       
 11751 
       
 11752         from differentiable_bound_linearization[OF seg deriv onorm]
       
 11753         have "norm (f (x, t) - f (x0, t) - fx (x0, t) (x - x0)) \<le> e * norm (x - x0)"
       
 11754           by (auto simp add: ac_simps)
 11824           by (auto simp add: ac_simps)
 11755       }
 11825       }
 11756       then have "norm ?id \<le> integral (cbox a b) (\<lambda>_. e * norm (x - x0))"
 11826       then have "norm ?id \<le> integral (cbox a b) (\<lambda>_. e * norm (x - x0))"
 11757         by (intro integral_norm_bound_integral)
 11827         by (intro integral_norm_bound_integral)
 11758           (auto intro!: continuous_intros integrable_diff integrable_f2
 11828           (auto intro!: continuous_intros integrable_diff integrable_f2
 11775   "(f has_vector_derivative f') (at x within U) \<longleftrightarrow>
 11845   "(f has_vector_derivative f') (at x within U) \<longleftrightarrow>
 11776     (f has_derivative blinfun_scaleR_left f') (at x within U)"
 11846     (f has_derivative blinfun_scaleR_left f') (at x within U)"
 11777   by (simp add: has_vector_derivative_def)
 11847   by (simp add: has_vector_derivative_def)
 11778 
 11848 
 11779 lemma leibniz_rule_vector_derivative:
 11849 lemma leibniz_rule_vector_derivative:
 11780   fixes f::"real \<times> 'b::euclidean_space \<Rightarrow> 'c::banach"
 11850   fixes f::"real \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'c::banach"
 11781   assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> (cbox a b) \<Longrightarrow>
 11851   assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow>
 11782       ((\<lambda>x. f (x, t)) has_vector_derivative (fx (x, t))) (at x within U)"
 11852       ((\<lambda>x. f x t) has_vector_derivative (fx x t)) (at x within U)"
 11783   assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> (\<lambda>t. f (x, t)) integrable_on cbox a b"
 11853   assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> (f x) integrable_on cbox a b"
 11784   assumes cont_fx: "continuous_on (U \<times> (cbox a b)) fx"
 11854   assumes cont_fx: "continuous_on (U \<times> cbox a b) (\<lambda>(x, t). fx x t)"
 11785   assumes U: "x0 \<in> U" "convex U"
 11855   assumes U: "x0 \<in> U" "convex U"
 11786   notes [continuous_intros] = continuous_on_compose2[OF cont_fx]
 11856   shows "((\<lambda>x. integral (cbox a b) (f x)) has_vector_derivative integral (cbox a b) (fx x0))
 11787   shows
 11857       (at x0 within U)"
 11788     "((\<lambda>x. integral (cbox a b) (\<lambda>t. f (x, t))) has_vector_derivative
       
 11789       integral (cbox a b) (\<lambda>t. fx (x0, t))) (at x0 within U)"
       
 11790 proof -
 11858 proof -
 11791   have *: "blinfun_scaleR_left (integral (cbox a b) (\<lambda>t. fx (x0, t))) =
 11859   note [continuous_intros] =
 11792     integral (cbox a b) (\<lambda>t. blinfun_scaleR_left (fx (x0, t)))"
 11860     continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x,
       
 11861       unfolded split_beta fst_conv snd_conv]
       
 11862   have *: "blinfun_scaleR_left (integral (cbox a b) (fx x0)) =
       
 11863     integral (cbox a b) (\<lambda>t. blinfun_scaleR_left (fx x0 t))"
 11793     by (subst integral_linear[symmetric])
 11864     by (subst integral_linear[symmetric])
 11794        (auto simp: has_vector_derivative_def o_def
 11865        (auto simp: has_vector_derivative_def o_def
 11795          intro!: integrable_continuous U continuous_intros bounded_linear_intros)
 11866          intro!: integrable_continuous U continuous_intros bounded_linear_intros)
 11796   show ?thesis
 11867   show ?thesis
 11797     unfolding has_vector_derivative_eq_has_derivative_blinfun
 11868     unfolding has_vector_derivative_eq_has_derivative_blinfun
 11798     apply (rule has_derivative_eq_rhs)
 11869     apply (rule has_derivative_eq_rhs)
 11799     apply (rule leibniz_rule[OF _ integrable_f2 _ U, where fx="\<lambda>x. blinfun_scaleR_left (fx x)"])
 11870     apply (rule leibniz_rule[OF _ integrable_f2 _ U, where fx="\<lambda>x t. blinfun_scaleR_left (fx x t)"])
 11800     using assms(1)
 11871     using fx cont_fx
 11801     apply (auto simp: has_vector_derivative_def * intro!: continuous_intros)
 11872     apply (auto simp: has_vector_derivative_def * split_beta intro!: continuous_intros)
 11802     done
 11873     done
 11803 qed
 11874 qed
 11804 
 11875 
 11805 lemma
 11876 lemma
 11806   has_field_derivative_eq_has_derivative_blinfun:
 11877   has_field_derivative_eq_has_derivative_blinfun:
 11807   "(f has_field_derivative f') (at x within U) \<longleftrightarrow> (f has_derivative blinfun_mult_right f') (at x within U)"
 11878   "(f has_field_derivative f') (at x within U) \<longleftrightarrow> (f has_derivative blinfun_mult_right f') (at x within U)"
 11808   by (simp add: has_field_derivative_def)
 11879   by (simp add: has_field_derivative_def)
 11809 
 11880 
 11810 lemma leibniz_rule_field_derivative:
 11881 lemma leibniz_rule_field_derivative:
 11811   fixes f::"'a::{real_normed_field, banach} \<times> 'b::euclidean_space \<Rightarrow> 'a"
 11882   fixes f::"'a::{real_normed_field, banach} \<Rightarrow> 'b::euclidean_space \<Rightarrow> 'a"
 11812   assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> (cbox a b) \<Longrightarrow> ((\<lambda>x. f (x, t)) has_field_derivative (fx (x, t))) (at x within U)"
 11883   assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> cbox a b \<Longrightarrow> ((\<lambda>x. f x t) has_field_derivative fx x t) (at x within U)"
 11813   assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> (\<lambda>t. f (x, t)) integrable_on cbox a b"
 11884   assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> (f x) integrable_on cbox a b"
 11814   assumes cont_fx: "continuous_on (U \<times> (cbox a b)) fx"
 11885   assumes cont_fx: "continuous_on (U \<times> (cbox a b)) (\<lambda>(x, t). fx x t)"
 11815   assumes U: "x0 \<in> U" "convex U"
 11886   assumes U: "x0 \<in> U" "convex U"
 11816   notes [continuous_intros] = continuous_on_compose2[OF cont_fx]
 11887   shows "((\<lambda>x. integral (cbox a b) (f x)) has_field_derivative integral (cbox a b) (fx x0)) (at x0 within U)"
 11817   shows "((\<lambda>x. integral (cbox a b) (\<lambda>t. f (x, t))) has_field_derivative integral (cbox a b) (\<lambda>t. fx (x0, t))) (at x0 within U)"
       
 11818 proof -
 11888 proof -
 11819   have *: "blinfun_mult_right (integral (cbox a b) (\<lambda>t. fx (x0, t))) =
 11889   note [continuous_intros] =
 11820     integral (cbox a b) (\<lambda>t. blinfun_mult_right (fx (x0, t)))"
 11890     continuous_on_compose2[OF cont_fx, where f="\<lambda>y. Pair x y" for x,
       
 11891       unfolded split_beta fst_conv snd_conv]
       
 11892   have *: "blinfun_mult_right (integral (cbox a b) (fx x0)) =
       
 11893     integral (cbox a b) (\<lambda>t. blinfun_mult_right (fx x0 t))"
 11821     by (subst integral_linear[symmetric])
 11894     by (subst integral_linear[symmetric])
 11822       (auto simp: has_vector_derivative_def o_def
 11895       (auto simp: has_vector_derivative_def o_def
 11823         intro!: integrable_continuous U continuous_intros bounded_linear_intros)
 11896         intro!: integrable_continuous U continuous_intros bounded_linear_intros)
 11824   show ?thesis
 11897   show ?thesis
 11825     unfolding has_field_derivative_eq_has_derivative_blinfun
 11898     unfolding has_field_derivative_eq_has_derivative_blinfun
 11826     apply (rule has_derivative_eq_rhs)
 11899     apply (rule has_derivative_eq_rhs)
 11827     apply (rule leibniz_rule[OF _ integrable_f2 _ U, where fx="\<lambda>x. blinfun_mult_right (fx x)"])
 11900     apply (rule leibniz_rule[OF _ integrable_f2 _ U, where fx="\<lambda>x t. blinfun_mult_right (fx x t)"])
 11828     using assms(1)
 11901     using fx cont_fx
 11829     apply (auto simp: has_field_derivative_def * intro!: continuous_intros)
 11902     apply (auto simp: has_field_derivative_def * split_beta intro!: continuous_intros)
 11830     done
 11903     done
 11831 qed
 11904 qed
 11832 
 11905 
 11833 
 11906 
 11834 subsection \<open>Exchange uniform limit and integral\<close>
 11907 subsection \<open>Exchange uniform limit and integral\<close>