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