Charged native trial division #
This is a finite instruction program, not an invocation of Lean's primality decision procedure. The Chan–He prime table will call it only on candidates at least two.
Main definitions #
PrimeTrial.program: trial divisors from two up to the candidate.
Main results #
PrimeTrial.exec: native trial division with an explicit linear instruction bound.
@[reducible, inline]
Candidate, preserved.
Instances For
@[reducible, inline]
Current trial divisor.
Instances For
@[reducible, inline]
Primality flag.
Instances For
@[reducible, inline]
Remainder scratch.
Instances For
@[reducible, inline]
Constant one.
Instances For
@[reducible, inline]
Constant zero.
Instances For
Test one trial divisor and advance. The conditional also charges its control instructions.
Instances For
Initialize and test every divisor strictly between one and the candidate.
Instances For
theorem Cslib.Algorithms.WordRAM.PrimeTrial.exec {w : ℕ} (x : WordRAM.Data 6) (hp : 2 ≤ x.regs arg) (hfit : WordRAM.Fits w (x.regs arg + 2)) :
Test a candidate at least two in at most 7(p-2)+6 native instructions.
All divisors are actual register values; the native remainder instruction is charged.