Documentation

CslibFrontier.Crypto.Primitives.Garbling.HalfGates.Conventional

XOR–AND conventional circuits as half-gates circuits #

Half-gates garbling [ZRE15] garbles circuits whose gates all compute XOR or AND (Figure 2, p. 9, which assumes "all gates are either AND or XOR"). XorAndCircuit is the type of valid conventional circuits of Bellare, Hoang and Rogaway [BHR12b] whose truth tables are all XOR or AND (ConventionalCircuit.IsXorAnd). It is a decidable subtype of ValidCircuit, encoded by encValidCircuit (encXorAndCircuit).

HalfGates.toCircuit f : Circuit HalfGates.signature n m is such a circuit over the XOR–AND basis: gate g applies AND when G g is the AND table and XOR otherwise, to the 0-indexed wires A g - 1 and B g - 1, and output o is wire n + q - m + o. Translating it back to the full binary basis along the meaning-preserving map HalfGates.toFull gives ConventionalCircuit.toCircuit f (HalfGates.mapOp_toCircuit), so its gates, wires and outputs are those of the conventional circuit, and it computes ConventionalCircuit.evalCirc (HalfGates.eval_toCircuit).

Main definitions #

Main results #

References #

Every gate of f computes XOR or AND.

Instances For
    @[reducible, inline]

    Valid conventional circuits whose gates all compute XOR or AND: the circuits that half-gates garbling garbles.

    @[reducible, inline]

    The conventional circuit of an XOR–AND circuit.

    The conventional circuit of an XOR–AND circuit is valid.

    Every gate of an XOR–AND circuit computes XOR or AND.

    XOR–AND circuits as words, by encValidCircuit.

    An XOR–AND circuit is written as its valid circuit.

    An XOR–AND circuit is written as its valid circuit, so reading the valid circuit costs nothing.

    The XOR–AND basis inside the full binary basis: XOR and AND as their truth tables.

    Instances For

      The half-gates operation of a truth table G of XOR or AND: AND when G 1 1 is set, XOR otherwise.

      The gates of a conventional circuit as circuit code over the XOR–AND basis: gate i applies opOf (G i) to the 0-indexed wires A i - 1 and B i - 1.

      An XOR–AND conventional circuit as a circuit over the XOR–AND basis, decoded from its gate list.

      The code of toCircuit f is the half-gates gate list of f with its last m wires as outputs.

      Back in the full binary basis. Translating toCircuit f along toFull gives the conventional circuit's own translation ConventionalCircuit.toCircuit f.

      Gate g of toCircuit f is an AND gate exactly when G g is the AND table.

      The first argument of gate g of toCircuit f is the 0-indexed wire A g - 1.

      The second argument of gate g of toCircuit f is the 0-indexed wire B g - 1.

      Output o of toCircuit f is the 0-indexed wire n + q - m + o.

      The value of wire w of toCircuit f on an n-bit input is wire w of the conventional evaluation, numbered from 0.

      The translation computes the conventional semantics. On every n-bit input, the outputs of toCircuit f are evalCirc f.