5575 and "e > 0" |
5575 and "e > 0" |
5576 and "gauge d" |
5576 and "gauge d" |
5577 and less_e: "\<And>p. \<lbrakk>p tagged_division_of (cbox a b); d fine p\<rbrakk> \<Longrightarrow> |
5577 and less_e: "\<And>p. \<lbrakk>p tagged_division_of (cbox a b); d fine p\<rbrakk> \<Longrightarrow> |
5578 norm (sum (\<lambda>(x,K). content K *\<^sub>R f x) p - integral(cbox a b) f) < e" |
5578 norm (sum (\<lambda>(x,K). content K *\<^sub>R f x) p - integral(cbox a b) f) < e" |
5579 and p: "p tagged_partial_division_of (cbox a b)" "d fine p" |
5579 and p: "p tagged_partial_division_of (cbox a b)" "d fine p" |
5580 shows "norm (sum (\<lambda>(x,K). content K *\<^sub>R f x - integral K f) p) \<le> e" |
5580 shows "norm (sum (\<lambda>(x,K). content K *\<^sub>R f x - integral K f) p) \<le> e" (is "?lhs \<le> e") |
5581 (is "?x \<le> e") |
|
5582 proof (rule field_le_epsilon) |
5581 proof (rule field_le_epsilon) |
5583 fix k :: real |
5582 fix k :: real |
5584 assume k: "k > 0" |
5583 assume "k > 0" |
|
5584 let ?SUM = "\<lambda>p. (\<Sum>(x,K) \<in> p. content K *\<^sub>R f x)" |
5585 note p' = tagged_partial_division_ofD[OF p(1)] |
5585 note p' = tagged_partial_division_ofD[OF p(1)] |
5586 have "\<Union>(snd ` p) \<subseteq> cbox a b" |
5586 have "\<Union>(snd ` p) \<subseteq> cbox a b" |
5587 using p'(3) by fastforce |
5587 using p'(3) by fastforce |
5588 then obtain q where q: "snd ` p \<subseteq> q" "q division_of cbox a b" |
5588 then obtain q where q: "snd ` p \<subseteq> q" and qdiv: "q division_of cbox a b" |
5589 by (meson p(1) partial_division_extend_interval partial_division_of_tagged_division) |
5589 by (meson p(1) partial_division_extend_interval partial_division_of_tagged_division) |
5590 note q' = division_ofD[OF this(2)] |
5590 note q' = division_ofD[OF qdiv] |
5591 define r where "r = q - snd ` p" |
5591 define r where "r = q - snd ` p" |
5592 have "snd ` p \<inter> r = {}" |
5592 have "snd ` p \<inter> r = {}" |
5593 unfolding r_def by auto |
5593 unfolding r_def by auto |
5594 have r: "finite r" |
5594 have "finite r" |
5595 using q' unfolding r_def by auto |
5595 using q' unfolding r_def by auto |
5596 |
|
5597 have "\<exists>p. p tagged_division_of i \<and> d fine p \<and> |
5596 have "\<exists>p. p tagged_division_of i \<and> d fine p \<and> |
5598 norm (sum (\<lambda>(x,j). content j *\<^sub>R f x) p - integral i f) < k / (real (card r) + 1)" |
5597 norm (?SUM p - integral i f) < k / (real (card r) + 1)" |
5599 if "i\<in>r" for i |
5598 if "i\<in>r" for i |
5600 proof - |
5599 proof - |
5601 have *: "k / (real (card r) + 1) > 0" using k by simp |
5600 have gt0: "k / (real (card r) + 1) > 0" using \<open>k > 0\<close> by simp |
5602 have i: "i \<in> q" |
5601 have i: "i \<in> q" |
5603 using that unfolding r_def by auto |
5602 using that unfolding r_def by auto |
5604 then obtain u v where uv: "i = cbox u v" |
5603 then obtain u v where uv: "i = cbox u v" |
5605 using q'(4) by blast |
5604 using q'(4) by blast |
5606 then have "cbox u v \<subseteq> cbox a b" |
5605 then have "cbox u v \<subseteq> cbox a b" |
5607 using i q'(2) by auto |
5606 using i q'(2) by auto |
5608 then have "f integrable_on cbox u v" |
5607 then have "f integrable_on cbox u v" |
5609 by (rule integrable_subinterval[OF intf]) |
5608 by (rule integrable_subinterval[OF intf]) |
5610 note integrable_integral[OF this, unfolded has_integral[of f]] |
5609 with integrable_integral[OF this, unfolded has_integral[of f]] |
5611 from this[rule_format,OF *] guess dd..note dd=conjunctD2[OF this,rule_format] |
5610 obtain dd where "gauge dd" and dd: |
5612 note gauge_Int[OF \<open>gauge d\<close> dd(1)] |
5611 "\<And>\<D>. \<lbrakk>\<D> tagged_division_of cbox u v; dd fine \<D>\<rbrakk> \<Longrightarrow> |
5613 then obtain qq where qq: "qq tagged_division_of cbox u v" "(\<lambda>x. d x \<inter> dd x) fine qq" |
5612 norm (?SUM \<D> - integral (cbox u v) f) < k / (real (card r) + 1)" |
|
5613 using gt0 by auto |
|
5614 with gauge_Int[OF \<open>gauge d\<close> \<open>gauge dd\<close>] |
|
5615 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 |
5616 using fine_division_exists by blast |
5615 then show ?thesis |
5617 with dd[of qq] show ?thesis |
5616 apply (rule_tac x=qq in exI) |
5618 by (auto simp: fine_Int uv) |
5617 using dd(2)[of qq] |
|
5618 unfolding fine_Int uv |
|
5619 apply auto |
|
5620 done |
|
5621 qed |
5619 qed |
5622 then obtain qq where qq: "\<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i \<and> |
5620 then obtain qq where qq: "\<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i \<and> |
5623 d fine qq i \<and> |
5621 d fine qq i \<and> norm (?SUM (qq i) - integral i f) < k / (real (card r) + 1)" |
5624 norm |
|
5625 ((\<Sum>(x, j) \<in> qq i. content j *\<^sub>R f x) - |
|
5626 integral i f) |
|
5627 < k / (real (card r) + 1)" |
|
5628 by metis |
5622 by metis |
5629 |
5623 |
5630 let ?p = "p \<union> \<Union>(qq ` r)" |
5624 let ?p = "p \<union> \<Union>(qq ` r)" |
5631 have "norm ((\<Sum>(x, k)\<in>?p. content k *\<^sub>R f x) - integral (cbox a b) f) < e" |
5625 have "norm (?SUM ?p - integral (cbox a b) f) < e" |
5632 proof (rule less_e) |
5626 proof (rule less_e) |
5633 show "d fine ?p" |
5627 show "d fine ?p" |
5634 by (metis (mono_tags, hide_lams) qq fine_Un fine_Union imageE p(2)) |
5628 by (metis (mono_tags, hide_lams) qq fine_Un fine_Union imageE p(2)) |
5635 note * = tagged_partial_division_of_Union_self[OF p(1)] |
5629 note ptag = tagged_partial_division_of_Union_self[OF p(1)] |
5636 have "p \<union> \<Union>(qq ` r) tagged_division_of \<Union>(snd ` p) \<union> \<Union>r" |
5630 have "p \<union> \<Union>(qq ` r) tagged_division_of \<Union>(snd ` p) \<union> \<Union>r" |
5637 using r |
5631 proof (rule tagged_division_Un[OF ptag tagged_division_Union [OF \<open>finite r\<close>]]) |
5638 proof (rule tagged_division_Un[OF * tagged_division_Union]) |
|
5639 show "\<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i" |
5632 show "\<And>i. i \<in> r \<Longrightarrow> qq i tagged_division_of i" |
5640 using qq by auto |
5633 using qq by auto |
5641 show "\<And>i1 i2. \<lbrakk>i1 \<in> r; i2 \<in> r; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> interior i1 \<inter> interior i2 = {}" |
5634 show "\<And>i1 i2. \<lbrakk>i1 \<in> r; i2 \<in> r; i1 \<noteq> i2\<rbrakk> \<Longrightarrow> interior i1 \<inter> interior i2 = {}" |
5642 by (simp add: q'(5) r_def) |
5635 by (simp add: q'(5) r_def) |
5643 show "interior (UNION p snd) \<inter> interior (\<Union>r) = {}" |
5636 show "interior (UNION p snd) \<inter> interior (\<Union>r) = {}" |
5644 proof (rule Int_interior_Union_intervals [OF \<open>finite r\<close>]) |
5637 proof (rule Int_interior_Union_intervals [OF \<open>finite r\<close>]) |
5645 show "open (interior (UNION p snd))" |
5638 show "open (interior (UNION p snd))" |
5646 by blast |
5639 by blast |
5647 show "\<And>T. T \<in> r \<Longrightarrow> \<exists>a b. T = cbox a b" |
5640 show "\<And>T. T \<in> r \<Longrightarrow> \<exists>a b. T = cbox a b" |
5648 apply (rule q') |
5641 by (simp add: q'(4) r_def) |
5649 using r_def by blast |
|
5650 have "finite (snd ` p)" |
5642 have "finite (snd ` p)" |
5651 by (simp add: p'(1)) |
5643 by (simp add: p'(1)) |
5652 then show "\<And>T. T \<in> r \<Longrightarrow> interior (UNION p snd) \<inter> interior T = {}" |
5644 then show "\<And>T. T \<in> r \<Longrightarrow> interior (UNION p snd) \<inter> interior T = {}" |
5653 apply (subst Int_commute) |
5645 apply (subst Int_commute) |
5654 apply (rule Int_interior_Union_intervals) |
5646 apply (rule Int_interior_Union_intervals) |
5655 using \<open>r \<equiv> q - snd ` p\<close> q'(5) q(1) apply auto |
5647 using r_def q'(5) q(1) apply auto |
5656 by (simp add: p'(4)) |
5648 by (simp add: p'(4)) |
5657 qed |
5649 qed |
5658 qed |
5650 qed |
5659 moreover have "\<Union>(snd ` p) \<union> \<Union>r = cbox a b" and "{qq i |i. i \<in> r} = qq ` r" |
5651 moreover have "\<Union>(snd ` p) \<union> \<Union>r = cbox a b" and "{qq i |i. i \<in> r} = qq ` r" |
5660 using q unfolding Union_Un_distrib[symmetric] r_def by auto |
5652 using qdiv q unfolding Union_Un_distrib[symmetric] r_def by auto |
5661 ultimately show "?p tagged_division_of (cbox a b)" |
5653 ultimately show "?p tagged_division_of (cbox a b)" |
5662 by fastforce |
5654 by fastforce |
5663 qed |
5655 qed |
5664 |
5656 then have "norm (?SUM p + (?SUM (\<Union>(qq ` r))) - integral (cbox a b) f) < e" |
5665 then have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + (\<Sum>(x, k)\<in>\<Union>(qq ` r). content k *\<^sub>R f x) - |
5657 proof (subst sum.union_inter_neutral[symmetric, OF \<open>finite p\<close>], safe) |
5666 integral (cbox a b) f) < e" |
5658 show "content L *\<^sub>R f x = 0" if "(x, L) \<in> p" "(x, L) \<in> qq K" "K \<in> r" for x K L |
5667 apply (subst sum.union_inter_neutral[symmetric]) |
5659 proof - |
5668 apply (rule p') |
5660 obtain u v where uv: "L = cbox u v" |
5669 prefer 3 |
5661 using \<open>(x,L) \<in> p\<close> p'(4) by blast |
5670 apply assumption |
5662 have "L \<subseteq> K" |
5671 apply rule |
5663 using qq[OF that(3)] tagged_division_ofD(3) \<open>(x,L) \<in> qq K\<close> by metis |
5672 apply (rule r) |
5664 have "L \<in> snd ` p" |
5673 apply safe |
5665 using \<open>(x,L) \<in> p\<close> image_iff by fastforce |
5674 apply (drule qq) |
5666 then have "L \<in> q" "K \<in> q" "L \<noteq> K" |
|
5667 using that(1,3) q(1) unfolding r_def by auto |
|
5668 with q'(5) have "interior L = {}" |
|
5669 using interior_mono[OF \<open>L \<subseteq> K\<close>] by blast |
|
5670 then show "content L *\<^sub>R f x = 0" |
|
5671 unfolding uv content_eq_0_interior[symmetric] by auto |
|
5672 qed |
|
5673 show "finite (UNION r qq)" |
|
5674 by (meson finite_UN qq \<open>finite r\<close> tagged_division_of_finite) |
|
5675 qed |
|
5676 moreover have "content M *\<^sub>R f x = 0" |
|
5677 if x: "(x,M) \<in> qq K" "(x,M) \<in> qq L" and KL: "qq K \<noteq> qq L" and r: "K \<in> r" "L \<in> r" |
|
5678 for x M K L |
5675 proof - |
5679 proof - |
5676 fix x l k |
|
5677 assume as: "(x, l) \<in> p" "(x, l) \<in> qq k" "k \<in> r" |
|
5678 then obtain u v where uv: "l = cbox u v" |
|
5679 using p'(4) by blast |
|
5680 have "l \<subseteq> k" |
|
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 |
|
5684 then have "l \<in> q" "k \<in> q" "l \<noteq> k" |
|
5685 using as(1,3) q(1) unfolding r_def by auto |
|
5686 with q'(5) have "interior l = {}" |
|
5687 using interior_mono[OF \<open>l \<subseteq> k\<close>] by blast |
|
5688 then show "content l *\<^sub>R f x = 0" |
|
5689 unfolding uv content_eq_0_interior[symmetric] by auto |
|
5690 qed auto |
|
5691 |
|
5692 then have "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + sum (sum (\<lambda>(x, k). content k *\<^sub>R f x)) |
|
5693 (qq ` r) - integral (cbox a b) f) < e" |
|
5694 apply (subst (asm) sum.Union_comp) |
|
5695 prefer 2 |
|
5696 unfolding split_paired_all split_conv image_iff |
|
5697 apply (erule bexE)+ |
|
5698 proof - |
|
5699 fix x m k l T1 T2 |
|
5700 assume "(x, m) \<in> T1" "(x, m) \<in> T2" "T1 \<noteq> T2" "k \<in> r" "l \<in> r" "T1 = qq k" "T2 = qq l" |
|
5701 note as = this(1-5)[unfolded this(6-)] |
|
5702 note kl = tagged_division_ofD(3,4)[OF qq[THEN conjunct1]] |
5680 note kl = tagged_division_ofD(3,4)[OF qq[THEN conjunct1]] |
5703 from this(2)[OF as(4,1)] guess u v by (elim exE) note uv=this |
5681 obtain u v where uv: "M = cbox u v" |
5704 have *: "interior (k \<inter> l) = {}" |
5682 using \<open>(x, M) \<in> qq L\<close> \<open>L \<in> r\<close> kl(2) by blast |
5705 by (metis DiffE \<open>T1 = qq k\<close> \<open>T1 \<noteq> T2\<close> \<open>T2 = qq l\<close> as(4) as(5) interior_Int q'(5) r_def) |
5683 have empty: "interior (K \<inter> L) = {}" |
5706 have "interior m = {}" |
5684 by (metis DiffD1 interior_Int q'(5) r_def KL r) |
5707 unfolding subset_empty[symmetric] |
5685 have "interior M = {}" |
5708 unfolding *[symmetric] |
5686 by (metis (no_types, lifting) Int_assoc empty inf.absorb_iff2 interior_Int kl(1) subset_empty x r) |
5709 apply (rule interior_mono) |
5687 then show "content M *\<^sub>R f x = 0" |
5710 using kl(1)[OF as(4,1)] kl(1)[OF as(5,2)] |
|
5711 apply auto |
|
5712 done |
|
5713 then show "content m *\<^sub>R f x = 0" |
|
5714 unfolding uv content_eq_0_interior[symmetric] |
5688 unfolding uv content_eq_0_interior[symmetric] |
5715 by auto |
5689 by auto |
5716 qed (insert qq, auto) |
5690 qed |
5717 |
5691 ultimately have "norm (?SUM p + sum ?SUM (qq ` r) - integral (cbox a b) f) < e" |
5718 then have **: "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) + sum (sum (\<lambda>(x, k). content k *\<^sub>R f x) \<circ> qq) r - |
5692 apply (subst (asm) sum.Union_comp) |
5719 integral (cbox a b) f) < e" |
5693 using qq by (force simp: split_paired_all)+ |
5720 apply (subst (asm) sum.reindex_nontrivial) |
5694 moreover have "content M *\<^sub>R f x = 0" |
5721 apply fact |
5695 if "K \<in> r" "L \<in> r" "K \<noteq> L" "qq K = qq L" "(x, M) \<in> qq K" for K L x M |
5722 apply (rule sum.neutral) |
5696 using tagged_division_ofD(6) qq that by (metis (no_types, lifting)) |
5723 apply rule |
5697 ultimately have less_e: "norm (?SUM p + sum (?SUM \<circ> qq) r - integral (cbox a b) f) < e" |
5724 unfolding split_paired_all split_conv |
5698 apply (subst (asm) sum.reindex_nontrivial [OF \<open>finite r\<close>]) |
5725 defer |
5699 apply (auto simp: split_paired_all sum.neutral) |
5726 apply assumption |
5700 done |
5727 proof - |
5701 have norm_le: "norm (cp - ip) \<le> e + k" |
5728 fix k l x m |
5702 if "norm ((cp + cr) - i) < e" "norm (cr - ir) < k" "ip + ir = i" |
5729 assume as: "k \<in> r" "l \<in> r" "k \<noteq> l" "qq k = qq l" "(x, m) \<in> qq k" |
5703 for ir ip i cr cp::'a |
5730 note tagged_division_ofD(6)[OF qq[THEN conjunct1]] |
|
5731 from this[OF as(1)] this[OF as(2)] show "content m *\<^sub>R f x = 0" |
|
5732 using as(3) unfolding as by auto |
|
5733 qed |
|
5734 |
|
5735 have *: "norm (cp - ip) \<le> e + k" |
|
5736 if "norm ((cp + cr) - i) < e" |
|
5737 and "norm (cr - ir) < k" |
|
5738 and "ip + ir = i" |
|
5739 for ir ip i cr cp |
|
5740 proof - |
5704 proof - |
5741 from that show ?thesis |
5705 from that show ?thesis |
5742 using norm_triangle_le[of "cp + cr - i" "- (cr - ir)"] |
5706 using norm_triangle_le[of "cp + cr - i" "- (cr - ir)"] |
5743 unfolding that(3)[symmetric] norm_minus_cancel |
5707 unfolding that(3)[symmetric] norm_minus_cancel |
5744 by (auto simp add: algebra_simps) |
5708 by (auto simp add: algebra_simps) |
5745 qed |
5709 qed |
5746 |
5710 |
5747 have "?x = norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) - (\<Sum>(x, k)\<in>p. integral k f))" |
5711 have "?lhs = norm (?SUM p - (\<Sum>(x, k)\<in>p. integral k f))" |
5748 unfolding split_def sum_subtractf .. |
5712 unfolding split_def sum_subtractf .. |
5749 also have "\<dots> \<le> e + k" |
5713 also have "\<dots> \<le> e + k" |
5750 proof (rule *[OF **]) |
5714 proof (rule norm_le[OF less_e]) |
5751 have *: "k * real (card r) / (1 + real (card r)) < k" |
5715 have lessk: "k * real (card r) / (1 + real (card r)) < k" |
5752 using k by (auto simp add: field_simps) |
5716 using \<open>k>0\<close> by (auto simp add: field_simps) |
5753 have "norm (sum (sum (\<lambda>(x, k). content k *\<^sub>R f x) \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) |
5717 have "norm (sum (?SUM \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) \<le> (\<Sum>x\<in>r. k / (real (card r) + 1))" |
5754 \<le> (\<Sum>x\<in>r. k / (real (card r) + 1))" |
|
5755 unfolding sum_subtractf[symmetric] by (force dest: qq intro!: sum_norm_le) |
5718 unfolding sum_subtractf[symmetric] by (force dest: qq intro!: sum_norm_le) |
5756 also have "... < k" |
5719 also have "... < k" |
5757 by (simp add: "*" add.commute mult.commute) |
5720 by (simp add: lessk add.commute mult.commute) |
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" . |
5721 finally show "norm (sum (?SUM \<circ> qq) r - (\<Sum>k\<in>r. integral k f)) < k" . |
5759 next |
5722 next |
5760 from q(1) have [simp]: "snd ` p \<union> q = q" by auto |
5723 from q(1) have [simp]: "snd ` p \<union> q = q" by auto |
5761 have "integral l f = 0" |
5724 have "integral l f = 0" |
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 |
5725 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 |
5763 proof - |
5726 proof - |