723 qed |
723 qed |
724 next |
724 next |
725 case False |
725 case False |
726 have prod_if: "(\<Prod>k\<in>Basis \<inter> - {i}. f k) = (\<Prod>k\<in>Basis. f k) / f i" if "f i \<noteq> (0::real)" for f |
726 have prod_if: "(\<Prod>k\<in>Basis \<inter> - {i}. f k) = (\<Prod>k\<in>Basis. f k) / f i" if "f i \<noteq> (0::real)" for f |
727 using that mk_disjoint_insert [OF i] |
727 using that mk_disjoint_insert [OF i] |
728 apply (clarsimp simp add: divide_simps) |
728 apply (clarsimp simp add: field_split_simps) |
729 by (metis Int_insert_left_if0 finite_Basis finite_insert le_iff_inf mult.commute order_refl prod.insert subset_Compl_singleton) |
729 by (metis Int_insert_left_if0 finite_Basis finite_insert le_iff_inf mult.commute order_refl prod.insert subset_Compl_singleton) |
730 have abc: "a \<bullet> i < c" "c < b \<bullet> i" |
730 have abc: "a \<bullet> i < c" "c < b \<bullet> i" |
731 using False assms by auto |
731 using False assms by auto |
732 then have "(\<Sum>K\<in>\<D>. ((\<lambda>K. content K / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i)) \<circ> ((\<lambda>K. K \<inter> {x. x \<bullet> i \<le> c}))) K) |
732 then have "(\<Sum>K\<in>\<D>. ((\<lambda>K. content K / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i)) \<circ> ((\<lambda>K. K \<inter> {x. x \<bullet> i \<le> c}))) K) |
733 \<le> content(cbox a b') / (c - a \<bullet> i)" |
733 \<le> content(cbox a b') / (c - a \<bullet> i)" |
734 "(\<Sum>K\<in>\<D>. ((\<lambda>K. content K / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i)) \<circ> ((\<lambda>K. K \<inter> {x. x \<bullet> i \<ge> c}))) K) |
734 "(\<Sum>K\<in>\<D>. ((\<lambda>K. content K / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i)) \<circ> ((\<lambda>K. K \<inter> {x. x \<bullet> i \<ge> c}))) K) |
735 \<le> content(cbox a' b) / (b \<bullet> i - c)" |
735 \<le> content(cbox a' b) / (b \<bullet> i - c)" |
736 using lec gec by (simp_all add: divide_simps mult.commute) |
736 using lec gec by (simp_all add: field_split_simps mult.commute) |
737 moreover |
737 moreover |
738 have "(\<Sum>K\<in>\<D>. content K / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i)) |
738 have "(\<Sum>K\<in>\<D>. content K / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i)) |
739 \<le> (\<Sum>K\<in>\<D>. ((\<lambda>K. content K / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i)) \<circ> ((\<lambda>K. K \<inter> {x. x \<bullet> i \<le> c}))) K) + |
739 \<le> (\<Sum>K\<in>\<D>. ((\<lambda>K. content K / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i)) \<circ> ((\<lambda>K. K \<inter> {x. x \<bullet> i \<le> c}))) K) + |
740 (\<Sum>K\<in>\<D>. ((\<lambda>K. content K / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i)) \<circ> ((\<lambda>K. K \<inter> {x. x \<bullet> i \<ge> c}))) K)" |
740 (\<Sum>K\<in>\<D>. ((\<lambda>K. content K / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i)) \<circ> ((\<lambda>K. K \<inter> {x. x \<bullet> i \<ge> c}))) K)" |
741 (is "?lhs \<le> ?rhs") |
741 (is "?lhs \<le> ?rhs") |
854 define \<gamma> where "\<gamma> \<equiv> \<lambda>x. \<gamma>0 x \<inter> |
854 define \<gamma> where "\<gamma> \<equiv> \<lambda>x. \<gamma>0 x \<inter> |
855 ball x ((\<epsilon>/8 / (norm(f x) + 1)) * (INF m\<in>Basis. b \<bullet> m - a \<bullet> m) / content(cbox a b))" |
855 ball x ((\<epsilon>/8 / (norm(f x) + 1)) * (INF m\<in>Basis. b \<bullet> m - a \<bullet> m) / content(cbox a b))" |
856 have "gauge (\<lambda>x. ball x |
856 have "gauge (\<lambda>x. ball x |
857 (\<epsilon> * (INF m\<in>Basis. b \<bullet> m - a \<bullet> m) / ((8 * norm (f x) + 8) * content (cbox a b))))" |
857 (\<epsilon> * (INF m\<in>Basis. b \<bullet> m - a \<bullet> m) / ((8 * norm (f x) + 8) * content (cbox a b))))" |
858 using \<open>0 < content (cbox a b)\<close> \<open>0 < \<epsilon>\<close> a_less_b |
858 using \<open>0 < content (cbox a b)\<close> \<open>0 < \<epsilon>\<close> a_less_b |
859 apply (auto simp: gauge_def divide_simps mult_less_0_iff zero_less_mult_iff add_nonneg_eq_0_iff finite_less_Inf_iff) |
859 apply (auto simp: gauge_def field_split_simps mult_less_0_iff zero_less_mult_iff add_nonneg_eq_0_iff finite_less_Inf_iff) |
860 apply (meson add_nonneg_nonneg mult_nonneg_nonneg norm_ge_zero not_less zero_le_numeral) |
860 apply (meson add_increasing measure_nonneg mult_nonneg_nonneg norm_ge_zero not_le zero_le_numeral) |
861 done |
861 done |
862 then have "gauge \<gamma>" |
862 then have "gauge \<gamma>" |
863 unfolding \<gamma>_def using \<open>gauge \<gamma>0\<close> gauge_Int by auto |
863 unfolding \<gamma>_def using \<open>gauge \<gamma>0\<close> gauge_Int by auto |
864 moreover |
864 moreover |
865 have "(\<Sum>(x,K) \<in> S. norm (integral K h)) < \<epsilon>" |
865 have "(\<Sum>(x,K) \<in> S. norm (integral K h)) < \<epsilon>" |
934 using x that by (auto simp: norm_f) |
934 using x that by (auto simp: norm_f) |
935 also have "... < (norm (f x) + 1)" |
935 also have "... < (norm (f x) + 1)" |
936 by simp |
936 by simp |
937 also have "... < \<epsilon> * (b \<bullet> i - a \<bullet> i) / dist u v / (4 * content (cbox a b))" |
937 also have "... < \<epsilon> * (b \<bullet> i - a \<bullet> i) / dist u v / (4 * content (cbox a b))" |
938 using duv dist_uv contab_gt0 |
938 using duv dist_uv contab_gt0 |
939 apply (simp add: divide_simps algebra_simps mult_less_0_iff zero_less_mult_iff split: if_split_asm) |
939 apply (simp add: field_split_simps algebra_simps mult_less_0_iff zero_less_mult_iff split: if_split_asm) |
940 by (meson add_nonneg_nonneg linorder_not_le measure_nonneg mult_nonneg_nonneg norm_ge_zero zero_le_numeral) |
940 by (meson add_nonneg_nonneg linorder_not_le measure_nonneg mult_nonneg_nonneg norm_ge_zero zero_le_numeral) |
941 also have "... = \<epsilon> * (b \<bullet> i - a \<bullet> i) / norm (v - u) / (4 * content (cbox a b))" |
941 also have "... = \<epsilon> * (b \<bullet> i - a \<bullet> i) / norm (v - u) / (4 * content (cbox a b))" |
942 by (simp add: dist_norm norm_minus_commute) |
942 by (simp add: dist_norm norm_minus_commute) |
943 also have "... \<le> \<epsilon> * (b \<bullet> i - a \<bullet> i) / \<bar>v \<bullet> i - u \<bullet> i\<bar> / (4 * content (cbox a b))" |
943 also have "... \<le> \<epsilon> * (b \<bullet> i - a \<bullet> i) / \<bar>v \<bullet> i - u \<bullet> i\<bar> / (4 * content (cbox a b))" |
944 apply (intro mult_right_mono divide_left_mono divide_right_mono uvi) |
944 apply (intro mult_right_mono divide_left_mono divide_right_mono uvi) |
951 qed |
951 qed |
952 with Kgt0 have "norm (content K *\<^sub>R h x) \<le> content K * ((\<epsilon>/4 * (b \<bullet> i - a \<bullet> i) / content (cbox a b)) / ?\<Delta>)" |
952 with Kgt0 have "norm (content K *\<^sub>R h x) \<le> content K * ((\<epsilon>/4 * (b \<bullet> i - a \<bullet> i) / content (cbox a b)) / ?\<Delta>)" |
953 using mult_left_mono by fastforce |
953 using mult_left_mono by fastforce |
954 also have "... = \<epsilon>/4 * (b \<bullet> i - a \<bullet> i) / content (cbox a b) * |
954 also have "... = \<epsilon>/4 * (b \<bullet> i - a \<bullet> i) / content (cbox a b) * |
955 content K / ?\<Delta>" |
955 content K / ?\<Delta>" |
956 by (simp add: divide_simps) |
956 by (simp add: field_split_simps) |
957 finally show ?thesis . |
957 finally show ?thesis . |
958 qed |
958 qed |
959 qed |
959 qed |
960 also have "... = (\<Sum>K\<in>snd ` S. \<epsilon>/4 * (b \<bullet> i - a \<bullet> i) / content (cbox a b) * content K |
960 also have "... = (\<Sum>K\<in>snd ` S. \<epsilon>/4 * (b \<bullet> i - a \<bullet> i) / content (cbox a b) * content K |
961 / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i))" |
961 / (interval_upperbound K \<bullet> i - interval_lowerbound K \<bullet> i))" |
1531 by (metis (full_types) order_trans Basis_le_norm inner_commute inner_diff_right that) |
1531 by (metis (full_types) order_trans Basis_le_norm inner_commute inner_diff_right that) |
1532 show "1/n < \<bar>x \<bullet> i - c \<bullet> i\<bar>" "1/n < \<bar>x \<bullet> i - d \<bullet> i\<bar>" |
1532 show "1/n < \<bar>x \<bullet> i - c \<bullet> i\<bar>" "1/n < \<bar>x \<bullet> i - d \<bullet> i\<bar>" |
1533 using n \<open>n \<noteq> 0\<close> emin [OF \<open>i \<in> Basis\<close>] |
1533 using n \<open>n \<noteq> 0\<close> emin [OF \<open>i \<in> Basis\<close>] |
1534 by (simp_all add: inverse_eq_divide) |
1534 by (simp_all add: inverse_eq_divide) |
1535 show "1 / real (Suc m) \<le> 1 / real n" |
1535 show "1 / real (Suc m) \<le> 1 / real n" |
1536 using \<open>n \<noteq> 0\<close> \<open>m \<ge> n\<close> by (simp add: divide_simps) |
1536 using \<open>n \<noteq> 0\<close> \<open>m \<ge> n\<close> by (simp add: field_split_simps) |
1537 qed |
1537 qed |
1538 then show ?thesis by (simp add: mem_box) |
1538 then show ?thesis by (simp add: mem_box) |
1539 qed |
1539 qed |
1540 then show ?thesis by blast |
1540 then show ?thesis by blast |
1541 qed |
1541 qed |
1682 using le_imp_inverse_le [OF * \<Delta>] |
1682 using le_imp_inverse_le [OF * \<Delta>] |
1683 by (simp add: field_simps) |
1683 by (simp add: field_simps) |
1684 with N have "k > ((b - a) \<bullet> i) / ((x - a) \<bullet> i)" |
1684 with N have "k > ((b - a) \<bullet> i) / ((x - a) \<bullet> i)" |
1685 using \<open>N \<le> k\<close> by linarith |
1685 using \<open>N \<le> k\<close> by linarith |
1686 with x that show ?thesis |
1686 with x that show ?thesis |
1687 by (auto simp: mem_box algebra_simps divide_simps) |
1687 by (auto simp: mem_box algebra_simps field_split_simps) |
1688 qed |
1688 qed |
1689 have bx_gt: "(b - x) \<bullet> i > ((b - a) \<bullet> i) / k" if "i \<in> Basis" for i |
1689 have bx_gt: "(b - x) \<bullet> i > ((b - a) \<bullet> i) / k" if "i \<in> Basis" for i |
1690 proof - |
1690 proof - |
1691 have *: "Inf ?\<Delta> \<le> ((b - x) \<bullet> i) / ((b - a) \<bullet> i)" |
1691 have *: "Inf ?\<Delta> \<le> ((b - x) \<bullet> i) / ((b - a) \<bullet> i)" |
1692 using that by (force intro: cInf_le_finite) |
1692 using that by (force intro: cInf_le_finite) |
1694 using le_imp_inverse_le [OF * \<Delta>] |
1694 using le_imp_inverse_le [OF * \<Delta>] |
1695 by (simp add: field_simps) |
1695 by (simp add: field_simps) |
1696 with N have "k > ((b - a) \<bullet> i) / ((b - x) \<bullet> i)" |
1696 with N have "k > ((b - a) \<bullet> i) / ((b - x) \<bullet> i)" |
1697 using \<open>N \<le> k\<close> by linarith |
1697 using \<open>N \<le> k\<close> by linarith |
1698 with x that show ?thesis |
1698 with x that show ?thesis |
1699 by (auto simp: mem_box algebra_simps divide_simps) |
1699 by (auto simp: mem_box algebra_simps field_split_simps) |
1700 qed |
1700 qed |
1701 show "x \<in> cbox (a + (b - a) /\<^sub>R k) (b - (b - a) /\<^sub>R k)" |
1701 show "x \<in> cbox (a + (b - a) /\<^sub>R k) (b - (b - a) /\<^sub>R k)" |
1702 using that \<Delta> \<open>k > 0\<close> |
1702 using that \<Delta> \<open>k > 0\<close> |
1703 by (auto simp: mem_box algebra_simps divide_inverse dest: xa_gt bx_gt) |
1703 by (auto simp: mem_box algebra_simps divide_inverse dest: xa_gt bx_gt) |
1704 qed |
1704 qed |
1881 have "n * f x \<ge> 0" |
1881 have "n * f x \<ge> 0" |
1882 using assms by auto |
1882 using assms by auto |
1883 then obtain m::nat where m: "floor(n * f x) = int m" |
1883 then obtain m::nat where m: "floor(n * f x) = int m" |
1884 using nonneg_int_cases zero_le_floor by blast |
1884 using nonneg_int_cases zero_le_floor by blast |
1885 then have kn: "real k / real n \<le> f x \<longleftrightarrow> k \<le> m" for k |
1885 then have kn: "real k / real n \<le> f x \<longleftrightarrow> k \<le> m" for k |
1886 using \<open>n \<noteq> 0\<close> by (simp add: divide_simps mult.commute) linarith |
1886 using \<open>n \<noteq> 0\<close> by (simp add: field_split_simps mult.commute) linarith |
1887 then have "Suc n / real n \<le> f x \<longleftrightarrow> Suc n \<le> m" |
1887 then have "Suc n / real n \<le> f x \<longleftrightarrow> Suc n \<le> m" |
1888 by blast |
1888 by blast |
1889 have "real n * f x \<le> real n" |
1889 have "real n * f x \<le> real n" |
1890 by (simp add: \<open>x \<in> S\<close> f mult_left_le) |
1890 by (simp add: \<open>x \<in> S\<close> f mult_left_le) |
1891 then have "m \<le> n" |
1891 then have "m \<le> n" |
1892 using m by linarith |
1892 using m by linarith |
1893 have "?lhs = \<bar>f x - (\<Sum>k \<in> {Suc 0..n} \<inter> {..m}. inverse n)\<bar>" |
1893 have "?lhs = \<bar>f x - (\<Sum>k \<in> {Suc 0..n} \<inter> {..m}. inverse n)\<bar>" |
1894 by (subst sum.inter_restrict) (auto simp: kn) |
1894 by (subst sum.inter_restrict) (auto simp: kn) |
1895 also have "\<dots> < inverse n" |
1895 also have "\<dots> < inverse n" |
1896 using \<open>m \<le> n\<close> \<open>n \<noteq> 0\<close> m |
1896 using \<open>m \<le> n\<close> \<open>n \<noteq> 0\<close> m |
1897 by (simp add: min_absorb2 divide_simps mult.commute) linarith |
1897 by (simp add: min_absorb2 field_split_simps mult.commute) linarith |
1898 finally show ?thesis . |
1898 finally show ?thesis . |
1899 qed |
1899 qed |
1900 |
1900 |
1901 |
1901 |
1902 lemma SMVT_lemma2: |
1902 lemma SMVT_lemma2: |
2154 proof (rule level_approx [of "{a..b}" g]) |
2154 proof (rule level_approx [of "{a..b}" g]) |
2155 show "\<sigma> n \<noteq> 0" |
2155 show "\<sigma> n \<noteq> 0" |
2156 by (metis Suc_n_not_le_n non0) |
2156 by (metis Suc_n_not_le_n non0) |
2157 qed (use x 01 non0 in auto) |
2157 qed (use x 01 non0 in auto) |
2158 also have "\<dots> \<le> inverse N" |
2158 also have "\<dots> \<le> inverse N" |
2159 using seq_suble [OF \<sigma>] \<open>N \<noteq> 0\<close> non0 that by (auto intro: order_trans simp: divide_simps) |
2159 using seq_suble [OF \<sigma>] \<open>N \<noteq> 0\<close> non0 that by (auto intro: order_trans simp: field_split_simps) |
2160 finally show ?thesis |
2160 finally show ?thesis |
2161 by linarith |
2161 by linarith |
2162 qed |
2162 qed |
2163 ultimately show "\<exists>N. \<forall>n\<ge>N. \<bar>\<psi> n x - g x\<bar> < e" |
2163 ultimately show "\<exists>N. \<forall>n\<ge>N. \<bar>\<psi> n x - g x\<bar> < e" |
2164 using less_trans by blast |
2164 using less_trans by blast |
2220 using \<open>a \<le> c\<close> \<open>c \<le> b\<close> by auto |
2220 using \<open>a \<le> c\<close> \<open>c \<le> b\<close> by auto |
2221 have I: "((\<lambda>x. g x * f x - g a * f x) has_integral (g b - g a) * integral {c..b} f) {a..b}" |
2221 have I: "((\<lambda>x. g x * f x - g a * f x) has_integral (g b - g a) * integral {c..b} f) {a..b}" |
2222 proof (subst has_integral_cong) |
2222 proof (subst has_integral_cong) |
2223 show "g x * f x - g a * f x = (g b - g a) * h x *\<^sub>R f x" |
2223 show "g x * f x - g a * f x = (g b - g a) * h x *\<^sub>R f x" |
2224 if "x \<in> {a..b}" for x |
2224 if "x \<in> {a..b}" for x |
2225 using 1 that by (simp add: h_def divide_simps algebra_simps) |
2225 using 1 that by (simp add: h_def field_split_simps algebra_simps) |
2226 show "((\<lambda>x. (g b - g a) * h x *\<^sub>R f x) has_integral (g b - g a) * integral {c..b} f) {a..b}" |
2226 show "((\<lambda>x. (g b - g a) * h x *\<^sub>R f x) has_integral (g b - g a) * integral {c..b} f) {a..b}" |
2227 using has_integral_mult_right [OF c, of "g b - g a"] . |
2227 using has_integral_mult_right [OF c, of "g b - g a"] . |
2228 qed |
2228 qed |
2229 have II: "((\<lambda>x. g a * f x) has_integral g a * integral {a..b} f) {a..b}" |
2229 have II: "((\<lambda>x. g a * f x) has_integral g a * integral {a..b} f) {a..b}" |
2230 using has_integral_mult_right [where c = "g a", OF integrable_integral [OF f]] . |
2230 using has_integral_mult_right [where c = "g a", OF integrable_integral [OF f]] . |