Native minimum and candidate-advance steps #
The actual strict-minimum update realizes the prefix-minimum invariant. The actual successor code advances the candidate and recomputes its square in two charged instructions. The counter must separately establish the value supplied to the minimum update; these local rules do not assume a complete modular-counting endpoint.
The prefix-minimum invariant BestBefore and its update rules are private to the proof-only
companion PrimeSelection.Minimum; this module reads them through import all.
theorem Cslib.Algorithms.WordRAM.ExactTriangle.PrimeSelection.exec_advance {w : ℕ} (x : WordRAM.Data 160) (ho : x.regs Reg.one = 1) (hfit : WordRAM.Fits w ((x.regs Reg.cursor + 1) * (x.regs Reg.cursor + 1))) :
∃ (y : WordRAM.Data 160),
WordRAM.ExecWithin w advance x y 2 ∧ y.regs Reg.cursor = x.regs Reg.cursor + 1 ∧ y.regs Reg.square = (x.regs Reg.cursor + 1) * (x.regs Reg.cursor + 1) ∧ y.mem = x.mem ∧ ∀ (i : Fin 160), i ≠ Reg.cursor → i ≠ Reg.square → y.regs i = x.regs i
Advance to the next candidate and compute its actual square. All other registers and all memory cells survive. Numerical admission is for the new square itself.