Computable polynomials #
Mathlib's Polynomial is noncomputable (it is Finsupp-based), which
rules out native_decide verification of identities in polynomial or
rational-function coefficients. This file provides CPoly K, a computable
polynomial ring over a DecidableEq commutative ring, as trimmed
coefficient lists (little-endian, no trailing zeros).
The ring axioms are not proven from scratch: the coefficient-list
operations are transported along the injective evaluation
CPoly.toPoly : CPoly K → Polynomial K via Function.Injective.commRing.
The intended use is the generic-parameter verification of order
conditions for the parametric EES(2,5;x) family: with a computable
fraction field of CPoly ℚ the symbolic identities of
arXiv:2509.20599, Theorem E.1, become native_decide checks.
Remove trailing zeros.
Equations
- BSeries.CPoly.trim l = (List.dropWhile (fun (x : L) => x == 0) l.reverse).reverse
Instances For
Raw coefficient-list operations #
Pointwise addition (little-endian, ragged).
Equations
- BSeries.CPoly.rawAdd [] x✝ = x✝
- BSeries.CPoly.rawAdd (a :: l) [] = a :: l
- BSeries.CPoly.rawAdd (a :: l) (b :: m) = (a + b) :: BSeries.CPoly.rawAdd l m
Instances For
Negation.
Equations
Instances For
Convolution product.
Equations
- BSeries.CPoly.rawMul [] x✝ = []
- BSeries.CPoly.rawMul (a :: l) x✝ = BSeries.CPoly.rawAdd (List.map (fun (x : K) => a * x) x✝) (0 :: BSeries.CPoly.rawMul l x✝)
Instances For
Interpret a coefficient list as a polynomial.
Equations
Instances For
Interpret a trimmed coefficient list as a polynomial.
Equations
Instances For
Ring structure by injective transfer #
Constant polynomials.
Equations
Instances For
Equations
- BSeries.CPoly.instOne = { one := BSeries.CPoly.C 1 }
Equations
- BSeries.CPoly.instAdd = { add := fun (p q : BSeries.CPoly K) => ⟨BSeries.CPoly.trim (BSeries.CPoly.rawAdd ↑p ↑q), ⋯⟩ }
Equations
- BSeries.CPoly.instMul = { mul := fun (p q : BSeries.CPoly K) => ⟨BSeries.CPoly.trim (BSeries.CPoly.rawMul ↑p ↑q), ⋯⟩ }
Equations
- BSeries.CPoly.instNeg = { neg := fun (p : BSeries.CPoly K) => ⟨BSeries.CPoly.trim (BSeries.CPoly.rawNeg ↑p), ⋯⟩ }
Equations
- p.instDecidableEq q = decidable_of_iff (↑p = ↑q) ⋯
The commutative ring structure: axioms transported from
Polynomial K through the injection, data fully computable.
Equations
- BSeries.CPoly.instCommRing = CommRing.ofMinimalAxioms ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
toPoly as a ring homomorphism.
Equations
- BSeries.CPoly.toPolyHom = { toFun := BSeries.CPoly.toPoly, map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ }
Instances For
The polynomial variable.
Equations
Instances For
No zero divisors, transported along the injection.
Unverified division and gcd #
Polynomial long division and the Euclidean algorithm, for use as runtime-checked reductions: callers verify the defining equations by a decidable guard, so no correctness theory is needed here.
One pass of polynomial long division (fuelled; little-endian).
Equations
Instances For
Quotient and remainder of polynomial division (unverified).
Equations
- BSeries.CPoly.rawDivMod p q = BSeries.CPoly.rawDivModAux (BSeries.CPoly.trim q) (p.length + 1) p
Instances For
Euclidean gcd, normalised to be monic (unverified).
Equations
- One or more equations did not get rendered due to their size.
- BSeries.CPoly.rawGcd 0 x✝¹ x✝ = BSeries.CPoly.trim x✝¹
Instances For
Monic gcd of two computable polynomials (unverified).
Equations
- p.cGcd q = ⟨BSeries.CPoly.trim (BSeries.CPoly.rawGcd ((↑p).length + (↑q).length + 2) ↑p ↑q), ⋯⟩
Instances For
Quotient of polynomial division (unverified).
Equations
- p.cDiv q = ⟨BSeries.CPoly.trim (BSeries.CPoly.rawDivMod ↑p ↑q).1, ⋯⟩