21 proof - |
21 proof - |
22 have "(f has_vector_derivative D) (at x within s) \<longleftrightarrow> (g has_vector_derivative D) (at x within s)" |
22 have "(f has_vector_derivative D) (at x within s) \<longleftrightarrow> (g has_vector_derivative D) (at x within s)" |
23 unfolding has_vector_derivative_def has_derivative_iff_norm |
23 unfolding has_vector_derivative_def has_derivative_iff_norm |
24 using assms by (intro conj_cong Lim_cong_within refl) auto |
24 using assms by (intro conj_cong Lim_cong_within refl) auto |
25 then show ?thesis |
25 then show ?thesis |
26 using has_vector_derivative_within_subset[OF f `s \<subseteq> t`] by simp |
26 using has_vector_derivative_within_subset[OF f \<open>s \<subseteq> t\<close>] by simp |
27 qed |
27 qed |
28 |
28 |
29 definition "einterval a b = {x. a < ereal x \<and> ereal x < b}" |
29 definition "einterval a b = {x. a < ereal x \<and> ereal x < b}" |
30 |
30 |
31 lemma einterval_eq[simp]: |
31 lemma einterval_eq[simp]: |
63 assumes "a < b" |
63 assumes "a < b" |
64 obtains X :: "nat \<Rightarrow> real" where |
64 obtains X :: "nat \<Rightarrow> real" where |
65 "incseq X" "\<And>i. a < X i" "\<And>i. X i < b" "X ----> b" |
65 "incseq X" "\<And>i. a < X i" "\<And>i. X i < b" "X ----> b" |
66 proof (cases b) |
66 proof (cases b) |
67 case PInf |
67 case PInf |
68 with `a < b` have "a = -\<infinity> \<or> (\<exists>r. a = ereal r)" |
68 with \<open>a < b\<close> have "a = -\<infinity> \<or> (\<exists>r. a = ereal r)" |
69 by (cases a) auto |
69 by (cases a) auto |
70 moreover have "(\<lambda>x. ereal (real (Suc x))) ----> \<infinity>" |
70 moreover have "(\<lambda>x. ereal (real (Suc x))) ----> \<infinity>" |
71 apply (subst LIMSEQ_Suc_iff) |
71 apply (subst LIMSEQ_Suc_iff) |
72 apply (simp add: Lim_PInfty) |
72 apply (simp add: Lim_PInfty) |
73 using nat_ceiling_le_eq by blast |
73 using nat_ceiling_le_eq by blast |
80 by (intro that[of "\<lambda>i. real_of_ereal a + Suc i"]) |
80 by (intro that[of "\<lambda>i. real_of_ereal a + Suc i"]) |
81 (auto simp: incseq_def PInf) |
81 (auto simp: incseq_def PInf) |
82 next |
82 next |
83 case (real b') |
83 case (real b') |
84 def d \<equiv> "b' - (if a = -\<infinity> then b' - 1 else real_of_ereal a)" |
84 def d \<equiv> "b' - (if a = -\<infinity> then b' - 1 else real_of_ereal a)" |
85 with `a < b` have a': "0 < d" |
85 with \<open>a < b\<close> have a': "0 < d" |
86 by (cases a) (auto simp: real) |
86 by (cases a) (auto simp: real) |
87 moreover |
87 moreover |
88 have "\<And>i r. r < b' \<Longrightarrow> (b' - r) * 1 < (b' - r) * real (Suc (Suc i))" |
88 have "\<And>i r. r < b' \<Longrightarrow> (b' - r) * 1 < (b' - r) * real (Suc (Suc i))" |
89 by (intro mult_strict_left_mono) auto |
89 by (intro mult_strict_left_mono) auto |
90 with `a < b` a' have "\<And>i. a < ereal (b' - d / real (Suc (Suc i)))" |
90 with \<open>a < b\<close> a' have "\<And>i. a < ereal (b' - d / real (Suc (Suc i)))" |
91 by (cases a) (auto simp: real d_def field_simps) |
91 by (cases a) (auto simp: real d_def field_simps) |
92 moreover have "(\<lambda>i. b' - d / Suc (Suc i)) ----> b'" |
92 moreover have "(\<lambda>i. b' - d / Suc (Suc i)) ----> b'" |
93 apply (subst filterlim_sequentially_Suc) |
93 apply (subst filterlim_sequentially_Suc) |
94 apply (subst filterlim_sequentially_Suc) |
94 apply (subst filterlim_sequentially_Suc) |
95 apply (rule tendsto_eq_intros) |
95 apply (rule tendsto_eq_intros) |
97 simp: at_infinity_eq_at_top_bot filterlim_real_sequentially) |
97 simp: at_infinity_eq_at_top_bot filterlim_real_sequentially) |
98 done |
98 done |
99 ultimately show thesis |
99 ultimately show thesis |
100 by (intro that[of "\<lambda>i. b' - d / Suc (Suc i)"]) |
100 by (intro that[of "\<lambda>i. b' - d / Suc (Suc i)"]) |
101 (auto simp add: real incseq_def intro!: divide_left_mono) |
101 (auto simp add: real incseq_def intro!: divide_left_mono) |
102 qed (insert `a < b`, auto) |
102 qed (insert \<open>a < b\<close>, auto) |
103 |
103 |
104 lemma ereal_decseq_approx: |
104 lemma ereal_decseq_approx: |
105 fixes a b :: ereal |
105 fixes a b :: ereal |
106 assumes "a < b" |
106 assumes "a < b" |
107 obtains X :: "nat \<Rightarrow> real" where |
107 obtains X :: "nat \<Rightarrow> real" where |
108 "decseq X" "\<And>i. a < X i" "\<And>i. X i < b" "X ----> a" |
108 "decseq X" "\<And>i. a < X i" "\<And>i. X i < b" "X ----> a" |
109 proof - |
109 proof - |
110 have "-b < -a" using `a < b` by simp |
110 have "-b < -a" using \<open>a < b\<close> by simp |
111 from ereal_incseq_approx[OF this] guess X . |
111 from ereal_incseq_approx[OF this] guess X . |
112 then show thesis |
112 then show thesis |
113 apply (intro that[of "\<lambda>i. - X i"]) |
113 apply (intro that[of "\<lambda>i. - X i"]) |
114 apply (auto simp add: uminus_ereal.simps[symmetric] decseq_def incseq_def |
114 apply (auto simp add: uminus_ereal.simps[symmetric] decseq_def incseq_def |
115 simp del: uminus_ereal.simps) |
115 simp del: uminus_ereal.simps) |
123 obtains u l :: "nat \<Rightarrow> real" where |
123 obtains u l :: "nat \<Rightarrow> real" where |
124 "einterval a b = (\<Union>i. {l i .. u i})" |
124 "einterval a b = (\<Union>i. {l i .. u i})" |
125 "incseq u" "decseq l" "\<And>i. l i < u i" "\<And>i. a < l i" "\<And>i. u i < b" |
125 "incseq u" "decseq l" "\<And>i. l i < u i" "\<And>i. a < l i" "\<And>i. u i < b" |
126 "l ----> a" "u ----> b" |
126 "l ----> a" "u ----> b" |
127 proof - |
127 proof - |
128 from dense[OF `a < b`] obtain c where "a < c" "c < b" by safe |
128 from dense[OF \<open>a < b\<close>] obtain c where "a < c" "c < b" by safe |
129 from ereal_incseq_approx[OF `c < b`] guess u . note u = this |
129 from ereal_incseq_approx[OF \<open>c < b\<close>] guess u . note u = this |
130 from ereal_decseq_approx[OF `a < c`] guess l . note l = this |
130 from ereal_decseq_approx[OF \<open>a < c\<close>] guess l . note l = this |
131 { fix i from less_trans[OF `l i < c` `c < u i`] have "l i < u i" by simp } |
131 { fix i from less_trans[OF \<open>l i < c\<close> \<open>c < u i\<close>] have "l i < u i" by simp } |
132 have "einterval a b = (\<Union>i. {l i .. u i})" |
132 have "einterval a b = (\<Union>i. {l i .. u i})" |
133 proof (auto simp: einterval_iff) |
133 proof (auto simp: einterval_iff) |
134 fix x assume "a < ereal x" "ereal x < b" |
134 fix x assume "a < ereal x" "ereal x < b" |
135 have "eventually (\<lambda>i. ereal (l i) < ereal x) sequentially" |
135 have "eventually (\<lambda>i. ereal (l i) < ereal x) sequentially" |
136 using l(4) `a < ereal x` by (rule order_tendstoD) |
136 using l(4) \<open>a < ereal x\<close> by (rule order_tendstoD) |
137 moreover |
137 moreover |
138 have "eventually (\<lambda>i. ereal x < ereal (u i)) sequentially" |
138 have "eventually (\<lambda>i. ereal x < ereal (u i)) sequentially" |
139 using u(4) `ereal x< b` by (rule order_tendstoD) |
139 using u(4) \<open>ereal x< b\<close> by (rule order_tendstoD) |
140 ultimately have "eventually (\<lambda>i. l i < x \<and> x < u i) sequentially" |
140 ultimately have "eventually (\<lambda>i. l i < x \<and> x < u i) sequentially" |
141 by eventually_elim auto |
141 by eventually_elim auto |
142 then show "\<exists>i. l i \<le> x \<and> x \<le> u i" |
142 then show "\<exists>i. l i \<le> x \<and> x \<le> u i" |
143 by (auto intro: less_imp_le simp: eventually_sequentially) |
143 by (auto intro: less_imp_le simp: eventually_sequentially) |
144 next |
144 next |
145 fix x i assume "l i \<le> x" "x \<le> u i" |
145 fix x i assume "l i \<le> x" "x \<le> u i" |
146 with `a < ereal (l i)` `ereal (u i) < b` |
146 with \<open>a < ereal (l i)\<close> \<open>ereal (u i) < b\<close> |
147 show "a < ereal x" "ereal x < b" |
147 show "a < ereal x" "ereal x < b" |
148 by (auto simp del: ereal_less_eq(3) simp add: ereal_less_eq(3)[symmetric]) |
148 by (auto simp del: ereal_less_eq(3) simp add: ereal_less_eq(3)[symmetric]) |
149 qed |
149 qed |
150 show thesis |
150 show thesis |
151 by (intro that) fact+ |
151 by (intro that) fact+ |
551 by (intro AE_I2) (auto simp: approx split: split_indicator) |
551 by (intro AE_I2) (auto simp: approx split: split_indicator) |
552 show "AE x in lborel. (\<lambda>i. indicator {l i..u i} x *\<^sub>R f x) ----> indicator (einterval a b) x *\<^sub>R f x" |
552 show "AE x in lborel. (\<lambda>i. indicator {l i..u i} x *\<^sub>R f x) ----> indicator (einterval a b) x *\<^sub>R f x" |
553 proof (intro AE_I2 tendsto_intros Lim_eventually) |
553 proof (intro AE_I2 tendsto_intros Lim_eventually) |
554 fix x |
554 fix x |
555 { fix i assume "l i \<le> x" "x \<le> u i" |
555 { fix i assume "l i \<le> x" "x \<le> u i" |
556 with `incseq u`[THEN incseqD, of i] `decseq l`[THEN decseqD, of i] |
556 with \<open>incseq u\<close>[THEN incseqD, of i] \<open>decseq l\<close>[THEN decseqD, of i] |
557 have "eventually (\<lambda>i. l i \<le> x \<and> x \<le> u i) sequentially" |
557 have "eventually (\<lambda>i. l i \<le> x \<and> x \<le> u i) sequentially" |
558 by (auto simp: eventually_sequentially decseq_def incseq_def intro: order_trans) } |
558 by (auto simp: eventually_sequentially decseq_def incseq_def intro: order_trans) } |
559 then show "eventually (\<lambda>xa. indicator {l xa..u xa} x = (indicator (einterval a b) x::real)) sequentially" |
559 then show "eventually (\<lambda>xa. indicator {l xa..u xa} x = (indicator (einterval a b) x::real)) sequentially" |
560 using approx order_tendstoD(2)[OF `l ----> a`, of x] order_tendstoD(1)[OF `u ----> b`, of x] |
560 using approx order_tendstoD(2)[OF \<open>l ----> a\<close>, of x] order_tendstoD(1)[OF \<open>u ----> b\<close>, of x] |
561 by (auto split: split_indicator) |
561 by (auto split: split_indicator) |
562 qed |
562 qed |
563 qed |
563 qed |
564 with `a < b` `\<And>i. l i < u i` show ?thesis |
564 with \<open>a < b\<close> \<open>\<And>i. l i < u i\<close> show ?thesis |
565 by (simp add: interval_lebesgue_integral_le_eq[symmetric] interval_integral_Icc less_imp_le) |
565 by (simp add: interval_lebesgue_integral_le_eq[symmetric] interval_integral_Icc less_imp_le) |
566 qed |
566 qed |
567 |
567 |
568 (* |
568 (* |
569 A slightly stronger version of integral_FTC_atLeastAtMost and related facts, |
569 A slightly stronger version of integral_FTC_atLeastAtMost and related facts, |
613 assumes B: "((F \<circ> real_of_ereal) ---> B) (at_left b)" |
613 assumes B: "((F \<circ> real_of_ereal) ---> B) (at_left b)" |
614 shows |
614 shows |
615 "set_integrable lborel (einterval a b) f" |
615 "set_integrable lborel (einterval a b) f" |
616 "(LBINT x=a..b. f x) = B - A" |
616 "(LBINT x=a..b. f x) = B - A" |
617 proof - |
617 proof - |
618 from einterval_Icc_approximation[OF `a < b`] guess u l . note approx = this |
618 from einterval_Icc_approximation[OF \<open>a < b\<close>] guess u l . note approx = this |
619 have [simp]: "\<And>x i. l i \<le> x \<Longrightarrow> a < ereal x" |
619 have [simp]: "\<And>x i. l i \<le> x \<Longrightarrow> a < ereal x" |
620 by (rule order_less_le_trans, rule approx, force) |
620 by (rule order_less_le_trans, rule approx, force) |
621 have [simp]: "\<And>x i. x \<le> u i \<Longrightarrow> ereal x < b" |
621 have [simp]: "\<And>x i. x \<le> u i \<Longrightarrow> ereal x < b" |
622 by (rule order_le_less_trans, subst ereal_less_eq(3), assumption, rule approx) |
622 by (rule order_le_less_trans, subst ereal_less_eq(3), assumption, rule approx) |
623 have FTCi: "\<And>i. (LBINT x=l i..u i. f x) = F (u i) - F (l i)" |
623 have FTCi: "\<And>i. (LBINT x=l i..u i. f x) = F (u i) - F (l i)" |
627 apply (rule continuous_at_imp_continuous_on, auto intro!: f) |
627 apply (rule continuous_at_imp_continuous_on, auto intro!: f) |
628 by (rule DERIV_subset [OF F], auto) |
628 by (rule DERIV_subset [OF F], auto) |
629 have 1: "\<And>i. set_integrable lborel {l i..u i} f" |
629 have 1: "\<And>i. set_integrable lborel {l i..u i} f" |
630 proof - |
630 proof - |
631 fix i show "set_integrable lborel {l i .. u i} f" |
631 fix i show "set_integrable lborel {l i .. u i} f" |
632 using `a < l i` `u i < b` |
632 using \<open>a < l i\<close> \<open>u i < b\<close> |
633 by (intro borel_integrable_compact f continuous_at_imp_continuous_on compact_Icc ballI) |
633 by (intro borel_integrable_compact f continuous_at_imp_continuous_on compact_Icc ballI) |
634 (auto simp del: ereal_less_eq simp add: ereal_less_eq(3)[symmetric]) |
634 (auto simp del: ereal_less_eq simp add: ereal_less_eq(3)[symmetric]) |
635 qed |
635 qed |
636 have 2: "set_borel_measurable lborel (einterval a b) f" |
636 have 2: "set_borel_measurable lborel (einterval a b) f" |
637 by (auto simp del: real_scaleR_def intro!: set_borel_measurable_continuous |
637 by (auto simp del: real_scaleR_def intro!: set_borel_measurable_continuous |
643 using tendsto_at_iff_sequentially[where 'a=real] |
643 using tendsto_at_iff_sequentially[where 'a=real] |
644 apply (elim allE[of _ "\<lambda>i. ereal (u i)"], auto) |
644 apply (elim allE[of _ "\<lambda>i. ereal (u i)"], auto) |
645 using A approx unfolding tendsto_at_iff_sequentially comp_def |
645 using A approx unfolding tendsto_at_iff_sequentially comp_def |
646 by (elim allE[of _ "\<lambda>i. ereal (l i)"], auto) |
646 by (elim allE[of _ "\<lambda>i. ereal (l i)"], auto) |
647 show "(LBINT x=a..b. f x) = B - A" |
647 show "(LBINT x=a..b. f x) = B - A" |
648 by (rule interval_integral_Icc_approx_nonneg [OF `a < b` approx 1 f_nonneg 2 3]) |
648 by (rule interval_integral_Icc_approx_nonneg [OF \<open>a < b\<close> approx 1 f_nonneg 2 3]) |
649 show "set_integrable lborel (einterval a b) f" |
649 show "set_integrable lborel (einterval a b) f" |
650 by (rule interval_integral_Icc_approx_nonneg [OF `a < b` approx 1 f_nonneg 2 3]) |
650 by (rule interval_integral_Icc_approx_nonneg [OF \<open>a < b\<close> approx 1 f_nonneg 2 3]) |
651 qed |
651 qed |
652 |
652 |
653 lemma interval_integral_FTC_integrable: |
653 lemma interval_integral_FTC_integrable: |
654 fixes f F :: "real \<Rightarrow> 'a::euclidean_space" and a b :: ereal |
654 fixes f F :: "real \<Rightarrow> 'a::euclidean_space" and a b :: ereal |
655 assumes "a < b" |
655 assumes "a < b" |
658 assumes f_integrable: "set_integrable lborel (einterval a b) f" |
658 assumes f_integrable: "set_integrable lborel (einterval a b) f" |
659 assumes A: "((F \<circ> real_of_ereal) ---> A) (at_right a)" |
659 assumes A: "((F \<circ> real_of_ereal) ---> A) (at_right a)" |
660 assumes B: "((F \<circ> real_of_ereal) ---> B) (at_left b)" |
660 assumes B: "((F \<circ> real_of_ereal) ---> B) (at_left b)" |
661 shows "(LBINT x=a..b. f x) = B - A" |
661 shows "(LBINT x=a..b. f x) = B - A" |
662 proof - |
662 proof - |
663 from einterval_Icc_approximation[OF `a < b`] guess u l . note approx = this |
663 from einterval_Icc_approximation[OF \<open>a < b\<close>] guess u l . note approx = this |
664 have [simp]: "\<And>x i. l i \<le> x \<Longrightarrow> a < ereal x" |
664 have [simp]: "\<And>x i. l i \<le> x \<Longrightarrow> a < ereal x" |
665 by (rule order_less_le_trans, rule approx, force) |
665 by (rule order_less_le_trans, rule approx, force) |
666 have [simp]: "\<And>x i. x \<le> u i \<Longrightarrow> ereal x < b" |
666 have [simp]: "\<And>x i. x \<le> u i \<Longrightarrow> ereal x < b" |
667 by (rule order_le_less_trans, subst ereal_less_eq(3), assumption, rule approx) |
667 by (rule order_le_less_trans, subst ereal_less_eq(3), assumption, rule approx) |
668 have FTCi: "\<And>i. (LBINT x=l i..u i. f x) = F (u i) - F (l i)" |
668 have FTCi: "\<And>i. (LBINT x=l i..u i. f x) = F (u i) - F (l i)" |
676 using B approx unfolding tendsto_at_iff_sequentially comp_def |
676 using B approx unfolding tendsto_at_iff_sequentially comp_def |
677 apply (elim allE[of _ "\<lambda>i. ereal (u i)"], auto) |
677 apply (elim allE[of _ "\<lambda>i. ereal (u i)"], auto) |
678 using A approx unfolding tendsto_at_iff_sequentially comp_def |
678 using A approx unfolding tendsto_at_iff_sequentially comp_def |
679 by (elim allE[of _ "\<lambda>i. ereal (l i)"], auto) |
679 by (elim allE[of _ "\<lambda>i. ereal (l i)"], auto) |
680 moreover have "(\<lambda>i. LBINT x=l i..u i. f x) ----> (LBINT x=a..b. f x)" |
680 moreover have "(\<lambda>i. LBINT x=l i..u i. f x) ----> (LBINT x=a..b. f x)" |
681 by (rule interval_integral_Icc_approx_integrable [OF `a < b` approx f_integrable]) |
681 by (rule interval_integral_Icc_approx_integrable [OF \<open>a < b\<close> approx f_integrable]) |
682 ultimately show ?thesis |
682 ultimately show ?thesis |
683 by (elim LIMSEQ_unique) |
683 by (elim LIMSEQ_unique) |
684 qed |
684 qed |
685 |
685 |
686 (* |
686 (* |
699 let ?F = "(\<lambda>u. LBINT y=a..u. f y)" |
699 let ?F = "(\<lambda>u. LBINT y=a..u. f y)" |
700 have intf: "set_integrable lborel {a..b} f" |
700 have intf: "set_integrable lborel {a..b} f" |
701 by (rule borel_integrable_atLeastAtMost', rule contf) |
701 by (rule borel_integrable_atLeastAtMost', rule contf) |
702 have "((\<lambda>u. integral {a..u} f) has_vector_derivative f x) (at x within {a..b})" |
702 have "((\<lambda>u. integral {a..u} f) has_vector_derivative f x) (at x within {a..b})" |
703 apply (intro integral_has_vector_derivative) |
703 apply (intro integral_has_vector_derivative) |
704 using `a \<le> x` `x \<le> b` by (intro continuous_on_subset [OF contf], auto) |
704 using \<open>a \<le> x\<close> \<open>x \<le> b\<close> by (intro continuous_on_subset [OF contf], auto) |
705 then have "((\<lambda>u. integral {a..u} f) has_vector_derivative (f x)) (at x within {a..b})" |
705 then have "((\<lambda>u. integral {a..u} f) has_vector_derivative (f x)) (at x within {a..b})" |
706 by simp |
706 by simp |
707 then have "(?F has_vector_derivative (f x)) (at x within {a..b})" |
707 then have "(?F has_vector_derivative (f x)) (at x within {a..b})" |
708 by (rule has_vector_derivative_weaken) |
708 by (rule has_vector_derivative_weaken) |
709 (auto intro!: assms interval_integral_eq_integral[symmetric] set_integrable_subset [OF intf]) |
709 (auto intro!: assms interval_integral_eq_integral[symmetric] set_integrable_subset [OF intf]) |
723 lemma einterval_antiderivative: |
723 lemma einterval_antiderivative: |
724 fixes a b :: ereal and f :: "real \<Rightarrow> 'a::euclidean_space" |
724 fixes a b :: ereal and f :: "real \<Rightarrow> 'a::euclidean_space" |
725 assumes "a < b" and contf: "\<And>x :: real. a < x \<Longrightarrow> x < b \<Longrightarrow> isCont f x" |
725 assumes "a < b" and contf: "\<And>x :: real. a < x \<Longrightarrow> x < b \<Longrightarrow> isCont f x" |
726 shows "\<exists>F. \<forall>x :: real. a < x \<longrightarrow> x < b \<longrightarrow> (F has_vector_derivative f x) (at x)" |
726 shows "\<exists>F. \<forall>x :: real. a < x \<longrightarrow> x < b \<longrightarrow> (F has_vector_derivative f x) (at x)" |
727 proof - |
727 proof - |
728 from einterval_nonempty [OF `a < b`] obtain c :: real where [simp]: "a < c" "c < b" |
728 from einterval_nonempty [OF \<open>a < b\<close>] obtain c :: real where [simp]: "a < c" "c < b" |
729 by (auto simp add: einterval_def) |
729 by (auto simp add: einterval_def) |
730 let ?F = "(\<lambda>u. LBINT y=c..u. f y)" |
730 let ?F = "(\<lambda>u. LBINT y=c..u. f y)" |
731 show ?thesis |
731 show ?thesis |
732 proof (rule exI, clarsimp) |
732 proof (rule exI, clarsimp) |
733 fix x :: real |
733 fix x :: real |
745 apply (subst has_vector_derivative_def [symmetric]) |
745 apply (subst has_vector_derivative_def [symmetric]) |
746 apply (rule has_vector_derivative_within_subset [of _ _ _ "{d..e}"]) |
746 apply (rule has_vector_derivative_within_subset [of _ _ _ "{d..e}"]) |
747 apply (rule interval_integral_FTC2, auto simp add: less_imp_le) |
747 apply (rule interval_integral_FTC2, auto simp add: less_imp_le) |
748 apply (rule continuous_at_imp_continuous_on) |
748 apply (rule continuous_at_imp_continuous_on) |
749 apply (auto intro!: contf) |
749 apply (auto intro!: contf) |
750 apply (rule order_less_le_trans, rule `a < d`, auto) |
750 apply (rule order_less_le_trans, rule \<open>a < d\<close>, auto) |
751 apply (rule order_le_less_trans) prefer 2 |
751 apply (rule order_le_less_trans) prefer 2 |
752 by (rule `e < b`, auto) |
752 by (rule \<open>e < b\<close>, auto) |
753 qed |
753 qed |
754 qed |
754 qed |
755 |
755 |
756 (* |
756 (* |
757 The substitution theorem |
757 The substitution theorem |
776 \<exists>x\<in>{a..b}. u = g x" |
776 \<exists>x\<in>{a..b}. u = g x" |
777 apply (case_tac "g a \<le> g b") |
777 apply (case_tac "g a \<le> g b") |
778 apply (auto simp add: min_def max_def less_imp_le) |
778 apply (auto simp add: min_def max_def less_imp_le) |
779 apply (frule (1) IVT' [of g], auto simp add: assms) |
779 apply (frule (1) IVT' [of g], auto simp add: assms) |
780 by (frule (1) IVT2' [of g], auto simp add: assms) |
780 by (frule (1) IVT2' [of g], auto simp add: assms) |
781 from contg `a \<le> b` have "\<exists>c d. g ` {a..b} = {c..d} \<and> c \<le> d" |
781 from contg \<open>a \<le> b\<close> have "\<exists>c d. g ` {a..b} = {c..d} \<and> c \<le> d" |
782 by (elim continuous_image_closed_interval) |
782 by (elim continuous_image_closed_interval) |
783 then obtain c d where g_im: "g ` {a..b} = {c..d}" and "c \<le> d" by auto |
783 then obtain c d where g_im: "g ` {a..b} = {c..d}" and "c \<le> d" by auto |
784 have "\<exists>F. \<forall>x\<in>{a..b}. (F has_vector_derivative (f (g x))) (at (g x) within (g ` {a..b}))" |
784 have "\<exists>F. \<forall>x\<in>{a..b}. (F has_vector_derivative (f (g x))) (at (g x) within (g ` {a..b}))" |
785 apply (rule exI, auto, subst g_im) |
785 apply (rule exI, auto, subst g_im) |
786 apply (rule interval_integral_FTC2 [of c c d]) |
786 apply (rule interval_integral_FTC2 [of c c d]) |
787 using `c \<le> d` apply auto |
787 using \<open>c \<le> d\<close> apply auto |
788 apply (rule continuous_on_subset [OF contf]) |
788 apply (rule continuous_on_subset [OF contf]) |
789 using g_im by auto |
789 using g_im by auto |
790 then guess F .. |
790 then guess F .. |
791 then have derivF: "\<And>x. a \<le> x \<Longrightarrow> x \<le> b \<Longrightarrow> |
791 then have derivF: "\<And>x. a \<le> x \<Longrightarrow> x \<le> b \<Longrightarrow> |
792 (F has_vector_derivative (f (g x))) (at (g x) within (g ` {a..b}))" by auto |
792 (F has_vector_derivative (f (g x))) (at (g x) within (g ` {a..b}))" by auto |
796 by (erule 1) |
796 by (erule 1) |
797 have contfg: "continuous_on {a..b} (\<lambda>x. f (g x))" |
797 have contfg: "continuous_on {a..b} (\<lambda>x. f (g x))" |
798 by (blast intro: continuous_on_compose2 contf contg) |
798 by (blast intro: continuous_on_compose2 contf contg) |
799 have "LBINT x=a..b. g' x *\<^sub>R f (g x) = F (g b) - F (g a)" |
799 have "LBINT x=a..b. g' x *\<^sub>R f (g x) = F (g b) - F (g a)" |
800 apply (subst interval_integral_Icc, simp add: assms) |
800 apply (subst interval_integral_Icc, simp add: assms) |
801 apply (rule integral_FTC_atLeastAtMost[of a b "\<lambda>x. F (g x)", OF `a \<le> b`]) |
801 apply (rule integral_FTC_atLeastAtMost[of a b "\<lambda>x. F (g x)", OF \<open>a \<le> b\<close>]) |
802 apply (rule vector_diff_chain_within[OF v_derivg derivF, unfolded comp_def]) |
802 apply (rule vector_diff_chain_within[OF v_derivg derivF, unfolded comp_def]) |
803 apply (auto intro!: continuous_on_scaleR contg' contfg) |
803 apply (auto intro!: continuous_on_scaleR contg' contfg) |
804 done |
804 done |
805 moreover have "LBINT y=(g a)..(g b). f y = F (g b) - F (g a)" |
805 moreover have "LBINT y=(g a)..(g b). f y = F (g b) - F (g a)" |
806 apply (rule interval_integral_FTC_finite) |
806 apply (rule interval_integral_FTC_finite) |
825 and B: "((ereal \<circ> g \<circ> real_of_ereal) ---> B) (at_left b)" |
825 and B: "((ereal \<circ> g \<circ> real_of_ereal) ---> B) (at_left b)" |
826 and integrable: "set_integrable lborel (einterval a b) (\<lambda>x. g' x *\<^sub>R f (g x))" |
826 and integrable: "set_integrable lborel (einterval a b) (\<lambda>x. g' x *\<^sub>R f (g x))" |
827 and integrable2: "set_integrable lborel (einterval A B) (\<lambda>x. f x)" |
827 and integrable2: "set_integrable lborel (einterval A B) (\<lambda>x. f x)" |
828 shows "(LBINT x=A..B. f x) = (LBINT x=a..b. g' x *\<^sub>R f (g x))" |
828 shows "(LBINT x=A..B. f x) = (LBINT x=a..b. g' x *\<^sub>R f (g x))" |
829 proof - |
829 proof - |
830 from einterval_Icc_approximation[OF `a < b`] guess u l . note approx [simp] = this |
830 from einterval_Icc_approximation[OF \<open>a < b\<close>] guess u l . note approx [simp] = this |
831 note less_imp_le [simp] |
831 note less_imp_le [simp] |
832 have [simp]: "\<And>x i. l i \<le> x \<Longrightarrow> a < ereal x" |
832 have [simp]: "\<And>x i. l i \<le> x \<Longrightarrow> a < ereal x" |
833 by (rule order_less_le_trans, rule approx, force) |
833 by (rule order_less_le_trans, rule approx, force) |
834 have [simp]: "\<And>x i. x \<le> u i \<Longrightarrow> ereal x < b" |
834 have [simp]: "\<And>x i. x \<le> u i \<Longrightarrow> ereal x < b" |
835 by (rule order_le_less_trans, subst ereal_less_eq(3), assumption, rule approx) |
835 by (rule order_le_less_trans, subst ereal_less_eq(3), assumption, rule approx) |
889 apply (rule deriv_g) |
889 apply (rule deriv_g) |
890 apply (auto intro!: continuous_at_imp_continuous_on contf contg') |
890 apply (auto intro!: continuous_at_imp_continuous_on contf contg') |
891 done |
891 done |
892 } note eq1 = this |
892 } note eq1 = this |
893 have "(\<lambda>i. LBINT x=l i..u i. g' x *\<^sub>R f (g x)) ----> (LBINT x=a..b. g' x *\<^sub>R f (g x))" |
893 have "(\<lambda>i. LBINT x=l i..u i. g' x *\<^sub>R f (g x)) ----> (LBINT x=a..b. g' x *\<^sub>R f (g x))" |
894 apply (rule interval_integral_Icc_approx_integrable [OF `a < b` approx]) |
894 apply (rule interval_integral_Icc_approx_integrable [OF \<open>a < b\<close> approx]) |
895 by (rule assms) |
895 by (rule assms) |
896 hence 2: "(\<lambda>i. (LBINT y=g (l i)..g (u i). f y)) ----> (LBINT x=a..b. g' x *\<^sub>R f (g x))" |
896 hence 2: "(\<lambda>i. (LBINT y=g (l i)..g (u i). f y)) ----> (LBINT x=a..b. g' x *\<^sub>R f (g x))" |
897 by (simp add: eq1) |
897 by (simp add: eq1) |
898 have incseq: "incseq (\<lambda>i. {g (l i)<..<g (u i)})" |
898 have incseq: "incseq (\<lambda>i. {g (l i)<..<g (u i)})" |
899 apply (auto simp add: incseq_def) |
899 apply (auto simp add: incseq_def) |
900 apply (rule order_le_less_trans) |
900 apply (rule order_le_less_trans) |
901 prefer 2 apply (assumption, auto) |
901 prefer 2 apply (assumption, auto) |
902 by (erule order_less_le_trans, rule g_nondec, auto) |
902 by (erule order_less_le_trans, rule g_nondec, auto) |
903 have "(\<lambda>i. (LBINT y=g (l i)..g (u i). f y)) ----> (LBINT x = A..B. f x)" |
903 have "(\<lambda>i. (LBINT y=g (l i)..g (u i). f y)) ----> (LBINT x = A..B. f x)" |
904 apply (subst interval_lebesgue_integral_le_eq, auto simp del: real_scaleR_def) |
904 apply (subst interval_lebesgue_integral_le_eq, auto simp del: real_scaleR_def) |
905 apply (subst interval_lebesgue_integral_le_eq, rule `A \<le> B`) |
905 apply (subst interval_lebesgue_integral_le_eq, rule \<open>A \<le> B\<close>) |
906 apply (subst un, rule set_integral_cont_up, auto simp del: real_scaleR_def) |
906 apply (subst un, rule set_integral_cont_up, auto simp del: real_scaleR_def) |
907 apply (rule incseq) |
907 apply (rule incseq) |
908 apply (subst un [symmetric]) |
908 apply (subst un [symmetric]) |
909 by (rule integrable2) |
909 by (rule integrable2) |
910 thus ?thesis by (intro LIMSEQ_unique [OF _ 2]) |
910 thus ?thesis by (intro LIMSEQ_unique [OF _ 2]) |
927 and integrable_fg: "set_integrable lborel (einterval a b) (\<lambda>x. f (g x) * g' x)" |
927 and integrable_fg: "set_integrable lborel (einterval a b) (\<lambda>x. f (g x) * g' x)" |
928 shows |
928 shows |
929 "set_integrable lborel (einterval A B) f" |
929 "set_integrable lborel (einterval A B) f" |
930 "(LBINT x=A..B. f x) = (LBINT x=a..b. (f (g x) * g' x))" |
930 "(LBINT x=A..B. f x) = (LBINT x=a..b. (f (g x) * g' x))" |
931 proof - |
931 proof - |
932 from einterval_Icc_approximation[OF `a < b`] guess u l . note approx [simp] = this |
932 from einterval_Icc_approximation[OF \<open>a < b\<close>] guess u l . note approx [simp] = this |
933 note less_imp_le [simp] |
933 note less_imp_le [simp] |
934 have [simp]: "\<And>x i. l i \<le> x \<Longrightarrow> a < ereal x" |
934 have [simp]: "\<And>x i. l i \<le> x \<Longrightarrow> a < ereal x" |
935 by (rule order_less_le_trans, rule approx, force) |
935 by (rule order_less_le_trans, rule approx, force) |
936 have [simp]: "\<And>x i. x \<le> u i \<Longrightarrow> ereal x < b" |
936 have [simp]: "\<And>x i. x \<le> u i \<Longrightarrow> ereal x < b" |
937 by (rule order_le_less_trans, subst ereal_less_eq(3), assumption, rule approx) |
937 by (rule order_le_less_trans, subst ereal_less_eq(3), assumption, rule approx) |
992 then have "(LBINT x=l i.. u i. (f (g x) * g' x)) = (LBINT y=g (l i)..g (u i). f y)" |
992 then have "(LBINT x=l i.. u i. (f (g x) * g' x)) = (LBINT y=g (l i)..g (u i). f y)" |
993 by (simp add: ac_simps) |
993 by (simp add: ac_simps) |
994 } note eq1 = this |
994 } note eq1 = this |
995 have "(\<lambda>i. LBINT x=l i..u i. f (g x) * g' x) |
995 have "(\<lambda>i. LBINT x=l i..u i. f (g x) * g' x) |
996 ----> (LBINT x=a..b. f (g x) * g' x)" |
996 ----> (LBINT x=a..b. f (g x) * g' x)" |
997 apply (rule interval_integral_Icc_approx_integrable [OF `a < b` approx]) |
997 apply (rule interval_integral_Icc_approx_integrable [OF \<open>a < b\<close> approx]) |
998 by (rule assms) |
998 by (rule assms) |
999 hence 2: "(\<lambda>i. (LBINT y=g (l i)..g (u i). f y)) ----> (LBINT x=a..b. f (g x) * g' x)" |
999 hence 2: "(\<lambda>i. (LBINT y=g (l i)..g (u i). f y)) ----> (LBINT x=a..b. f (g x) * g' x)" |
1000 by (simp add: eq1) |
1000 by (simp add: eq1) |
1001 have incseq: "incseq (\<lambda>i. {g (l i)<..<g (u i)})" |
1001 have incseq: "incseq (\<lambda>i. {g (l i)<..<g (u i)})" |
1002 apply (auto simp add: incseq_def) |
1002 apply (auto simp add: incseq_def) |