Word-RAM code for the children search and the affine representation of the 4n - 9d refuter #
Standard-basis Word-RAM routines for the children search pGetChildren, the evaluation oracle
pEvaluateAux and the affine representation pFindAffineRep 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
PackedSearchCode (issue #4322, Milestone 4); it claims no running time for a step or for the
refuter.
Main definitions #
Cslib.Algorithms.WordRAM.Refuter4n.childCode,childTest: a child of a name as a number belowN + E, and the test of such a number.Cslib.Algorithms.WordRAM.Refuter4n.childOfCode: the child of a code.Cslib.Algorithms.WordRAM.Refuter4n.evalAuxTime: the instruction bound of the evaluation oracle of the affine representation.Cslib.Algorithms.WordRAM.Refuter4n.evalAuxCode: the evaluation oraclepEvaluateAuxfor a unit assignment on the image (scratch copy of its rows, thenXORSATDense.elimCode), a fixedCode .standard 32.Cslib.Algorithms.WordRAM.Refuter4n.childrenCode: the first two children of a name (pGetChildren) on the image, a fixedCode .standard 32.Cslib.Algorithms.WordRAM.Refuter4n.findAffineRepCode,findAffineRepTime: the affine representationpFindAffineRepon the image (N + 1calls ofevalAuxCode), a fixedCode .standard 32, and its instruction bound.
Main results #
Cslib.Algorithms.WordRAM.Refuter4n.exec_childrenCode:childrenCodeleaves the codes of the first and the second child (orN + E) within61 (N + E) + 21instructions.Cslib.Algorithms.WordRAM.Refuter4n.exec_evalAuxCode:evalAuxCodeleavespEvaluateAux N E a P (· == y)withinevalAuxTime N Einstructions, writing only its scratch window.Cslib.Algorithms.WordRAM.Refuter4n.exec_findAffineRepCode:findAffineRepCodeleaves the constant and the mask ofpFindAffineRep N E a PwithinfindAffineRepTime N Einstructions, writing only the scratch window of the oracle.
Supporting lemmas, not results: map_childCode_pGetChildren (the coded children are the hits of
childTest below N + E), childCode_lt and childOfCode_childCode (child codes are below
N + E and decode back to the child; the later step programs use them) and pEvaluateAux_eq_N
(the constant assignment as the unit assignment of N). The
scratch window of the oracle starts at top, the first address past the image (Layout.top), so
Stored.of_eq_below of PackedCode keeps the image while it is written.
The children search #
The children of p (pGetChildren) are coded as numbers below N + E: the gate J as J and
the equation e as N + e (childCode). In this coding they are the hits of one scan over
K < N + E with the test childTest (map_childCode_pGetChildren), so the first child is the
first hit, and the second child is the first hit other than the first child.
Whether the code K is a child of p: a gate reading p (rowReads), or an alive equation
with the term p, the two tests of pGetChildren.
The children as one scan: their codes are the hits of childTest below N + E, in
order.
The code of a child is below N + E.
Decoding recovers every child of p.
The children search on the image, for the name Reg.argB: the gate mask, the two table bases
and the bound N + E; the scan of childTest, its first hit into Reg.argC; the scan of the
hits other than it (exec_childrenCode).
The children search on the memory image. With the base address b, the name bound N, the
number E of equation words and a name p < N in Reg.base, Reg.argN, Reg.numE and
Reg.argB, for the image of P at b with N gate rows, a word-sized gate mask and E
word-sized equation words, childrenCode leaves the code (childCode) of the first child of p in
Reg.argC and that of the second child in Reg.wT, each N + E if there is no such child,
within 61 (N + E) + 21 instructions, at every width w ≥ N + 2 at which b + 5 + 3 N + E + 1
fits. It keeps the memory and every register from 14 on except Reg.argA, Reg.argC, Reg.argD,
Reg.passBase and Reg.passLen.
The evaluation oracle of the affine representation #
pEvaluateAux N E a P val runs the packed elimination XORSATDense.cols on the rows auxWords.
For the unit assignments val = (· == y) (y = N: no parameter is set), these rows are one filter
over the codes K < E + N (auxRow: the alive equation words below their alive flag, then the rows
of the parameters) followed by the row of a. The code copies them into a scratch window at
Z = top (Layout.top, b + 5 + 3 N + E + n + 2 N), after the pair records when there are at most
N of them (as under Rep), and calls the elimination routine XORSATDense.elimCode on that
window.
The constant of the oracle does not see the unit assignment of N.
pEvaluateAux for the auxiliary variable Reg.argQ and the unit assignment of Reg.argC
(none when it is N), into Reg.result (exec_evalAuxCode).
The time bound of evalAuxCode in the library's Word-RAM cost model.
The evaluation oracle on the memory image. With the base address b, the name bound N,
the numbers E and n of equation words and parameter rows, a name y and an auxiliary name
a < N in Reg.base, Reg.argN, Reg.numE, Reg.numIn, Reg.argC and Reg.argQ, for the image
of P at b with a word-sized parameter mask and E word-sized equation words, evalAuxCode
leaves (pEvaluateAux N E a P (· == y)).toNat in Reg.result within evalAuxTime N E
instructions, at every width w ≥ N + 2 at which the end Z + E + N + 1 of the scratch window at
Z = top (Layout.top, the first address past the image) fits. It keeps every register from 14
on and every memory cell outside [Z, Z + E + N + 1).
The affine representation #
pFindAffineRep N E a P is the constant c = pEvaluateAux N E a P (fun _ => false) and the sum
of 2 ^ y over the parameters y < N whose unit assignment changes the value. The code queries
the oracle once for y = N (the constant, by pEvaluateAux_eq_N) and once for every y < N, with
the loop index in Reg.argC (where the oracle reads its assignment), the constant in Reg.tmp₁
and the partial sum in Reg.tmp₂.
pFindAffineRep for the auxiliary variable Reg.argQ: the constant into Reg.tmp₁, the mask
into Reg.tmp₂ (exec_findAffineRepCode).
The time bound of findAffineRepCode in the library's Word-RAM cost model: N + 1 oracle
queries and 11 N + 6 further instructions.
The affine representation 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 an auxiliary name a < N in
Reg.base, Reg.argN, Reg.numE, Reg.numIn and Reg.argQ, for the image of P at b with at
most N gate rows, at most n parameter rows, at most N pair records, a word-sized parameter
mask and E word-sized equation words, findAffineRepCode leaves the constant
(pFindAffineRep N E a P).1 (as 0 or 1) in Reg.tmp₁ and the mask (pFindAffineRep N E a P).2
in Reg.tmp₂ within findAffineRepTime N E instructions, at every width w ≥ N + 2 at which the
end Z + E + N + 1 of the scratch window at Z = top (Layout.top, the first address past the
image) fits. It leaves N in Reg.argC, keeps every other register from 14 on and every memory
cell outside [Z, Z + E + N + 1), so the image of P too.