Packed primitive operations of the 4n - 9d refuter #
The refuter step applyStep (Cslib.Circuits.Boolean.AffineDisperser4n) is built from a few
state operations: rerouting a name to a literal (inside State.deleteGate, State.restrict and
State.deleteEqn), dropping equations, moving an affine gate into the affine system, the affine
reparameterisation State.swap and pair creation State.addPair. This file gives each of them as
a word-level operation on the packed state PackedState and proves that it represents the state
operation (Rep). This is the pure layer of the step programs of issue #4322 (Milestone 4); no
program and no running time is claimed here.
The operations read and write only words: names, argument codes argCode, negation bits and
packed rows. A literal ℓ enters as its argument code argCode ℓ.arg and negation bit
ℓ.neg.toNat.
- Gate rows. Rerouting
vrewrites every row bysubstRow: argument codesv + 2become the code of the literal, and its negation is absorbed into the truth table byabsorbNegofTruthTable, the operation of the input decoder (substRow_rowOf). - Equation words. Rerouting
vin an equation is the row substitutionsubstWordof the parameter map applied to the equation word, with the literal as the rowlitWordOf(substWord_eqnWord,litWordOf_eq). A deleted equation gets the word0. - Output.
substOutrewrites the output code (substOut_litCode). - Masks. Erasing and inserting a name clear and set its bit (
maskOf_erase,maskOf_insert). - Moved gates. The equation of a moved affine gate is computed from its row by
affWord(affWord_rowOf).
Main definitions #
Cslib.Algorithms.WordRAM.Refuter4n.clearBit,setBit: mask updates.Cslib.Algorithms.WordRAM.Refuter4n.negBit,substCode,substRow,substOut: rerouting in gate rows and in the output.Cslib.Algorithms.WordRAM.Refuter4n.argWord,litWordOf,affWord: rows of literals and of moved gates.Cslib.Algorithms.WordRAM.Refuter4n.pairAvoids: the pair records avoiding a name.Cslib.Algorithms.WordRAM.Refuter4n.Bounded: names read by a state are belowN.Cslib.Algorithms.WordRAM.Refuter4n.PackedState.subst,PackedState.deleteGate,PackedState.restrictAvoid,PackedState.deleteEqn,PackedState.dropEqn,PackedState.dropTrivialEqn,PackedState.moveAffine,PackedState.swap,PackedState.addPair: the packed operations.
Main results #
Cslib.Algorithms.WordRAM.Refuter4n.testBit_eqnWord,argCode_eq_node: the bits of an equation word, and the codes of nodes.Cslib.Algorithms.WordRAM.Refuter4n.maskOf_erase,maskOf_insert,substRow_rowOf,substOut_litCode,litWordOf_eq,substWord_eqnWord,affWord_rowOf: the word operations are the operations on gates, literals and equations.Cslib.Algorithms.WordRAM.Refuter4n.rowLt_substRow: rerouted rows stay within range;argWord_lt,litWordOf_lt: the rows of argument codes and literals fit inN + 1bits.Cslib.Algorithms.WordRAM.Refuter4n.PackedState.getD_gateRows_subst,PackedState.getD_eqnRows_subst: the gate rows and equation words ofPackedState.subst.Cslib.Algorithms.WordRAM.Refuter4n.Rep.deleteGate,Rep.restrictAvoid,Rep.fixConst,Rep.deleteEqn,Rep.dropEqn,Rep.dropTrivialEqn,Rep.moveAffine,Rep.swap,Rep.addPair: each packed operation represents its state operation. The hypotheses are names belowN(andEfor a new equation name), the moved gate forRep.moveAffine, forRep.addPaira new pair, and, for the operations that reroute a name, a bounded state (Bounded: the names read by equations, gates and the output are belowN).Cslib.Algorithms.WordRAM.Refuter4n.Rep.bounded,Bounded.deleteGate,Bounded.restrict,Bounded.deleteEqn,Bounded.dropEqn,Bounded.dropTrivialEqn,Bounded.swap,Bounded.addPair,Bounded.moveAffine: valid represented states are bounded, and the state operations preserve boundedness, so a step can chain operations.
Masks #
Rerouting in gate rows and in the output #
The negation bit ln absorbed for the argument code c when v is rerouted.
The argument code c with v rerouted to the code la.
Reroute v to the literal with argument code la and negation bit ln in a gate row.
The code v + 2 is the argument node v.
Rerouting in a gate row is Gate.subst.
Reroute v to the literal with argument code la and negation bit ln in the output code
o = 2 · argCode + neg.
Rows of literals, equations and moved gates #
The row of an argument code: the constant a at bit N for a < 2, and the term a - 2
otherwise.
The row of the literal with argument code la and negation bit ln.
The equation word of the affine gate with row r moved into the affine system as J
(affEqn): the terms J, left (if the operation depends on it) and right (likewise), the
constant op false false at bit N and the alive flag at bit N + 1.
The bits of an equation word: terms below N, the right-hand side at N and the alive flag
at N + 1.
Equation update. Rerouting v to ℓ in an equation (Equation.subst) is the row
substitution substWord of the parameter map applied to its word, with the row of ℓ.
Packed operations #
Reroute v to the literal with argument code la and negation bit ln in every gate row,
every equation word and the output (SemiCircuit.subst).
A gate row after substitution (the zero row is fixed).
Delete the gate J, rerouting it to the literal (la, ln) (State.deleteGate).
Restrict the parameter x to the literal (la, ln), keeping the pairs avoiding x
(State.restrict x ℓ (S.pairsAvoid x), hence State.fixConst).
Delete the equation e and the auxiliary variable v, rerouting v to the literal
(la, ln) (State.deleteEqn).
Drop the equation e and the auxiliary variable v (State.dropEqn).
Drop the equation e (State.dropTrivialEqn).
Move the gate J into the affine system with the equation name e (State.moveAffine).
Exchange the parameter x and the auxiliary variable Q, substituting the row u for x
in the parameter map (State.swap).
Append the pair record c (State.addPair).
Representation of the packed operations #
Bounded states #
The names read by the equations, the gates and the output of S are below N. A valid
represented state is bounded (Rep.bounded). Gate deletion, restriction and equation deletion
by a literal reading names below N, dropping an equation, swapping, adding a pair, and moving a
gate below N preserve it (Bounded.deleteGate to Bounded.moveAffine).
Terms of equations are below
N.Names read by gates are below
N.The name read by the output is below
N.
Deleting a gate preserves boundedness.
Restriction preserves boundedness.
Deleting an equation preserves boundedness.
Dropping an equation preserves boundedness.
Dropping a trivial equation preserves boundedness.
The affine reparameterisation preserves boundedness.
Pair creation preserves boundedness.
Moving a gate named below N into the affine system preserves boundedness.
A valid represented state is bounded.
Deleting a gate. PackedState.deleteGate represents State.deleteGate J ℓ.
Restriction. PackedState.restrictAvoid represents State.restrict x ℓ (S.pairsAvoid x).
Fixing a parameter. PackedState.restrictAvoid N w b.toNat 0 represents
State.fixConst w b.
Dropping a trivial equation. PackedState.dropTrivialEqn represents
State.dropTrivialEqn e.
Dropping an equation. PackedState.dropEqn represents State.dropEqn e v: the trivial
drop of e, and v leaves the auxiliary variables.
Deleting an equation. PackedState.deleteEqn represents State.deleteEqn e v ℓ: the
rerouting of v to ℓ followed by the drop of e and v.
Moving an affine gate. PackedState.moveAffine represents State.moveAffine J e for a
gate J and an equation name e < E.
Affine reparameterisation. PackedState.swap with the row of ∑ ((T \ {x}) ∆ {Q}) = c
represents State.swap x Q c T.
Pair creation. PackedState.addPair (pairCode pr) represents State.addPair pr for a
new pair pr.