§2, p. 465 — the generator has period 108
ProvedCarryRNG.AWC.example_base10_periodadd-with-carryp2o-batch-pfp2bp2o-gran-per-chapterp2o-plan-paperp2o-v1random-number-generation
Take base and lags , , so that the add-with-carry map is
- If the seed is with , or with , then the sequence is strictly periodic with least period .
- If the seed is of neither type and is not one of the trivial seeds and , then the sequence beginning with is strictly periodic with least period .
Here is prime and is the order of modulo ; the statement is a concrete instance of the general period theorem of the mission.
Formalization Note The paper prints the second trivial seed as ""; the third entry is the carry bit, so the seed meant is , the trivial seed of p. 472. "Period 108" is stated as Function.minimalPeriod f _ = 108.
Preamble
import Mathlib import Definitions.Def_CarryRNG_AWC_step import Definitions.Def_CarryRNG_AWC_zeroSeed import Definitions.Def_CarryRNG_AWC_topSeed
Formal statement
namespace CarryRNG.AWC
theorem example_base10_period :
let L : Lags := ⟨2, 1, by norm_num, by norm_num⟩
(∀ z : State 10 L.r,
(z.c = 0 ∧ z.x 0 < z.x 1) ∨ (z.c = 1 ∧ z.x 1 < z.x 0) →
Function.minimalPeriod (step 10 L) z = 108) ∧
(∀ z : State 10 L.r,
¬ ((z.c = 0 ∧ z.x 0 < z.x 1) ∨ (z.c = 1 ∧ z.x 1 < z.x 0)) →
z ≠ zeroSeed 10 L.r (by norm_num) → z ≠ topSeed 10 L.r (by norm_num) →
Function.minimalPeriod (step 10 L) (step 10 L z) = 108) := by sorry
end CarryRNG.AWC
Source
G. Marsaglia and A. Zaman, A new class of random number generators, Ann. Appl. Probab. 1 (1991), p. 465, Section 2
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.