Documentation

CslibFrontier.Crypto.Primitives.Garbling.CircuitInverters

Conventional circuits and side-information inverters #

For circuit garbling schemes in the sense of Bellare, Hoang and Rogaway [BHR12b], Sections 2.3 and 4.1, function descriptions are well-formed conventional Boolean circuits f = (n, m, q, A, B, G) with n ≥ 2 inputs, m ≥ 1 outputs, q ≥ 1 binary gates (m ≤ q), 1-indexed wire numbers 1 to n + q, and gate inputs satisfying 1 ≤ A(g) < B(g) < g and B(g) ≤ n + q - m so that output wires are disjoint from input wires and are never fed into subsequent gates. Unlike Cslib.Circuits.Circuit, where input and output arities are type parameters and output wires may alias arbitrary wires, ConventionalCircuit packages (n, m, q) as data inside a single type ValidCircuit of function descriptions (so an adversary can query circuits of chosen sizes) and enforces the BHR12 output-wire convention needed for total side-information inversion.

Three standard side-information functions (SideInfo) on ValidCircuit are defined:

Following [BHR12b], Section 4.1, Proposition 1, we construct explicit deterministic (Φ, ev)-inverters mTopo and mSize and Φ-inverters mTopoInv and mSizeInv. Given a valid topology t and target output y ∈ {0, 1}^m, mTopo leaves the wiring unchanged, sets every non-output gate to the constant false table and every output gate g to the constant table returning the corresponding bit of y, and pairs this circuit with 0^n. Given a valid shape (n, m, q) and y, mSize wires every gate to the first two input wires A(g) = 1, B(g) = 2 (which is well-formed because 2 ≤ n and m ≤ q for every valid circuit) and applies mTopo. These are the inverters of the proof of Proposition 1; the proposition says they run in linear time. CslibFrontier.Crypto.Primitives.Garbling.CircuitInvertersPPT certifies strict polynomial time on multi-tape Turing machines; the linear-time bound remains open (#5293).

Combining these inverters with the reductions of CslibFrontier.Crypto.Primitives.Garbling.Foundations gives, at a fixed security parameter, the advantage relations behind Corollaries 1 and 2 of [BHR12b], Sections 4.2 and 4.3, for phiTopo, phiSize and phiCirc. They are steps, not the corollaries. Each corollary is an equality between sets of garbling schemes that are secure against every polynomial-time adversary, with a polynomial-time simulator for the simulation notions (Section 3.7). CslibFrontier.Crypto.Primitives.Garbling.FoundationsAsymptotic defines the asymptotic notions and proves Propositions 2 and 3, certifying the reductions prvIndToSim, prvSimToInd, obvIndToSim and obvSimToInd and the simulators built from any polynomial-time inverter as strict PPT. The corollaries stay open (#5293): they also need polynomial-time certificates for the inverters mTopo, mSize, mTopoInv and mSizeInv and for the side information phiSize, which are not proved.

Main definitions #

Main results #

Steps toward Corollaries 1 and 2 #

At a fixed security parameter, for every circuit garbling scheme:

References #

Conventional circuits and topologies #

The topology (n, m, q, A, B) of a conventional Boolean circuit ([BHR12b], Section 2.3): n input wires, m output wires, q binary gates, and first/second input-wire maps A, B : Fin q → ℕ (with 1-indexed wire numbers).

  • n : ℕ

    The number of input wires n.

  • m : ℕ

    The number of output wires m.

  • q : ℕ

    The number of gates q.

  • A : Fin self.q → ℕ

    The first input wire A(g) of each gate (1-indexed).

  • B : Fin self.q → ℕ

    The second input wire B(g) of each gate (1-indexed).

Well-formedness of a topology ([BHR12b], Section 2.3): 2 ≤ n, 1 ≤ m, 1 ≤ q, m ≤ q (output wires are disjoint from input wires), and for every gate g = n + 1 + i, 1 ≤ A(g) < B(g) < g and B(g) ≤ n + q - m (output wires are not fed into any gate).

  • two_le_n : 2 ≤ t.n

    At least two input wires.

  • one_le_m : 1 ≤ t.m

    At least one output wire.

  • one_le_q : 1 ≤ t.q

    At least one gate.

  • m_le_q : t.m ≤ t.q

    The output wires are gate wires, disjoint from the input wires.

  • one_le_A (i : Fin t.q) : 1 ≤ t.A i

    Wire numbers start at 1.

  • A_lt_B (i : Fin t.q) : t.A i < t.B i

    The first input wire of a gate precedes its second input wire.

  • B_lt_gate (i : Fin t.q) : t.B i < t.n + 1 + ↑i

    A gate reads only earlier wires.

  • B_le_n_add_q_sub_m (i : Fin t.q) : t.B i ≤ t.n + t.q - t.m

    No gate reads an output wire.

Instances For
    theorem Cslib.Crypto.Garbling.Topo.isValid_iff (t : Topo) :
    t.IsValid ↔ 2 ≤ t.n ∧ 1 ≤ t.m ∧ 1 ≤ t.q ∧ t.m ≤ t.q ∧ (∀ (i : Fin t.q), 1 ≤ t.A i) ∧ (∀ (i : Fin t.q), t.A i < t.B i) ∧ (∀ (i : Fin t.q), t.B i < t.n + 1 + ↑i) ∧ ∀ (i : Fin t.q), t.B i ≤ t.n + t.q - t.m

    A conventional Boolean circuit f = (n, m, q, A, B, G) following [BHR12b], Section 2.3: wires are numbered 1 to n + q, with inputs 1 to n, gate i : Fin q on wire n + 1 + i.val, and outputs on the last m wires n + q - m + 1 to n + q.

    • n : ℕ

      The number of input wires n.

    • m : ℕ

      The number of output wires m.

    • q : ℕ

      The number of gates q.

    • A : Fin self.q → ℕ

      The first input wire A(g) of each gate (1-indexed).

    • B : Fin self.q → ℕ

      The second input wire B(g) of each gate (1-indexed).

    • G : Fin self.q → Bool → Bool → Bool

      The truth table G(g) of each binary gate.

    The topology of a conventional circuit, forgetting the gate truth tables G.

    @[reducible, inline]

    Well-formedness of a conventional circuit ([BHR12b], Section 2.3): its topology is valid (Topo.IsValid). It does not depend on the gate truth tables.

    Read the 1-indexed wire w from a list of wire values, defaulting to false.

    The values on the first n + s wires (n input wires followed by the first s gate wires) when evaluating f on x. Inputs shorter than n are padded with false; longer inputs are truncated to n bits.

    Plaintext evaluation ev_circ(f, x) of a conventional circuit ([BHR12b], Section 2.3): evaluate all q gates and return the values on the final m output wires.

    @[reducible, inline]

    Valid conventional circuits: the function descriptions of circuit garbling.

    A garbling scheme G over ValidCircuit is a circuit garbling scheme when its length readers return (n, m, q) and its semantics ev is ConventionalCircuit.evalCirc ([BHR12b], Section 3.1).

    Assemble a conventional circuit from a topology t and gate truth tables G.

    @[simp]
    theorem Cslib.Crypto.Garbling.topo_ofTopo (t : Topo) (G : Fin t.q → Bool → Bool → Bool) :
    (ofTopo t G).topo = t
    @[reducible, inline]

    Topologies of valid conventional circuits.

    Valid circuit shapes (n, m, q): 2 ≤ n, 1 ≤ m, 1 ≤ q and m ≤ q, the shape conditions of Topo.IsValid.

    • n : ℕ

      The number of input wires n.

    • m : ℕ

      The number of output wires m.

    • q : ℕ

      The number of gates q.

    • two_le_n : 2 ≤ self.n

      At least two input wires.

    • one_le_m : 1 ≤ self.m

      At least one output wire.

    • one_le_q : 1 ≤ self.q

      At least one gate.

    • m_le_q : self.m ≤ self.q

      The output wires are gate wires.

    Standard side-information functions #

    Φ_topo(f) = (n, m, q, A, B): side information revealing the circuit topology ([BHR12b], Section 3.3).

    Φ_size(f) = (n, m, q): side information revealing only the input count, output count and gate count ([BHR12b], Section 3.3).

    Φ_circ(f) = f: side information revealing the entire valid circuit ([BHR12b], Section 3.3).

    Explicit side-information inverters #

    Gate tables for mTopo ([BHR12b], Section 4.1, Proposition 1): non-output gates are constant false, while output gate g = n + 1 + i is the constant gate returning bit g - (n + q - m) - 1 of y.

    The (Φ_topo, ev)-inverter M_topo ([BHR12b], Section 4.1, Proposition 1): from a valid topology t and output string y, build the circuit with topology t and constant gates mTopoGates t y paired with the all-zero input 0^n.

    The canonical wiring for a shape (n, m, q) ([BHR12b], Section 4.1, Proposition 1): every gate takes wires A(g) = 1 and B(g) = 2.

    The (Φ_size, ev)-inverter M_size ([BHR12b], Section 4.1, Proposition 1): extend the shape s = (n, m, q) with the canonical wiring A(g) = 1, B(g) = 2 and apply mTopo.

    The Φ_topo-inverter built from mTopo by setting y = 0^m.

    The Φ_size-inverter built from mSize by setting y = 0^m.

    mTopoInv is a Φ_topo-inverter (proof of [BHR12b], Section 4.1, Proposition 1). Strict polynomial running time is certified in CircuitInvertersPPT; Proposition 1's linear-time bound remains open (#5293).

    mSizeInv is a Φ_size-inverter (proof of [BHR12b], Section 4.1, Proposition 1). Strict polynomial running time is certified in CircuitInvertersPPT; Proposition 1's linear-time bound remains open (#5293).

    The identity is a Φ_circ-inverter (proof of [BHR12b], Section 4.1, Proposition 1).

    theorem Cslib.Crypto.Garbling.wires_ofTopo_const (t : Topo) (c : Fin t.q → Bool) (x : List Bool) (hx : x.length = t.n) (s : ℕ) (hs : s ≤ t.q) :
    (ofTopo t fun (i : Fin t.q) (x x_1 : Bool) => c i).wires x s = x ++ List.ofFn fun (i : Fin s) => c ⟨↑i, ⋯⟩

    Wire evaluation for any circuit whose gate tables fun i _ _ => c i depend only on the gate index i.

    theorem Cslib.Crypto.Garbling.evalCirc_ofTopo_mTopoGates_any (t : Topo) (hm : t.m ≤ t.q) (y x : List Bool) (hy : y.length = t.m) (hx : x.length = t.n) :
    (ofTopo t (mTopoGates t y)).evalCirc x = y

    Because mTopoGates t y ignores gate wire inputs, (ofTopo t (mTopoGates t y)).evalCirc x = y for every t.n-bit input x whenever t.m ≤ t.q and y.length = t.m.

    Evaluating ofTopo t (mTopoGates t y) on 0^n returns y whenever t.m ≤ t.q and y.length = t.m.

    mTopo is a (Φ_topo, ev)-inverter for every circuit garbling scheme (proof of [BHR12b], Section 4.1, Proposition 1). Strict polynomial running time is certified in CircuitInvertersPPT; Proposition 1's linear-time bound remains open (#5293).

    mSize is a (Φ_size, ev)-inverter for every circuit garbling scheme (proof of [BHR12b], Section 4.1, Proposition 1). Strict polynomial running time is certified in CircuitInvertersPPT; Proposition 1's linear-time bound remains open (#5293).

    Indistinguishability and simulation advantages for circuit side information #

    Step toward Corollary 1 of [BHR12b], Section 4.2 (open, #5293), not the cited result (Φ_topo, simulation to indistinguishability): at a fixed security parameter, for any circuit garbling scheme, the prv.ind advantage under phiTopo is twice the prv.sim advantage of prvIndToSim against any simulator. No running-time bound for prvIndToSim is proved.

    Step toward Corollary 1 of [BHR12b], Section 4.2 (open, #5293), not the cited result (Φ_topo, indistinguishability to simulation): at a fixed security parameter, for any circuit garbling scheme, the prv.sim advantage against the mTopo inverter simulator equals the prv.ind advantage of prvSimToInd. No running-time bound for the simulator or for prvSimToInd is proved.

    Step toward Corollary 1 of [BHR12b], Section 4.2 (open, #5293), not the cited result (Φ_size, simulation to indistinguishability): at a fixed security parameter, for any circuit garbling scheme, the prv.ind advantage under phiSize is twice the prv.sim advantage of prvIndToSim against any simulator. No running-time bound for prvIndToSim is proved.

    Step toward Corollary 1 of [BHR12b], Section 4.2 (open, #5293), not the cited result (Φ_size, indistinguishability to simulation): at a fixed security parameter, for any circuit garbling scheme, the prv.sim advantage against the mSize inverter simulator equals the prv.ind advantage of prvSimToInd. No running-time bound for the simulator or for prvSimToInd is proved.

    Step toward Corollary 2 of [BHR12b], Section 4.3 (open, #5293), not the cited result (Φ_topo, simulation to indistinguishability): at a fixed security parameter, for any circuit garbling scheme, the obv.ind advantage under phiTopo is twice the obv.sim advantage of obvIndToSim against any simulator. No running-time bound for obvIndToSim is proved.

    Step toward Corollary 2 of [BHR12b], Section 4.3 (open, #5293), not the cited result (Φ_topo, indistinguishability to simulation): at a fixed security parameter, for any circuit garbling scheme, the obv.sim advantage against the mTopoInv inverter simulator equals the obv.ind advantage of obvSimToInd. No running-time bound for the simulator or for obvSimToInd is proved.

    Step toward Corollary 2 of [BHR12b], Section 4.3 (open, #5293), not the cited result (Φ_size, simulation to indistinguishability): at a fixed security parameter, for any circuit garbling scheme, the obv.ind advantage under phiSize is twice the obv.sim advantage of obvIndToSim against any simulator. No running-time bound for obvIndToSim is proved.

    Step toward Corollary 2 of [BHR12b], Section 4.3 (open, #5293), not the cited result (Φ_size, indistinguishability to simulation): at a fixed security parameter, for any circuit garbling scheme, the obv.sim advantage against the mSizeInv inverter simulator equals the obv.ind advantage of obvSimToInd. No running-time bound for the simulator or for obvSimToInd is proved.

    Step toward Corollary 2 of [BHR12b], Section 4.3 (open, #5293), not the cited result (Φ_circ, simulation to indistinguishability): at a fixed security parameter, for any circuit garbling scheme, the obv.ind advantage under phiCirc is twice the obv.sim advantage of obvIndToSim against any simulator. No running-time bound for obvIndToSim is proved.

    Step toward Corollary 2 of [BHR12b], Section 4.3 (open, #5293), not the cited result (Φ_circ, indistinguishability to simulation): at a fixed security parameter, for any circuit garbling scheme, the obv.sim advantage against the identity inverter simulator equals the obv.ind advantage of obvSimToInd. No running-time bound for the simulator or for obvSimToInd is proved.