src/HOL/Analysis/Henstock_Kurzweil_Integration.thy
changeset 67685 bdff8bf0a75b
parent 67399 eab6ce8368fa
child 67686 2c58505bf151
equal deleted inserted replaced
67682:00c436488398 67685:bdff8bf0a75b
   618 next
   618 next
   619   case False then have "~ (\<lambda>x. c *\<^sub>R f x) integrable_on S"
   619   case False then have "~ (\<lambda>x. c *\<^sub>R f x) integrable_on S"
   620     using has_integral_cmul [of "(\<lambda>x. c *\<^sub>R f x)" _ S "inverse c"] by auto
   620     using has_integral_cmul [of "(\<lambda>x. c *\<^sub>R f x)" _ S "inverse c"] by auto
   621   with False show ?thesis by (simp add: not_integrable_integral)
   621   with False show ?thesis by (simp add: not_integrable_integral)
   622 qed
   622 qed
       
   623 
       
   624 lemma integral_mult:
       
   625   fixes K::real
       
   626   shows "f integrable_on X \<Longrightarrow> K * integral X f = integral X (\<lambda>x. K * f x)"
       
   627   unfolding real_scaleR_def[symmetric] integral_cmul ..
   623 
   628 
   624 lemma integral_neg [simp]: "integral S (\<lambda>x. - f x) = - integral S f"
   629 lemma integral_neg [simp]: "integral S (\<lambda>x. - f x) = - integral S f"
   625 proof (cases "f integrable_on S")
   630 proof (cases "f integrable_on S")
   626   case True then show ?thesis
   631   case True then show ?thesis
   627     by (simp add: has_integral_neg integrable_integral integral_unique)
   632     by (simp add: has_integral_neg integrable_integral integral_unique)
  2547   shows "f integrable_on {a..b}"
  2552   shows "f integrable_on {a..b}"
  2548   by (metis assms integrable_continuous interval_cbox)
  2553   by (metis assms integrable_continuous interval_cbox)
  2549 
  2554 
  2550 lemmas integrable_continuous_real = integrable_continuous_interval[where 'b=real]
  2555 lemmas integrable_continuous_real = integrable_continuous_interval[where 'b=real]
  2551 
  2556 
       
  2557 lemma integrable_continuous_closed_segment:
       
  2558   fixes f :: "real \<Rightarrow> 'a::banach"
       
  2559   assumes "continuous_on (closed_segment a b) f"
       
  2560   shows "f integrable_on (closed_segment a b)"
       
  2561   using assms
       
  2562   by (auto intro!: integrable_continuous_interval simp: closed_segment_eq_real_ivl)
       
  2563 
  2552 
  2564 
  2553 subsection \<open>Specialization of additivity to one dimension.\<close>
  2565 subsection \<open>Specialization of additivity to one dimension.\<close>
  2554 
  2566 
  2555 
  2567 
  2556 subsection \<open>A useful lemma allowing us to factor out the content size.\<close>
  2568 subsection \<open>A useful lemma allowing us to factor out the content size.\<close>
  2719   shows "(\<lambda>x. x) integrable_on {a..b}"
  2731   shows "(\<lambda>x. x) integrable_on {a..b}"
  2720 by (metis atLeastatMost_empty_iff integrable_on_def has_integral_empty ident_has_integral)
  2732 by (metis atLeastatMost_empty_iff integrable_on_def has_integral_empty ident_has_integral)
  2721 
  2733 
  2722 
  2734 
  2723 subsection \<open>Taylor series expansion\<close>
  2735 subsection \<open>Taylor series expansion\<close>
       
  2736 
       
  2737 lemma mvt_integral:
       
  2738   fixes f::"'a::real_normed_vector\<Rightarrow>'b::banach"
       
  2739   assumes f'[derivative_intros]:
       
  2740     "\<And>x. x \<in> S \<Longrightarrow> (f has_derivative f' x) (at x within S)"
       
  2741   assumes line_in: "\<And>t. t \<in> {0..1} \<Longrightarrow> x + t *\<^sub>R y \<in> S"
       
  2742   shows "f (x + y) - f x = integral {0..1} (\<lambda>t. f' (x + t *\<^sub>R y) y)" (is ?th1)
       
  2743 proof -
       
  2744   from assms have subset: "(\<lambda>xa. x + xa *\<^sub>R y) ` {0..1} \<subseteq> S" by auto
       
  2745   note [derivative_intros] =
       
  2746     has_derivative_subset[OF _ subset]
       
  2747     has_derivative_in_compose[where f="(\<lambda>xa. x + xa *\<^sub>R y)" and g = f]
       
  2748   note [continuous_intros] =
       
  2749     continuous_on_compose2[where f="(\<lambda>xa. x + xa *\<^sub>R y)"]
       
  2750     continuous_on_subset[OF _ subset]
       
  2751   have "\<And>t. t \<in> {0..1} \<Longrightarrow>
       
  2752     ((\<lambda>t. f (x + t *\<^sub>R y)) has_vector_derivative f' (x + t *\<^sub>R y) y)
       
  2753     (at t within {0..1})"
       
  2754     using assms
       
  2755     by (auto simp: has_vector_derivative_def
       
  2756         linear_cmul[OF has_derivative_linear[OF f'], symmetric]
       
  2757       intro!: derivative_eq_intros)
       
  2758   from fundamental_theorem_of_calculus[rule_format, OF _ this]
       
  2759   show ?th1
       
  2760     by (auto intro!: integral_unique[symmetric])
       
  2761 qed
  2724 
  2762 
  2725 lemma (in bounded_bilinear) sum_prod_derivatives_has_vector_derivative:
  2763 lemma (in bounded_bilinear) sum_prod_derivatives_has_vector_derivative:
  2726   assumes "p>0"
  2764   assumes "p>0"
  2727   and f0: "Df 0 = f"
  2765   and f0: "Df 0 = f"
  2728   and Df: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
  2766   and Df: "\<And>m t. m < p \<Longrightarrow> a \<le> t \<Longrightarrow> t \<le> b \<Longrightarrow>
  2831   finally show c: ?case .
  2869   finally show c: ?case .
  2832   case 2 show ?case using c integral_unique
  2870   case 2 show ?case using c integral_unique
  2833     by (metis (lifting) add.commute diff_eq_eq integral_unique)
  2871     by (metis (lifting) add.commute diff_eq_eq integral_unique)
  2834   case 3 show ?case using c by force
  2872   case 3 show ?case using c by force
  2835 qed
  2873 qed
  2836 
       
  2837 
  2874 
  2838 
  2875 
  2839 subsection \<open>Only need trivial subintervals if the interval itself is trivial.\<close>
  2876 subsection \<open>Only need trivial subintervals if the interval itself is trivial.\<close>
  2840 
  2877 
  2841 proposition division_of_nontrivial:
  2878 proposition division_of_nontrivial:
  3022   shows "f integrable_on {a..b}"
  3059   shows "f integrable_on {a..b}"
  3023   using assms
  3060   using assms
  3024   unfolding integrable_on_def
  3061   unfolding integrable_on_def
  3025   by (auto intro!: has_integral_combine)
  3062   by (auto intro!: has_integral_combine)
  3026 
  3063 
       
  3064 lemma integral_minus_sets:
       
  3065   fixes f::"real \<Rightarrow> 'a::banach"
       
  3066   shows "c \<le> a \<Longrightarrow> c \<le> b \<Longrightarrow> f integrable_on {c .. max a b} \<Longrightarrow>
       
  3067     integral {c .. a} f - integral {c .. b} f =
       
  3068     (if a \<le> b then - integral {a .. b} f else integral {b .. a} f)"
       
  3069   using integral_combine[of c a b f]  integral_combine[of c b a f]
       
  3070   by (auto simp: algebra_simps max_def)
       
  3071 
       
  3072 lemma integral_minus_sets':
       
  3073   fixes f::"real \<Rightarrow> 'a::banach"
       
  3074   shows "c \<ge> a \<Longrightarrow> c \<ge> b \<Longrightarrow> f integrable_on {min a b .. c} \<Longrightarrow>
       
  3075     integral {a .. c} f - integral {b .. c} f =
       
  3076     (if a \<le> b then integral {a .. b} f else - integral {b .. a} f)"
       
  3077   using integral_combine[of b a c f] integral_combine[of a b c f]
       
  3078   by (auto simp: algebra_simps min_def)
  3027 
  3079 
  3028 subsection \<open>Reduce integrability to "local" integrability.\<close>
  3080 subsection \<open>Reduce integrability to "local" integrability.\<close>
  3029 
  3081 
  3030 lemma integrable_on_little_subintervals:
  3082 lemma integrable_on_little_subintervals:
  3031   fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
  3083   fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
  3127     and "x \<in> {a..b}"
  3179     and "x \<in> {a..b}"
  3128   shows "((\<lambda>u. integral {a..u} f) has_vector_derivative f(x)) (at x within {a..b})"
  3180   shows "((\<lambda>u. integral {a..u} f) has_vector_derivative f(x)) (at x within {a..b})"
  3129 using assms integral_has_vector_derivative_continuous_at [OF integrable_continuous_real]
  3181 using assms integral_has_vector_derivative_continuous_at [OF integrable_continuous_real]
  3130   by (fastforce simp: continuous_on_eq_continuous_within)
  3182   by (fastforce simp: continuous_on_eq_continuous_within)
  3131 
  3183 
       
  3184 lemma integral_has_real_derivative:
       
  3185   assumes "continuous_on {a..b} g"
       
  3186   assumes "t \<in> {a..b}"
       
  3187   shows "((\<lambda>x. integral {a..x} g) has_real_derivative g t) (at t within {a..b})"
       
  3188   using integral_has_vector_derivative[of a b g t] assms
       
  3189   by (auto simp: has_field_derivative_iff_has_vector_derivative)
       
  3190 
  3132 lemma antiderivative_continuous:
  3191 lemma antiderivative_continuous:
  3133   fixes q b :: real
  3192   fixes q b :: real
  3134   assumes "continuous_on {a..b} f"
  3193   assumes "continuous_on {a..b} f"
  3135   obtains g where "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative (f x::_::banach)) (at x within {a..b})"
  3194   obtains g where "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative (f x::_::banach)) (at x within {a..b})"
  3136   using integral_has_vector_derivative[OF assms] by auto
  3195   using integral_has_vector_derivative[OF assms] by auto
  3137 
       
  3138 
  3196 
  3139 subsection \<open>Combined fundamental theorem of calculus.\<close>
  3197 subsection \<open>Combined fundamental theorem of calculus.\<close>
  3140 
  3198 
  3141 lemma antiderivative_integral_continuous:
  3199 lemma antiderivative_integral_continuous:
  3142   fixes f :: "real \<Rightarrow> 'a::banach"
  3200   fixes f :: "real \<Rightarrow> 'a::banach"
  3147     where g: "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative f x) (at x within {a..b})" 
  3205     where g: "\<And>x. x \<in> {a..b} \<Longrightarrow> (g has_vector_derivative f x) (at x within {a..b})" 
  3148     using  antiderivative_continuous[OF assms] by metis
  3206     using  antiderivative_continuous[OF assms] by metis
  3149   have "(f has_integral g v - g u) {u..v}" if "u \<in> {a..b}" "v \<in> {a..b}" "u \<le> v" for u v
  3207   have "(f has_integral g v - g u) {u..v}" if "u \<in> {a..b}" "v \<in> {a..b}" "u \<le> v" for u v
  3150   proof -
  3208   proof -
  3151     have "\<And>x. x \<in> cbox u v \<Longrightarrow> (g has_vector_derivative f x) (at x within cbox u v)"
  3209     have "\<And>x. x \<in> cbox u v \<Longrightarrow> (g has_vector_derivative f x) (at x within cbox u v)"
  3152       by (meson g has_vector_derivative_within_subset interval_subset_is_interval is_interval_closed_interval subsetCE that(1) that(2))
  3210       by (metis atLeastAtMost_iff atLeastatMost_subset_iff box_real(2) g
       
  3211           has_vector_derivative_within_subset subsetCE that(1,2))
  3153     then show ?thesis
  3212     then show ?thesis
  3154       by (metis box_real(2) that(3) fundamental_theorem_of_calculus)
  3213       by (metis box_real(2) that(3) fundamental_theorem_of_calculus)
  3155   qed
  3214   qed
  3156   then show ?thesis
  3215   then show ?thesis
  3157     using that by blast
  3216     using that by blast
  4123     by (auto simp: algebra_simps)
  4182     by (auto simp: algebra_simps)
  4124   with _ show ?thesis
  4183   with _ show ?thesis
  4125     by (rule continuous_on_eq) (auto intro!: continuous_intros indefinite_integral_continuous_1 assms)
  4184     by (rule continuous_on_eq) (auto intro!: continuous_intros indefinite_integral_continuous_1 assms)
  4126 qed
  4185 qed
  4127 
  4186 
       
  4187 theorem integral_has_vector_derivative':
       
  4188   fixes f :: "real \<Rightarrow> 'b::banach"
       
  4189   assumes "continuous_on {a..b} f"
       
  4190     and "x \<in> {a..b}"
       
  4191   shows "((\<lambda>u. integral {u..b} f) has_vector_derivative - f x) (at x within {a..b})"
       
  4192 proof -
       
  4193   have *: "integral {x..b} f = integral {a .. b} f - integral {a .. x} f" if "a \<le> x" "x \<le> b" for x
       
  4194     using integral_combine[of a x b for x, OF that integrable_continuous_real[OF assms(1)]]
       
  4195     by (simp add: algebra_simps)
       
  4196   show ?thesis
       
  4197     using \<open>x \<in> _\<close> *
       
  4198     by (rule has_vector_derivative_transform)
       
  4199       (auto intro!: derivative_eq_intros assms integral_has_vector_derivative)
       
  4200 qed
       
  4201 
       
  4202 lemma integral_has_real_derivative':
       
  4203   assumes "continuous_on {a..b} g"
       
  4204   assumes "t \<in> {a..b}"
       
  4205   shows "((\<lambda>x. integral {x..b} g) has_real_derivative -g t) (at t within {a..b})"
       
  4206   using integral_has_vector_derivative'[OF assms]
       
  4207   by (auto simp: has_field_derivative_iff_has_vector_derivative)
       
  4208 
  4128 
  4209 
  4129 subsection \<open>This doesn't directly involve integration, but that gives an easy proof.\<close>
  4210 subsection \<open>This doesn't directly involve integration, but that gives an easy proof.\<close>
  4130 
  4211 
  4131 lemma has_derivative_zero_unique_strong_interval:
  4212 lemma has_derivative_zero_unique_strong_interval:
  4132   fixes f :: "real \<Rightarrow> 'a::banach"
  4213   fixes f :: "real \<Rightarrow> 'a::banach"
  4658 lemma integrable_spike_set_eq:
  4739 lemma integrable_spike_set_eq:
  4659   fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  4740   fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  4660   assumes "negligible ((S - T) \<union> (T - S))"
  4741   assumes "negligible ((S - T) \<union> (T - S))"
  4661   shows "f integrable_on S \<longleftrightarrow> f integrable_on T"
  4742   shows "f integrable_on S \<longleftrightarrow> f integrable_on T"
  4662   by (blast intro: integrable_spike_set assms negligible_subset)
  4743   by (blast intro: integrable_spike_set assms negligible_subset)
       
  4744 
       
  4745 lemma integrable_on_insert_iff: "f integrable_on (insert x X) \<longleftrightarrow> f integrable_on X"
       
  4746   for f::"_ \<Rightarrow> 'a::banach"
       
  4747   by (rule integrable_spike_set_eq) (auto simp: insert_Diff_if)
  4663 
  4748 
  4664 lemma has_integral_interior:
  4749 lemma has_integral_interior:
  4665   fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
  4750   fixes f :: "'a :: euclidean_space \<Rightarrow> 'b :: banach"
  4666   shows "negligible(frontier S) \<Longrightarrow> (f has_integral y) (interior S) \<longleftrightarrow> (f has_integral y) S"
  4751   shows "negligible(frontier S) \<Longrightarrow> (f has_integral y) (interior S) \<longleftrightarrow> (f has_integral y) S"
  4667   apply (rule has_integral_spike_set_eq)
  4752   apply (rule has_integral_spike_set_eq)
  6047         using int_fz integral_unique z by blast
  6132         using int_fz integral_unique z by blast
  6048     qed
  6133     qed
  6049   qed
  6134   qed
  6050 qed
  6135 qed
  6051 
  6136 
       
  6137 lemma continuous_on_imp_absolutely_integrable_on:
       
  6138   fixes f::"real \<Rightarrow> 'a::banach"
       
  6139   shows "continuous_on {a..b} f \<Longrightarrow>
       
  6140     norm (integral {a..b} f) \<le> integral {a..b} (\<lambda>x. norm (f x))"
       
  6141   by (intro integral_norm_bound_integral integrable_continuous_real continuous_on_norm) auto
       
  6142 
       
  6143 lemma integral_bound:
       
  6144   fixes f::"real \<Rightarrow> 'a::banach"
       
  6145   assumes "a \<le> b"
       
  6146   assumes "continuous_on {a .. b} f"
       
  6147   assumes "\<And>t. t \<in> {a .. b} \<Longrightarrow> norm (f t) \<le> B"
       
  6148   shows "norm (integral {a .. b} f) \<le> B * (b - a)"
       
  6149 proof -
       
  6150   note continuous_on_imp_absolutely_integrable_on[OF assms(2)]
       
  6151   also have "integral {a..b} (\<lambda>x. norm (f x)) \<le> integral {a..b} (\<lambda>_. B)"
       
  6152     by (rule integral_le)
       
  6153       (auto intro!: integrable_continuous_real continuous_intros assms)
       
  6154   also have "\<dots> = B * (b - a)" using assms by simp
       
  6155   finally show ?thesis .
       
  6156 qed
  6052 
  6157 
  6053 lemma integral_norm_bound_integral_component:
  6158 lemma integral_norm_bound_integral_component:
  6054   fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  6159   fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  6055   fixes g :: "'n \<Rightarrow> 'b::euclidean_space"
  6160   fixes g :: "'n \<Rightarrow> 'b::euclidean_space"
  6056   assumes f: "f integrable_on S" and g: "g integrable_on S"
  6161   assumes f: "f integrable_on S" and g: "g integrable_on S"