5608 then have "f integrable_on cbox u v" |
5608 then have "f integrable_on cbox u v" |
5609 by (rule integrable_subinterval[OF intf]) |
5609 by (rule integrable_subinterval[OF intf]) |
5610 note integrable_integral[OF this, unfolded has_integral[of f]] |
5610 note integrable_integral[OF this, unfolded has_integral[of f]] |
5611 from this[rule_format,OF *] guess dd..note dd=conjunctD2[OF this,rule_format] |
5611 from this[rule_format,OF *] guess dd..note dd=conjunctD2[OF this,rule_format] |
5612 note gauge_Int[OF \<open>gauge d\<close> dd(1)] |
5612 note gauge_Int[OF \<open>gauge d\<close> dd(1)] |
5613 from fine_division_exists[OF this,of u v] guess qq . |
5613 then obtain qq where qq: "qq tagged_division_of cbox u v" "(\<lambda>x. d x \<inter> dd x) fine qq" |
|
5614 using fine_division_exists by blast |
5614 then show ?thesis |
5615 then show ?thesis |
5615 apply (rule_tac x=qq in exI) |
5616 apply (rule_tac x=qq in exI) |
5616 using dd(2)[of qq] |
5617 using dd(2)[of qq] |
5617 unfolding fine_Int uv |
5618 unfolding fine_Int uv |
5618 apply auto |
5619 apply auto |
5672 apply safe |
5673 apply safe |
5673 apply (drule qq) |
5674 apply (drule qq) |
5674 proof - |
5675 proof - |
5675 fix x l k |
5676 fix x l k |
5676 assume as: "(x, l) \<in> p" "(x, l) \<in> qq k" "k \<in> r" |
5677 assume as: "(x, l) \<in> p" "(x, l) \<in> qq k" "k \<in> r" |
5677 note qq[OF this(3)] |
5678 then obtain u v where uv: "l = cbox u v" |
5678 note tagged_division_ofD(3,4)[OF conjunct1[OF this] as(2)] |
5679 using p'(4) by blast |
5679 from this(2) guess u v by (elim exE) note uv=this |
5680 have "l \<subseteq> k" |
5680 have "l\<in>snd ` p" unfolding image_iff apply(rule_tac x="(x,l)" in bexI) using as by auto |
5681 using qq[OF as(3)] tagged_division_ofD(3) \<open>(x, l) \<in> qq k\<close> by metis |
|
5682 have "l \<in> snd ` p" |
|
5683 using \<open>(x, l) \<in> p\<close> image_iff by fastforce |
5681 then have "l \<in> q" "k \<in> q" "l \<noteq> k" |
5684 then have "l \<in> q" "k \<in> q" "l \<noteq> k" |
5682 using as(1,3) q(1) unfolding r_def by auto |
5685 using as(1,3) q(1) unfolding r_def by auto |
5683 note q'(5)[OF this] |
5686 with q'(5) have "interior l = {}" |
5684 then have "interior l = {}" |
|
5685 using interior_mono[OF \<open>l \<subseteq> k\<close>] by blast |
5687 using interior_mono[OF \<open>l \<subseteq> k\<close>] by blast |
5686 then show "content l *\<^sub>R f x = 0" |
5688 then show "content l *\<^sub>R f x = 0" |
5687 unfolding uv content_eq_0_interior[symmetric] by auto |
5689 unfolding uv content_eq_0_interior[symmetric] by auto |
5688 qed auto |
5690 qed auto |
5689 |
5691 |
5743 qed |
5745 qed |
5744 |
5746 |
5745 have "?x = norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f))" |
5747 have "?x = norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f))" |
5746 unfolding split_def sum_subtractf .. |
5748 unfolding split_def sum_subtractf .. |
5747 also have "\<dots> \<le> e + k" |
5749 also have "\<dots> \<le> e + k" |
5748 apply (rule *[OF **, where ir1="sum (\<lambda>k. integral k f) r"]) |
5750 proof (rule *[OF **]) |
5749 proof goal_cases |
|
5750 case 1 |
|
5751 have *: "k * real (card r) / (1 + real (card r)) < k" |
5751 have *: "k * real (card r) / (1 + real (card r)) < k" |
5752 using k by (auto simp add: field_simps) |
5752 using k by (auto simp add: field_simps) |
5753 show ?case |
5753 have "norm (sum (sum (\<lambda>(x, k). content k *\<^sub>R f x) \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) |
5754 apply (rule le_less_trans[of _ "sum (\<lambda>x. k / (real (card r) + 1)) r"]) |
5754 \<le> (\<Sum>x\<in>r. k / (real (card r) + 1))" |
5755 unfolding sum_subtractf[symmetric] |
5755 unfolding sum_subtractf[symmetric] by (force dest: qq intro!: sum_norm_le) |
5756 apply (rule sum_norm_le) |
5756 also have "... < k" |
5757 apply (drule qq) |
5757 by (simp add: "*" add.commute mult.commute) |
5758 defer |
5758 finally show "norm (sum (sum (\<lambda>(x, k). content k *\<^sub>R f x) \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) < k" . |
5759 unfolding divide_inverse sum_distrib_right[symmetric] |
|
5760 unfolding divide_inverse[symmetric] |
|
5761 using * apply (auto simp add: field_simps) |
|
5762 done |
|
5763 next |
5759 next |
5764 case 2 |
5760 from q(1) have [simp]: "snd ` p \<union> q = q" by auto |
5765 have *: "(\<Sum>(x, k)\<in>p. integral k f) = (\<Sum>k\<in>snd ` p. integral k f)" |
5761 have "integral l f = 0" |
5766 apply (subst sum.reindex_nontrivial) |
5762 if inp: "(x, l) \<in> p" "(y, m) \<in> p" and ne: "(x, l) \<noteq> (y, m)" and "l = m" for x l y m |
5767 apply fact |
|
5768 unfolding split_paired_all snd_conv split_def o_def |
|
5769 proof - |
5763 proof - |
5770 fix x l y m |
5764 obtain u v where uv: "l = cbox u v" |
5771 assume as: "(x, l) \<in> p" "(y, m) \<in> p" "(x, l) \<noteq> (y, m)" "l = m" |
5765 using inp p'(4) by blast |
5772 from p'(4)[OF as(1)] guess u v by (elim exE) note uv=this |
5766 have "content (cbox u v) = 0" |
5773 show "integral l f = 0" |
5767 unfolding content_eq_0_interior using that p(1) uv by auto |
5774 unfolding uv |
5768 then show ?thesis |
5775 apply (rule integral_unique) |
5769 using uv by blast |
5776 apply (rule has_integral_null) |
5770 qed |
5777 unfolding content_eq_0_interior |
5771 then have "(\<Sum>(x, k)\<in>p. integral k f) = (\<Sum>k\<in>snd ` p. integral k f)" |
5778 using p'(5)[OF as(1-3)] |
5772 apply (subst sum.reindex_nontrivial [OF \<open>finite p\<close>]) |
5779 unfolding uv as(4)[symmetric] |
5773 unfolding split_paired_all split_def by auto |
5780 apply auto |
5774 then show "(\<Sum>(x, k)\<in>p. integral k f) + (\<Sum>k\<in>r. integral k f) = integral (cbox a b) f" |
5781 done |
5775 unfolding integral_combine_division_topdown[OF assms(1) q(2)] r_def |
5782 qed auto |
5776 using q'(1) p'(1) sum.union_disjoint [of "snd ` p" "q - snd ` p", symmetric] |
5783 from q(1) have **: "snd ` p \<union> q = q" by auto |
|
5784 show ?case |
|
5785 unfolding integral_combine_division_topdown[OF assms(1) q(2)] * r_def |
|
5786 using ** q'(1) p'(1) sum.union_disjoint [of "snd ` p" "q - snd ` p" "\<lambda>k. integral k f", symmetric] |
|
5787 by simp |
5777 by simp |
5788 qed |
5778 qed |
5789 finally show "?x \<le> e + k" . |
5779 finally show "?x \<le> e + k" . |
5790 qed |
5780 qed |
5791 |
5781 |