Piecewise Quasi-Polynomials, Faulhaber Summation, and Polynomial-Time Evaluation #
This module defines quasi-polynomials, rational polyhedral chambers, and piecewise
quasi-polynomials on ℤ^d, establishes their algebraic closure laws and Faulhaber summation over
arbitrary integer intervals, and proves that any fixed integer-valued piecewise quasi-polynomial
is computable in polynomial time on a multi-tape Turing machine from binary-encoded inputs
(Turing.MultiTapeTM.ComputableInPolyTime) with positivity decidable in Cslib.Complexity.P.
1. Quasi-polynomials #
A quasi-polynomial on ℤ^d: a finite-index sublattice sublattice ≤ (Fin d → ℤ) together
with a rational multivariate polynomial poly z ∈ ℚ[X₁, …, X_d] for each coset
z ∈ (Fin d → ℤ) ⧸ sublattice.
Finite-index sublattice
L ⊆ ℤ^dof periodicity.The quotient
ℤ^d / Lis finite.Rational polynomial assigned to each coset
z ∈ ℤ^d / L.
Evaluate a quasi-polynomial at an integer vector y : Fin d → ℤ.
The zero quasi-polynomial.
A constant rational quasi-polynomial.
A pure multivariate polynomial viewed as a quasi-polynomial with trivial period.
The sublattice M • ℤ^d of integer vectors divisible entrywise by M.
Construct a quasi-polynomial from an explicit positive modulus M and polynomials indexed by
Fin d → ZMod M.
Every quasi-polynomial has a positive integer period M such that M • ℤ^d ≤ q.sublattice.
Refine the sublattice of a quasi-polynomial to a smaller finite-index sublattice L' ≤ L.
Pointwise sum of two quasi-polynomials.
Pointwise scalar multiplication of a quasi-polynomial by a rational scalar.
Pull back a quasi-polynomial along an affine map y ↦ B y + c.
Multiply a quasi-polynomial by a periodic {0, 1} indicator
pred : (Fin d → ZMod M) → Prop.
2. Polyhedral Chambers and Piecewise Quasi-Polynomials #
A rational polyhedral chamber in ℤ^d, defined as the intersection of finitely many closed
rational half-spaces {y ∈ ℤ^d : ∑ i, a i * y i ≤ c}.
List of linear inequality constraints
(a, c)representing∑ i, a i * y i ≤ c.
The set of integer lattice points belonging to a polyhedral chamber.
The underlying real rational convex polyhedron {x ∈ ℝ^d : ∀ (a, c) ∈ ineqs, a · x ≤ c}.
Every polyhedral chamber's real locus is a convex polyhedron.
The whole space ℤ^d as a chamber with no constraints.
Intersection of two polyhedral chambers.
Add a single linear inequality a · y ≤ c to a chamber.
Pull back a chamber along an affine map y ↦ B y + c.
Decidable check whether y : Fin d → ℤ belongs to a polyhedral chamber.
Decidability of membership in a rational polyhedral chamber.
A piecewise quasi-polynomial function on ℤ^d: a finite partition of ℤ^d into pairwise
disjoint rational polyhedral chambers together with a quasi-polynomial on each chamber.
Finite list of
(chamber, quasiPolynomial)pieces.The chambers cover
ℤ^d.- disjoint : List.Pairwise (fun (a b : PolyhedralChamber d × QuasiPolynomial d) => Disjoint a.1.carrier b.1.carrier) self.pieces
The chambers are pairwise disjoint on
ℤ^d.
Evaluate a piecewise quasi-polynomial at y : Fin d → ℤ.
A single quasi-polynomial viewed as a piecewise quasi-polynomial on ℤ^d.
The zero piecewise quasi-polynomial.
Scalar multiplication of a piecewise quasi-polynomial by a rational scalar.
Pointwise sum of two piecewise quasi-polynomials on the common refinement of their chambers.
Pull back a piecewise quasi-polynomial along an affine map y ↦ B y + c.
Multiply a piecewise quasi-polynomial by a periodic {0, 1} indicator.
Split a chamber partition by a single linear inequality a · y ≤ c and its complement
(-a) · y ≤ -c - 1.
Split a chamber partition successively by a finite list of linear inequalities.
Every chamber in splitPartitionList decides every inequality in ineqs uniformly.
3. Faulhaber Polynomial Summation over Arbitrary Integer Intervals #
For each degree j : ℕ, there exists a rational polynomial Q : ℚ[X] satisfying the
forward-difference identity Q(X + 1) - Q(X) = X ^ j.
Chosen Faulhaber antiderivative polynomial satisfying Q(X + 1) - Q(X) = X ^ j.
Summing m ^ j over any integer interval Finset.Icc a b with a ≤ b + 1 equals
faulhaberPoly j (b + 1) - faulhaberPoly j a.
Summing a multivariate polynomial P(b - m • v) over m ∈ Finset.Icc lo hi (lo ≤ hi + 1)
yields a multivariate polynomial in (b, lo, hi).
4. Polynomial-Time Evaluation on Multi-Tape Turing Machines #
Deciding membership in a fixed polyhedral chamber C is computable in polynomial time.
Evaluating a fixed integer multivariate polynomial P : MvPolynomial (Fin d) ℤ at binary
integer inputs y : Fin d → ℤ is computable in polynomial time.
Polynomial-Time Evaluation of Fixed Piecewise Quasi-Polynomials:
any integer-valued function g : (Fin d → ℤ) → ℤ given by a fixed
piecewise quasi-polynomial is computable in polynomial time on a multi-tape Turing machine from
binary-encoded inputs.
Polynomial-time evaluation of a nonnegative-integer-valued piecewise quasi-polynomial,
outputting binary natural numbers (encNat).
Polynomial-Time Positivity Decision:
deciding whether a fixed integer-valued piecewise quasi-polynomial is strictly positive lies in
Cslib.Complexity.P.