4360 lemma has_integral_restrict_open_subinterval: |
4360 lemma has_integral_restrict_open_subinterval: |
4361 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
4361 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
4362 assumes intf: "(f has_integral i) (cbox c d)" |
4362 assumes intf: "(f has_integral i) (cbox c d)" |
4363 and cb: "cbox c d \<subseteq> cbox a b" |
4363 and cb: "cbox c d \<subseteq> cbox a b" |
4364 shows "((\<lambda>x. if x \<in> box c d then f x else 0) has_integral i) (cbox a b)" |
4364 shows "((\<lambda>x. if x \<in> box c d then f x else 0) has_integral i) (cbox a b)" |
4365 proof - |
4365 proof (cases "cbox c d = {}") |
|
4366 case True |
|
4367 then have "box c d = {}" |
|
4368 by (metis bot.extremum_uniqueI box_subset_cbox) |
|
4369 then show ?thesis |
|
4370 using True intf by auto |
|
4371 next |
|
4372 case False |
|
4373 then obtain p where pdiv: "p division_of cbox a b" and inp: "cbox c d \<in> p" |
|
4374 using cb partial_division_extend_1 by blast |
4366 define g where [abs_def]: "g x = (if x \<in>box c d then f x else 0)" for x |
4375 define g where [abs_def]: "g x = (if x \<in>box c d then f x else 0)" for x |
4367 { |
|
4368 presume *: "cbox c d \<noteq> {} \<Longrightarrow> ?thesis" |
|
4369 show ?thesis |
|
4370 apply cases |
|
4371 apply (rule *) |
|
4372 apply assumption |
|
4373 proof goal_cases |
|
4374 case prems: 1 |
|
4375 then have *: "box c d = {}" |
|
4376 by (metis bot.extremum_uniqueI box_subset_cbox) |
|
4377 show ?thesis |
|
4378 using assms(1) |
|
4379 unfolding * |
|
4380 using prems |
|
4381 by auto |
|
4382 qed |
|
4383 } |
|
4384 assume "cbox c d \<noteq> {}" |
|
4385 then obtain p where p: "p division_of cbox a b" "cbox c d \<in> p" |
|
4386 using cb partial_division_extend_1 by blast |
|
4387 interpret operative "lift_option plus" "Some (0 :: 'b)" |
4376 interpret operative "lift_option plus" "Some (0 :: 'b)" |
4388 "\<lambda>i. if g integrable_on i then Some (integral i g) else None" |
4377 "\<lambda>i. if g integrable_on i then Some (integral i g) else None" |
4389 by (fact operative_integralI) |
4378 by (fact operative_integralI) |
4390 note operat = division |
4379 note operat = division [OF pdiv, symmetric] |
4391 [OF p(1), symmetric] |
4380 show ?thesis |
4392 let ?P = "(if g integrable_on cbox a b then Some (integral (cbox a b) g) else None) = Some i" |
4381 proof (cases "(g has_integral i) (cbox a b)") |
4393 { |
4382 case True then show ?thesis |
4394 presume "?P" |
4383 by (simp add: g_def) |
4395 then have "g integrable_on cbox a b \<and> integral (cbox a b) g = i" |
4384 next |
4396 apply - |
4385 case False |
4397 apply cases |
4386 have iterate:"F (\<lambda>i. if g integrable_on i then Some (integral i g) else None) (p - {cbox c d}) = Some 0" |
4398 apply (subst(asm) if_P) |
4387 proof (intro neutral ballI) |
4399 apply assumption |
4388 fix x |
4400 apply auto |
4389 assume x: "x \<in> p - {cbox c d}" |
4401 done |
4390 then have "x \<in> p" |
4402 then show ?thesis |
4391 by auto |
4403 using integrable_integral |
4392 then obtain u v where uv: "x = cbox u v" |
4404 unfolding g_def |
4393 using pdiv by blast |
4405 by auto |
4394 have "interior x \<inter> interior (cbox c d) = {}" |
4406 } |
4395 using pdiv inp x by blast |
4407 let ?F = F |
4396 then have "(g has_integral 0) x" |
4408 have iterate:"?F (\<lambda>i. if g integrable_on i then Some (integral i g) else None) (p - {cbox c d}) = Some 0" |
4397 unfolding uv using has_integral_spike_interior[where f="\<lambda>x. 0"] |
4409 proof (intro neutral ballI) |
4398 by (metis (no_types, lifting) disjoint_iff_not_equal g_def has_integral_0_eq interior_cbox) |
4410 fix x |
4399 then show "(if g integrable_on x then Some (integral x g) else None) = Some 0" |
4411 assume x: "x \<in> p - {cbox c d}" |
4400 by auto |
4412 then have "x \<in> p" |
4401 qed |
4413 by auto |
4402 interpret comm_monoid_set "lift_option plus" "Some (0 :: 'b)" |
4414 note div = division_ofD(2-5)[OF p(1) this] |
4403 by (intro comm_monoid_set.intro comm_monoid_lift_option add.comm_monoid_axioms) |
4415 then obtain u v where uv: "x = cbox u v" by blast |
4404 have intg: "g integrable_on cbox c d" |
4416 have "interior x \<inter> interior (cbox c d) = {}" |
4405 using integrable_spike_interior[where f=f] |
4417 using div(4)[OF p(2)] x by auto |
4406 by (meson g_def has_integral_integrable intf) |
4418 then have "(g has_integral 0) x" |
4407 moreover have "integral (cbox c d) g = i" |
4419 unfolding uv |
4408 proof (rule has_integral_unique[OF has_integral_spike_interior intf]) |
4420 using has_integral_spike_interior[where f="\<lambda>x. 0"] |
4409 show "\<forall>x\<in>box c d. f x = g x" |
4421 by (metis (no_types, lifting) disjoint_iff_not_equal g_def has_integral_0_eq interior_cbox) |
4410 by (auto simp: g_def) |
4422 then show "(if g integrable_on x then Some (integral x g) else None) = Some 0" |
4411 show "(g has_integral integral (cbox c d) g) (cbox c d)" |
4423 by auto |
4412 by (rule integrable_integral[OF intg]) |
|
4413 qed |
|
4414 ultimately have "F (\<lambda>A. if g integrable_on A then Some (integral A g) else None) p = Some i" |
|
4415 by (metis (full_types, lifting) division_of_finite inp iterate pdiv remove right_neutral) |
|
4416 then |
|
4417 have "(g has_integral i) (cbox a b)" |
|
4418 by (metis integrable_on_def integral_unique operat option.inject option.simps(3)) |
|
4419 with False show ?thesis |
|
4420 by blast |
4424 qed |
4421 qed |
4425 |
4422 qed |
4426 have *: "p = insert (cbox c d) (p - {cbox c d})" |
4423 |
4427 using p by auto |
|
4428 interpret comm_monoid_set "lift_option plus" "Some (0 :: 'b)" |
|
4429 apply (rule comm_monoid_set.intro) |
|
4430 apply (rule comm_monoid_lift_option) |
|
4431 apply (rule add.comm_monoid_axioms) |
|
4432 done |
|
4433 have **: "g integrable_on cbox c d" |
|
4434 apply (rule integrable_spike_interior[where f=f]) |
|
4435 unfolding g_def using assms(1) |
|
4436 apply auto |
|
4437 done |
|
4438 moreover |
|
4439 have "integral (cbox c d) g = i" |
|
4440 apply (rule has_integral_unique[OF _ assms(1)]) |
|
4441 apply (rule has_integral_spike_interior[where f=g]) |
|
4442 defer |
|
4443 apply (rule integrable_integral[OF **]) |
|
4444 unfolding g_def |
|
4445 apply auto |
|
4446 done |
|
4447 ultimately show ?P |
|
4448 unfolding operat |
|
4449 using p |
|
4450 apply (subst *) |
|
4451 apply (subst insert) |
|
4452 apply (simp_all add: division_of_finite iterate) |
|
4453 done |
|
4454 qed |
|
4455 |
4424 |
4456 lemma has_integral_restrict_closed_subinterval: |
4425 lemma has_integral_restrict_closed_subinterval: |
4457 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
4426 fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach" |
4458 assumes "(f has_integral i) (cbox c d)" |
4427 assumes "(f has_integral i) (cbox c d)" |
4459 and "cbox c d \<subseteq> cbox a b" |
4428 and "cbox c d \<subseteq> cbox a b" |