/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ module public import Mathlib.Analysis.SpecialFunctions.Log.Basic public import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic import Mathlib.MeasureTheory.Integral.Bochner.Set import Mathlib.Tactic.FieldSimp import Mathlib.Tactic.Linarith import Mathlib.Tactic.Ring

Cauchy Principal-Value Logarithmic Integral

This file defines Real.logIntegralTwo ($\operatorname{li}(2)$) and Real.logIntegral ($\operatorname{li}(x) = \operatorname{li}(2) + \int_2^x \frac{dt}{\log t}$) and establishes basic positivity, integrability, and monotonicity properties.

@[expose] public sectionnamespace Real

Cauchy principal value $\operatorname{li}(2) = \int_0^1 \left(\frac{1}{\log(1 + u)} + \frac{1}{\log(1 - u)}\right) du \approx 1.04516378$.

noncomputable def logIntegralTwo : ℝ := ∫ u in Set.Ioo (0 : ℝ) 1, (1 / Real.log (1 + u) + 1 / Real.log (1 - u))

Principal-value logarithmic integral $\operatorname{li}(x) = \operatorname{li}(2) + \int_2^x \frac{dt}{\log t}$ for $x > 1$ (for $x \le 1$, the non-integrable interval integral across $t = 1$ vanishes in Mathlib).

noncomputable def logIntegral (x : ℝ) : ℝ := logIntegralTwo + ∫ t in (2 : ℝ)..x, 1 / Real.log t

On $(0, 1)$, the symmetrized Cauchy principal-value integrand defining logIntegralTwo is strictly positive.

u:ℝhu0:0 < uhu1:u < 1hpos:0 < log (1 + u)hneg:log (1 - u) < 0hsum:log (1 - u) + log (1 + u) < 0⊢ 0 < (1 * log (1 - u) + log (1 + u) * 1) / (log (1 + u) * log (1 - u)) exact div_pos_of_neg_of_neg (u:ℝhu0:0 < uhu1:u < 1hpos:0 < log (1 + u)hneg:log (1 - u) < 0hsum:log (1 - u) + log (1 + u) < 0⊢ 1 * log (1 - u) + log (1 + u) * 1 < 0 All goals completed! 🐙) (mul_neg_of_pos_of_neg hpos hneg)

On $(0, 1)$, the symmetrized Cauchy principal-value integrand defining logIntegralTwo is bounded above by $2$.

u:ℝhu0:0 < uhu1:u < 1h1pu:0 < 1 + uh1mu:0 < 1 - uhpos:0 < log (1 + u)hneg:0 < -log (1 - u)hb1:1 / log (1 + u) ≤ (1 + u) / uhb2:(1 - u) / u ≤ 1 / -log (1 - u)hsum2:(1 + u) / u - (1 - u) / u = 2⊢ 1 / log (1 + u) + 1 / log (1 - u) ≤ 2 u:ℝhu0:0 < uhu1:u < 1h1pu:0 < 1 + uh1mu:0 < 1 - uhpos:0 < log (1 + u)hneg:0 < -log (1 - u)hb1:1 / log (1 + u) ≤ (1 + u) / uhb2:(1 - u) / u ≤ 1 / -log (1 - u)hsum2:(1 + u) / u - (1 - u) / u = 2hrew:1 / -log (1 - u) = -(1 / log (1 - u))⊢ 1 / log (1 + u) + 1 / log (1 - u) ≤ 2 All goals completed! 🐙

The symmetrized integrand defining logIntegralTwo is Bochner-integrable on $(0, 1)$.

hcont:ContinuousOn (fun u ↦ 1 / log (1 + u) + 1 / log (1 - u)) (Set.Ioo 0 1)u:ℝhu0:0 < uhu1:u < 1⊢ 1 / log (1 + u) + 1 / log (1 - u) ≤ 2 All goals completed! 🐙@[simp] theorem logIntegral_two : logIntegral 2 = logIntegralTwo := ⊢ logIntegral 2 = logIntegralTwo All goals completed! 🐙

logIntegral 2 is strictly positive.

f:ℝ → ℝ := fun u ↦ 1 / log (1 + u) + 1 / log (1 - u)hae:0 ≤ᵐ[MeasureTheory.volume.restrict (Set.Ioo 0 1)] f⊢ 0 < MeasureTheory.volume (Function.support f ∩ Set.Ioo 0 1) f:ℝ → ℝ := fun u ↦ 1 / log (1 + u) + 1 / log (1 - u)hae:0 ≤ᵐ[MeasureTheory.volume.restrict (Set.Ioo 0 1)] fhsupp:Function.support f ∩ Set.Ioo 0 1 = Set.Ioo 0 1⊢ 0 < MeasureTheory.volume (Function.support f ∩ Set.Ioo 0 1) All goals completed! 🐙

Offset identity $\operatorname{li}(x) - \operatorname{li}(2) = \int_2^x \frac{dt}{\log t}$.

theorem logIntegral_sub_logIntegralTwo (x : ℝ) : logIntegral x - logIntegralTwo = ∫ t in (2 : ℝ)..x, 1 / Real.log t := x:ℝ⊢ x.logIntegral - logIntegralTwo = ∫ (t : ℝ) in 2..x, 1 / log t All goals completed! 🐙

Monotonicity bound $\operatorname{li}(2) \le \operatorname{li}(x)$ for $x \ge 2$.

x:ℝhx:2 ≤ xhnonneg:0 ≤ ∫ (t : ℝ) in 2..x, 1 / log t⊢ logIntegralTwo ≤ logIntegralTwo + ∫ (t : ℝ) in 2..x, 1 / log t All goals completed! 🐙end Real