src/HOL/Analysis/Equivalence_Lebesgue_Henstock_Integration.thy
changeset 66342 d8c7ca0e01c6
parent 66341 1072edd475dc
child 66343 ff60679dc21d
equal deleted inserted replaced
66341:1072edd475dc 66342:d8c7ca0e01c6
  1200 proof (clarsimp simp: completion.null_sets_outer)
  1200 proof (clarsimp simp: completion.null_sets_outer)
  1201   fix e::real
  1201   fix e::real
  1202   assume "0 < e"
  1202   assume "0 < e"
  1203   have "S \<in> lmeasurable"
  1203   have "S \<in> lmeasurable"
  1204     using \<open>negligible S\<close> by (simp add: negligible_iff_null_sets fmeasurableI_null_sets)
  1204     using \<open>negligible S\<close> by (simp add: negligible_iff_null_sets fmeasurableI_null_sets)
  1205   have e22: "0 < e / 2 / (2 * B * real DIM('M)) ^ DIM('N)"
  1205   have e22: "0 < e/2 / (2 * B * real DIM('M)) ^ DIM('N)"
  1206     using \<open>0 < e\<close> \<open>0 < B\<close> by (simp add: divide_simps)
  1206     using \<open>0 < e\<close> \<open>0 < B\<close> by (simp add: divide_simps)
  1207   obtain T
  1207   obtain T
  1208     where "open T" "S \<subseteq> T" "T \<in> lmeasurable"
  1208     where "open T" "S \<subseteq> T" "T \<in> lmeasurable"
  1209       and "measure lebesgue T \<le> measure lebesgue S + e / 2 / (2 * B * DIM('M)) ^ DIM('N)"
  1209       and "measure lebesgue T \<le> measure lebesgue S + e/2 / (2 * B * DIM('M)) ^ DIM('N)"
  1210     by (rule lmeasurable_outer_open [OF \<open>S \<in> lmeasurable\<close> e22])
  1210     by (rule lmeasurable_outer_open [OF \<open>S \<in> lmeasurable\<close> e22])
  1211   then have T: "measure lebesgue T \<le> e / 2 / (2 * B * DIM('M)) ^ DIM('N)"
  1211   then have T: "measure lebesgue T \<le> e/2 / (2 * B * DIM('M)) ^ DIM('N)"
  1212     using \<open>negligible S\<close> by (simp add: negligible_iff_null_sets measure_eq_0_null_sets)
  1212     using \<open>negligible S\<close> by (simp add: negligible_iff_null_sets measure_eq_0_null_sets)
  1213   have "\<exists>r. 0 < r \<and> r \<le> 1/2 \<and>
  1213   have "\<exists>r. 0 < r \<and> r \<le> 1/2 \<and>
  1214             (x \<in> S \<longrightarrow> (\<forall>y. norm(y - x) < r
  1214             (x \<in> S \<longrightarrow> (\<forall>y. norm(y - x) < r
  1215                        \<longrightarrow> y \<in> T \<and> (y \<in> S \<longrightarrow> norm(f y - f x) \<le> B * norm(y - x))))"
  1215                        \<longrightarrow> y \<in> T \<and> (y \<in> S \<longrightarrow> norm(f y - f x) \<le> B * norm(y - x))))"
  1216         for x
  1216         for x
  1287     then show ?thesis
  1287     then show ?thesis
  1288       by (simp add: \<open>i \<in> Basis\<close> SOME_Basis inner_diff prj1_def)
  1288       by (simp add: \<open>i \<in> Basis\<close> SOME_Basis inner_diff prj1_def)
  1289   qed
  1289   qed
  1290   have countbl: "countable (fbx ` \<D>)"
  1290   have countbl: "countable (fbx ` \<D>)"
  1291     using \<open>countable \<D>\<close> by blast
  1291     using \<open>countable \<D>\<close> by blast
  1292   have "(\<Sum>k\<in>fbx`\<D>'. measure lebesgue k) \<le> e / 2" if "\<D>' \<subseteq> \<D>" "finite \<D>'" for \<D>'
  1292   have "(\<Sum>k\<in>fbx`\<D>'. measure lebesgue k) \<le> e/2" if "\<D>' \<subseteq> \<D>" "finite \<D>'" for \<D>'
  1293   proof -
  1293   proof -
  1294     have BM_ge0: "0 \<le> B * (DIM('M) * prj1 (vf X - uf X))" if "X \<in> \<D>'" for X
  1294     have BM_ge0: "0 \<le> B * (DIM('M) * prj1 (vf X - uf X))" if "X \<in> \<D>'" for X
  1295       using \<open>0 < B\<close> \<open>\<D>' \<subseteq> \<D>\<close> that vu_pos by fastforce
  1295       using \<open>0 < B\<close> \<open>\<D>' \<subseteq> \<D>\<close> that vu_pos by fastforce
  1296     have "{} \<notin> \<D>'"
  1296     have "{} \<notin> \<D>'"
  1297       using cbox \<open>\<D>' \<subseteq> \<D>\<close> interior_empty by blast
  1297       using cbox \<open>\<D>' \<subseteq> \<D>\<close> interior_empty by blast
  1331         by (subst (3) ufvf[symmetric]) simp
  1331         by (subst (3) ufvf[symmetric]) simp
  1332       finally show "(measure lebesgue \<circ> fbx) X \<le> (2 * B * DIM('M)) ^ DIM('N) * measure lebesgue X" .
  1332       finally show "(measure lebesgue \<circ> fbx) X \<le> (2 * B * DIM('M)) ^ DIM('N) * measure lebesgue X" .
  1333     qed
  1333     qed
  1334     also have "\<dots> = (2 * B * DIM('M)) ^ DIM('N) * sum (measure lebesgue) \<D>'"
  1334     also have "\<dots> = (2 * B * DIM('M)) ^ DIM('N) * sum (measure lebesgue) \<D>'"
  1335       by (simp add: sum_distrib_left)
  1335       by (simp add: sum_distrib_left)
  1336     also have "\<dots> \<le> e / 2"
  1336     also have "\<dots> \<le> e/2"
  1337     proof -
  1337     proof -
  1338       have div: "\<D>' division_of \<Union>\<D>'"
  1338       have div: "\<D>' division_of \<Union>\<D>'"
  1339         apply (auto simp: \<open>finite \<D>'\<close> \<open>{} \<notin> \<D>'\<close> division_of_def)
  1339         apply (auto simp: \<open>finite \<D>'\<close> \<open>{} \<notin> \<D>'\<close> division_of_def)
  1340         using cbox that apply blast
  1340         using cbox that apply blast
  1341         using pairwise_subset [OF pw \<open>\<D>' \<subseteq> \<D>\<close>] unfolding pairwise_def apply force+
  1341         using pairwise_subset [OF pw \<open>\<D>' \<subseteq> \<D>\<close>] unfolding pairwise_def apply force+
  1364       also have "\<dots> \<le> (2 * B * real DIM('M)) ^ DIM('N) * measure lebesgue T"
  1364       also have "\<dots> \<le> (2 * B * real DIM('M)) ^ DIM('N) * measure lebesgue T"
  1365         apply (rule mult_left_mono [OF le_meaT])
  1365         apply (rule mult_left_mono [OF le_meaT])
  1366         using \<open>0 < B\<close>
  1366         using \<open>0 < B\<close>
  1367         apply (simp add: algebra_simps)
  1367         apply (simp add: algebra_simps)
  1368         done
  1368         done
  1369       also have "\<dots> \<le> e / 2"
  1369       also have "\<dots> \<le> e/2"
  1370         using T \<open>0 < B\<close> by (simp add: field_simps)
  1370         using T \<open>0 < B\<close> by (simp add: field_simps)
  1371       finally show ?thesis .
  1371       finally show ?thesis .
  1372     qed
  1372     qed
  1373     finally show ?thesis .
  1373     finally show ?thesis .
  1374   qed
  1374   qed
  1375   then have e2: "sum (measure lebesgue) \<G> \<le> e / 2" if "\<G> \<subseteq> fbx ` \<D>" "finite \<G>" for \<G>
  1375   then have e2: "sum (measure lebesgue) \<G> \<le> e/2" if "\<G> \<subseteq> fbx ` \<D>" "finite \<G>" for \<G>
  1376     by (metis finite_subset_image that)
  1376     by (metis finite_subset_image that)
  1377   show "\<exists>W\<in>lmeasurable. f ` S \<subseteq> W \<and> measure lebesgue W < e"
  1377   show "\<exists>W\<in>lmeasurable. f ` S \<subseteq> W \<and> measure lebesgue W < e"
  1378   proof (intro bexI conjI)
  1378   proof (intro bexI conjI)
  1379     have "\<exists>X\<in>\<D>. f y \<in> fbx X" if "y \<in> S" for y
  1379     have "\<exists>X\<in>\<D>. f y \<in> fbx X" if "y \<in> S" for y
  1380     proof -
  1380     proof -
  1634              (\<forall>p. p tagged_division_of cbox a b \<and>
  1634              (\<forall>p. p tagged_division_of cbox a b \<and>
  1635                   d fine p \<longrightarrow>
  1635                   d fine p \<longrightarrow>
  1636                   norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - ?S) < e)"
  1636                   norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - ?S) < e)"
  1637     if e: "e > 0" for e
  1637     if e: "e > 0" for e
  1638   proof -
  1638   proof -
  1639     have "?S - e / 2 < ?S" using \<open>e > 0\<close> by simp
  1639     have "?S - e/2 < ?S" using \<open>e > 0\<close> by simp
  1640     then obtain d where d: "d division_of (cbox a b)" "?S - e / 2 < (\<Sum>k\<in>d. norm (integral k f))"
  1640     then obtain d where d: "d division_of (cbox a b)" "?S - e/2 < (\<Sum>k\<in>d. norm (integral k f))"
  1641       unfolding less_cSUP_iff[OF D] by auto
  1641       unfolding less_cSUP_iff[OF D] by auto
  1642     note d' = division_ofD[OF this(1)]
  1642     note d' = division_ofD[OF this(1)]
  1643 
  1643 
  1644     have "\<forall>x. \<exists>e>0. \<forall>i\<in>d. x \<notin> i \<longrightarrow> ball x e \<inter> i = {}"
  1644     have "\<forall>x. \<exists>e>0. \<forall>i\<in>d. x \<notin> i \<longrightarrow> ball x e \<inter> i = {}"
  1645     proof
  1645     proof
  1659     qed
  1659     qed
  1660     then obtain k where k: "\<And>x. 0 < k x" "\<And>i x. \<lbrakk>i \<in> d; x \<notin> i\<rbrakk> \<Longrightarrow> ball x (k x) \<inter> i = {}"
  1660     then obtain k where k: "\<And>x. 0 < k x" "\<And>i x. \<lbrakk>i \<in> d; x \<notin> i\<rbrakk> \<Longrightarrow> ball x (k x) \<inter> i = {}"
  1661       by metis
  1661       by metis
  1662     have "e/2 > 0"
  1662     have "e/2 > 0"
  1663       using e by auto
  1663       using e by auto
  1664     from henstock_lemma[OF assms(1) this] 
  1664     with henstock_lemma[OF f] 
  1665     obtain g where g: "gauge g"
  1665     obtain g where g: "gauge g"
  1666       "\<And>p. \<lbrakk>p tagged_partial_division_of cbox a b; g fine p\<rbrakk> 
  1666       "\<And>p. \<lbrakk>p tagged_partial_division_of cbox a b; g fine p\<rbrakk> 
  1667                 \<Longrightarrow> (\<Sum>(x, k)\<in>p. norm (content k *\<^sub>R f x - integral k f)) < e / 2"
  1667                 \<Longrightarrow> (\<Sum>(x, k)\<in>p. norm (content k *\<^sub>R f x - integral k f)) < e/2"
  1668       by (metis (no_types, lifting))      
  1668       by (metis (no_types, lifting))      
  1669     let ?g = "\<lambda>x. g x \<inter> ball x (k x)"
  1669     let ?g = "\<lambda>x. g x \<inter> ball x (k x)"
  1670     show ?thesis 
  1670     show ?thesis 
  1671       apply (rule_tac x="?g" in exI)
  1671     proof (intro exI conjI allI impI)
  1672       apply safe
       
  1673     proof -
       
  1674       show "gauge ?g"
  1672       show "gauge ?g"
  1675         using g(1) k(1)
  1673         using g(1) k(1) by (auto simp: gauge_def)
  1676         unfolding gauge_def
  1674     next
  1677         by auto
       
  1678       fix p
  1675       fix p
  1679       assume "p tagged_division_of (cbox a b)" and "?g fine p"
  1676       assume "p tagged_division_of (cbox a b) \<and> ?g fine p"
  1680       note p = this(1) conjunctD2[OF this(2)[unfolded fine_Int]]
  1677       then have p: "p tagged_division_of cbox a b" "g fine p" "(\<lambda>x. ball x (k x)) fine p"
       
  1678         by (auto simp: fine_Int)
  1681       note p' = tagged_division_ofD[OF p(1)]
  1679       note p' = tagged_division_ofD[OF p(1)]
  1682       define p' where "p' = {(x,k) | x k. \<exists>i l. x \<in> i \<and> i \<in> d \<and> (x,l) \<in> p \<and> k = i \<inter> l}"
  1680       define p' where "p' = {(x,k) | x k. \<exists>i l. x \<in> i \<and> i \<in> d \<and> (x,l) \<in> p \<and> k = i \<inter> l}"
  1683       have gp': "g fine p'"
  1681       have gp': "g fine p'"
  1684         using p(2)
  1682         using p(2) by (auto simp: p'_def fine_def)
  1685         unfolding p'_def fine_def
       
  1686         by auto
       
  1687       have p'': "p' tagged_division_of (cbox a b)"
  1683       have p'': "p' tagged_division_of (cbox a b)"
  1688       proof (rule tagged_division_ofI)
  1684       proof (rule tagged_division_ofI)
  1689         show "finite p'"
  1685         show "finite p'"
  1690           apply (rule finite_subset[of _ "(\<lambda>(k,(x,l)). (x,k \<inter> l)) `
  1686         proof (rule finite_subset)
  1691             {(k,xl) | k xl. k \<in> d \<and> xl \<in> p}"])
  1687           show "p' \<subseteq> (\<lambda>(k, x, l). (x, k \<inter> l)) ` (d \<times> p)"
  1692           unfolding p'_def
  1688             by (force simp: p'_def image_iff)
  1693            defer
  1689           show "finite ((\<lambda>(k, x, l). (x, k \<inter> l)) ` (d \<times> p))"
  1694            apply (rule finite_imageI,rule finite_product_dependent[OF d'(1) p'(1)])
  1690             by (simp add: d'(1) p'(1))
  1695           apply safe
  1691         qed
  1696           unfolding image_iff
       
  1697           apply (rule_tac x="(i,x,l)" in bexI)
       
  1698            apply auto
       
  1699           done
       
  1700         fix x k
  1692         fix x k
  1701         assume "(x, k) \<in> p'"
  1693         assume "(x, k) \<in> p'"
  1702         then have "\<exists>i l. x \<in> i \<and> i \<in> d \<and> (x, l) \<in> p \<and> k = i \<inter> l"
  1694         then have "\<exists>i l. x \<in> i \<and> i \<in> d \<and> (x, l) \<in> p \<and> k = i \<inter> l"
  1703           unfolding p'_def by auto
  1695           unfolding p'_def by auto
  1704         then obtain i l where il: "x \<in> i" "i \<in> d" "(x, l) \<in> p" "k = i \<inter> l" by blast
  1696         then obtain i l where il: "x \<in> i" "i \<in> d" "(x, l) \<in> p" "k = i \<inter> l" by blast
  1712         assume "(x1, k1) \<in> p'"
  1704         assume "(x1, k1) \<in> p'"
  1713         then have "\<exists>i l. x1 \<in> i \<and> i \<in> d \<and> (x1, l) \<in> p \<and> k1 = i \<inter> l"
  1705         then have "\<exists>i l. x1 \<in> i \<and> i \<in> d \<and> (x1, l) \<in> p \<and> k1 = i \<inter> l"
  1714           unfolding p'_def by auto
  1706           unfolding p'_def by auto
  1715         then obtain i1 l1 where il1: "x1 \<in> i1" "i1 \<in> d" "(x1, l1) \<in> p" "k1 = i1 \<inter> l1" by blast
  1707         then obtain i1 l1 where il1: "x1 \<in> i1" "i1 \<in> d" "(x1, l1) \<in> p" "k1 = i1 \<inter> l1" by blast
  1716         fix x2 k2
  1708         fix x2 k2
  1717         assume "(x2,k2)\<in>p'"
  1709         assume "(x2,k2) \<in> p'"
  1718         then have "\<exists>i l. x2 \<in> i \<and> i \<in> d \<and> (x2, l) \<in> p \<and> k2 = i \<inter> l"
  1710         then have "\<exists>i l. x2 \<in> i \<and> i \<in> d \<and> (x2, l) \<in> p \<and> k2 = i \<inter> l"
  1719           unfolding p'_def by auto
  1711           unfolding p'_def by auto
  1720         then obtain i2 l2 where il2: "x2 \<in> i2" "i2 \<in> d" "(x2, l2) \<in> p" "k2 = i2 \<inter> l2" by blast
  1712         then obtain i2 l2 where il2: "x2 \<in> i2" "i2 \<in> d" "(x2, l2) \<in> p" "k2 = i2 \<inter> l2" by blast
  1721         assume "(x1, k1) \<noteq> (x2, k2)"
  1713         assume "(x1, k1) \<noteq> (x2, k2)"
  1722         then have "interior i1 \<inter> interior i2 = {} \<or> interior l1 \<inter> interior l2 = {}"
  1714         then have "interior i1 \<inter> interior i2 = {} \<or> interior l1 \<inter> interior l2 = {}"
  1733           obtain i where i: "i \<in> d" "y \<in> i" 
  1725           obtain i where i: "i \<in> d" "y \<in> i" 
  1734             using y unfolding d'(6)[symmetric] by auto
  1726             using y unfolding d'(6)[symmetric] by auto
  1735           have "x \<in> i"
  1727           have "x \<in> i"
  1736             using fineD[OF p(3) xl(1)] using k(2) i xl by auto
  1728             using fineD[OF p(3) xl(1)] using k(2) i xl by auto
  1737           then show ?thesis
  1729           then show ?thesis
  1738             apply (rule_tac X="i \<inter> l" in UnionI)
  1730             unfolding p'_def
  1739             using i xl by (auto simp: p'_def)
  1731             by (rule_tac X="i \<inter> l" in UnionI) (use i xl in auto)
  1740         qed
  1732         qed
  1741         show "\<Union>{k. \<exists>x. (x, k) \<in> p'} = cbox a b"
  1733         show "\<Union>{k. \<exists>x. (x, k) \<in> p'} = cbox a b"
  1742         proof
  1734         proof
  1743           show "\<Union>{k. \<exists>x. (x, k) \<in> p'} \<subseteq> cbox a b"
  1735           show "\<Union>{k. \<exists>x. (x, k) \<in> p'} \<subseteq> cbox a b"
  1744             using * by auto
  1736             using * by auto
  1758               using i xl by (auto simp: p'_def)
  1750               using i xl by (auto simp: p'_def)
  1759           qed
  1751           qed
  1760         qed
  1752         qed
  1761       qed
  1753       qed
  1762 
  1754 
  1763       then have sum_less_e2: "(\<Sum>(x, k)\<in>p'. norm (content k *\<^sub>R f x - integral k f)) < e / 2"
  1755       then have sum_less_e2: "(\<Sum>(x, k)\<in>p'. norm (content k *\<^sub>R f x - integral k f)) < e/2"
  1764         using g(2) gp' tagged_division_of_def by blast
  1756         using g(2) gp' tagged_division_of_def by blast
  1765       then have XXX: "\<bar>(\<Sum>(x,k)\<in>p'. norm (content k *\<^sub>R f x)) - (\<Sum>(x,k)\<in>p'. norm (integral k f))\<bar> < e / 2"
       
  1766         unfolding split_def
       
  1767         using p'' by (force intro!: absdiff_norm_less)
       
  1768 
  1757 
  1769       have p'alt: "p' = {(x,(i \<inter> l)) | x i l. (x,l) \<in> p \<and> i \<in> d \<and> i \<inter> l \<noteq> {}}"
  1758       have p'alt: "p' = {(x,(i \<inter> l)) | x i l. (x,l) \<in> p \<and> i \<in> d \<and> i \<inter> l \<noteq> {}}"
  1770       proof (safe, goal_cases)
  1759       proof (safe, goal_cases)
  1771         case prems: (2 _ _ x i l)
  1760         case prems: (2 _ _ x i l)
  1772         have "x \<in> i"
  1761         have "x \<in> i"
  1795         apply (subst sum.over_tagged_division_lemma[OF p'',of "\<lambda>k. norm (integral k f)"])
  1784         apply (subst sum.over_tagged_division_lemma[OF p'',of "\<lambda>k. norm (integral k f)"])
  1796          apply (auto intro: integral_null simp: content_eq_0_interior)
  1785          apply (auto intro: integral_null simp: content_eq_0_interior)
  1797         done
  1786         done
  1798       note snd_p = division_ofD[OF division_of_tagged_division[OF p(1)]]
  1787       note snd_p = division_ofD[OF division_of_tagged_division[OF p(1)]]
  1799 
  1788 
  1800 
  1789       have *: "\<And>sni sni' sf sf'. \<lbrakk>\<bar>sf' - sni'\<bar> < e/2; ?S - e/2 < sni; sni' \<le> ?S;
  1801       have *: "\<And>sni sni' sf sf'. \<lbrakk>\<bar>sf' - sni'\<bar> < e / 2; ?S - e / 2 < sni; sni' \<le> ?S;
       
  1802         sni \<le> sni'; sf' = sf\<rbrakk> \<Longrightarrow> \<bar>sf - ?S\<bar> < e"
  1790         sni \<le> sni'; sf' = sf\<rbrakk> \<Longrightarrow> \<bar>sf - ?S\<bar> < e"
  1803         by arith
  1791         by arith
  1804       show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - ?S) < e"
  1792       show "norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - ?S) < e"
  1805         unfolding real_norm_def
  1793         unfolding real_norm_def
  1806       proof (rule *)
  1794       proof (rule *)
  1807         show "\<bar>(\<Sum>(x,k)\<in>p'. norm (content k *\<^sub>R f x)) - (\<Sum>(x,k)\<in>p'. norm (integral k f))\<bar> < e / 2"
  1795         show "\<bar>(\<Sum>(x,k)\<in>p'. norm (content k *\<^sub>R f x)) - (\<Sum>(x,k)\<in>p'. norm (integral k f))\<bar> < e/2"
  1808           by (rule XXX)
  1796           using p'' sum_less_e2 unfolding split_def by (force intro!: absdiff_norm_less)
  1809         show "(\<Sum>(x, k)\<in>p'. norm (integral k f)) \<le>?S"
  1797         show "(\<Sum>(x, k)\<in>p'. norm (integral k f)) \<le>?S"
  1810           by (auto simp: sum_p' division_of_tagged_division[OF p''] D intro!: cSUP_upper)
  1798           by (auto simp: sum_p' division_of_tagged_division[OF p''] D intro!: cSUP_upper)
  1811         show "(\<Sum>k\<in>d. norm (integral k f)) \<le> (\<Sum>(x, k)\<in>p'. norm (integral k f))"
  1799         show "(\<Sum>k\<in>d. norm (integral k f)) \<le> (\<Sum>(x, k)\<in>p'. norm (integral k f))"
  1812         proof -
  1800         proof -
  1813           have *: "{k \<inter> l | k l. k \<in> d \<and> l \<in> snd ` p} =
  1801           have *: "{k \<inter> l | k l. k \<in> d \<and> l \<in> snd ` p} =
  2145         note * = this(2)[unfolded has_integral_integral has_integral[of "\<lambda>x. norm (f x)"],rule_format]
  2133         note * = this(2)[unfolded has_integral_integral has_integral[of "\<lambda>x. norm (f x)"],rule_format]
  2146         have "e/2>0"
  2134         have "e/2>0"
  2147           using \<open>e > 0\<close> by auto
  2135           using \<open>e > 0\<close> by auto
  2148         from * [OF this] obtain d1 where
  2136         from * [OF this] obtain d1 where
  2149           d1: "gauge d1" "\<forall>p. p tagged_division_of (cbox a b) \<and> d1 fine p \<longrightarrow>
  2137           d1: "gauge d1" "\<forall>p. p tagged_division_of (cbox a b) \<and> d1 fine p \<longrightarrow>
  2150             norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - integral (cbox a b) (\<lambda>x. norm (f x))) < e / 2"
  2138             norm ((\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - integral (cbox a b) (\<lambda>x. norm (f x))) < e/2"
  2151           by auto
  2139           by auto
  2152         from henstock_lemma [OF f(1) \<open>e/2>0\<close>] obtain d2 where
  2140         from henstock_lemma [OF f(1) \<open>e/2>0\<close>] obtain d2 where
  2153           d2: "gauge d2" "\<forall>p. p tagged_partial_division_of (cbox a b) \<and> d2 fine p \<longrightarrow>
  2141           d2: "gauge d2" "\<forall>p. p tagged_partial_division_of (cbox a b) \<and> d2 fine p \<longrightarrow>
  2154             (\<Sum>(x, k)\<in>p. norm (content k *\<^sub>R f x - integral k f)) < e / 2" .
  2142             (\<Sum>(x, k)\<in>p. norm (content k *\<^sub>R f x - integral k f)) < e/2" .
  2155          obtain p where
  2143          obtain p where
  2156           p: "p tagged_division_of (cbox a b)" "d1 fine p" "d2 fine p"
  2144           p: "p tagged_division_of (cbox a b)" "d1 fine p" "d2 fine p"
  2157           by (rule fine_division_exists [OF gauge_Int [OF d1(1) d2(1)], of a b])
  2145           by (rule fine_division_exists [OF gauge_Int [OF d1(1) d2(1)], of a b])
  2158             (auto simp add: fine_Int)
  2146             (auto simp add: fine_Int)
  2159         have *: "\<And>sf sf' si di. sf' = sf \<longrightarrow> si \<le> ?S \<longrightarrow> \<bar>sf - si\<bar> < e / 2 \<longrightarrow>
  2147         have *: "\<And>sf sf' si di. sf' = sf \<longrightarrow> si \<le> ?S \<longrightarrow> \<bar>sf - si\<bar> < e/2 \<longrightarrow>
  2160           \<bar>sf' - di\<bar> < e / 2 \<longrightarrow> di < ?S + e"
  2148           \<bar>sf' - di\<bar> < e/2 \<longrightarrow> di < ?S + e"
  2161           by arith
  2149           by arith
  2162         show "integral (cbox a b) (\<lambda>x. if x \<in> UNIV then norm (f x) else 0) < ?S + e"
  2150         show "integral (cbox a b) (\<lambda>x. if x \<in> UNIV then norm (f x) else 0) < ?S + e"
  2163           apply (subst if_P)
  2151           apply (subst if_P)
  2164           apply rule
  2152           apply rule
  2165         proof (rule *[rule_format])
  2153         proof (rule *[rule_format])
  2166           show "\<bar>(\<Sum>(x,k)\<in>p. norm (content k *\<^sub>R f x)) - (\<Sum>(x,k)\<in>p. norm (integral k f))\<bar> < e / 2"
  2154           show "\<bar>(\<Sum>(x,k)\<in>p. norm (content k *\<^sub>R f x)) - (\<Sum>(x,k)\<in>p. norm (integral k f))\<bar> < e/2"
  2167             unfolding split_def
  2155             unfolding split_def
  2168             apply (rule absdiff_norm_less)
  2156             apply (rule absdiff_norm_less)
  2169             using d2(2)[rule_format,of p]
  2157             using d2(2)[rule_format,of p]
  2170             using p(1,3)
  2158             using p(1,3)
  2171             unfolding tagged_division_of_def split_def
  2159             unfolding tagged_division_of_def split_def
  2172             apply auto
  2160             apply auto
  2173             done
  2161             done
  2174           show "\<bar>(\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - integral (cbox a b) (\<lambda>x. norm(f x))\<bar> < e / 2"
  2162           show "\<bar>(\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) - integral (cbox a b) (\<lambda>x. norm(f x))\<bar> < e/2"
  2175             using d1(2)[rule_format,OF conjI[OF p(1,2)]]
  2163             using d1(2)[rule_format,OF conjI[OF p(1,2)]]
  2176             by (simp only: real_norm_def)
  2164             by (simp only: real_norm_def)
  2177           show "(\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) = (\<Sum>(x, k)\<in>p. norm (content k *\<^sub>R f x))"
  2165           show "(\<Sum>(x, k)\<in>p. content k *\<^sub>R norm (f x)) = (\<Sum>(x, k)\<in>p. norm (content k *\<^sub>R f x))"
  2178             apply (rule sum.cong)
  2166             apply (rule sum.cong)
  2179             apply (rule refl)
  2167             apply (rule refl)