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 #
Cslib.Complexity.RealAlgebraic.gridPoint: base-modulus grid-address decoding.Cslib.Complexity.RealAlgebraic.gridWeight: product of modular Fourier weights.
Main results #
Cslib.Complexity.RealAlgebraic.gridPoint_polyTime,Cslib.Complexity.RealAlgebraic.gridWeight_polyTime: uniform polynomial-time grid access.Cslib.Complexity.RealAlgebraic.sum_gridPoint: every grid point occurs exactly once.
The first n base-p digits, least significant coordinate first.
theorem Cslib.Complexity.RealAlgebraic.gridPoint_polyTime {α : Type} {enc : α ↪ List Bool} {p n r : α → ℕ} (hp : Turing.MultiTapeTM.ComputableInPolyTime p enc Turing.MultiTapeTM.encNat) (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encUnary) (hr : Turing.MultiTapeTM.ComputableInPolyTime r enc Turing.MultiTapeTM.encNat) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (w : α) => gridPoint (p w) (n w) (r w)) enc
(Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat)
theorem Cslib.Complexity.RealAlgebraic.gridWeight_polyTime {α : Type} {enc : α ↪ List Bool} {p n : α → ℕ} {β z : α → List ℕ} (hp : Turing.MultiTapeTM.ComputableInPolyTime p enc Turing.MultiTapeTM.encNat) (hn : Turing.MultiTapeTM.ComputableInPolyTime n enc Turing.MultiTapeTM.encUnary) (hβ : Turing.MultiTapeTM.ComputableInPolyTime β enc (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat)) (hz : Turing.MultiTapeTM.ComputableInPolyTime z enc (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encNat)) :
Turing.MultiTapeTM.ComputableInPolyTime (fun (w : α) => gridWeight (p w) (n w) (β w) (z w)) enc
Turing.MultiTapeTM.encNat
theorem Cslib.Complexity.RealAlgebraic.sum_gridPoint {p n : ℕ} [NeZero p] {M : Type u_1} [AddCommMonoid M] (F : (Fin n → ZMod p) → M) :
A single natural-number range enumerates the entire grid exactly once. The zero-dimensional grid has one empty point.