Skip to content

Commit

Permalink
feat(measure_theory/integral): substitution without continuity at end…
Browse files Browse the repository at this point in the history
…points (#17540)

This PR generalises the substitution law `∫ x in a..b, (g ∘ f) x * f' x = ∫ u in f a..f b, g u` to remove the assumption that `g` be continuous at the endpoints of the interval. (A subsequent PR will use this to prove that `Γ(1/2) = sqrt(π)`.)
  • Loading branch information
loefflerd committed Nov 17, 2022
1 parent 1f93ad3 commit 0d4bacd
Showing 1 changed file with 69 additions and 30 deletions.
99 changes: 69 additions & 30 deletions src/measure_theory/integral/interval_integral.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2511,47 +2511,68 @@ section smul

/--
Change of variables, general form. If `f` is continuous on `[a, b]` and has
continuous right-derivative `f'` in `(a, b)`, and `g` is continuous on `f '' [a, b]` then we can
substitute `u = f x` to get `∫ x in a..b, f' x • (g ∘ f) x = ∫ u in f a..f b, g u`.
We could potentially slightly weaken the conditions, by not requiring that `f'` and `g` are
continuous on the endpoints of these intervals, but in that case we need to additionally assume that
the functions are integrable on that interval.
-/
theorem integral_comp_smul_deriv'' {f f' : ℝ → ℝ} {g : ℝ → E}
right-derivative `f'` in `(a, b)`, `g` is continuous on `f '' (a, b)` and integrable on
`f '' [a, b]`, and `f' x • (g ∘ f) x` is integrable on `[a, b]`,
then we can substitute `u = f x` to get `∫ x in a..b, f' x • (g ∘ f) x = ∫ u in f a..f b, g u`.
--/
theorem integral_comp_smul_deriv''' {f f' : ℝ → ℝ} {g : ℝ → E}
(hf : continuous_on f [a, b])
(hff' : ∀ x ∈ Ioo (min a b) (max a b), has_deriv_within_at f (f' x) (Ioi x) x)
(hf' : continuous_on f' [a, b])
(hg : continuous_on g (f '' [a, b])) :
∫ x in a..b, f' x • (g ∘ f) x= ∫ u in f a..f b, g u :=
(hg_cont : continuous_on g (f '' Ioo (min a b) (max a b)))
(hg1 : integrable_on g (f '' [a, b]) )
(hg2 : integrable_on (λ x, f'(x) • (g ∘ f) x) [a, b]) :
∫ x in a..b, f' x • (g ∘ f) x = ∫ u in f a..f b, g u :=
begin
rw [hf.image_interval, ←interval_integrable_iff'] at hg1,
have h_cont : continuous_on (λ u, ∫ t in f a..f u, g t) [a, b],
{ rw [hf.image_interval] at hg,
refine (continuous_on_primitive_interval' hg.interval_integrable _).comp hf _,
{ refine (continuous_on_primitive_interval' hg1 _).comp hf _,
{ rw ← hf.image_interval, exact mem_image_of_mem f left_mem_interval },
{ rw ← hf.image_interval, exact maps_to_image _ _ } },
have h_der : ∀ x ∈ Ioo (min a b) (max a b), has_deriv_within_at
(λ u, ∫ t in f a..f u, g t) (f' x • ((g ∘ f) x)) (Ioi x) x,
{ intros x hx,
let I := [Inf (f '' [a, b]), Sup (f '' [a, b])],
have hI : f '' [a, b] = I := hf.image_interval,
have h2x : f x ∈ I, { rw [← hI], exact mem_image_of_mem f (Ioo_subset_Icc_self hx) },
obtain ⟨c, hc⟩ := nonempty_Ioo.mpr hx.1,
obtain ⟨d, hd⟩ := nonempty_Ioo.mpr hx.2,
have cdsub : [c, d] ⊆ Ioo (min a b) (max a b),
{ rw interval_of_le (hc.2.trans hd.1).le, exact Icc_subset_Ioo hc.1 hd.2 },
replace hg_cont := hg_cont.mono (image_subset f cdsub),
let J := [Inf (f '' [c, d]), Sup (f '' [c, d])],
have hJ : f '' [c, d] = J := (hf.mono (cdsub.trans Ioo_subset_Icc_self)).image_interval,
rw hJ at hg_cont,
have h2x : f x ∈ J, { rw ←hJ, exact mem_image_of_mem _ (mem_interval_of_le hc.2.le hd.1.le), },
have h2g : interval_integrable g volume (f a) (f x),
{ refine (hg.mono $ _).interval_integrable,
{ refine hg1.mono_set _,
rw ←hf.image_interval,
exact hf.surj_on_interval left_mem_interval (Ioo_subset_Icc_self hx) },
rw [hI] at hg,
have h3g : strongly_measurable_at_filter g (𝓝[I] f x) volume :=
hg.strongly_measurable_at_filter_nhds_within measurable_set_Icc (f x),
haveI : fact (f x ∈ I) := ⟨h2x⟩,
have : has_deriv_within_at (λ u, ∫ x in f a..u, g x) (g (f x)) I (f x) :=
integral_has_deriv_within_at_right h2g h3g (hg (f x) h2x),
refine (this.scomp x ((hff' x hx).Ioo_of_Ioi hx.2) _).Ioi_of_Ioo hx.2,
rw ← hI,
exact (maps_to_image _ _).mono (Ioo_subset_Icc_self.trans $ Icc_subset_Icc_left hx.1.le)
subset.rfl },
have h_int : interval_integrable (λ (x : ℝ), f' x • (g ∘ f) x) volume a b :=
(hf'.smul (hg.comp hf $ subset_preimage_image f _)).interval_integrable,
simp_rw [integral_eq_sub_of_has_deriv_right h_cont h_der h_int, integral_same, sub_zero],
have h3g := hg_cont.strongly_measurable_at_filter_nhds_within measurable_set_Icc (f x),
haveI : fact (f x ∈ J) := ⟨h2x⟩,
have : has_deriv_within_at (λ u, ∫ x in f a..u, g x) (g (f x)) J (f x) :=
interval_integral.integral_has_deriv_within_at_right h2g h3g (hg_cont (f x) h2x),
refine (this.scomp x ((hff' x hx).Ioo_of_Ioi hd.1) _).Ioi_of_Ioo hd.1,
rw ←hJ,
refine (maps_to_image _ _).mono _ subset.rfl,
exact Ioo_subset_Icc_self.trans ((Icc_subset_Icc_left hc.2.le).trans Icc_subset_interval) },
rw ←interval_integrable_iff' at hg2,
simp_rw [integral_eq_sub_of_has_deriv_right h_cont h_der hg2, integral_same, sub_zero],
end

/--
Change of variables for continuous integrands. If `f` is continuous on `[a, b]` and has
continuous right-derivative `f'` in `(a, b)`, and `g` is continuous on `f '' [a, b]` then we can
substitute `u = f x` to get `∫ x in a..b, f' x • (g ∘ f) x = ∫ u in f a..f b, g u`.
-/
theorem integral_comp_smul_deriv'' {f f' : ℝ → ℝ} {g : ℝ → E}
(hf : continuous_on f [a, b])
(hff' : ∀ x ∈ Ioo (min a b) (max a b), has_deriv_within_at f (f' x) (Ioi x) x)
(hf' : continuous_on f' [a, b])
(hg : continuous_on g (f '' [a, b])) :
∫ x in a..b, f' x • (g ∘ f) x = ∫ u in f a..f b, g u :=
begin
refine integral_comp_smul_deriv''' hf hff'
(hg.mono $ image_subset _ Ioo_subset_Icc_self) _
(hf'.smul (hg.comp hf $ subset_preimage_image f _)).integrable_on_Icc,
rw hf.image_interval at hg ⊢,
exact hg.integrable_on_Icc,
end

/--
Expand Down Expand Up @@ -2606,6 +2627,24 @@ section mul

/--
Change of variables, general form for scalar functions. If `f` is continuous on `[a, b]` and has
continuous right-derivative `f'` in `(a, b)`, `g` is continuous on `f '' (a, b)` and integrable on
`f '' [a, b]`, and `(g ∘ f) x * f' x` is integrable on `[a, b]`, then we can substitute `u = f x`
to get `∫ x in a..b, (g ∘ f) x * f' x = ∫ u in f a..f b, g u`.
-/
theorem integral_comp_mul_deriv''' {a b : ℝ} {f f' : ℝ → ℝ} {g : ℝ → ℝ}
(hf : continuous_on f [a, b])
(hff' : ∀ x ∈ Ioo (min a b) (max a b), has_deriv_within_at f (f' x) (Ioi x) x)
(hg_cont : continuous_on g (f '' Ioo (min a b) (max a b)))
(hg1 : integrable_on g (f '' [a, b]) )
(hg2 : integrable_on (λ x, (g ∘ f) x * f' x) [a, b]) :
∫ x in a..b, (g ∘ f) x * f' x = ∫ u in f a..f b, g u :=
begin
have hg2' : integrable_on (λ x, f' x • (g ∘ f) x) [a, b] := by simpa [mul_comm] using hg2,
simpa [mul_comm] using integral_comp_smul_deriv''' hf hff' hg_cont hg1 hg2',
end

/--
Change of variables for continuous integrands. If `f` is continuous on `[a, b]` and has
continuous right-derivative `f'` in `(a, b)`, and `g` is continuous on `f '' [a, b]` then we can
substitute `u = f x` to get `∫ x in a..b, (g ∘ f) x * f' x = ∫ u in f a..f b, g u`.
-/
Expand Down

0 comments on commit 0d4bacd

Please sign in to comment.