Executable exact rational polynomials #
Polynomial ℚ is the semantic representation used by Mathlib, but its sparse
implementation is not a suitable native certificate payload. QPoly stores
ascending coefficients in an Array ℚ and supplies a small exact executable
kernel. The toPoly lemmas connect successful computations to Mathlib.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
Instances For
Instances For
The polynomial variable.
Instances For
Equations
- p.derivative = { coeffs := (LeanCert.Engine.QPoly.trimCoeffs✝ (LeanCert.Engine.QPoly.derivativeCoeffs✝ p.coeffs.toList)).toArray }
Instances For
The exact rational antiderivative with constant coefficient zero.
Equations
- p.antiderivative = { coeffs := (0 :: LeanCert.Engine.QPoly.antiderivativeCoeffs✝ 1 p.coeffs.toList).toArray }
Instances For
Exact Horner evaluation over the rationals.
Equations
Instances For
Exact definite integral between rational endpoints.
Equations
- p.integralRat a b = p.antiderivative.evalRat b - p.antiderivative.evalRat a
Instances For
Sparse products with 1 - X^n and monomial shifts #
mul is dense (O(deg p · deg q)), which is far too slow for products of a
few hundred factors 1 - X^n of total degree in the hundreds of thousands.
mulOneSubPow computes p · (1 - X^n) as p - X^n · p in linear time.
p · (1 - X^n), in linear time.
Equations
- p.mulOneSubPow n = { coeffs := (LeanCert.Engine.QPoly.addCoeffs✝ p.coeffs.toList (List.replicate n 0 ++ LeanCert.Engine.QPoly.negCoeffs✝ p.coeffs.toList)).toArray }
Instances For
Composition and coefficient sums #
Horner composition p ∘ q, exact over the rationals.
Equations
Instances For
Evaluating a composition evaluates the inner polynomial first.
Convert to a single-variable Horner expression in variable 0.
Equations
Instances For
The Horner Expr and Mathlib polynomial have identical real semantics.
The executable exact integral agrees with the interval integral of the represented polynomial.
The analytic derivative of the Horner expression agrees with the formal polynomial derivative.