Native row-major residue-class queries #
The program scans a square residue matrix and writes the row and column of each entry equal to
the runtime query residue. Its output order is the row-major order used by the existing finite
chunk construction. Prefix ranks use Mathlib's Nat.count.
This directly adapts the query-class construction in the pinned Theorem 17 class builder. The per-class scan is charged explicitly; composing all residue classes multiplies its bound by the modulus. No class-membership or query-list table is supplied to the program.
Main definitions #
QueryScan.program: the fixed twelve-register query scan.
Main results #
QueryScan.exec: actual scan execution, exact ranks and the output-prefix frame.
Square residue input pointer.
Instances For
Output pointer for consecutive row/column pairs.
Instances For
Matrix side.
Instances For
Selected residue.
Instances For
Flat input cursor.
Instances For
Input area.
Instances For
Number of emitted pairs.
Instances For
Address temporary.
Instances For
Loaded residue.
Instances For
Constant one.
Instances For
Output row.
Instances For
Output column.
Instances For
Every successful match computes both coordinates and stores their two words.
Instances For
Constants, counters and matrix area are initialized by actual instructions.
Instances For
The query scanner has a fixed instruction graph and no physical-width reads.
Scan an actual residue matrix, preserving the input and all cells outside the emitted pair
prefix. Each selected flat position is stored at its exact row-major rank, counted by Nat.count.
The final halt is excluded from the 14n²+6 instruction bound.