Documentation

Complexity.Computability.Circuit.Monotone.DualRail

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 #

Main results #

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

    The dual-rail values: the constant true, then each value followed by its negation.

    Instances For

      The positive rail of a value.

      The negative rail of a value.

      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 dual-rail translation of a gate list: each gate by its two monotone gates.

        Instances For
          theorem Cslib.Circuits.Monotone.dualCode_append (gates gates' : List (Boolean.Op × List ℕ)) :
          dualCode (gates ++ gates') = dualCode gates ++ dualCode gates'

          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 inputs of an input of a De Morgan circuit (railBits).

          Instances For

            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.