Absorbing operand negations into a four-bit truth table #
A gate row of the packed state of the 4n - 9d refuter (issue #4322, Milestone 4) stores the
operation of a gate as its four-bit truth table ttOf. When an operand of the gate is replaced by
a negated literal, the negation moves into the table: negating the second input swaps the bits
0 ↔ 1 and 2 ↔ 3 (swapLo), negating the first input swaps 0 ↔ 2 and 1 ↔ 3 (swapHi).
absorbNeg t x₀ x₁ does both, reading the two negations from the low bits of the words x₀ and
x₁, so it applies to literal codes (litCode, whose low bit is the negation) and to negation
bits alike.
This is the one word operation for that step. The input decoder of InputLayout certifies its
machine block against it, and the packed substitution substRow of PackedOps is defined with
it; another instruction sequence can be certified against the same operation.
Main definitions #
Cslib.Algorithms.WordRAM.Refuter4n.swapLo,swapHi: negate the second and the first input of a truth table.Cslib.Algorithms.WordRAM.Refuter4n.absorbNeg: absorb the negations of two operand words.
Main results #
Cslib.Algorithms.WordRAM.Refuter4n.absorbNeg_ttOf: on the table ofop,absorbNegis the table ofopwith the inputs negated as the low bits of the operand words say.Cslib.Algorithms.WordRAM.Refuter4n.absorbNeg_zero: the zero table is fixed.Cslib.Algorithms.WordRAM.Refuter4n.swapLo_lt,swapHi_lt,absorbNeg_lt: four-bit tables stay four-bit tables.
Swap the truth-table bits 0 ↔ 1 and 2 ↔ 3 (negate the second input).
Swap the truth-table bits 0 ↔ 2 and 1 ↔ 3 (negate the first input).
Absorb the negations of the operand words x₀, x₁ (their low bits) into the truth table
t.
Absorbing into the table of op gives the table of op with the first input negated when
the low bit of x₀ is set and the second input negated when the low bit of x₁ is set.
Absorbing negations fixes the zero table.