Skip to content

Commit e695740

Browse files
committed
refactor(Analysis/SpecialFunctions/ImproperIntegrals): add Frullani limit form (sorry); improve docstring and variable naming; format
1 parent 2c6dae8 commit e695740

1 file changed

Lines changed: 85 additions & 78 deletions

File tree

Mathlib/Analysis/SpecialFunctions/ImproperIntegrals.lean

Lines changed: 85 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -288,44 +288,51 @@ theorem integral_univ_inv_one_add_sq : ∫ (x : ℝ), (1 + x ^ 2)⁻¹ = π :=
288288

289289
namespace Frullani
290290

291-
lemma comp_mul_left_div
292-
{f : ℝ → ℝ} (hf : ContinuousOn f (Ici 0)) {p q : ℝ} (p_pos : 0 < p) (q_pos : 0 < q) {c : ℝ}
293-
(c_pos : 0 < c) : ContinuousOn (fun x ↦ f (c * x) / x) (uIcc p q) := by
294-
have hsub : uIcc p q ⊆ Ici 0 := by simp [uIcc, Icc_subset_Ici_iff, p_pos.le, q_pos.le]
291+
variable {f : ℝ → ℝ} {a b c d L R : ℝ}
292+
293+
lemma comp_mul_left_div (hf : ContinuousOn f (Ici 0)) (ha : 0 < a) (hb : 0 < b) (hc : 0 < c) :
294+
ContinuousOn (fun x ↦ f (c * x) / x) (uIcc a b) := by
295+
have hsub : uIcc a b ⊆ Ici 0 := by simp [uIcc, Icc_subset_Ici_iff, ha.le, hb.le]
295296
apply hf.comp_mul_left_div continuousOn_id
296297
all_goals intro x hx
297-
· simpa [mem_Ici] using mul_nonneg (le_of_lt c_pos) (hsub hx)
298-
· exact ((lt_min p_pos q_pos).trans_le hx.1).ne'
299-
300-
lemma intervalIntegrable_div
301-
{f : ℝ → ℝ} (hf : ContinuousOn f (Ici 0)) {p q : ℝ} (hp : 0 < p) (hq : 0 < q) :
302-
IntervalIntegrable (fun x ↦ f x / x) volume p q := by
303-
have hcont : ContinuousOn (fun x ↦ f (1 * x) / x) (uIcc p q) :=
304-
Frullani.comp_mul_left_div hf hp hq (by simp)
298+
· simpa [mem_Ici] using mul_nonneg (le_of_lt hc) (hsub hx)
299+
· exact ((lt_min ha hb).trans_le hx.1).ne'
300+
301+
lemma intervalIntegrable_div (hf : ContinuousOn f (Ici 0)) (ha : 0 < a) (hb : 0 < b) :
302+
IntervalIntegrable (fun x ↦ f x / x) volume a b := by
303+
have hcont : ContinuousOn (fun x ↦ f (1 * x) / x) (uIcc a b) :=
304+
Frullani.comp_mul_left_div hf ha hb (by simp)
305305
simpa using hcont.intervalIntegrable
306306

307-
lemma exists_integral_div_eq_mul_log {a b : ℝ} {f : ℝ → ℝ} {y : ℝ} (a_pos : 0 < a) (b_pos : 0 < b)
308-
(y_pos : 0 < y) (hf : ContinuousOn f (Ici 0)) :
309-
∃ c ∈ uIcc (a * y) (b * y), ∫ x in (a * y)..(b * y), f x / x = f c * log (b / a) := by
310-
have hay := mul_pos a_pos y_pos
311-
have hby := mul_pos b_pos y_pos
312-
have hf' : ContinuousOn f (uIcc (a * y) (b * y)) :=
313-
hf.mono (by simp [uIcc, Icc_subset_Ici_iff, hay.le, hby.le])
314-
obtain ⟨c, hc, heq⟩ := _root_.exists_integral_div_eq_mul_log hay hby hf'
315-
rw [mul_div_mul_right b a (ne_of_gt y_pos)] at heq
316-
exact ⟨c, hc, heq⟩
317-
318-
/-- **Frullani integral**.
319-
If `f : ℝ → ℝ` is continuous on `[0, ∞)` with `Tendsto f atTop (𝓝 L)`, and `0 < a`, `0 < b`, then
320-
`∫ x in Ioi 0, (f (a * x) - f (b * x)) / x = (f 0 - L) * log (b / a)`. -/
321-
theorem integral_Ioi
322-
{a b : ℝ} {f : ℝ → ℝ} {L : ℝ} (a_pos : 0 < a) (b_pos : 0 < b) (hf : ContinuousOn f (Ici 0))
323-
(hlim : Tendsto f atTop (𝓝 L))
307+
lemma exists_integral_div_eq_mul_log (hf : ContinuousOn f (Ici 0)) (ha : 0 < a) (hb : 0 < b)
308+
(hc : 0 < c) :
309+
∃ d ∈ uIcc (a * c) (b * c), ∫ x in (a * c)..(b * c), f x / x = f d * log (b / a) := by
310+
have hac := mul_pos ha hc
311+
have hbc := mul_pos hb hc
312+
have hf' : ContinuousOn f (uIcc (a * c) (b * c)) :=
313+
hf.mono (by simp [uIcc, Icc_subset_Ici_iff, hac.le, hbc.le])
314+
obtain ⟨d, hd, heq⟩ := _root_.exists_integral_div_eq_mul_log hac hbc hf'
315+
rw [mul_div_mul_right b a (ne_of_gt hc)] at heq
316+
exact ⟨d, hd, heq⟩
317+
318+
/-- **Frullani's integral**, limit form. Let `f` be continuous on `(0, ∞)` with
319+
`f(x) → L` as `x → 0⁺` and `f(x) → R` as `x → ∞`. Then for `0 < a` and `0 < b`,
320+
`∫ x in u..v, (f(a x) - f(b x)) / x → (L - R) * log(b / a)` as `u → 0⁺` and `v → ∞`. -/
321+
theorem tendsto_intervalIntegral (hf : ContinuousOn f (Ioi 0)) (ha : 0 < a) (hb : 0 < b)
322+
(h0 : Tendsto f (𝓝[>] 0) (𝓝 L)) (htop : Tendsto f atTop (𝓝 R)) :
323+
Tendsto (fun p : ℝ × ℝ ↦ ∫ x in p.1..p.2, (f (a * x) - f (b * x)) / x) ((𝓝[>] 0) ×ˢ atTop)
324+
(𝓝 ((L - R) * log (b / a))) := by
325+
sorry
326+
327+
/-- **Frullani's integral**. If `f` is continuous on `[0, ∞)` with `f(x) → R` as `x → ∞`,
328+
and `0 < a`, `0 < b`, then `∫ x in Ioi 0, (f(a x) - f(b x)) / x = (f 0 - R) * log(b / a)`. -/
329+
theorem integral_Ioi_eq (hf : ContinuousOn f (Ici 0)) (ha : 0 < a) (hb : 0 < b)
330+
(htop : Tendsto f atTop (𝓝 R))
324331
(hint : IntegrableOn (fun x ↦ (f (a * x) - f (b * x)) / x) (Ioi 0)) :
325-
∫ x in Ioi 0, (f (a * x) - f (b * x)) / x = (f 0 - L) * log (b / a) := by
332+
∫ x in Ioi 0, (f (a * x) - f (b * x)) / x = (f 0 - R) * log (b / a) := by
326333
let g : ℝ → ℝ := fun x ↦ (f (a * x) - f (b * x)) / x
327-
have hg (ε R : ℝ) (hε : 0 < ε) (hR : ε < R) : ∫ x in ε..R, g x =
328-
(∫ x in a * ε..b * ε, f x / x) - (∫ x in a * R..b * R, f x / x) := by
334+
have hg (ε r : ℝ) (hε : 0 < ε) (hr : ε < r) : ∫ x in ε..r, g x =
335+
(∫ x in a * ε..b * ε, f x / x) - (∫ x in a * r..b * r, f x / x) := by
329336
let u x := f x / x
330337
wlog hab : a ≤ b generalizing a b
331338
· have hint_neg :
@@ -335,64 +342,64 @@ theorem integral_Ioi
335342
ext
336343
ring
337344
simp only [not_le] at hab
338-
specialize this b_pos a_pos hint_neg' hab.le
345+
specialize this hb ha hint_neg' hab.le
339346
have hg_neg : (fun x ↦ (f (b * x) - f (a * x)) / x) = fun x ↦ - g x := by
340347
funext x
341348
unfold g
342349
ring
343350
simp only [hg_neg, intervalIntegral.integral_neg] at this
344-
rw [integral_symm (b * ε) (a * ε), integral_symm (b * R) (a * R), ← neg_inj, this]
351+
rw [integral_symm (b * ε) (a * ε), integral_symm (b * r) (a * r), ← neg_inj, this]
345352
ring
346353
calc
347-
_ = (∫ x in ε..R, f (a * x) / x) - ∫ x in ε..R, f (b * x) / x := by
354+
_ = (∫ x in ε..r, f (a * x) / x) - ∫ x in ε..r, f (b * x) / x := by
348355
simp_rw [g, sub_div]
349-
have hR_pos : 0 < R := by nlinarith
356+
have hr_pos : 0 < r := by nlinarith
350357
apply intervalIntegral.integral_sub
351358
all_goals apply ContinuousOn.intervalIntegrable
352-
· exact Frullani.comp_mul_left_div hf hε hR_pos a_pos
353-
· exact Frullani.comp_mul_left_div hf hε hR_pos b_pos
354-
_ = (∫ y in a * ε..a * R, u y) - ∫ y in b * ε..b * R, u y := by
355-
have hfa_eq : ∫ x in ε..R, f (a * x) / x = ∫ y in a * ε..a * R, u y := by
359+
· exact Frullani.comp_mul_left_div hf hε hr_pos ha
360+
· exact Frullani.comp_mul_left_div hf hε hr_pos hb
361+
_ = (∫ y in a * ε..a * r, u y) - ∫ y in b * ε..b * r, u y := by
362+
have hfa_eq : ∫ x in ε..r, f (a * x) / x = ∫ y in a * ε..a * r, u y := by
356363
calc
357-
_ = ∫ x in ε..R, a * u (a * x) := by
364+
_ = ∫ x in ε..r, a * u (a * x) := by
358365
unfold u
359366
field_simp
360-
_ = a * ∫ x in ε..R, u (a * x) := by apply intervalIntegral.integral_const_mul
361-
_ = ∫ y in a * ε..a * R, u y := by apply mul_integral_comp_mul_left
362-
have hfb_eq : ∫ x in ε..R, f (b * x) / x = ∫ y in b * ε..b * R, u y := by
367+
_ = a * ∫ x in ε..r, u (a * x) := by apply intervalIntegral.integral_const_mul
368+
_ = ∫ y in a * ε..a * r, u y := by apply mul_integral_comp_mul_left
369+
have hfb_eq : ∫ x in ε..r, f (b * x) / x = ∫ y in b * ε..b * r, u y := by
363370
calc
364-
_ = ∫ x in ε..R, b * u (b * x) := by
371+
_ = ∫ x in ε..r, b * u (b * x) := by
365372
congr
366373
funext x
367374
unfold u
368375
field_simp
369-
_ = b * ∫ x in ε..R, u (b * x) := by
376+
_ = b * ∫ x in ε..r, u (b * x) := by
370377
apply intervalIntegral.integral_const_mul
371-
_ = ∫ y in b * ε..b * R, u y := by
378+
_ = ∫ y in b * ε..b * r, u y := by
372379
apply mul_integral_comp_mul_left
373380
rw [hfa_eq, hfb_eq]
374-
_ = (∫ x in a * ε..b * ε, u x) - (∫ x in a * R..b * R, u x) := by
381+
_ = (∫ x in a * ε..b * ε, u x) - (∫ x in a * r..b * r, u x) := by
375382
apply integral_interval_sub_interval_comm
376383
all_goals
377384
apply intervalIntegrable_div hf
378385
all_goals nlinarith
379-
change ∫ x in Ioi 0, g x = (f 0 - L) * log (b / a)
380-
have hc (y : ℝ) (y_pos : 0 < y) : ∃ c ∈ uIcc (a * y) (b * y),
386+
change ∫ x in Ioi 0, g x = (f 0 - R) * log (b / a)
387+
have hc (y : ℝ) (hy : 0 < y) : ∃ c ∈ uIcc (a * y) (b * y),
381388
(∫ x in (a * y)..(b * y), f x / x) = f c * log (b / a) :=
382-
exists_integral_div_eq_mul_log a_pos b_pos y_pos hf
383-
let F : ℝ → ℝ := fun R ↦ ∫ x in 0..R, g x
389+
exists_integral_div_eq_mul_log hf ha hb hy
390+
let F : ℝ → ℝ := fun r ↦ ∫ x in 0..r, g x
384391
have h_lhs : Tendsto F atTop (𝓝 (∫ x in Ioi 0, g x)) :=
385392
intervalIntegral_tendsto_integral_Ioi 0 hint tendsto_id
386-
have h_rhs : Tendsto F atTop (𝓝 ((f 0 - L) * log (b / a))) := by
393+
have h_rhs : Tendsto F atTop (𝓝 ((f 0 - R) * log (b / a))) := by
387394
unfold F
388395
choose! fc hy_mem hy_eq using hc
389-
have hg' (ε R : ℝ) (hε : 0 < ε) (hεR : ε < R) :
390-
∫ x in ε..R, g x = (f (fc ε) - f (fc R)) * log (b / a) := by
391-
have hR_pos : 0 < R := by linarith
392-
rw [hg ε RhεR, hy_eq ε hε, hy_eq R hR_pos]
396+
have hg' (ε r : ℝ) (hε : 0 < ε) (hεr : ε < r) :
397+
∫ x in ε..r, g x = (f (fc ε) - f (fc r)) * log (b / a) := by
398+
have hr_pos : 0 < r := by linarith
399+
rw [hg ε rhεr, hy_eq ε hε, hy_eq r hr_pos]
393400
field_simp
394-
have h_lim_L : Tendsto (fun R ↦ f (fc R)) atTop (𝓝 L) := by
395-
apply hlim.comp
401+
have h_lim_R : Tendsto (fun r ↦ f (fc r)) atTop (𝓝 R) := by
402+
apply htop.comp
396403
let m := min a b
397404
have hm_pos : 0 < m := by grind
398405
have h_ev_le : (fun y ↦ m * y) ≤ᶠ[atTop] fc := by
@@ -411,32 +418,32 @@ theorem integral_Ioi
411418
have h_lim_atTop : Tendsto (fun y ↦ m * y) atTop atTop := by
412419
simpa [tendsto_const_mul_atTop_of_pos hm_pos] using tendsto_id
413420
exact tendsto_atTop_mono' atTop h_ev_le h_lim_atTop
414-
have h_tail (ε R : ℝ) (hε : 0 < ε) (hεR : ε < R) :
415-
∫ x in Ioi ε, g x = (f (fc ε) - L) * log (b / a) := by
416-
have hR' : Tendsto (fun R ↦ ∫ x in ε..R, g x) atTop (𝓝 (∫ x in Ioi ε, g x)) := by
421+
have h_tail (ε r : ℝ) (hε : 0 < ε) (hεr : ε < r) :
422+
∫ x in Ioi ε, g x = (f (fc ε) - R) * log (b / a) := by
423+
have hr' : Tendsto (fun r ↦ ∫ x in ε..r, g x) atTop (𝓝 (∫ x in Ioi ε, g x)) := by
417424
apply intervalIntegral_tendsto_integral_Ioi
418425
· apply hint.mono_set (Ioi_subset_Ioi hε.le)
419426
· exact tendsto_id
420-
have hR : Tendsto (fun R ↦ ∫ x in ε..R, g x) atTop (𝓝 ((f (fc ε) - L) * log (b / a))) := by
421-
have h_ev_eq : (fun R ↦ ∫ x in ε..R, g x) =ᶠ[atTop]
422-
(fun R ↦ (f (fc ε) - f (fc R)) * log (b / a)) := by
427+
have hr : Tendsto (fun r ↦ ∫ x in ε..r, g x) atTop (𝓝 ((f (fc ε) - R) * log (b / a))) := by
428+
have h_ev_eq : (fun r ↦ ∫ x in ε..r, g x) =ᶠ[atTop]
429+
(fun r ↦ (f (fc ε) - f (fc r)) * log (b / a)) := by
423430
apply (eventually_gt_atTop ε).mono
424-
intro R hεR'
425-
exact hg' ε RhεR'
431+
intro r hεr'
432+
exact hg' ε rhεr'
426433
rw [tendsto_congr' h_ev_eq]
427434
have h_lim_const : Tendsto (fun _ : ℝ ↦ f (fc ε)) atTop (𝓝 (f (fc ε))) := tendsto_const_nhds
428-
have h_sub : Tendsto (fun R ↦ (f (fc ε) - f (fc R))) atTop (𝓝 ((f (fc ε)) - L)) :=
429-
h_lim_const.sub h_lim_L
435+
have h_sub : Tendsto (fun r ↦ (f (fc ε) - f (fc r))) atTop (𝓝 ((f (fc ε)) - R)) :=
436+
h_lim_const.sub h_lim_R
430437
have h_const_log : Tendsto (fun _ : ℝ ↦ log (b / a)) atTop (𝓝 (log (b / a))) :=
431438
tendsto_const_nhds
432439
exact h_sub.mul h_const_log
433-
exact tendsto_nhds_unique hR' hR
440+
exact tendsto_nhds_unique hr' hr
434441
have hε : Tendsto (fun ε ↦ ∫ x in Ioi ε, g x) (𝓝[>] 0) (𝓝 (∫ x in Ioi 0, g x)) :=
435442
IntegrableOn.tendsto_integral_Ioi hint
436443
have h_lim_f_zero : Tendsto (fun ε ↦ f (fc ε)) (𝓝[>] 0) (𝓝 (f 0)) := by
437444
have h_lim_zero : Tendsto (fun ε ↦ (max a b) * ε) (𝓝[>] 0) (𝓝 0) := by
438445
have hc : ContinuousWithinAt (fun ε : ℝ ↦ (max a b) * ε) (Ioi (0 : ℝ)) 0 :=
439-
(continuous_mul_left (max a b)).continuousWithinAt
446+
(continuous_const_mul (max a b)).continuousWithinAt
440447
simpa using hc.tendsto
441448
have h_ev_fc_nonneg : ∀ᶠ ε in 𝓝[>] 0, 0 ≤ fc ε := by
442449
apply eventually_of_mem self_mem_nhdsWithin
@@ -462,19 +469,19 @@ theorem integral_Ioi
462469
tendsto_const_nhds h_lim_zero h_ev_fc_nonneg h_ev_fc_le_max
463470
· exact h_ev_fc_nonneg
464471
exact hcont_zero.tendsto.comp hfc_within
465-
have h_main : ∫ x in Ioi 0, g x = (f 0 - L) * log (b / a) := by
472+
have h_main : ∫ x in Ioi 0, g x = (f 0 - R) * log (b / a) := by
466473
have h_ev_eq : (fun ε ↦ ∫ x in Ioi ε, g x) =ᶠ[𝓝[>] 0]
467-
(fun ε ↦ (f (fc ε) - L) * log (b / a)) := by
468-
change (∀ᶠ ε in 𝓝[>] 0, ∫ x in Ioi ε, g x = (f (fc ε) - L) * log (b / a))
474+
(fun ε ↦ (f (fc ε) - R) * log (b / a)) := by
475+
change (∀ᶠ ε in 𝓝[>] 0, ∫ x in Ioi ε, g x = (f (fc ε) - R) * log (b / a))
469476
apply eventually_of_mem self_mem_nhdsWithin
470477
intro ε hε
471478
simp [h_tail ε (ε + 1) hε]
472-
have h_rhs_from_left : Tendsto (fun ε ↦ (f (fc ε) - L) * log (b / a))
479+
have h_rhs_from_left : Tendsto (fun ε ↦ (f (fc ε) - R) * log (b / a))
473480
(𝓝[>] 0) (𝓝 (∫ x in Ioi 0, g x)) := by rwa [← tendsto_congr' h_ev_eq]
474-
have h_lim_f_zero_sub_L : Tendsto (fun ε ↦ f (fc ε) - L) (𝓝[>] 0) (𝓝 (f 0 - L)) :=
481+
have h_lim_f_zero_sub_R : Tendsto (fun ε ↦ f (fc ε) - R) (𝓝[>] 0) (𝓝 (f 0 - R)) :=
475482
h_lim_f_zero.sub tendsto_const_nhds
476-
have h_rhs_goal : Tendsto (fun ε ↦ (f (fc ε) - L) * log (b / a))
477-
(𝓝[>] 0) (𝓝 ((f 0 - L) * log (b / a))) := h_lim_f_zero_sub_L.mul_const (log (b / a))
483+
have h_rhs_goal : Tendsto (fun ε ↦ (f (fc ε) - R) * log (b / a))
484+
(𝓝[>] 0) (𝓝 ((f 0 - R) * log (b / a))) := h_lim_f_zero_sub_R.mul_const (log (b / a))
478485
exact tendsto_nhds_unique h_rhs_from_left h_rhs_goal
479486
rwa [h_main] at h_lhs
480487
exact tendsto_nhds_unique h_lhs h_rhs

0 commit comments

Comments
 (0)