/-Copyright (c) 2026 Carles MarΓn. All rights reserved.Released under Apache 2.0 license as described in the file LICENSE.Authors: Carles MarΓn-/module public import Mathlib.Analysis.SpecialFunctions.Log.NegMulLogpublic import Formalizations.Analysis.SpecialFunctions.Dilogarithm.Basic /-!# Abel's five-term relation For `x, y β (0, 1)` the Rogers dilogarithm satisfies `L(x) + L(y) = L(xy) + L(x(1 - y)/(1 - xy)) + L(y(1 - x)/(1 - xy))`. For fixed `y` the difference of the two sides has vanishing derivative in `x` on `(0, 1)`, so it isconstant, and its limit at `x β 0βΊ` is `0`. ## Main results * `Dilog.hasDerivAt_rogersL`: `Lβ²(x) = -Β½ (log(1 - x)/x + log x/(1 - x))` on `(0, 1)`.* `Dilog.tendsto_rogersL_nhdsGT_zero`, `Dilog.continuousAt_rogersL`.* `Dilog.rogersL_fiveterm`: the five-term relation. ## References * L. Lewin, *Polylogarithms and Associated Functions*, North-Holland, 1981.* D. Zagier, *The dilogarithm function*, in *Frontiers in Number Theory, Physics, and Geometry II*, Springer, 2007, 3β65.-/ @[expose] public section open Setopen scoped Real namespace Dilog /-- The derivative of the Rogers `L`-function on `(0,1)`:`L'(x) = β(log(1βx)/x + log x/(1βx))/2`. -/theorem hasDerivAt_rogersL {x : β} (hx : x β Ioo (0 : β) 1) : HasDerivAt rogersL (-(Real.log (1 - x) / x + Real.log x / (1 - x)) / 2) x := by obtain β¨hx0, hx1β© := hx have hx0' : x β 0 := ne_of_gt hx0 have h1x : (1 : β) - x β 0 := by linarith -- derivative of `Liβ` have hLi : HasDerivAt Liβ (-Real.log (1 - x) / x) x := hasDerivAt_Liβ (by rw [abs_of_pos hx0]; exact hx1) hx0' -- derivative of `log` have hlogx : HasDerivAt Real.log xβ»ΒΉ x := Real.hasDerivAt_log hx0' -- derivative of `log (1 - Β·)` have hlin : HasDerivAt (fun t : β => 1 - t) (-1) x := by simpa using (hasDerivAt_id x).const_sub (1 : β) have hlog1x : HasDerivAt (fun t : β => Real.log (1 - t)) (-(1 - x)β»ΒΉ) x := by have := (Real.hasDerivAt_log h1x).comp x hlin simpa [Function.comp_def] using this -- product rule for `log x Β· log (1 - x)` have hprod : HasDerivAt (fun t : β => Real.log t * Real.log (1 - t)) (xβ»ΒΉ * Real.log (1 - x) + Real.log x * -(1 - x)β»ΒΉ) x := hlogx.mul hlog1x -- `rogersL = Liβ + (log Β· log(1-Β·)) / 2` have hsum : HasDerivAt rogersL ((-Real.log (1 - x) / x) + (xβ»ΒΉ * Real.log (1 - x) + Real.log x * -(1 - x)β»ΒΉ) / 2) x := by rw [show rogersL = fun t => Liβ t + Real.log t * Real.log (1 - t) / 2 from rfl] exact hLi.add (hprod.div_const 2) convert hsum using 1 field_simp ring /-- The five-term difference, as a function of `x` with `y` fixed, has zero derivative on`(0,1)`: the log-terms of `L'` cancel after rewriting every argument's logarithm in thebasis `{log x, log y, log(1βx), log(1βy), log(1βxy)}`. -/theorem fiveterm_hasDerivAt_zero {x y : β} (hx : x β Ioo (0 : β) 1) (hy : y β Ioo (0 : β) 1) : HasDerivAt (fun t : β => rogersL t - rogersL (t * y) - rogersL (t * (1 - y) / (1 - t * y)) - rogersL (y * (1 - t) / (1 - t * y))) 0 x := by obtain β¨hx0, hx1β© := hx obtain β¨hy0, hy1β© := hy have hD : (0 : β) < 1 - x * y := by nlinarith have hD' : (1 : β) - x * y β 0 := ne_of_gt hD have h1y : (0 : β) < 1 - y := by linarith have h1x : (0 : β) < 1 - x := by linarith -- membership of the three composite arguments in (0,1) have ha : x * y β Ioo (0 : β) 1 := β¨mul_pos hx0 hy0, by nlinarithβ© have hb : x * (1 - y) / (1 - x * y) β Ioo (0 : β) 1 := β¨div_pos (mul_pos hx0 h1y) hD, by rw [div_lt_one hD]; nlinarithβ© have hc : y * (1 - x) / (1 - x * y) β Ioo (0 : β) 1 := β¨div_pos (mul_pos hy0 h1x) hD, by rw [div_lt_one hD]; nlinarithβ© -- derivatives of the three rational arguments have da : HasDerivAt (fun t : β => t * y) y x := by simpa using (hasDerivAt_id x).mul_const y have dden : HasDerivAt (fun t : β => 1 - t * y) (-y) x := by simpa using ((hasDerivAt_id x).mul_const y).const_sub (1 : β) have dbnum : HasDerivAt (fun t : β => t * (1 - y)) (1 - y) x := by simpa using (hasDerivAt_id x).mul_const (1 - y) have db := dbnum.div dden hD' have dcnum : HasDerivAt (fun t : β => y * (1 - t)) (y * -1) x := ((hasDerivAt_id x).const_sub (1 : β)).const_mul y have dc := dcnum.div dden hD' -- compose with the Rogers-L derivative have Lx := hasDerivAt_rogersL β¨hx0, hx1β© have La := (hasDerivAt_rogersL ha).comp x da have Lb := (hasDerivAt_rogersL hb).comp x db have Lc := (hasDerivAt_rogersL hc).comp x dc have HG := ((Lx.sub La).sub Lb).sub Lc convert HG using 1 <;> try rfl -- now the algebraic + logarithmic cancellation `0 = (derivative expression)` have hxy0 : x * y β 0 := ne_of_gt (mul_pos hx0 hy0) have hx0' : x β 0 := ne_of_gt hx0 have hy0' : y β 0 := ne_of_gt hy0 have hDyx : (1 : β) - y * x β 0 := by rw [mul_comm]; exact hD' -- simplify `1 - b` and `1 - c` have hb1 : 1 - x * (1 - y) / (1 - x * y) = (1 - x) / (1 - x * y) := by field_simp; ring have hc1 : 1 - y * (1 - x) / (1 - x * y) = (1 - y) / (1 - x * y) := by field_simp; ring rw [hb1, hc1] -- expand all logarithms into the basis rw [Real.log_mul hx0' hy0', Real.log_div (mul_pos hx0 h1y).ne' hD', Real.log_mul hx0' h1y.ne', Real.log_div h1x.ne' hD', Real.log_div (mul_pos hy0 h1x).ne' hD', Real.log_mul hy0' h1x.ne', Real.log_div h1y.ne' hD'] have h1x' : (1 : β) - x β 0 := h1x.ne' have h1y' : (1 : β) - y β 0 := h1y.ne' field_simp ring open Filter Topology /-- `L(t) β 0` as `t β 0βΊ`: the `Liβ` part is continuous, and `log t Β· log(1βt) β 0` issqueezed by `2Β·(βt log t) β 0` (using `βlog(1βt) β€ 2t` on `(0,Β½]`). -/theorem tendsto_rogersL_nhdsGT_zero : Tendsto rogersL (π[>] (0 : β)) (π 0) := by have hLi : Tendsto Liβ (π[>] (0 : β)) (π 0) := by have hc : Tendsto Liβ (π[Icc (-1 : β) 1] 0) (π 0) := by have := (continuousOn_Liβ.continuousWithinAt (by norm_num : (0:β) β Icc (-1:β) 1)).tendsto rwa [Liβ_zero] at this refine hc.mono_left ?_ rw [nhdsWithin_le_iff] exact mem_nhdsWithin_of_mem_nhds (Icc_mem_nhds (by norm_num) (by norm_num)) have hmem1 : Ioo (0:β) 1 β π[>] (0:β) := (nhdsGT_basis (0:β)).mem_of_mem (show (0:β) < 1 by norm_num) have hmem2 : Ioo (0:β) (1/2) β π[>] (0:β) := (nhdsGT_basis (0:β)).mem_of_mem (show (0:β) < 1/2 by norm_num) have hlog : Tendsto (fun t : β => Real.log t * Real.log (1 - t)) (π[>] (0 : β)) (π 0) := by have hg : Tendsto (fun t : β => 2 * Real.negMulLog t) (π[>] (0 : β)) (π 0) := by have h0 : Tendsto Real.negMulLog (π[>] (0 : β)) (π 0) := by simpa using (Real.continuous_negMulLog.tendsto (0 : β)).mono_left (nhdsWithin_le_nhds (a := (0:β)) (s := Set.Ioi 0)) simpa using h0.const_mul 2 refine squeeze_zero' ?_ ?_ hg Β· filter_upwards [hmem1] with t ht have h1 : Real.log t β€ 0 := Real.log_nonpos ht.1.le ht.2.le have h2 : Real.log (1 - t) β€ 0 := Real.log_nonpos (by linarith [ht.2]) (by linarith [ht.1]) nlinarith [mul_nonneg (neg_nonneg.mpr h1) (neg_nonneg.mpr h2)] Β· filter_upwards [hmem2] with t ht have ht0 : 0 < t := ht.1 have h1t : (0:β) < 1 - t := by linarith [ht.2] have hlogt : Real.log t β€ 0 := Real.log_nonpos ht0.le (by linarith [ht.2]) have hb : -Real.log (1 - t) β€ 2 * t := by have h := Real.one_sub_inv_le_log_of_pos h1t have e : (1 - t)β»ΒΉ - 1 = t / (1 - t) := by field_simp; ring have hle : t / (1 - t) β€ 2 * t := by rw [div_le_iffβ h1t]; nlinarith [ht.2, ht0] have hh : -Real.log (1 - t) β€ (1 - t)β»ΒΉ - 1 := by linarith rw [e] at hh; linarith calc Real.log t * Real.log (1 - t) = (-Real.log t) * (-Real.log (1 - t)) := by ring _ β€ (-Real.log t) * (2 * t) := mul_le_mul_of_nonneg_left hb (neg_nonneg.mpr hlogt) _ = 2 * Real.negMulLog t := by rw [show Real.negMulLog t = -t * Real.log t from rfl]; ring have hr : rogersL = fun t => Liβ t + Real.log t * Real.log (1 - t) / 2 := rfl rw [hr] simpa using hLi.add (hlog.div_const 2) /-- The Rogers `L`-function is continuous at every interior point of `(0,1)`. -/theorem continuousAt_rogersL {x : β} (hx : x β Ioo (0 : β) 1) : ContinuousAt rogersL x := by obtain β¨hx0, hx1β© := hx have hLi : ContinuousAt Liβ x := continuousOn_Liβ.continuousAt (Icc_mem_nhds (by linarith) (by linarith)) have hlog1 : ContinuousAt (fun t : β => Real.log t) x := Real.continuousAt_log (ne_of_gt hx0) have hlog2 : ContinuousAt (fun t : β => Real.log (1 - t)) x := (Real.continuousAt_log (by linarith : (1 : β) - x β 0)).comp (continuousAt_const.sub continuousAt_id) have hr : rogersL = fun t => Liβ t + Real.log t * Real.log (1 - t) / 2 := rfl rw [hr] exact hLi.add ((hlog1.mul hlog2).div_const 2) /-- **Abel's five-term relation** in Rogers `L` form: for `x, y β (0,1)`,`L(x) + L(y) = L(xy) + L(x(1βy)/(1βxy)) + L(y(1βx)/(1βxy))`. The main theorem of weight-2dilogarithm theory. -/theorem rogersL_fiveterm {x y : β} (hx : x β Ioo (0 : β) 1) (hy : y β Ioo (0 : β) 1) : rogersL x + rogersL y = rogersL (x * y) + rogersL (x * (1 - y) / (1 - x * y)) + rogersL (y * (1 - x) / (1 - x * y)) := by obtain β¨hx0, hx1β© := hx obtain β¨hy0, hy1β© := hy have hyIoo : y β Ioo (0 : β) 1 := β¨hy0, hy1β© set G : β β β := fun t => rogersL t - rogersL (t * y) - rogersL (t * (1 - y) / (1 - t * y)) - rogersL (y * (1 - t) / (1 - t * y)) with hG -- G is constant on (0,1). have hd : β t β Ioo (0 : β) 1, HasDerivAt G 0 t := fun t ht => fiveterm_hasDerivAt_zero ht hyIoo have hGconst : β t β Ioo (0 : β) 1, G t = G x := fun t ht => isOpen_Ioo.is_const_of_deriv_eq_zero (convex_Ioo 0 1).isPreconnected (fun s hs => (hd s hs).differentiableAt.differentiableWithinAt) (fun s hs => (hd s hs).deriv) ht β¨hx0, hx1β© have hmem01 : Ioo (0:β) 1 β π[>] (0:β) := (nhdsGT_basis (0:β)).mem_of_mem (show (0:β) < 1 by norm_num) have hev : βαΆ t in π[>] (0:β), t β Ioo (0:β) 1 := eventually_of_mem hmem01 fun t ht => ht -- Boundary limit of each piece as t β 0βΊ. have key : β {f : β β β}, Tendsto f (π[>] (0 : β)) (π 0) β (βαΆ t in π[>] (0:β), 0 < f t) β Tendsto (fun t => rogersL (f t)) (π[>] 0) (π 0) := fun hf hpos => tendsto_rogersL_nhdsGT_zero.comp (tendsto_nhdsWithin_iff.mpr β¨hf, hposβ©) have hL_t : Tendsto (fun t : β => rogersL t) (π[>] 0) (π 0) := tendsto_rogersL_nhdsGT_zero have hty0 : Tendsto (fun t : β => t * y) (π[>] (0:β)) (π 0) := by have hc : Continuous fun t : β => t * y := by fun_prop simpa using (hc.tendsto (0:β)).mono_left nhdsWithin_le_nhds have hL_ty : Tendsto (fun t : β => rogersL (t * y)) (π[>] 0) (π 0) := key hty0 (hev.mono fun t ht => mul_pos ht.1 hy0) have hbcont : ContinuousAt (fun t : β => t * (1 - y) / (1 - t * y)) 0 := by refine ContinuousAt.div (continuousAt_id.mul continuousAt_const) (continuousAt_const.sub (continuousAt_id.mul continuousAt_const)) ?_ simp have hb0 : Tendsto (fun t : β => t * (1 - y) / (1 - t * y)) (π[>] (0:β)) (π 0) := by have h := hbcont.tendsto; simp only [zero_mul, zero_div] at h exact h.mono_left nhdsWithin_le_nhds have hL_b : Tendsto (fun t : β => rogersL (t * (1 - y) / (1 - t * y))) (π[>] 0) (π 0) := key hb0 (hev.mono fun t ht => div_pos (mul_pos ht.1 (by linarith [hy1])) (by nlinarith [ht.1, ht.2, hy0, hy1])) have hccont : ContinuousAt (fun t : β => y * (1 - t) / (1 - t * y)) 0 := by refine ContinuousAt.div (continuousAt_const.mul (continuousAt_const.sub continuousAt_id)) (continuousAt_const.sub (continuousAt_id.mul continuousAt_const)) ?_ simp have hcy : Tendsto (fun t : β => y * (1 - t) / (1 - t * y)) (π[>] (0:β)) (π y) := by have h := hccont.tendsto simp only [sub_zero, zero_mul, mul_one, div_one] at h exact h.mono_left nhdsWithin_le_nhds have hL_c : Tendsto (fun t : β => rogersL (y * (1 - t) / (1 - t * y))) (π[>] 0) (π (rogersL y)) := (continuousAt_rogersL hyIoo).tendsto.comp hcy have hlim : Tendsto G (π[>] 0) (π (-rogersL y)) := by have h := ((hL_t.sub hL_ty).sub hL_b).sub hL_c simpa using h -- G is eventually constant (= G x) near 0βΊ, so its limit is G x; hence G x = -L y. have hGx : G x = -rogersL y := by refine tendsto_nhds_unique ?_ hlim refine Tendsto.congr' ?_ (tendsto_const_nhds : Tendsto (fun _ : β => G x) (π[>] 0) (π (G x))) filter_upwards [hev] with t ht using (hGconst t ht).symm simp only [hG] at hGx linarith [hGx] end Dilog