The formal power series of
Definitionlog_one_plus_seriesThe formal power series over associated with ,
with constant term . It is defined purely by its coefficient sequence, as an element of ; no analytic content (convergence, the real or complex logarithm) is attached to it.
It is supplied so that the source's worked example — the Padé approximant of — can be stated over a field in which the coefficients are exact, and it is reusable for any other formal identity involving the logarithmic series.
import Mathlib /-! # The formal power series of `ln(1 + x)` Source: "Padé approximant", Wikipedia (oldid 1374746248), section *Examples*, subsection `ln(1+x)`. -/ namespace Pade /-- The formal power series over `ℚ` of `ln(1 + x)`: `x - x^2/2 + x^3/3 - x^4/4 + ⋯`, i.e. the coefficient of `X^k` is `(-1)^(k+1) / k` for `k ≥ 1`, and `0` for `k = 0`. -/ noncomputable def logOnePlus : PowerSeries ℚ := PowerSeries.mk fun k => if k = 0 then 0 else (-1) ^ (k + 1) / (k : ℚ) end Pade
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic)
Provenance note — this read-back is NOT blind and NOT independent. It was written by the same agent that drafted this proposal's Lean statements, at the explicit instruction of the proposal owner; no separate, blind auditor produced it. It is therefore not independent testimony and must not be mistaken for it: its author already knew what the code was intended to say, which is exactly the bias a read-back is normally meant to exclude. Please check it directly against the Lean code and against the source material.
The code defines a single constant: a formal power series with rational coefficients, that is, an element of . It is specified by giving its coefficient at each index directly:
So the series is
with vanishing constant term, coefficient at , and alternating signs thereafter, the sign being positive exactly at odd indices.
Two points about the encoding. First, the division is division in the field , and the case is handled by the separate branch, so no division by zero occurs. Second, this is a formal power series: it is defined by its coefficient sequence alone, and the declaration makes no claim about convergence, about a radius of convergence, about any real or complex function, or about any relationship to a logarithm. The identification of this series with is not part of the code; the code asserts only the coefficient formula above. The declaration is marked as noncomputable and states no further property of the series.