Word-RAM code for the searches of the packed step of the 4n - 9d refuter #
Standard-basis Word-RAM routines for the literal of a gate row and the pair search of the packed
step pApplyStep on the memory image Stored of a packed state, each with an execution theorem
in the library's Word-RAM cost model (Cslib.WordRAM.ExecWithin: every instruction is charged).
This file continues PackedScanCode (issue #4322, Milestone 4); it claims no running time for
a step or for the refuter.
Main definitions #
Cslib.Algorithms.WordRAM.Refuter4n.rowLitCode: the literal codesrowLitof a gate row of the image, a fixedCode .standard 32.Cslib.Algorithms.WordRAM.Refuter4n.pairCand: candidateqof the pair search, a pair of the searched name and the parameterq / 8.Cslib.Algorithms.WordRAM.Refuter4n.pairSearchCode: the pair searchpFindPairon the image, a fixedCode .standard 32.
Main results #
Cslib.Algorithms.WordRAM.Refuter4n.exec_rowLitCode_row,exec_rowLitCode:rowLitCodeleaves the two codes ofrowLitof the gate rowJ(given by its three words, or by the image) inReg.argBandReg.argCwithin25instructions.Cslib.Algorithms.WordRAM.Refuter4n.pFindPair_eq_getD:pFindPairfrom the first candidateq < 8 Non a parameter with a set parameter bit whose record is present.Cslib.Algorithms.WordRAM.Refuter4n.exec_pairSearchCode:pairSearchCodeleaves that first candidate (or8 N) and, when there is one, its record within8 N (12 k + 32) + 39instructions,kthe number of pair records.
The literal of a gate row #
rowLit of the gate row Reg.passVar of the image at Reg.base, into Reg.argB (argument
code) and Reg.argC (negation bit) (exec_rowLitCode).
The literal of a gate row from its three words. With the base address b and a gate
name J < N in Reg.base and Reg.passVar, and the three words of a row r within range
(RowLt N r) at b + 5 + 3 J (GateRowAt), rowLitCode leaves (rowLit r).1 in Reg.argB
and (rowLit r).2 in Reg.argC within 25 instructions, at every width w ≥ max 4 (N + 2) at
which b + 5 + 3 N fits. It keeps the memory and every register from 14 on except Reg.argB
and Reg.argC.
The literal of a gate row on the memory image. With the base address b and a gate name
J < N in Reg.base and Reg.passVar, for the image of P at b with N gate rows whose gate
row J is within range (RowLt N), rowLitCode leaves (rowLit r).1 in Reg.argB and
(rowLit r).2 in Reg.argC, r the gate row J, within 25 instructions, at every width
w ≥ max 4 (N + 2) at which b + 5 + 3 N fits. It keeps the memory and every register from 14
on except Reg.argB and Reg.argC.
The pair search #
pFindPair N p P scans the parameters r < N and, for each, eight candidate pairs of p and r
in a fixed order (pairCandidate p r t for t < 8). As one scan over q < 8 N, the candidate
q is pairCand p q = pairCandidate p (q / 8) q: the parameter q / 8, with the low bits of q
as the local index. The test of q computes the record of the candidate and looks it up in the
pair records with an inner loop.
Candidate q of the pair search of p: the candidate pairCandidate of p with the
parameter q / 8, at the local index given by the low bits of q.
pFindPair from the first candidate: the first candidate Q < 8 N on a parameter with a
set parameter bit whose record is present (8 N if there is none) gives pFindPair exactly when
Q < 8 N.
The pair search pFindPair on the image, for the name Reg.argB: the parameter mask, the
number and base of the pair records and the bound 8 N, the scan of the candidates, then the
record of the first hit into Reg.pairFst, Reg.pairSnd (exec_pairSearchCode).
The pair search on the memory image. With the base address b, the name bound N, the
numbers E and n of equation words and parameter rows and a name p in Reg.base, Reg.argN,
Reg.numE, Reg.numIn and Reg.argB, for the image of P at b with k pair records and a
word-sized parameter mask, pairSearchCode leaves in Reg.wT the first candidate
Q = ((List.range (8 N)).find? _).getD (8 N) of the scan of pFindPair_eq_getD, and, when
Q < 8 N, the record pairCode (pairCand p Q) in Reg.pairFst and Reg.pairSnd, within
8 N (12 k + 32) + 39 instructions, at every width w ≥ 4 at which 8 N + 1 and the address
b + 5 + 3 N + E + n + 2 k + 1 fit, for p < N. It keeps the memory and every register from 14
on except Reg.argA, Reg.argD, Reg.passBase, Reg.passLen, Reg.pairFst and
Reg.pairSnd.