The dual-rail translation of De Morgan circuits #
A De Morgan circuit becomes a monotone circuit by computing, for every wire, both its value and
its negation [Gol77]. The monotone circuit (Cslib.Circuits.Monotone.dualRail) has
2 n + 1 inputs: input 0 is the constant true, and the input i of the De Morgan circuit is
carried positively by input 2 i + 1 and negatively by input 2 i + 2 (railBits). Each gate is
replaced by two gates, carrying it positively and negatively: an AND gate by the AND of the
positive rails and the OR of the negative rails, an OR gate dually, a negation by copies of the
crossed rails (conjunctions with the constant true wire), and a constant by the constant and its
negation (dualGates). Every wire w of the De Morgan circuit is then carried by the wires
2 w + 1 and 2 w + 2 (railWire), uniformly for inputs and gates, so the translation of a gate
depends on the gate alone, not on its position.
The translation works on gate lists (dualCode): it keeps well-formedness
(isCodeFrom_dualCode), and evaluating the translated list on the dual-rail inputs gives the
dual-rail values (evalCode_dualCode). The translated circuit computes the same function on the
dual-rail inputs (eval_dualRail) and has twice the size (size_dualRail).
Main definitions #
Cslib.Circuits.Monotone.railWire,Cslib.Circuits.Monotone.railBits: the dual-rail wires and inputs.Cslib.Circuits.Monotone.dualGates,Cslib.Circuits.Monotone.dualCode: the translation of gates and gate lists.Cslib.Circuits.Monotone.dualRail: the dual-rail translation of a De Morgan circuit.
Main results #
Cslib.Circuits.Monotone.evalCode_dualCode: the translated gate list computes the dual-rail values.Cslib.Circuits.Monotone.eval_dualRail: the translated circuit computes the same function.Cslib.Circuits.Monotone.size_dualRail: the translated circuit has twice the size.
References #
Dual-rail wires and inputs #
The wire carrying wire w positively (b = true), 2 w + 1, or negatively, 2 w + 2.
Wire 0 is the constant true.
Instances For
Gates #
The two monotone gates computing a De Morgan gate positively and negatively, from its
operation and its wires g.2: an AND gate by the AND of the positive rails and the OR of the
negative rails, an OR gate dually, a negation by the crossed rails (each in a conjunction with the
constant true wire 0), a constant by the constant and its negation.
Instances For
The translation keeps well-formedness: the gates of a De Morgan gate list reading the
first n + k wires become gates reading the first 2 n + 1 + 2 k wires.
The translated gate list computes the dual-rail values: on the dual-rail inputs, the
gates translating gate j carry the value of gate j and its negation.
Circuits #
The dual-rail translation of a De Morgan circuit: a monotone circuit on the 2 n + 1
dual-rail inputs with two gates for every gate.
Instances For
The dual-rail translation has twice the size.
The dual-rail translation computes the same function on the dual-rail inputs.