The three semantically distinct stage-1 gcd outcomes.
- noFactor : PMinusOneResult
- factor (value : Nat) : PMinusOneResult
- whole : PMinusOneResult
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Hex.Nat.instDecidableEqPMinusOneResult.decEq Hex.Nat.PMinusOneResult.noFactor Hex.Nat.PMinusOneResult.noFactor = isTrue ⋯
- Hex.Nat.instDecidableEqPMinusOneResult.decEq Hex.Nat.PMinusOneResult.noFactor (Hex.Nat.PMinusOneResult.factor value) = isFalse ⋯
- Hex.Nat.instDecidableEqPMinusOneResult.decEq Hex.Nat.PMinusOneResult.noFactor Hex.Nat.PMinusOneResult.whole = isFalse Hex.Nat.instDecidableEqPMinusOneResult.decEq._proof_2✝
- Hex.Nat.instDecidableEqPMinusOneResult.decEq (Hex.Nat.PMinusOneResult.factor value) Hex.Nat.PMinusOneResult.noFactor = isFalse ⋯
- Hex.Nat.instDecidableEqPMinusOneResult.decEq (Hex.Nat.PMinusOneResult.factor a) (Hex.Nat.PMinusOneResult.factor b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Hex.Nat.instDecidableEqPMinusOneResult.decEq (Hex.Nat.PMinusOneResult.factor value) Hex.Nat.PMinusOneResult.whole = isFalse ⋯
- Hex.Nat.instDecidableEqPMinusOneResult.decEq Hex.Nat.PMinusOneResult.whole Hex.Nat.PMinusOneResult.noFactor = isFalse Hex.Nat.instDecidableEqPMinusOneResult.decEq._proof_7✝
- Hex.Nat.instDecidableEqPMinusOneResult.decEq Hex.Nat.PMinusOneResult.whole (Hex.Nat.PMinusOneResult.factor value) = isFalse ⋯
- Hex.Nat.instDecidableEqPMinusOneResult.decEq Hex.Nat.PMinusOneResult.whole Hex.Nat.PMinusOneResult.whole = isTrue ⋯
Instances For
Equations
The result of one counted deterministic stage-1 call. A call is one
attempt on every terminal gcd outcome. Pollard p - 1 draws no randomness,
so the returned generator is exactly the supplied state; carrying it here
lets randomized callers resume through the same boundary as rho.
- result : PMinusOneResult
The terminal gcd outcome.
- attempts : Nat
Semantic stage-1 calls executed; always one at this boundary.
- rand : Rand
The unchanged generator state.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Maximum supported stage-one bound. Stage primes come from the verified runtime sieve, independently of the committed table. Ordinary search policies may select smaller bounds.
Equations
- Hex.Nat.smoothBoundCap = 524288
Instances For
Clamp a requested stage-1 bound to the supported runtime range.
Equations
- Hex.Nat.smoothBound bound = min bound Hex.Nat.smoothBoundCap
Instances For
One deterministic Pollard p - 1 stage-1 attempt. Invalid bases or
moduli return noFactor; a gcd equal to the modulus is reported separately
as whole. The effective smoothness bound is smoothBound bound, with every prime up to that bound included by the runtime sieve.
Equations
- Hex.Nat.pMinusOneStage1 n base bound = Hex.Nat.pMinusOneStage1Core✝ n base (Hex.Nat.smoothBound bound)
Instances For
One counted, resumable Pollard p - 1 stage-1 attempt. The deterministic
primitive consumes no generator words, but every call costs exactly one search
attempt whether it returns noFactor, a proper factor, or whole.
Equations
- Hex.Nat.pMinusOneStage1Counted n base bound r = { result := Hex.Nat.pMinusOneStage1 n base bound, attempts := 1, rand := r }
Instances For
Requests beyond the supported runtime range are exactly capped.
Every reported factor is a dynamically checked proper divisor.
A proper factor returned through the counted boundary satisfies the same dynamically checked contract as the compatibility result.
Independent ceiling for the continuation's prime enumeration.
Equations
- Hex.Nat.PMinusOne.stage2BoundCap = 4194304
Instances For
Never increase the requested continuation bound.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Untrusted diagnostics produced by one execution, including zero-attempt policy skips. Reasons distinguish invalid inputs, empty intervals, setup factors, stage factors, whole gcds, and ready residues.
- subject : Nat
- requestedB1 : Nat
- effectiveB1 : Nat
- outcome : PMinusOneResult
- reason : String
- candidates : Nat
- giantAdvances : Nat
- multiplications : Nat
- setupGcds : Nat
- batchGcds : Nat
- recoveryGcds : Nat
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
The stage boundary retains its residue only after both gcds equal one.
- result : PMinusOneResult
- event : Event
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Execute stage 1 once, retaining the ready residue and its diagnostics.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Largest power of the supplied prime within the effective first bound.
Equations
Instances For
The loop computes the maximal prime power, including its full exponent, not just the product of small distinct primes.
The stage-1 exponent, used in statements only. Execution applies each prime power successively and never constructs this product.
Equations
- Hex.Nat.PMinusOne.exponent B₁ = (List.map (fun (x : Nat) => Hex.Nat.PMinusOne.primePower x B₁) (Hex.Nat.primesBelow (Hex.Nat.smoothBound B₁ + 1))).prod
Instances For
Complete ascending interval, including the small primes dividing 210.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Recover from retained terms in their original order. A whole leaf does not hide a proper divisor in a later leaf. Returns only executed gcds.
Equations
- Hex.Nat.PMinusOne.recover n terms = (Hex.Nat.PMinusOne.Checked.result✝ (Hex.Nat.PMinusOne.recoverCore✝ n terms).fst, (Hex.Nat.PMinusOne.recoverCore✝ n terms).snd)
Instances For
All 210 babies and the next power, built by successive multiplication.
Equations
- Hex.Nat.PMinusOne.babies n x = Hex.Nat.PMinusOne.babyPowers✝ n x 210
Instances For
Exact multiply count of the direct binary power used for the initial giant: one square per bit plus one multiply per set bit.
Equations
Instances For
Advance the giant through every intervening block.
Equations
- Hex.Nat.PMinusOne.advance n h 0 x✝ = x✝
- Hex.Nat.PMinusOne.advance n h fuel.succ x✝ = Hex.Nat.PMinusOne.advance n h fuel (x✝ * h % n)
Instances For
A candidate captures a prime divisor exactly when the base order divides its exponent. The hypothesis identifies the actual baby/giant product.
Total raw-residue continuation. Every factor exit validates range and divisibility; no provenance of the supplied residue is assumed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Standalone search preserves the stage boundary instead of recomputing it.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Counted calls preserve deterministic state, including failed calls.
- result : PMinusOneResult
- attempts : Nat
- rand : Rand
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
The stage-1 exponentiation loop on prepared primes and a normalized base. Used to measure exponentiation separately from enumeration and setup.
Equations
- Hex.Nat.PMinusOne.smoothPower n x B₁ ps = Hex.Nat.raiseSmooth✝ n (Hex.Nat.smoothBound B₁) ps x
Instances For
The continuation on a prepared prime interval and saved residue. This measurement boundary omits the public raw-residue preflight and enumeration; callers supply the prepared data. Factor exits are still dynamically checked. The standalone APIs perform all preparation and remain the general entry points.
Equations
- One or more equations did not get rendered due to their size.
Instances For
One continuation always costs exactly one semantic attempt.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Charge stage 1 once and the continuation only when actually invoked.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Modular batch product, reducing after each multiplication as in the scan.
Equations
- Hex.Nat.PMinusOne.batchProduct n ts = List.foldl (fun (acc t : Nat) => acc * t % n) (1 % n) ts
Instances For
Flush a retained batch; the scan calls the same implementation.
Equations
- Hex.Nat.PMinusOne.flushBatch n product buffer = (Hex.Nat.PMinusOne.Checked.result✝ (Hex.Nat.PMinusOne.flush✝ n product buffer).fst, (Hex.Nat.PMinusOne.flush✝ n product buffer).snd)