Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

p. 472, Method 1 — classification of periodic seeds

Proved
CarryRNG.SWB.periodic_seed_iff

by mikedeng1 · Oct 6, 2026 · Mathlib 0df444a (Lean v4.33.1)

p2o-batch-pfp2bp2o-gran-per-chapterp2o-plan-paperp2o-v1random-number-generationsubtract-with-borrow

Let b≥2b\ge2b≥2, 0<s<r0<s<r0<s<r, and write A=xr⋯xs+1A=x_r\cdots x_{s+1}A=xr​⋯xs+1​ and B=xr−s⋯x1B=x_{r-s}\cdots x_1B=xr−s​⋯x1​ as base-bbb integers. A Method 1 seed (x1,…,xr,c)(x_1,\ldots,x_r,c)(x1​,…,xr​,c) is strictly periodic exactly in these cases:

(c=0 and A<B)or(c=1 and B<A)or(0,…,0,0)or(b−1,…,b−1,1).(c=0\ \text{and}\ A<B)\quad\text{or}\quad (c=1\ \text{and}\ B<A)\quad\text{or}\quad (0,\ldots,0,0)\quad\text{or}\quad(b-1,\ldots,b-1,1).(c=0 and A<B)or(c=1 and B<A)or(0,…,0,0)or(b−1,…,b−1,1).

The two named seeds are fixed points; the strict inequalities classify every nontrivial periodic seed. This is the paper’s Method 1 rule, with digit strings interpreted as integers.

Preamble
import Definitions.Def_CarryRNG_SWB_step
import Definitions.Def_CarryRNG_SWB_highBlock
import Definitions.Def_CarryRNG_SWB_lowBlock
import Definitions.Def_CarryRNG_AWC_zeroSeed
import Definitions.Def_CarryRNG_AWC_topSeed
Formal statement
namespace CarryRNG.SWB

/-- Page 472, Method 1: the strict inequalities classify the nontrivial periodic seeds. -/
theorem periodic_seed_iff (b : ℕ) (L : CarryRNG.AWC.Lags) (hb : 2 ≤ b) (z : CarryRNG.AWC.State b L.r) :
    z ∈ Function.periodicPts (step b L hb) ↔
      (z.c.val = 0 ∧ highBlock b L z < lowBlock b L z) ∨
      (z.c.val = 1 ∧ lowBlock b L z < highBlock b L z) ∨
      z = CarryRNG.AWC.zeroSeed b L.r hb ∨ z = CarryRNG.AWC.topSeed b L.r hb := by sorry

end CarryRNG.SWB
Source
G. Marsaglia and A. Zaman, A new class of random number generators, Ann. Appl. Probab. 1 (1991), p. 472, Section 4.5, Method 1
Human review
  • Endorsed by Shuze Chen · Oct 6, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 6, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me