src/HOL/Analysis/Henstock_Kurzweil_Integration.thy
changeset 68073 fad29d2a17a5
parent 68072 493b818e8e10
parent 68053 56ff7c3e5550
child 68120 2f161c6910f7
equal deleted inserted replaced
68072:493b818e8e10 68073:fad29d2a17a5
   126 lemma content_split:
   126 lemma content_split:
   127   fixes a :: "'a::euclidean_space"
   127   fixes a :: "'a::euclidean_space"
   128   assumes "k \<in> Basis"
   128   assumes "k \<in> Basis"
   129   shows "content (cbox a b) = content(cbox a b \<inter> {x. x\<bullet>k \<le> c}) + content(cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
   129   shows "content (cbox a b) = content(cbox a b \<inter> {x. x\<bullet>k \<le> c}) + content(cbox a b \<inter> {x. x\<bullet>k \<ge> c})"
   130   \<comment> \<open>Prove using measure theory\<close>
   130   \<comment> \<open>Prove using measure theory\<close>
   131 proof cases
   131 proof (cases "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i")
       
   132   case True
       
   133   have 1: "\<And>X Y Z. (\<Prod>i\<in>Basis. Z i (if i = k then X else Y i)) = Z k X * (\<Prod>i\<in>Basis-{k}. Z i (Y i))"
       
   134     by (simp add: if_distrib prod.delta_remove assms)
   132   note simps = interval_split[OF assms] content_cbox_cases
   135   note simps = interval_split[OF assms] content_cbox_cases
   133   have *: "Basis = insert k (Basis - {k})" "\<And>x. finite (Basis-{x})" "\<And>x. x\<notin>Basis-{x}"
   136   have 2: "(\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i) = (\<Prod>i\<in>Basis-{k}. b\<bullet>i - a\<bullet>i) * (b\<bullet>k - a\<bullet>k)"
   134     using assms by auto
   137     by (metis (no_types, lifting) assms finite_Basis mult.commute prod.remove)
   135   have *: "\<And>X Y Z. (\<Prod>i\<in>Basis. Z i (if i = k then X else Y i)) = Z k X * (\<Prod>i\<in>Basis-{k}. Z i (Y i))"
       
   136     "(\<Prod>i\<in>Basis. b\<bullet>i - a\<bullet>i) = (\<Prod>i\<in>Basis-{k}. b\<bullet>i - a\<bullet>i) * (b\<bullet>k - a\<bullet>k)"
       
   137     apply (subst *(1))
       
   138     defer
       
   139     apply (subst *(1))
       
   140     unfolding prod.insert[OF *(2-)]
       
   141     apply auto
       
   142     done
       
   143   assume as: "\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i"
       
   144   moreover
       
   145   have "\<And>x. min (b \<bullet> k) c = max (a \<bullet> k) c \<Longrightarrow>
   138   have "\<And>x. min (b \<bullet> k) c = max (a \<bullet> k) c \<Longrightarrow>
   146     x * (b\<bullet>k - a\<bullet>k) = x * (max (a \<bullet> k) c - a \<bullet> k) + x * (b \<bullet> k - max (a \<bullet> k) c)"
   139     x * (b\<bullet>k - a\<bullet>k) = x * (max (a \<bullet> k) c - a \<bullet> k) + x * (b \<bullet> k - max (a \<bullet> k) c)"
   147     by  (auto simp add: field_simps)
   140     by  (auto simp add: field_simps)
   148   moreover
   141   moreover
   149   have **: "(\<Prod>i\<in>Basis. ((\<Sum>i\<in>Basis. (if i = k then min (b \<bullet> k) c else b \<bullet> i) *\<^sub>R i) \<bullet> i - a \<bullet> i)) =
   142   have **: "(\<Prod>i\<in>Basis. ((\<Sum>i\<in>Basis. (if i = k then min (b \<bullet> k) c else b \<bullet> i) *\<^sub>R i) \<bullet> i - a \<bullet> i)) =
   150       (\<Prod>i\<in>Basis. (if i = k then min (b \<bullet> k) c else b \<bullet> i) - a \<bullet> i)"
   143       (\<Prod>i\<in>Basis. (if i = k then min (b \<bullet> k) c else b \<bullet> i) - a \<bullet> i)"
   151     "(\<Prod>i\<in>Basis. b \<bullet> i - ((\<Sum>i\<in>Basis. (if i = k then max (a \<bullet> k) c else a \<bullet> i) *\<^sub>R i) \<bullet> i)) =
   144     "(\<Prod>i\<in>Basis. b \<bullet> i - ((\<Sum>i\<in>Basis. (if i = k then max (a \<bullet> k) c else a \<bullet> i) *\<^sub>R i) \<bullet> i)) =
   152       (\<Prod>i\<in>Basis. b \<bullet> i - (if i = k then max (a \<bullet> k) c else a \<bullet> i))"
   145       (\<Prod>i\<in>Basis. b \<bullet> i - (if i = k then max (a \<bullet> k) c else a \<bullet> i))"
   153     by (auto intro!: prod.cong)
   146     by (auto intro!: prod.cong)
   154   have "\<not> a \<bullet> k \<le> c \<Longrightarrow> \<not> c \<le> b \<bullet> k \<Longrightarrow> False"
   147   have "\<not> a \<bullet> k \<le> c \<Longrightarrow> \<not> c \<le> b \<bullet> k \<Longrightarrow> False"
   155     unfolding not_le
   148     unfolding not_le using True assms by auto
   156     using as[unfolded ,rule_format,of k] assms
       
   157     by auto
       
   158   ultimately show ?thesis
   149   ultimately show ?thesis
   159     using assms
   150     using assms unfolding simps ** 1[of "\<lambda>i x. b\<bullet>i - x"] 1[of "\<lambda>i x. x - a\<bullet>i"] 2
   160     unfolding simps **
       
   161     unfolding *(1)[of "\<lambda>i x. b\<bullet>i - x"] *(1)[of "\<lambda>i x. x - a\<bullet>i"]
       
   162     unfolding *(2)
       
   163     by auto
   151     by auto
   164 next
   152 next
   165   assume "\<not> (\<forall>i\<in>Basis. a \<bullet> i \<le> b \<bullet> i)"
   153   case False
   166   then have "cbox a b = {}"
   154   then have "cbox a b = {}"
   167     unfolding box_eq_empty by (auto simp: not_le)
   155     unfolding box_eq_empty by (auto simp: not_le)
   168   then show ?thesis
   156   then show ?thesis
   169     by (auto simp: not_le)
   157     by (auto simp: not_le)
   170 qed
   158 qed
   782 
   770 
   783 lemma integrable_on_cdivide:
   771 lemma integrable_on_cdivide:
   784   fixes f :: "_ \<Rightarrow> 'b :: real_normed_field"
   772   fixes f :: "_ \<Rightarrow> 'b :: real_normed_field"
   785   assumes "f integrable_on s"
   773   assumes "f integrable_on s"
   786   shows "(\<lambda>x. f x / of_real c) integrable_on s"
   774   shows "(\<lambda>x. f x / of_real c) integrable_on s"
   787 by (simp add: integrable_on_cmult_right divide_inverse assms of_real_inverse [symmetric] del: of_real_inverse)
   775 by (simp add: integrable_on_cmult_right divide_inverse assms reorient: of_real_inverse)
   788 
   776 
   789 lemma integrable_on_cdivide_iff [simp]:
   777 lemma integrable_on_cdivide_iff [simp]:
   790   fixes f :: "_ \<Rightarrow> 'b :: real_normed_field"
   778   fixes f :: "_ \<Rightarrow> 'b :: real_normed_field"
   791   assumes "c \<noteq> 0"
   779   assumes "c \<noteq> 0"
   792   shows "(\<lambda>x. f x / of_real c) integrable_on s \<longleftrightarrow> f integrable_on s"
   780   shows "(\<lambda>x. f x / of_real c) integrable_on s \<longleftrightarrow> f integrable_on s"
   793 by (simp add: divide_inverse assms of_real_inverse [symmetric] del: of_real_inverse)
   781 by (simp add: divide_inverse assms reorient: of_real_inverse)
   794 
   782 
   795 lemma has_integral_null [intro]: "content(cbox a b) = 0 \<Longrightarrow> (f has_integral 0) (cbox a b)"
   783 lemma has_integral_null [intro]: "content(cbox a b) = 0 \<Longrightarrow> (f has_integral 0) (cbox a b)"
   796   unfolding has_integral_cbox
   784   unfolding has_integral_cbox
   797   using eventually_division_filter_tagged_division[of "cbox a b"]
   785   using eventually_division_filter_tagged_division[of "cbox a b"]
   798   by (subst tendsto_cong[where g="\<lambda>_. 0"]) (auto elim: eventually_mono intro: sum_content_null)
   786   by (subst tendsto_cong[where g="\<lambda>_. 0"]) (auto elim: eventually_mono intro: sum_content_null)
  2583   "(f has_integral i) (cbox a b) \<longleftrightarrow>
  2571   "(f has_integral i) (cbox a b) \<longleftrightarrow>
  2584     (\<forall>e>0. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow>
  2572     (\<forall>e>0. \<exists>d. gauge d \<and> (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow>
  2585       norm (sum (\<lambda>(x,k). content k *\<^sub>R f x) p - i) \<le> e * content (cbox a b)))"
  2573       norm (sum (\<lambda>(x,k). content k *\<^sub>R f x) p - i) \<le> e * content (cbox a b)))"
  2586 proof (cases "content (cbox a b) = 0")
  2574 proof (cases "content (cbox a b) = 0")
  2587   case True
  2575   case True
  2588   show ?thesis
  2576   have "\<And>e p. p tagged_division_of cbox a b \<Longrightarrow> norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x)) \<le> e * content (cbox a b)"
       
  2577     unfolding sum_content_null[OF True] True by force
       
  2578   moreover have "i = 0" 
       
  2579     if "\<And>e. e > 0 \<Longrightarrow> \<exists>d. gauge d \<and>
       
  2580               (\<forall>p. p tagged_division_of cbox a b \<and>
       
  2581                    d fine p \<longrightarrow>
       
  2582                    norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i) \<le> e * content (cbox a b))"
       
  2583     using that [of 1]
       
  2584     by (force simp add: True sum_content_null[OF True] intro: fine_division_exists[of _ a b])
       
  2585   ultimately show ?thesis
  2589     unfolding has_integral_null_eq[OF True]
  2586     unfolding has_integral_null_eq[OF True]
  2590     apply safe
  2587     by (force simp add: )
  2591     apply (rule, rule, rule gauge_trivial, safe)
       
  2592     unfolding sum_content_null[OF True] True
       
  2593     defer
       
  2594     apply (erule_tac x=1 in allE)
       
  2595     apply safe
       
  2596     defer
       
  2597     apply (rule fine_division_exists[of _ a b])
       
  2598     apply assumption
       
  2599     apply (erule_tac x=p in allE)
       
  2600     unfolding sum_content_null[OF True]
       
  2601     apply auto
       
  2602     done
       
  2603 next
  2588 next
  2604   case False
  2589   case False
  2605   note F = this[unfolded content_lt_nz[symmetric]]
  2590   then have F: "0 < content (cbox a b)"
       
  2591     using zero_less_measure_iff by blast
  2606   let ?P = "\<lambda>e opp. \<exists>d. gauge d \<and>
  2592   let ?P = "\<lambda>e opp. \<exists>d. gauge d \<and>
  2607     (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> opp (norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i)) e)"
  2593     (\<forall>p. p tagged_division_of (cbox a b) \<and> d fine p \<longrightarrow> opp (norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - i)) e)"
  2608   show ?thesis
  2594   show ?thesis
  2609     apply (subst has_integral)
  2595     apply (subst has_integral)
  2610   proof safe
  2596   proof safe
  2611     fix e :: real
  2597     fix e :: real
  2612     assume e: "e > 0"
  2598     assume e: "e > 0"
  2613     {
  2599     { assume "\<forall>e>0. ?P e (<)"
  2614       assume "\<forall>e>0. ?P e (<)"
       
  2615       then show "?P (e * content (cbox a b)) (\<le>)"
  2600       then show "?P (e * content (cbox a b)) (\<le>)"
  2616         apply (erule_tac x="e * content (cbox a b)" in allE)
  2601         apply (rule allE [where x="e * content (cbox a b)"])
  2617         apply (erule impE)
  2602         apply (elim impE ex_forward conj_forward)
  2618         defer
  2603         using F e apply (auto simp add: algebra_simps)
  2619         apply (erule exE,rule_tac x=d in exI)
  2604         done }
  2620         using F e
  2605     { assume "\<forall>e>0. ?P (e * content (cbox a b)) (\<le>)"
  2621         apply (auto simp add:field_simps)
       
  2622         done
       
  2623     }
       
  2624     {
       
  2625       assume "\<forall>e>0. ?P (e * content (cbox a b)) (\<le>)"
       
  2626       then show "?P e (<)"
  2606       then show "?P e (<)"
  2627         apply (erule_tac x="e/2 / content (cbox a b)" in allE)
  2607         apply (rule allE [where x="e/2 / content (cbox a b)"])
  2628         apply (erule impE)
  2608         apply (elim impE ex_forward conj_forward)
  2629         defer
  2609         using F e apply (auto simp add: algebra_simps)
  2630         apply (erule exE,rule_tac x=d in exI)
  2610         done }
  2631         using F e
       
  2632         apply (auto simp add: field_simps)
       
  2633         done
       
  2634     }
       
  2635   qed
  2611   qed
  2636 qed
  2612 qed
  2637 
  2613 
  2638 lemma has_integral_factor_content_real:
  2614 lemma has_integral_factor_content_real:
  2639   "(f has_integral i) {a..b::real} \<longleftrightarrow>
  2615   "(f has_integral i) {a..b::real} \<longleftrightarrow>
  2993     using 1 2 by blast+
  2969     using 1 2 by blast+
  2994 qed
  2970 qed
  2995 
  2971 
  2996 lemma integrable_subinterval:
  2972 lemma integrable_subinterval:
  2997   fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
  2973   fixes f :: "'b::euclidean_space \<Rightarrow> 'a::banach"
  2998   assumes "f integrable_on cbox a b"
  2974   assumes f: "f integrable_on cbox a b"
  2999     and "cbox c d \<subseteq> cbox a b"
  2975     and cd: "cbox c d \<subseteq> cbox a b"
  3000   shows "f integrable_on cbox c d"
  2976   shows "f integrable_on cbox c d"
  3001 proof -
  2977 proof -
  3002   interpret operative conj True "\<lambda>i. f integrable_on i"
  2978   interpret operative conj True "\<lambda>i. f integrable_on i"
  3003     using order_refl by (rule operative_integrableI)
  2979     using order_refl by (rule operative_integrableI)
  3004   show ?thesis
  2980   show ?thesis
  3005     apply (cases "cbox c d = {}")
  2981   proof (cases "cbox c d = {}")
  3006      defer
  2982     case True
  3007      apply (rule partial_division_extend_1[OF assms(2)],assumption)
  2983     then show ?thesis
  3008     using division [symmetric] assms(1)
  2984       using division [symmetric] f by (auto simp: comm_monoid_set_F_and)
  3009      apply (auto simp: comm_monoid_set_F_and)
  2985   next
  3010     done
  2986     case False
       
  2987     then show ?thesis
       
  2988       by (metis cd comm_monoid_set_F_and division division_of_finite f partial_division_extend_1)
       
  2989   qed
  3011 qed
  2990 qed
  3012 
  2991 
  3013 lemma integrable_subinterval_real:
  2992 lemma integrable_subinterval_real:
  3014   fixes f :: "real \<Rightarrow> 'a::banach"
  2993   fixes f :: "real \<Rightarrow> 'a::banach"
  3015   assumes "f integrable_on {a..b}"
  2994   assumes "f integrable_on {a..b}"
  3429       done
  3408       done
  3430     moreover from False have *: "\<And>i. (m *\<^sub>R a + c) \<bullet> i - (m *\<^sub>R b + c) \<bullet> i = (-m) *\<^sub>R (b-a) \<bullet> i"
  3409     moreover from False have *: "\<And>i. (m *\<^sub>R a + c) \<bullet> i - (m *\<^sub>R b + c) \<bullet> i = (-m) *\<^sub>R (b-a) \<bullet> i"
  3431       by (simp add: inner_simps field_simps)
  3410       by (simp add: inner_simps field_simps)
  3432     ultimately show ?thesis using False
  3411     ultimately show ?thesis using False
  3433       by (simp add: image_affinity_cbox content_cbox'
  3412       by (simp add: image_affinity_cbox content_cbox'
  3434         prod.distrib[symmetric] prod_constant[symmetric] inner_diff_left del: prod_constant)
  3413         prod.distrib[symmetric] inner_diff_left reorient: prod_constant)
  3435   qed
  3414   qed
  3436 qed
  3415 qed
  3437 
  3416 
  3438 lemma has_integral_affinity:
  3417 lemma has_integral_affinity:
  3439   fixes a :: "'a::euclidean_space"
  3418   fixes a :: "'a::euclidean_space"
  4259 subsection \<open>This doesn't directly involve integration, but that gives an easy proof\<close>
  4238 subsection \<open>This doesn't directly involve integration, but that gives an easy proof\<close>
  4260 
  4239 
  4261 lemma has_derivative_zero_unique_strong_interval:
  4240 lemma has_derivative_zero_unique_strong_interval:
  4262   fixes f :: "real \<Rightarrow> 'a::banach"
  4241   fixes f :: "real \<Rightarrow> 'a::banach"
  4263   assumes "finite k"
  4242   assumes "finite k"
  4264     and "continuous_on {a..b} f"
  4243     and contf: "continuous_on {a..b} f"
  4265     and "f a = y"
  4244     and "f a = y"
  4266     and "\<forall>x\<in>({a..b} - k). (f has_derivative (\<lambda>h. 0)) (at x within {a..b})" "x \<in> {a..b}"
  4245     and fder: "\<And>x. x \<in> {a..b} - k \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within {a..b})"
       
  4246     and x: "x \<in> {a..b}"
  4267   shows "f x = y"
  4247   shows "f x = y"
  4268 proof -
  4248 proof -
  4269   have ab: "a \<le> b"
  4249   have "a \<le> b" "a \<le> x"
  4270     using assms by auto
  4250     using assms by auto
  4271   have *: "a \<le> x"
       
  4272     using assms(5) by auto
       
  4273   have "((\<lambda>x. 0::'a) has_integral f x - f a) {a..x}"
  4251   have "((\<lambda>x. 0::'a) has_integral f x - f a) {a..x}"
  4274     apply (rule fundamental_theorem_of_calculus_interior_strong[OF assms(1) *])
  4252   proof (rule fundamental_theorem_of_calculus_interior_strong[OF \<open>finite k\<close> \<open>a \<le> x\<close>]; clarify?)
  4275     apply (rule continuous_on_subset[OF assms(2)])
  4253     have "{a..x} \<subseteq> {a..b}"
  4276     defer
  4254       using x by auto
  4277     apply safe
  4255     then show "continuous_on {a..x} f"
  4278     unfolding has_vector_derivative_def
  4256       by (rule continuous_on_subset[OF contf])
  4279     apply (subst has_derivative_within_open[symmetric])
  4257     show "(f has_vector_derivative 0) (at z)" if z: "z \<in> {a<..<x}" and notin: "z \<notin> k" for z
  4280     apply assumption
  4258       unfolding has_vector_derivative_def
  4281     apply (rule open_greaterThanLessThan)
  4259     proof (simp add: has_derivative_within_open[OF z, symmetric])
  4282     apply (rule has_derivative_within_subset[where s="{a..b}"])
  4260       show "(f has_derivative (\<lambda>x. 0)) (at z within {a<..<x})"
  4283     using assms(4) assms(5)
  4261         by (rule has_derivative_within_subset [OF fder]) (use x z notin in auto)
  4284     apply (auto simp: mem_box)
  4262     qed
  4285     done
  4263   qed
  4286   note this[unfolded *]
  4264   from has_integral_unique[OF has_integral_0 this]
  4287   note has_integral_unique[OF has_integral_0 this]
  4265   show ?thesis
  4288   then show ?thesis
       
  4289     unfolding assms by auto
  4266     unfolding assms by auto
  4290 qed
  4267 qed
  4291 
  4268 
  4292 
  4269 
  4293 subsection \<open>Generalize a bit to any convex set\<close>
  4270 subsection \<open>Generalize a bit to any convex set\<close>
  4295 lemma has_derivative_zero_unique_strong_convex:
  4272 lemma has_derivative_zero_unique_strong_convex:
  4296   fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
  4273   fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
  4297   assumes "convex S" "finite K"
  4274   assumes "convex S" "finite K"
  4298     and contf: "continuous_on S f"
  4275     and contf: "continuous_on S f"
  4299     and "c \<in> S" "f c = y"
  4276     and "c \<in> S" "f c = y"
  4300     and derf: "\<And>x. x \<in> (S - K) \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within S)"
  4277     and derf: "\<And>x. x \<in> S - K \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within S)"
  4301     and "x \<in> S"
  4278     and "x \<in> S"
  4302   shows "f x = y"
  4279   shows "f x = y"
  4303 proof (cases "x = c")
  4280 proof (cases "x = c")
  4304   case True with \<open>f c = y\<close> show ?thesis
  4281   case True with \<open>f c = y\<close> show ?thesis
  4305     by blast
  4282     by blast
  4306 next
  4283 next
  4307   case False
  4284   case False
  4308   let ?\<phi> = "\<lambda>u. (1 - u) *\<^sub>R c + u *\<^sub>R x"
  4285   let ?\<phi> = "\<lambda>u. (1 - u) *\<^sub>R c + u *\<^sub>R x"
  4309   have contf': "continuous_on {0 ..1} (f \<circ> ?\<phi>)"
  4286   have contf': "continuous_on {0 ..1} (f \<circ> ?\<phi>)"
  4310     apply (rule continuous_intros continuous_on_subset[OF contf])+
  4287   proof (rule continuous_intros continuous_on_subset[OF contf])+
  4311     using \<open>convex S\<close> \<open>x \<in> S\<close> \<open>c \<in> S\<close> by (auto simp add: convex_alt algebra_simps)
  4288     show "(\<lambda>u. (1 - u) *\<^sub>R c + u *\<^sub>R x) ` {0..1} \<subseteq> S"
       
  4289       using \<open>convex S\<close> \<open>x \<in> S\<close> \<open>c \<in> S\<close> by (auto simp add: convex_alt algebra_simps)
       
  4290   qed
  4312   have "t = u" if "?\<phi> t = ?\<phi> u" for t u
  4291   have "t = u" if "?\<phi> t = ?\<phi> u" for t u
  4313   proof -
  4292   proof -
  4314     from that have "(t - u) *\<^sub>R x = (t - u) *\<^sub>R c"
  4293     from that have "(t - u) *\<^sub>R x = (t - u) *\<^sub>R c"
  4315       by (auto simp add: algebra_simps)
  4294       by (auto simp add: algebra_simps)
  4316     then show ?thesis
  4295     then show ?thesis
  4351     and "open S"
  4330     and "open S"
  4352     and "finite K"
  4331     and "finite K"
  4353     and contf: "continuous_on S f"
  4332     and contf: "continuous_on S f"
  4354     and "c \<in> S"
  4333     and "c \<in> S"
  4355     and "f c = y"
  4334     and "f c = y"
  4356     and derf: "\<And>x. x \<in> (S - K) \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within S)"
  4335     and derf: "\<And>x. x \<in> S - K \<Longrightarrow> (f has_derivative (\<lambda>h. 0)) (at x within S)"
  4357     and "x \<in> S"
  4336     and "x \<in> S"
  4358   shows "f x = y"
  4337   shows "f x = y"
  4359 proof -
  4338 proof -
  4360   have "\<exists>e>0. ball x e \<subseteq> (S \<inter> f -` {f x})" if "x \<in> S" for x
  4339   have "\<exists>e>0. ball x e \<subseteq> (S \<inter> f -` {f x})" if "x \<in> S" for x
  4361   proof -
  4340   proof -
  4484   shows "((\<lambda>x. if x \<in> cbox c d then f x else 0) has_integral i) (cbox a b)"
  4463   shows "((\<lambda>x. if x \<in> cbox c d then f x else 0) has_integral i) (cbox a b)"
  4485 proof -
  4464 proof -
  4486   note has_integral_restrict_open_subinterval[OF assms]
  4465   note has_integral_restrict_open_subinterval[OF assms]
  4487   note * = has_integral_spike[OF negligible_frontier_interval _ this]
  4466   note * = has_integral_spike[OF negligible_frontier_interval _ this]
  4488   show ?thesis
  4467   show ?thesis
  4489     apply (rule *[of c d])
  4468     by (rule *[of c d]) (use box_subset_cbox[of c d] in auto)
  4490     using box_subset_cbox[of c d]
       
  4491     apply auto
       
  4492     done
       
  4493 qed
  4469 qed
  4494 
  4470 
  4495 lemma has_integral_restrict_closed_subintervals_eq:
  4471 lemma has_integral_restrict_closed_subintervals_eq:
  4496   fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
  4472   fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
  4497   assumes "cbox c d \<subseteq> cbox a b"
  4473   assumes "cbox c d \<subseteq> cbox a b"