70 then have "(\<lambda>i. b' - d / Suc (Suc i)) \<longlonglongrightarrow> b'" |
70 then have "(\<lambda>i. b' - d / Suc (Suc i)) \<longlonglongrightarrow> b'" |
71 by (blast intro: dest: filterlim_sequentially_Suc [THEN iffD2]) |
71 by (blast intro: dest: filterlim_sequentially_Suc [THEN iffD2]) |
72 ultimately show thesis |
72 ultimately show thesis |
73 by (intro that[of "\<lambda>i. b' - d / Suc (Suc i)"]) |
73 by (intro that[of "\<lambda>i. b' - d / Suc (Suc i)"]) |
74 (auto simp: real incseq_def intro!: divide_left_mono) |
74 (auto simp: real incseq_def intro!: divide_left_mono) |
75 qed (insert \<open>a < b\<close>, auto) |
75 qed (use \<open>a < b\<close> in auto) |
76 |
76 |
77 lemma ereal_decseq_approx: |
77 lemma ereal_decseq_approx: |
78 fixes a b :: ereal |
78 fixes a b :: ereal |
79 assumes "a < b" |
79 assumes "a < b" |
80 obtains X :: "nat \<Rightarrow> real" where |
80 obtains X :: "nat \<Rightarrow> real" where |
81 "decseq X" "\<And>i. a < X i" "\<And>i. X i < b" "X \<longlonglongrightarrow> a" |
81 "decseq X" "\<And>i. a < X i" "\<And>i. X i < b" "X \<longlonglongrightarrow> a" |
82 proof - |
82 proof - |
83 have "-b < -a" using \<open>a < b\<close> by simp |
83 have "-b < -a" using \<open>a < b\<close> by simp |
84 from ereal_incseq_approx[OF this] guess X . |
84 from ereal_incseq_approx[OF this] obtain X where |
|
85 "incseq X" |
|
86 "\<And>i. - b < ereal (X i)" |
|
87 "\<And>i. ereal (X i) < - a" |
|
88 "(\<lambda>x. ereal (X x)) \<longlonglongrightarrow> - a" |
|
89 by auto |
85 then show thesis |
90 then show thesis |
86 apply (intro that[of "\<lambda>i. - X i"]) |
91 apply (intro that[of "\<lambda>i. - X i"]) |
87 apply (auto simp: decseq_def incseq_def simp flip: uminus_ereal.simps) |
92 apply (auto simp: decseq_def incseq_def simp flip: uminus_ereal.simps) |
88 apply (metis ereal_minus_less_minus ereal_uminus_uminus ereal_Lim_uminus)+ |
93 apply (metis ereal_minus_less_minus ereal_uminus_uminus ereal_Lim_uminus)+ |
89 done |
94 done |
96 "einterval a b = (\<Union>i. {l i .. u i})" |
101 "einterval a b = (\<Union>i. {l i .. u i})" |
97 "incseq u" "decseq l" "\<And>i. l i < u i" "\<And>i. a < l i" "\<And>i. u i < b" |
102 "incseq u" "decseq l" "\<And>i. l i < u i" "\<And>i. a < l i" "\<And>i. u i < b" |
98 "l \<longlonglongrightarrow> a" "u \<longlonglongrightarrow> b" |
103 "l \<longlonglongrightarrow> a" "u \<longlonglongrightarrow> b" |
99 proof - |
104 proof - |
100 from dense[OF \<open>a < b\<close>] obtain c where "a < c" "c < b" by safe |
105 from dense[OF \<open>a < b\<close>] obtain c where "a < c" "c < b" by safe |
101 from ereal_incseq_approx[OF \<open>c < b\<close>] guess u . note u = this |
106 from ereal_incseq_approx[OF \<open>c < b\<close>] obtain u where u: |
102 from ereal_decseq_approx[OF \<open>a < c\<close>] guess l . note l = this |
107 "incseq u" |
|
108 "\<And>i. c < ereal (u i)" |
|
109 "\<And>i. ereal (u i) < b" |
|
110 "(\<lambda>x. ereal (u x)) \<longlonglongrightarrow> b" |
|
111 by auto |
|
112 from ereal_decseq_approx[OF \<open>a < c\<close>] obtain l where l: |
|
113 "decseq l" |
|
114 "\<And>i. a < ereal (l i)" |
|
115 "\<And>i. ereal (l i) < c" |
|
116 "(\<lambda>x. ereal (l x)) \<longlonglongrightarrow> a" |
|
117 by auto |
103 { fix i from less_trans[OF \<open>l i < c\<close> \<open>c < u i\<close>] have "l i < u i" by simp } |
118 { fix i from less_trans[OF \<open>l i < c\<close> \<open>c < u i\<close>] have "l i < u i" by simp } |
104 have "einterval a b = (\<Union>i. {l i .. u i})" |
119 have "einterval a b = (\<Union>i. {l i .. u i})" |
105 proof (auto simp: einterval_iff) |
120 proof (auto simp: einterval_iff) |
106 fix x assume "a < ereal x" "ereal x < b" |
121 fix x assume "a < ereal x" "ereal x < b" |
107 have "eventually (\<lambda>i. ereal (l i) < ereal x) sequentially" |
122 have "eventually (\<lambda>i. ereal (l i) < ereal x) sequentially" |
942 and integrable_fg: "set_integrable lborel (einterval a b) (\<lambda>x. f (g x) * g' x)" |
957 and integrable_fg: "set_integrable lborel (einterval a b) (\<lambda>x. f (g x) * g' x)" |
943 shows |
958 shows |
944 "set_integrable lborel (einterval A B) f" |
959 "set_integrable lborel (einterval A B) f" |
945 "(LBINT x=A..B. f x) = (LBINT x=a..b. (f (g x) * g' x))" |
960 "(LBINT x=A..B. f x) = (LBINT x=a..b. (f (g x) * g' x))" |
946 proof - |
961 proof - |
947 from einterval_Icc_approximation[OF \<open>a < b\<close>] guess u l . note approx [simp] = this |
962 from einterval_Icc_approximation[OF \<open>a < b\<close>] obtain u l where approx [simp]: |
948 note less_imp_le [simp] |
963 "einterval a b = (\<Union>i. {l i..u i})" |
|
964 "incseq u" |
|
965 "decseq l" |
|
966 "\<And>i. l i < u i" |
|
967 "\<And>i. a < ereal (l i)" |
|
968 "\<And>i. ereal (u i) < b" |
|
969 "(\<lambda>x. ereal (l x)) \<longlonglongrightarrow> a" |
|
970 "(\<lambda>x. ereal (u x)) \<longlonglongrightarrow> b" by this auto |
949 have aless[simp]: "\<And>x i. l i \<le> x \<Longrightarrow> a < ereal x" |
971 have aless[simp]: "\<And>x i. l i \<le> x \<Longrightarrow> a < ereal x" |
950 by (rule order_less_le_trans, rule approx, force) |
972 by (rule order_less_le_trans, rule approx, force) |
951 have lessb[simp]: "\<And>x i. x \<le> u i \<Longrightarrow> ereal x < b" |
973 have lessb[simp]: "\<And>x i. x \<le> u i \<Longrightarrow> ereal x < b" |
952 by (rule order_le_less_trans, subst ereal_less_eq(3), assumption, rule approx) |
974 by (rule order_le_less_trans, subst ereal_less_eq(3), assumption, rule approx) |
953 have llb[simp]: "\<And>i. l i < b" |
975 have llb[simp]: "\<And>i. l i < b" |
974 using B apply (auto simp: einterval_def tendsto_at_iff_sequentially comp_def) |
996 using B apply (auto simp: einterval_def tendsto_at_iff_sequentially comp_def) |
975 by (drule_tac x = "\<lambda>i. ereal (u i)" in spec, auto) |
997 by (drule_tac x = "\<lambda>i. ereal (u i)" in spec, auto) |
976 hence B3: "\<And>i. g (u i) \<le> B" |
998 hence B3: "\<And>i. g (u i) \<le> B" |
977 by (intro incseq_le, auto simp: incseq_def) |
999 by (intro incseq_le, auto simp: incseq_def) |
978 have "ereal (g (l 0)) \<le> ereal (g (u 0))" |
1000 have "ereal (g (l 0)) \<le> ereal (g (u 0))" |
979 by auto |
1001 by (auto simp: less_imp_le) |
980 then show "A \<le> B" |
1002 then show "A \<le> B" |
981 by (meson A3 B3 order.trans) |
1003 by (meson A3 B3 order.trans) |
982 { fix x :: real |
1004 { fix x :: real |
983 assume "A < x" and "x < B" |
1005 assume "A < x" and "x < B" |
984 then have "eventually (\<lambda>i. ereal (g (l i)) < x \<and> x < ereal (g (u i))) sequentially" |
1006 then have "eventually (\<lambda>i. ereal (g (l i)) < x \<and> x < ereal (g (u i))) sequentially" |
1000 have eq1: "(LBINT x=l i.. u i. (f (g x) * g' x)) = (LBINT y=g (l i)..g (u i). f y)" for i |
1022 have eq1: "(LBINT x=l i.. u i. (f (g x) * g' x)) = (LBINT y=g (l i)..g (u i). f y)" for i |
1001 proof - |
1023 proof - |
1002 have "(LBINT x=l i.. u i. g' x *\<^sub>R f (g x)) = (LBINT y=g (l i)..g (u i). f y)" |
1024 have "(LBINT x=l i.. u i. g' x *\<^sub>R f (g x)) = (LBINT y=g (l i)..g (u i). f y)" |
1003 apply (rule interval_integral_substitution_finite [OF _ DERIV_subset [OF deriv_g]]) |
1025 apply (rule interval_integral_substitution_finite [OF _ DERIV_subset [OF deriv_g]]) |
1004 unfolding has_field_derivative_iff_has_vector_derivative[symmetric] |
1026 unfolding has_field_derivative_iff_has_vector_derivative[symmetric] |
1005 apply (auto intro!: continuous_at_imp_continuous_on contf contg') |
1027 apply (auto simp: less_imp_le intro!: continuous_at_imp_continuous_on contf contg') |
1006 done |
1028 done |
1007 then show ?thesis |
1029 then show ?thesis |
1008 by (simp add: ac_simps) |
1030 by (simp add: ac_simps) |
1009 qed |
1031 qed |
1010 have incseq: "incseq (\<lambda>i. {g (l i)<..<g (u i)})" |
1032 have incseq: "incseq (\<lambda>i. {g (l i)<..<g (u i)})" |
1029 have "(\<lambda>i. LBINT x=l i..u i. f (g x) * g' x) \<longlonglongrightarrow> ?l" |
1051 have "(\<lambda>i. LBINT x=l i..u i. f (g x) * g' x) \<longlonglongrightarrow> ?l" |
1030 by (intro assms interval_integral_Icc_approx_integrable [OF \<open>a < b\<close> approx]) |
1052 by (intro assms interval_integral_Icc_approx_integrable [OF \<open>a < b\<close> approx]) |
1031 hence "(\<lambda>i. (LBINT y=g (l i)..g (u i). f y)) \<longlonglongrightarrow> ?l" |
1053 hence "(\<lambda>i. (LBINT y=g (l i)..g (u i). f y)) \<longlonglongrightarrow> ?l" |
1032 by (simp add: eq1) |
1054 by (simp add: eq1) |
1033 then show "(\<lambda>i. set_lebesgue_integral lborel {g (l i)<..<g (u i)} f) \<longlonglongrightarrow> ?l" |
1055 then show "(\<lambda>i. set_lebesgue_integral lborel {g (l i)<..<g (u i)} f) \<longlonglongrightarrow> ?l" |
1034 unfolding interval_lebesgue_integral_def by auto |
1056 unfolding interval_lebesgue_integral_def by (auto simp: less_imp_le) |
1035 have "\<And>x i. g (l i) \<le> x \<Longrightarrow> x \<le> g (u i) \<Longrightarrow> 0 \<le> f x" |
1057 have "\<And>x i. g (l i) \<le> x \<Longrightarrow> x \<le> g (u i) \<Longrightarrow> 0 \<le> f x" |
1036 using aless f_nonneg img lessb by blast |
1058 using aless f_nonneg img lessb by blast |
1037 then show "\<And>x i. x \<in> {g (l i)<..<g (u i)} \<Longrightarrow> 0 \<le> f x" |
1059 then show "\<And>x i. x \<in> {g (l i)<..<g (u i)} \<Longrightarrow> 0 \<le> f x" |
1038 using less_eq_real_def by auto |
1060 using less_eq_real_def by auto |
1039 qed (auto simp: greaterThanLessThan_borel) |
1061 qed (auto simp: greaterThanLessThan_borel) |