Integer Nisan powering by a fixed sweep #
For a matrix of integer transition counts with an absorbing sink, the seven-register sweep can evaluate an entry of Nisan powering. The sweep accepts a numbered-letter function, which on a valid seed and position must give the corresponding Nisan block.
Main results #
sweepHits_eq_nisanHitsidentifies the sweep's counter with the number of Nisan starting blocks taking a given source to a given destination.
theorem Cslib.Probability.SaksZhou.sweepHits_eq_nisanHits {n b k : ℕ} (scale : ℕ) (counts : ℕ → ℕ → ℕ) (hs : Fin k → ToeplitzSeed b) (label : ℕ → ℕ → ℕ) (hlabel :
∀ (x : BitString b) (t : Fin (2 ^ k)),
label ↑((BitString.equivFin b) x) ↑t = ↑((BitString.equivFin b) (Crypto.PRG.Nisan.blocks toeplitzHash k x hs t))) (hrow : ∀ (i : Fin n), ∑ j : Fin n, counts ↑i ↑j * scale ≤ 2 ^ b) (hsink : ∀ (j : ℕ), counts n j = 0) (src dst : Fin n) :
((fun (s : SweepState) =>
sweepUpdate n (2 ^ k) scale (↑src) (↑dst) label s (counts s.current s.j))^[2 ^ b * ((n + 2) * 2 ^ k + 1)]
(sweepStart n ↑src)).hits = {x : BitString b |
List.foldl
(walkStepOfCounts (Equiv.refl (Fin n)) (BitString.equivFin b) fun (i j : Fin n) => counts ↑i ↑j * scale)
(some src) (List.ofFn (Crypto.PRG.Nisan.blocks toeplitzHash k x hs)) = some dst}.card
Counting starting letters by sweeping all columns and positions gives the exact numerator
of a Nisan-powered entry. The natural identifier n is the absorbing sink.