p. 472, Method 3 — the seeds whose add-with-carry sequence is strictly periodic
ProvedCarryRNG.AWC.periodic_seed_iffLet be a base, lags, and the add-with-carry map. For a state write, following the paper, and for the integers whose base- representations are these strings of digits (most significant digit on the left):
Then is a periodic point of (the sequence is strictly periodic, the seed itself recurring) if and only if
This is the paper's rule for "periodic seed vectors" of the add-with-carry generator (Method 3). It holds without any primality assumption, and it includes the two trivial seeds.
Formalization Note In Lean, sums x (s + i) * b ^ i and sums x i * b ^ i over i : Fin (r - s) (Lean index is the paper's ). The worked example on p. 473, item (a), prints these two inequalities reversed; this statement follows the rule on p. 472, which is the correct one.
import Mathlib import Definitions.Def_CarryRNG_AWC_step
namespace CarryRNG.AWC
theorem periodic_seed_iff (b : ℕ) (L : Lags) (hb : 2 ≤ b) (z : State b L.r) :
z ∈ Function.periodicPts (step b L) ↔
let A : ℕ := ∑ i : Fin (L.r - L.s),
(z.x ⟨L.s + i.val, by have := i.isLt; omega⟩).val * b ^ i.val
let B : ℕ := ∑ i : Fin (L.r - L.s),
(z.x ⟨i.val, by have := i.isLt; have := L.hs; omega⟩).val * b ^ i.val
(z.c = 0 ∧ B ≤ A) ∨ (z.c = 1 ∧ A ≤ B) := by sorry
end CarryRNG.AWC
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.