Skip to content

Commit 9b8e831

Browse files
committed
feat(Analysis/SpecialFunctions/ImproperIntegrals): add Frullani integral as Frullani.integral_Ioi
1 parent b5a8608 commit 9b8e831

1 file changed

Lines changed: 196 additions & 0 deletions

File tree

Mathlib/Analysis/SpecialFunctions/ImproperIntegrals.lean

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public import Mathlib.Analysis.SpecialFunctions.Integrals.Basic
1010
public import Mathlib.MeasureTheory.Group.Integral
1111
public import Mathlib.MeasureTheory.Integral.IntegralEqImproper
1212
public import Mathlib.MeasureTheory.Measure.Lebesgue.Integral
13+
public import Mathlib.MeasureTheory.Integral.IntervalIntegral.MeanValue
1314

1415
/-!
1516
# Evaluation of specific improper integrals
@@ -286,3 +287,198 @@ theorem integral_univ_inv_one_add_sq : ∫ (x : ℝ), (1 + x ^ 2)⁻¹ = π :=
286287
(by ring : π = (π / 2) - (-(π / 2))) ▸ integral_of_hasDerivAt_of_tendsto hasDerivAt_arctan'
287288
integrable_inv_one_add_sq (tendsto_nhds_of_tendsto_nhdsWithin tendsto_arctan_atBot)
288289
(tendsto_nhds_of_tendsto_nhdsWithin tendsto_arctan_atTop)
290+
291+
namespace Frullani
292+
293+
lemma comp_mul_left_div
294+
{f : ℝ → ℝ} (hf : ContinuousOn f (Ici 0)) {p q : ℝ} (p_pos : 0 < p) (q_pos : 0 < q) {c : ℝ}
295+
(c_pos : 0 < c) : ContinuousOn (fun x ↦ f (c * x) / x) (uIcc p q) := by
296+
have hsub : uIcc p q ⊆ Ici 0 := by simp [uIcc, Icc_subset_Ici_iff, p_pos.le, q_pos.le]
297+
apply hf.comp_mul_left_div continuousOn_id
298+
all_goals intro x hx
299+
· simpa [mem_Ici] using mul_nonneg (le_of_lt c_pos) (hsub hx)
300+
· exact ((lt_min p_pos q_pos).trans_le hx.1).ne'
301+
302+
lemma intervalIntegrable_div
303+
{f : ℝ → ℝ} (hf : ContinuousOn f (Ici 0)) {p q : ℝ} (hp : 0 < p) (hq : 0 < q) :
304+
IntervalIntegrable (fun x ↦ f x / x) volume p q := by
305+
have hcont : ContinuousOn (fun x ↦ f (1 * x) / x) (uIcc p q) :=
306+
Frullani.comp_mul_left_div hf hp hq (by simp)
307+
simpa using hcont.intervalIntegrable
308+
309+
lemma exists_integral_div_eq_mul_log {a b : ℝ} {f : ℝ → ℝ} {y : ℝ} (a_pos : 0 < a) (b_pos : 0 < b)
310+
(y_pos : 0 < y) (hf : ContinuousOn f (Ici 0)) :
311+
∃ c ∈ uIcc (a * y) (b * y), ∫ x in (a * y)..(b * y), f x / x = f c * log (b / a) := by
312+
have hay := mul_pos a_pos y_pos
313+
have hby := mul_pos b_pos y_pos
314+
have hf' : ContinuousOn f (uIcc (a * y) (b * y)) :=
315+
hf.mono (by simp [uIcc, Icc_subset_Ici_iff, hay.le, hby.le])
316+
obtain ⟨c, hc, heq⟩ := _root_.exists_integral_div_eq_mul_log hay hby hf'
317+
rw [mul_div_mul_right b a (ne_of_gt y_pos)] at heq
318+
exact ⟨c, hc, heq⟩
319+
320+
/-- **Frullani integral**.
321+
If `f : ℝ → ℝ` is continuous on `[0, ∞)` with `Tendsto f atTop (𝓝 L)`, and `0 < a`, `0 < b`, then
322+
`∫ x in Ioi 0, (f (a * x) - f (b * x)) / x = (f 0 - L) * log (b / a)`. -/
323+
theorem integral_Ioi
324+
{a b : ℝ} {f : ℝ → ℝ} {L : ℝ} (a_pos : 0 < a) (b_pos : 0 < b) (hf : ContinuousOn f (Ici 0))
325+
(hlim : Tendsto f atTop (𝓝 L))
326+
(hint : IntegrableOn (fun x ↦ (f (a * x) - f (b * x)) / x) (Ioi 0)) :
327+
∫ x in Ioi 0, (f (a * x) - f (b * x)) / x = (f 0 - L) * log (b / a) := by
328+
let g : ℝ → ℝ := fun x ↦ (f (a * x) - f (b * x)) / x
329+
have hg (ε R : ℝ) (hε : 0 < ε) (hR : ε < R) : ∫ x in ε..R, g x =
330+
(∫ x in a * ε..b * ε, f x / x) - (∫ x in a * R..b * R, f x / x) := by
331+
let u x := f x / x
332+
wlog hab : a ≤ b generalizing a b
333+
· have hint_neg :
334+
IntegrableOn (fun x ↦ - ((f (a * x) - f (b * x)) / x)) (Ioi 0) volume := hint.neg
335+
have hint_neg' : IntegrableOn (fun x ↦ (f (b * x) - f (a * x)) / x) (Ioi 0) volume := by
336+
convert hint_neg using 1
337+
ext
338+
ring
339+
simp only [not_le] at hab
340+
specialize this b_pos a_pos hint_neg' hab.le
341+
have hg_neg : (fun x ↦ (f (b * x) - f (a * x)) / x) = fun x ↦ - g x := by
342+
funext x
343+
unfold g
344+
ring
345+
simp only [hg_neg, intervalIntegral.integral_neg] at this
346+
rw [integral_symm (b * ε) (a * ε), integral_symm (b * R) (a * R), ← neg_inj, this]
347+
ring
348+
calc
349+
_ = (∫ x in ε..R, f (a * x) / x) - ∫ x in ε..R, f (b * x) / x := by
350+
simp_rw [g, sub_div]
351+
have hR_pos : 0 < R := by nlinarith
352+
apply intervalIntegral.integral_sub
353+
all_goals apply ContinuousOn.intervalIntegrable
354+
· exact Frullani.comp_mul_left_div hf hε hR_pos a_pos
355+
· exact Frullani.comp_mul_left_div hf hε hR_pos b_pos
356+
_ = (∫ y in a * ε..a * R, u y) - ∫ y in b * ε..b * R, u y := by
357+
have hfa_eq : ∫ x in ε..R, f (a * x) / x = ∫ y in a * ε..a * R, u y := by
358+
calc
359+
_ = ∫ x in ε..R, a * u (a * x) := by
360+
unfold u
361+
field_simp
362+
_ = a * ∫ x in ε..R, u (a * x) := by apply intervalIntegral.integral_const_mul
363+
_ = ∫ y in a * ε..a * R, u y := by apply mul_integral_comp_mul_left
364+
have hfb_eq : ∫ x in ε..R, f (b * x) / x = ∫ y in b * ε..b * R, u y := by
365+
calc
366+
_ = ∫ x in ε..R, b * u (b * x) := by
367+
congr
368+
funext x
369+
unfold u
370+
field_simp
371+
_ = b * ∫ x in ε..R, u (b * x) := by
372+
apply intervalIntegral.integral_const_mul
373+
_ = ∫ y in b * ε..b * R, u y := by
374+
apply mul_integral_comp_mul_left
375+
rw [hfa_eq, hfb_eq]
376+
_ = (∫ x in a * ε..b * ε, u x) - (∫ x in a * R..b * R, u x) := by
377+
apply integral_interval_sub_interval_comm
378+
all_goals
379+
apply intervalIntegrable_div hf
380+
all_goals nlinarith
381+
change ∫ x in Ioi 0, g x = (f 0 - L) * log (b / a)
382+
have hc (y : ℝ) (y_pos : 0 < y) : ∃ c ∈ uIcc (a * y) (b * y),
383+
(∫ x in (a * y)..(b * y), f x / x) = f c * log (b / a) :=
384+
exists_integral_div_eq_mul_log a_pos b_pos y_pos hf
385+
let F : ℝ → ℝ := fun R ↦ ∫ x in 0..R, g x
386+
have h_lhs : Tendsto F atTop (𝓝 (∫ x in Ioi 0, g x)) :=
387+
intervalIntegral_tendsto_integral_Ioi 0 hint tendsto_id
388+
have h_rhs : Tendsto F atTop (𝓝 ((f 0 - L) * log (b / a))) := by
389+
unfold F
390+
choose! fc hy_mem hy_eq using hc
391+
have hg' (ε R : ℝ) (hε : 0 < ε) (hεR : ε < R) :
392+
∫ x in ε..R, g x = (f (fc ε) - f (fc R)) * log (b / a) := by
393+
have hR_pos : 0 < R := by linarith
394+
rw [hg ε R hε hεR, hy_eq ε hε, hy_eq R hR_pos]
395+
field_simp
396+
have h_lim_L : Tendsto (fun R ↦ f (fc R)) atTop (𝓝 L) := by
397+
apply hlim.comp
398+
let m := min a b
399+
have hm_pos : 0 < m := by grind
400+
have h_ev_le : (fun y ↦ m * y) ≤ᶠ[atTop] fc := by
401+
rw [EventuallyLE, eventually_atTop]
402+
use 1
403+
intro y hy1
404+
have hy_pos : 0 < y := by linarith
405+
have hy := hy_mem y hy_pos
406+
simp only [ge_iff_le]
407+
rw [mem_uIcc] at hy
408+
rcases hy with h | h
409+
· have : m ≤ a := by grind
410+
nlinarith
411+
· have : m ≤ b := by grind
412+
nlinarith
413+
have h_lim_atTop : Tendsto (fun y ↦ m * y) atTop atTop := by
414+
simpa [tendsto_const_mul_atTop_of_pos hm_pos] using tendsto_id
415+
exact tendsto_atTop_mono' atTop h_ev_le h_lim_atTop
416+
have h_tail (ε R : ℝ) (hε : 0 < ε) (hεR : ε < R) :
417+
∫ x in Ioi ε, g x = (f (fc ε) - L) * log (b / a) := by
418+
have hR' : Tendsto (fun R ↦ ∫ x in ε..R, g x) atTop (𝓝 (∫ x in Ioi ε, g x)) := by
419+
apply intervalIntegral_tendsto_integral_Ioi
420+
· apply hint.mono_set (Ioi_subset_Ioi hε.le)
421+
· exact tendsto_id
422+
have hR : Tendsto (fun R ↦ ∫ x in ε..R, g x) atTop (𝓝 ((f (fc ε) - L) * log (b / a))) := by
423+
have h_ev_eq : (fun R ↦ ∫ x in ε..R, g x) =ᶠ[atTop]
424+
(fun R ↦ (f (fc ε) - f (fc R)) * log (b / a)) := by
425+
apply (eventually_gt_atTop ε).mono
426+
intro R hεR'
427+
exact hg' ε R hε hεR'
428+
rw [tendsto_congr' h_ev_eq]
429+
have h_lim_const : Tendsto (fun _ : ℝ ↦ f (fc ε)) atTop (𝓝 (f (fc ε))) := tendsto_const_nhds
430+
have h_sub : Tendsto (fun R ↦ (f (fc ε) - f (fc R))) atTop (𝓝 ((f (fc ε)) - L)) :=
431+
h_lim_const.sub h_lim_L
432+
have h_const_log : Tendsto (fun _ : ℝ ↦ log (b / a)) atTop (𝓝 (log (b / a))) :=
433+
tendsto_const_nhds
434+
exact h_sub.mul h_const_log
435+
exact tendsto_nhds_unique hR' hR
436+
have hε : Tendsto (fun ε ↦ ∫ x in Ioi ε, g x) (𝓝[>] 0) (𝓝 (∫ x in Ioi 0, g x)) :=
437+
IntegrableOn.tendsto_integral_Ioi hint
438+
have h_lim_f_zero : Tendsto (fun ε ↦ f (fc ε)) (𝓝[>] 0) (𝓝 (f 0)) := by
439+
have h_lim_zero : Tendsto (fun ε ↦ (max a b) * ε) (𝓝[>] 0) (𝓝 0) := by
440+
have hc : ContinuousWithinAt (fun ε : ℝ ↦ (max a b) * ε) (Ioi (0 : ℝ)) 0 :=
441+
(continuous_mul_left (max a b)).continuousWithinAt
442+
simpa using hc.tendsto
443+
have h_ev_fc_nonneg : ∀ᶠ ε in 𝓝[>] 0, 0 ≤ fc ε := by
444+
apply eventually_of_mem self_mem_nhdsWithin
445+
intro ε hε
446+
have hmem := hy_mem ε hε
447+
have hε_pos : 0 < ε := by grind
448+
have hmin_nonneg : 0 ≤ min (a * ε) (b * ε) := by apply le_min (by nlinarith) (by nlinarith)
449+
apply le_trans hmin_nonneg
450+
rw [mem_uIcc] at hmem
451+
grind
452+
have h_ev_fc_le_max : ∀ᶠ ε in 𝓝[>] 0, fc ε ≤ (max a b) * ε := by
453+
apply eventually_of_mem self_mem_nhdsWithin
454+
intro ε hε
455+
have hmem := hy_mem ε hε
456+
rw [max_mul_of_nonneg a b hε.le]
457+
rw [mem_uIcc] at hmem
458+
grind
459+
have hcont_zero : ContinuousWithinAt f (Ici (0 : ℝ)) 0 := by
460+
apply hf.continuousWithinAt (by simp)
461+
have hfc_within : Tendsto fc (𝓝[>] 0) (𝓝[Ici (0 : ℝ)] 0) := by
462+
apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within
463+
· exact tendsto_of_tendsto_of_tendsto_of_le_of_le'
464+
tendsto_const_nhds h_lim_zero h_ev_fc_nonneg h_ev_fc_le_max
465+
· exact h_ev_fc_nonneg
466+
exact hcont_zero.tendsto.comp hfc_within
467+
have h_main : ∫ x in Ioi 0, g x = (f 0 - L) * log (b / a) := by
468+
have h_ev_eq : (fun ε ↦ ∫ x in Ioi ε, g x) =ᶠ[𝓝[>] 0]
469+
(fun ε ↦ (f (fc ε) - L) * log (b / a)) := by
470+
change (∀ᶠ ε in 𝓝[>] 0, ∫ x in Ioi ε, g x = (f (fc ε) - L) * log (b / a))
471+
apply eventually_of_mem self_mem_nhdsWithin
472+
intro ε hε
473+
simp [h_tail ε (ε + 1) hε]
474+
have h_rhs_from_left : Tendsto (fun ε ↦ (f (fc ε) - L) * log (b / a))
475+
(𝓝[>] 0) (𝓝 (∫ x in Ioi 0, g x)) := by rwa [← tendsto_congr' h_ev_eq]
476+
have h_lim_f_zero_sub_L : Tendsto (fun ε ↦ f (fc ε) - L) (𝓝[>] 0) (𝓝 (f 0 - L)) :=
477+
h_lim_f_zero.sub tendsto_const_nhds
478+
have h_rhs_goal : Tendsto (fun ε ↦ (f (fc ε) - L) * log (b / a))
479+
(𝓝[>] 0) (𝓝 ((f 0 - L) * log (b / a))) := h_lim_f_zero_sub_L.mul_const (log (b / a))
480+
exact tendsto_nhds_unique h_rhs_from_left h_rhs_goal
481+
rwa [h_main] at h_lhs
482+
exact tendsto_nhds_unique h_lhs h_rhs
483+
484+
end Frullani

0 commit comments

Comments
 (0)