Documentation

CslibFrontier.Crypto.Primitives.Garbling.PointPermute.Simulator

The simulator of point-and-permute garbling #

The privacy simulator of CslibFrontier.Crypto.Primitives.Garbling.Privacy written on words, for the point-and-permute scheme PointPermute.scheme family with topology side information (phiTopo). The simulator simWord family k y t sees the parameter k, the output y and the topology t = (n, m, q, A, B). It samples one (k + 2)-bit label for each of the n + q wires and four filler labels for each gate, and writes the view (F, X, d) (simViewWord): in each gate's table, the row named by the colours of its argument wires' labels holds the gate's label masked under their keys, and every other row holds a filler label; X lists the input wires' labels, and d makes the output wires' colours decode to y when y has m bits.

The words written are those of the typed simulator simulateWith on toCircuit f, for every valid circuit f of topology t, with the labels read from the coins (simViewWord_eq), and the coins give uniform wire labels and filler rows (uniformList_map_simCoins). So the simulator's output law is the typed simulator's (eval_simWord). Every view it writes for an output of m bits, m the topology's output count, decodes to that output (decodeWord_evalWord_simViewWord).

Main definitions #

Main results #

References #

The simulator's coins #

The number of coins of the simulator at parameter k for n inputs and q gates: one label for each of the n + q wires, then four filler labels for each gate.

Label v of the simulator's coins, their (k + 2)-bit block v. Wire v has label v; row i of gate g has filler label n + q + 4 g + i.

The wire labels read from the simulator's coins: wire w has label number w.

The filler rows read from the simulator's coins: row ρ of gate g has label number n + s + 4 g + rowIndex ρ.

theorem Cslib.Crypto.Garbling.PointPermute.rowIndex_lt_four {r : ℕ} (hr : r = 2) (colours : Fin r → Bool) :
rowIndex colours < 4

A row of a binary gate has number below 4.

Row numbers determine the colours of a binary gate.

Distinct slots have distinct tweaks while 8 q ≤ 2 ^ k: slot a of row ρ of gate g has the tweak 8 g + 2 rowIndex ρ + a, which is below 2 ^ k.

theorem Cslib.Crypto.Garbling.PointPermute.uniformList_map_simCoins {n m s : ℕ} (k : ℕ) (τ : Circuits.Circuit.Topology n m s) (hτ : ∀ (g : Fin s), τ.arity g = 2) :

The simulator's coins are uniform labels. For a topology of binary gates, the wire labels and filler rows read from uniform coins are uniform and independent.

The simulated view #

def Cslib.Crypto.Garbling.PointPermute.simRow (family : List Bool → List Bool → List Bool) (k : ℕ) (t : Topo) (coins : List Bool) (g : Fin t.q) (i : ℕ) :

Row i of gate g of the simulated garbled function at parameter k for the topology t: the row named by the colours of the labels of the gate's argument wires holds the gate's label masked by the keyed function at their keys; every other row holds its filler label.

The simulated view (F, X, d) at parameter k for the output y and the topology t, on the simulator's coins: the garbled function with the header and wire numbers of t and the rows simRow, the labels of the input wires, and the decoding bits that make the colours of the output wires' labels decode to y when y has t.m bits.

noncomputable def Cslib.Crypto.Garbling.PointPermute.simWord (family : List Bool → List Bool → List Bool) (k : ℕ) (y : List Bool) (t : ValidTopo) :

The simulator S(1^k, y, φ) of point-and-permute garbling with topology side information: sample the coins and write the simulated view.

The words (F, X, d) of a typed view at parameter k: the garbled function of its table, the words of its input labels in order, and its decoding bits.

The simulated view is the typed simulator's #

theorem Cslib.Crypto.Garbling.PointPermute.rowIndex_testBit_of_eq_two {r i : ℕ} (hr : r = 2) (hi : i < 4) :
(rowIndex fun (a : Fin r) => i.testBit (r - 1 - ↑a)) = i

Row i < 4 of a binary gate has number i.

The simulated view is the typed simulator's. For every valid circuit f, the simulated view for the topology of f and the output y is the words of the typed simulated view of toCircuit f, with the wire labels and filler rows read from the coins.

The simulator samples the typed simulator's view. For every valid circuit f and output y, the simulator on the topology of f samples the words of the typed simulator's view of toCircuit f.

theorem Cslib.Crypto.Garbling.PointPermute.decodeWord_evalWord_simViewWord (family : List Bool → List Bool → List Bool) (k : ℕ) (t : ValidTopo) {y : List Bool} (hy : y.length = (↑t).m) (coins : List Bool) :
decodeWord (simViewWord family k y (↑t) coins).decInfo (evalWord family (simViewWord family k y (↑t) coins).fn (simViewWord family k y (↑t) coins).input) = some y

Simulated views decode to the output. For every valid topology t, every output y of t.m bits and all coins, decoding the evaluation of the simulated garbled input gives y.

Efficiency #

Labels of the simulator's coins are read in polynomial time.

The simulator is PPT. For every family computed in polynomial time, the simulator runs in uniform strict probabilistic polynomial time on the parameter in unary, the output and the encoded topology.