Skip to content

Commit 8837782

Browse files
committed
refactor(Analysis/SpecialFunctions): move Frullani's integral to its own file; improve style
1 parent ba9b598 commit 8837782

3 files changed

Lines changed: 254 additions & 228 deletions

File tree

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,6 +2351,7 @@ public import Mathlib.Analysis.SpecialFunctions.Elliptic.Weierstrass
23512351
public import Mathlib.Analysis.SpecialFunctions.Exp
23522352
public import Mathlib.Analysis.SpecialFunctions.ExpDeriv
23532353
public import Mathlib.Analysis.SpecialFunctions.Exponential
2354+
public import Mathlib.Analysis.SpecialFunctions.FrullaniIntegral
23542355
public import Mathlib.Analysis.SpecialFunctions.Gamma.Basic
23552356
public import Mathlib.Analysis.SpecialFunctions.Gamma.Beta
23562357
public import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
/-
2+
Copyright (c) 2026 Louis (Yiyang) Liu. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Louis (Yiyang) Liu
5+
-/
6+
module
7+
8+
public import Mathlib.Analysis.SpecialFunctions.Integrals.Basic
9+
public import Mathlib.MeasureTheory.Integral.IntegralEqImproper
10+
11+
/-!
12+
# Frullani's integral
13+
14+
This file proves **Frullani's integral**: if `f : ℝ → E` is locally integrable on `(0, ∞)` with
15+
`f x → L` as `x → 0⁺` and `f x → R` as `x → +∞`, and `0 < a` and `0 < b`, then
16+
`∫ x in Ioi 0, x⁻¹ • (f (a * x) - f (b * x)) = log (b / a) • (L - R)`
17+
(`Frullani.integral_Ioi_eq`), provided the integrand is integrable on `(0, ∞)`.
18+
19+
We also prove a limit form `Frullani.tendsto_intervalIntegral`, which does not require global
20+
integrability of the integrand.
21+
-/
22+
23+
public section
24+
25+
open Real Set Filter MeasureTheory intervalIntegral
26+
27+
open scoped Topology
28+
29+
namespace Frullani
30+
31+
open Metric
32+
33+
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {f : ℝ → E}
34+
{a b c : ℝ} {L R : E}
35+
36+
lemma intervalIntegrable_inv_smul (hf : LocallyIntegrableOn f (Ioi 0)) (ha : 0 < a)
37+
(hb : 0 < b) : IntervalIntegrable (fun x ↦ x⁻¹ • f x) volume a b := by
38+
have hsub : uIcc a b ⊆ Ioi 0 := by simp [uIcc, Icc_subset_Ioi_iff, ha, hb]
39+
have hf_int : IntervalIntegrable f volume a b :=
40+
intervalIntegrable_iff.mpr
41+
((hf.integrableOn_compact_subset hsub isCompact_uIcc).mono_set uIoc_subset_uIcc)
42+
exact hf_int.continuousOn_smul (continuousOn_inv₀.mono fun x hx ↦ ne_of_gt (hsub hx))
43+
44+
lemma intervalIntegrable_inv_smul_comp_mul (hf : LocallyIntegrableOn f (Ioi 0)) (ha : 0 < a)
45+
(hb : 0 < b) (hc : 0 < c) :
46+
IntervalIntegrable (fun x ↦ x⁻¹ • f (c * x)) volume a b := by
47+
have hsub : uIcc a b ⊆ Ioi 0 := by simp [uIcc, Icc_subset_Ioi_iff, ha, hb]
48+
have hf_cint : IntervalIntegrable f volume (c * a) (c * b) :=
49+
intervalIntegrable_iff.mpr
50+
((hf.integrableOn_compact_subset (by simp [uIcc, Icc_subset_Ioi_iff, mul_pos hc ha,
51+
mul_pos hc hb]) isCompact_uIcc).mono_set uIoc_subset_uIcc)
52+
have hf_comp : IntervalIntegrable (fun x ↦ f (c * x)) volume a b := by
53+
have h := hf_cint.comp_mul_left (c := c)
54+
rwa [mul_div_cancel_left₀ a hc.ne', mul_div_cancel_left₀ b hc.ne'] at h
55+
exact hf_comp.continuousOn_smul (continuousOn_inv₀.mono fun x hx ↦ ne_of_gt (hsub hx))
56+
57+
lemma integral_comp_mul_inv_smul {ε r : ℝ} (hc : c ≠ 0) :
58+
∫ x in ε..r, x⁻¹ • f (c * x) = ∫ x in c * ε..c * r, x⁻¹ • f x := by
59+
let u : ℝ → E := fun x ↦ x⁻¹ • f x
60+
have key : (fun x ↦ x⁻¹ • f (c * x)) = fun x ↦ c • u (c * x) := by
61+
funext x
62+
simp only [u, smul_smul]
63+
congr 1
64+
field_simp
65+
rw [key, intervalIntegral.integral_smul, smul_integral_comp_mul_left]
66+
67+
variable [CompleteSpace E]
68+
69+
lemma norm_integral_inv_smul_sub_le (hf : LocallyIntegrableOn f (Ioi 0)) (ha : 0 < a)
70+
(hb : 0 < b) {V : E} {δ : ℝ} (hδ : 0 ≤ δ) (h : ∀ x ∈ uIoc a b, ‖f x - V‖ ≤ δ) :
71+
‖(∫ x in a..b, x⁻¹ • f x) - log (b / a) • V‖ ≤ δ * |log (b / a)| := by
72+
have hsub : uIcc a b ⊆ Ioi 0 := by simp [uIcc, Icc_subset_Ioi_iff, ha, hb]
73+
have hint_f : IntervalIntegrable (fun x ↦ x⁻¹ • f x) volume a b :=
74+
intervalIntegrable_inv_smul hf ha hb
75+
have hint_V : IntervalIntegrable (fun x ↦ x⁻¹ • V) volume a b := by
76+
apply ContinuousOn.intervalIntegrable
77+
exact (continuousOn_inv₀.mono (fun x hx ↦ ne_of_gt (hsub hx))).smul continuousOn_const
78+
have hint_inv : IntervalIntegrable (fun x : ℝ ↦ x⁻¹ * δ) volume a b := by
79+
apply ContinuousOn.intervalIntegrable
80+
exact (continuousOn_inv₀.mono (fun x hx ↦ ne_of_gt (hsub hx))).mul continuousOn_const
81+
calc ‖(∫ x in a..b, x⁻¹ • f x) - log (b / a) • V‖
82+
_ = ‖∫ x in a..b, x⁻¹ • (f x - V)‖ := by
83+
congr 1
84+
have : log (b / a) • V = ∫ x in a..b, x⁻¹ • V := by
85+
rw [intervalIntegral.integral_smul_const (f := fun x ↦ (x⁻¹ : ℝ)) (c := V),
86+
integral_inv_of_pos ha hb]
87+
rw [this, ← integral_sub hint_f hint_V]
88+
congr 1
89+
funext x
90+
exact (smul_sub _ _ _).symm
91+
_ ≤ |∫ x in a..b, x⁻¹ * δ| := by
92+
apply norm_integral_le_abs_of_norm_le
93+
· exact (ae_restrict_mem measurableSet_uIoc).mono fun x hx ↦ by
94+
have hx_pos : 0 < x :=
95+
lt_of_lt_of_le (lt_min ha hb) (uIoc_subset_uIcc hx).1
96+
rw [norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.2 hx_pos)]
97+
exact mul_le_mul_of_nonneg_left (h x hx) (inv_nonneg.2 hx_pos.le)
98+
· exact hint_inv
99+
_ = δ * |log (b / a)| := by
100+
have heq : (fun x : ℝ ↦ x⁻¹ * δ) = fun x ↦ δ * x⁻¹ := by
101+
funext x
102+
ring
103+
rw [heq, intervalIntegral.integral_const_mul, integral_inv_of_pos ha hb]
104+
exact (abs_mul δ (log (b / a))).trans (by rw [abs_of_nonneg hδ])
105+
106+
lemma tendsto_integral_inv_smul_of_tendsto_uniform (hf : LocallyIntegrableOn f (Ioi 0)) (ha : 0 < a)
107+
(hb : 0 < b) {F : Filter ℝ} (hpos : ∀ᶠ t in F, 0 < t) {V : E}
108+
(huni : ∀ δ > 0, ∀ᶠ t in F, ∀ x ∈ uIoc (a * t) (b * t), ‖f x - V‖ ≤ δ) :
109+
Tendsto (fun t ↦ ∫ x in (a * t)..(b * t), x⁻¹ • f x) F (𝓝 (log (b / a) • V)) := by
110+
rw [Metric.tendsto_nhds]
111+
intro δ hδ
112+
set C := |log (b / a)| with hC_def
113+
set δ' := δ / (C + 1)
114+
have hδ' : 0 < δ' := div_pos hδ (by positivity)
115+
filter_upwards [hpos, huni δ' hδ'] with t ht_pos hbound
116+
have haε : 0 < a * t := mul_pos ha ht_pos
117+
have hbε : 0 < b * t := mul_pos hb ht_pos
118+
have hlog_eq : log (b * t / (a * t)) = log (b / a) := by
119+
rw [mul_div_mul_right b a (ne_of_gt ht_pos)]
120+
calc dist (∫ x in a * t..b * t, x⁻¹ • f x) (log (b / a) • V)
121+
_ = ‖(∫ x in a * t..b * t, x⁻¹ • f x) - log (b / a) • V‖ := dist_eq_norm _ _
122+
_ = ‖(∫ x in a * t..b * t, x⁻¹ • f x) - log (b * t / (a * t)) • V‖ := by rw [hlog_eq]
123+
_ ≤ δ' * |log (b * t / (a * t))| :=
124+
norm_integral_inv_smul_sub_le hf haε hbε hδ'.le hbound
125+
_ = δ' * C := by rw [hlog_eq]
126+
_ < δ := by
127+
calc δ' * C
128+
_ = δ * (C / (C + 1)) := by ring
129+
_ < δ * 1 :=
130+
mul_lt_mul_of_pos_left ((div_lt_one (by positivity)).2 (lt_add_one C)) hδ
131+
_ = δ := mul_one δ
132+
133+
lemma tendsto_integral_inv_smul_nhdsWithin (hf : LocallyIntegrableOn f (Ioi 0)) (ha : 0 < a)
134+
(hb : 0 < b) (hL : Tendsto f (𝓝[>] 0) (𝓝 L)) :
135+
Tendsto (fun ε ↦ ∫ x in (a * ε)..(b * ε), x⁻¹ • f x) (𝓝[>] 0) (𝓝 (log (b / a) • L)) := by
136+
apply tendsto_integral_inv_smul_of_tendsto_uniform hf ha hb self_mem_nhdsWithin
137+
intro δ hδ
138+
have hev : ∀ᶠ x in 𝓝[>] (0 : ℝ), dist (f x) L < δ :=
139+
hL.eventually (ball_mem_nhds L hδ)
140+
rw [Filter.Eventually, mem_nhdsWithin_iff] at hev
141+
obtain ⟨η, hη, hη_sub⟩ := hev
142+
set M := max a b with hM_def
143+
have hM : 0 < M := lt_max_of_lt_left ha
144+
filter_upwards [self_mem_nhdsWithin,
145+
nhdsWithin_le_nhds (Iio_mem_nhds (div_pos hη hM))] with t ht_pos ht_bound
146+
intro x hx
147+
have haε : 0 < a * t := mul_pos ha ht_pos
148+
have hbε : 0 < b * t := mul_pos hb ht_pos
149+
have hx_pos : 0 < x := lt_of_lt_of_le (lt_min haε hbε) (uIoc_subset_uIcc hx).1
150+
have hx_lt_η : dist x 0 < η := by
151+
rw [Real.dist_eq, sub_zero, abs_of_pos hx_pos]
152+
calc x
153+
_ ≤ max (a * t) (b * t) := (uIoc_subset_uIcc hx).2
154+
_ = M * t := by rw [hM_def, max_mul_of_nonneg _ _ ht_pos.le]
155+
_ < M * (η / M) := mul_lt_mul_of_pos_left ht_bound hM
156+
_ = η := mul_div_cancel₀ η (ne_of_gt hM)
157+
have := hη_sub ⟨mem_ball.2 hx_lt_η, hx_pos⟩
158+
rw [mem_setOf_eq, dist_eq_norm] at this
159+
exact le_of_lt this
160+
161+
/-- If `f → R` as `x → +∞` and `f` is locally integrable on `(0, ∞)`, then the weighted integral
162+
`∫ x in a*r..b*r, x⁻¹ • f x` converges to `log(b/a) • R` as `r → +∞`. -/
163+
lemma tendsto_integral_inv_smul_atTop (hf : LocallyIntegrableOn f (Ioi 0)) (ha : 0 < a) (hb : 0 < b)
164+
(hR : Tendsto f atTop (𝓝 R)) :
165+
Tendsto (fun r ↦ ∫ x in (a * r)..(b * r), x⁻¹ • f x) atTop (𝓝 (log (b / a) • R)) := by
166+
apply tendsto_integral_inv_smul_of_tendsto_uniform hf ha hb
167+
(eventually_atTop.21, fun r hr ↦ zero_lt_one.trans_le hr⟩)
168+
intro δ hδ
169+
have hev : ∀ᶠ x in atTop, dist (f x) R < δ :=
170+
hR.eventually (ball_mem_nhds R hδ)
171+
rw [Filter.eventually_atTop] at hev
172+
obtain ⟨N, hN⟩ := hev
173+
have hm : 0 < min a b := lt_min ha hb
174+
filter_upwards [eventually_atTop.2 ⟨max 1 (N / min a b), fun r hr ↦ hr⟩] with t ht
175+
intro x hx
176+
have ht_pos : 0 < t := lt_of_lt_of_le one_pos ((le_max_left 1 _).trans ht)
177+
have haε : 0 < a * t := mul_pos ha ht_pos
178+
have hbε : 0 < b * t := mul_pos hb ht_pos
179+
have hNx : N ≤ x :=
180+
calc N
181+
_ = min a b * (N / min a b) := by field_simp
182+
_ ≤ min a b * t :=
183+
mul_le_mul_of_nonneg_left ((le_max_right _ _).trans ht) hm.le
184+
_ = min (a * t) (b * t) := by rw [min_mul_of_nonneg _ _ ht_pos.le]
185+
_ ≤ x := (uIoc_subset_uIcc hx).1
186+
have hdist := hN x hNx
187+
rw [dist_eq_norm] at hdist
188+
exact le_of_lt hdist
189+
190+
/-- **Frullani's integral**, limit form, for functions valued in a complete normed space.
191+
If `f` is locally integrable on `(0, ∞)` with `f x → L` as `x → 0⁺` and `f x → R` as `x → +∞`,
192+
and `0 < a` and `0 < b`, then `∫ x in ε..r, x⁻¹ • (f (a * x) - f (b * x)) → log (b / a) • (L - R)`
193+
as `ε → 0⁺` and `r → +∞`. -/
194+
theorem tendsto_intervalIntegral (hf : LocallyIntegrableOn f (Ioi 0)) (ha : 0 < a) (hb : 0 < b)
195+
(hL : Tendsto f (𝓝[>] 0) (𝓝 L)) (hR : Tendsto f atTop (𝓝 R)) :
196+
Tendsto (fun p : ℝ × ℝ ↦ ∫ x in p.1..p.2, x⁻¹ • (f (a * x) - f (b * x)))
197+
((𝓝[>] 0) ×ˢ atTop) (𝓝 (log (b / a) • (L - R))) := by
198+
let u := fun x ↦ x⁻¹ • f x
199+
have hint {p q : ℝ} (hp : 0 < p) (hq : 0 < q) : IntervalIntegrable u volume p q :=
200+
intervalIntegrable_inv_smul hf hp hq
201+
have hsplit {ε r : ℝ} (hε : 0 < ε) (hr : 0 < r) :
202+
∫ x in ε..r, x⁻¹ • (f (a * x) - f (b * x)) =
203+
(∫ x in (a * ε)..(b * ε), u x) - ∫ x in (a * r)..(b * r), u x := by
204+
calc ∫ x in ε..r, x⁻¹ • (f (a * x) - f (b * x))
205+
_ = (∫ x in ε..r, x⁻¹ • f (a * x)) - ∫ x in ε..r, x⁻¹ • f (b * x) := by
206+
simp_rw [smul_sub]
207+
exact integral_sub (intervalIntegrable_inv_smul_comp_mul hf hε hr ha)
208+
(intervalIntegrable_inv_smul_comp_mul hf hε hr hb)
209+
_ = (∫ y in a * ε..a * r, u y) - ∫ y in b * ε..b * r, u y := by
210+
rw [integral_comp_mul_inv_smul ha.ne', integral_comp_mul_inv_smul hb.ne']
211+
_ = _ := integral_interval_sub_interval_comm
212+
(hint (mul_pos ha hε) (mul_pos ha hr))
213+
(hint (mul_pos hb hε) (mul_pos hb hr))
214+
(hint (mul_pos ha hε) (mul_pos hb hε))
215+
have h_ev : (fun p : ℝ × ℝ ↦ ∫ x in p.1..p.2, x⁻¹ • (f (a * x) - f (b * x))) =ᶠ[(𝓝[>] 0) ×ˢ atTop]
216+
fun p ↦ (∫ x in (a * p.1)..(b * p.1), u x) - ∫ x in (a * p.2)..(b * p.2), u x := by
217+
filter_upwards [prod_mem_prod (eventually_nhdsWithin_of_forall fun _ h ↦ h)
218+
(eventually_atTop.21, fun _ h ↦ lt_of_lt_of_le one_pos h⟩)] with ⟨ε, r⟩ ⟨hε, hr⟩
219+
exact hsplit hε hr
220+
rw [tendsto_congr' h_ev, show log (b / a) • (L - R) =
221+
log (b / a) • L - log (b / a) • R from smul_sub _ _ _]
222+
exact ((tendsto_integral_inv_smul_nhdsWithin hf ha hb hL).comp tendsto_fst).sub
223+
((tendsto_integral_inv_smul_atTop hf ha hb hR).comp tendsto_snd)
224+
225+
/-- **Frullani's integral** for functions valued in a complete normed space.
226+
If `f` is locally integrable on `(0, ∞)` with `f x → L` as `x → 0⁺` and `f x → R` as `x → +∞`,
227+
`0 < a` and `0 < b`, and `x ↦ x⁻¹ • (f (a * x) - f (b * x))` is integrable on `(0, ∞)`, then
228+
`∫ x in Ioi 0, x⁻¹ • (f (a * x) - f (b * x)) = log (b / a) • (L - R)`. -/
229+
theorem integral_Ioi_eq (hf : LocallyIntegrableOn f (Ioi 0)) (ha : 0 < a) (hb : 0 < b)
230+
(hL : Tendsto f (𝓝[>] 0) (𝓝 L)) (hR : Tendsto f atTop (𝓝 R))
231+
(hint : IntegrableOn (fun x ↦ x⁻¹ • (f (a * x) - f (b * x))) (Ioi 0)) :
232+
∫ x in Ioi 0, x⁻¹ • (f (a * x) - f (b * x)) = log (b / a) • (L - R) := by
233+
have h_lim := (tendsto_intervalIntegral hf ha hb hL hR).mono_left curry_le_prod
234+
set g := fun x ↦ x⁻¹ • (f (a * x) - f (b * x)) with hg
235+
apply tendsto_nhds_unique
236+
(hint.continuousWithinAt_Ici_primitive_Ioi.mono_left (nhdsWithin_mono 0 Ioi_subset_Ici_self))
237+
rw [tendsto_nhdsWithin_nhds]
238+
intro ε hε
239+
rw [Metric.tendsto_nhds] at h_lim
240+
specialize h_lim (ε / 2) (by positivity)
241+
rw [eventually_curry_iff, Filter.Eventually, mem_nhdsWithin_iff] at h_lim
242+
obtain ⟨δ, hδ_pos, hδ⟩ := h_lim
243+
simp_rw [subset_def, mem_inter_iff, mem_ball] at hδ
244+
refine ⟨δ, hδ_pos, ?_⟩
245+
intro x hx hdist
246+
specialize hδ x ⟨hdist, hx⟩
247+
rw [mem_setOf] at hδ
248+
have hint' : IntegrableOn g (Ioi x) := hint.mono (by grind) (by simp)
249+
have htends := intervalIntegral_tendsto_integral_Ioi x hint' tendsto_id
250+
have hle := le_of_tendsto (htends.dist tendsto_const_nhds) (hδ.mono (fun _ hy ↦ hy.le))
251+
linarith
252+
253+
end Frullani

0 commit comments

Comments
 (0)