Documentation

CslibFrontier.Computability.Complexity.RealAlgebraic.GridEnumeration

Short addresses for finite-field grids #

An address below p^n enumerates one point in the n-dimensional prime-field grid. Decoding the address and forming Fourier weights are ordinary polynomial-time computations when n is unary and all other numbers are binary. Thus the whole grid can be handled by one counting sum.

Adapted from lean-canny.

Main definitions #

Main results #

The first n base-p digits, least significant coordinate first.

theorem Cslib.Complexity.RealAlgebraic.gridPoint_get {p n r i : ℕ} (hi : i < n) :
(gridPoint p n r)[i]?.getD 0 = r / p ^ i % p

Modular Fourier monomials are multiplied as a polynomially long list. Every factor already has binary length bounded by the input modulus.

theorem Cslib.Complexity.RealAlgebraic.gridWeight_cast {p : ℕ} [Fact (Nat.Prime p)] (n : ℕ) (β z : List ℕ) :
↑(gridWeight p n β z) = ∏ i : Fin n, ↑(z[↑i]?.getD 0) ^ (p - 1 - β[↑i]?.getD 0)
theorem Cslib.Complexity.RealAlgebraic.sum_gridPoint {p n : ℕ} [NeZero p] {M : Type u_1} [AddCommMonoid M] (F : (Fin n → ZMod p) → M) :
(∑ r ∈ Finset.range (p ^ n), F fun (i : Fin n) => ↑((gridPoint p n r)[↑i]?.getD 0)) = ∑ z : Fin n → ZMod p, F z

A single natural-number range enumerates the entire grid exactly once. The zero-dimensional grid has one empty point.