Documentation

CslibFrontier.Algorithms.WordRAM.ExactTriangle.PrimeSelection.Header

Initialized prime-selector code and actual header delivery #

The existing counter's nine-instruction header reads raw (n,D) and computes the three original array pointers and workspace start. It only reads/copies the second scalar; no counter is run with D as a modulus. Six copies preserve these actual arguments in the selector's high bank before its loop computes and tests candidate primes.

The input is the existing CountPrime.inputWords n D values format, interpreting the second unsigned header as the window parameter rather than a supplied prime. The complete entry program contains the actual cyclic-Strassen counter and no runtime solver argument.

Reuse the actual native matrix header and move its six arguments into selector metadata.

One fixed initialized native program, including the actual modular counter.

The initialized selector adds 56 slots to the complete initialized counter's flat code.

theorem Cslib.Algorithms.WordRAM.ExactTriangle.PrimeSelection.exec_header {W n D : ℕ} (x : WordRAM.Data 160) (hn : x.mem 1 = n) (hD : x.mem 2 = D) (hw : WordRAM.Fits W (3 + 3 * (n * n) + 8)) :
∃ (y : WordRAM.Data 160), WordRAM.ExecWithin W header x y 15 ∧ y.mem = x.mem ∧ y.regs Reg.side = n ∧ y.regs Reg.window = D ∧ y.regs Reg.inputAB = 3 ∧ y.regs Reg.inputBC = 3 + n * n ∧ y.regs Reg.inputAC = 3 + 2 * (n * n) ∧ y.regs Reg.scratch = 3 + 3 * (n * n)

Read both original scalar words, compute all source/workspace pointers and deliver the real selector metadata in fifteen charged instructions, preserving every memory cell.