Documentation

CslibFrontier.Crypto.Primitives.Garbling.FreeXOR.Simulator

The simulator of Free-XOR garbling #

The privacy simulator FreeXOR.simulate of CslibFrontier.Crypto.Primitives.Garbling.FreeXOR, written on words, for FreeXOR.scheme hash with the side information phiXor, which reveals the circuit topology and which gates compute XOR while hiding the truth tables of all non-XOR gates.

The simulator simWord hash k y t sees the parameter k, the output y and t : XorTopology ((topo, free)). It samples one (k + 2)-bit label for each of the n + q wires and four filler labels for each non-XOR gate (nonXorRank), propagates active labels through the XOR gates, writes the garbled function with the active row of each non-XOR gate holding the gate's label masked under the hash of its arguments' active labels and the remaining three rows filled from the coins, lists the input labels in X, and sets d so that the output active labels decode to y.

The simulator's output law is the typed simulator's (eval_simWord), every view it writes for a valid circuit and an m-bit output decodes to that output (decodeWord_evalWord_simViewWord), and it is PPT whenever hash is computed in polynomial time (isPPTOn_simWord).

Main definitions #

Main results #

The simulated view #

The number of non-XOR gates among the first g gates recorded in free.

The number of coins of the simulator at parameter k for t: one label for each of the n + q wires, then four filler labels for each non-XOR gate.

def Cslib.Crypto.Garbling.FreeXOR.simRow (hash : List Bool → List Bool → List Bool) (k : ℕ) (t : Topo) (free : List Bool) (labels : List (List Bool)) (coins : List Bool) (g : Fin t.q) (i : ℕ) :

Row i of non-XOR gate g in the simulated table, from the active wire labels labels and the coins.

def Cslib.Crypto.Garbling.FreeXOR.simGateWord (hash : List Bool → List Bool → List Bool) (k w : ℕ) (t : XorTopology) (labels : List (List Bool)) (coins : List Bool) (g : Fin (↑t.topo).q) :

The block of gate g in the simulated garbled function.

The simulated view (F, X, d) at parameter k for output y and t : XorTopology, on the simulator's coins.

noncomputable def Cslib.Crypto.Garbling.FreeXOR.simWord (hash : List Bool → List Bool → List Bool) (k : ℕ) (y : List Bool) (t : XorTopology) :

The simulator S(1^k, y, Φ_xor(f)) of Free-XOR garbling: sample the coins and write the simulated view.

def Cslib.Crypto.Garbling.FreeXOR.viewWord {n m s : ℕ} (k : ℕ) (τ : Circuits.Circuit.Topology n m s) (free : Fin s → Bool) (V : View τ free (BitString (k + 1))) :

The words (F, X, d) of a typed Free-XOR view at parameter k.

The simulator's coins #

theorem Cslib.Crypto.Garbling.FreeXOR.nonXorRank_lt (free : List Bool) {g g' : ℕ} (hg : g < free.length) (hf : free[g] = false) (h : g < g') :
nonXorRank free g < nonXorRank free g'

A non-XOR gate strictly increases nonXorRank.

The simulated view is the typed simulator's #

The simulated propagated words after all q gates match the typed propagated base labels.

theorem Cslib.Crypto.Garbling.FreeXOR.decodeWord_evalWord_simViewWord (hash : List Bool → List Bool → List Bool) (k : ℕ) (f : ValidCircuit) {y : List Bool} (hy : y.length = (↑f).m) (coins : List Bool) :
PointPermute.decodeWord (simViewWord hash k y (phiXor.phi f) coins).decInfo (evalWord hash (simViewWord hash k y (phiXor.phi f) coins).fn (simViewWord hash k y (phiXor.phi f) coins).input) = some y

Simulated views decode to the output.

Efficiency #

theorem Cslib.Crypto.Garbling.FreeXOR.simPropWords_polyTime_of {γ : Type} {encIn : γ ↪ List Bool} {k : γ → ℕ} {t : γ → Topo} {free coins : γ → List Bool} (hk : Turing.MultiTapeTM.ComputableInPolyTime k encIn Turing.MultiTapeTM.encUnary) (hd : Turing.MultiTapeTM.ComputableInPolyTime (fun (x : γ) => ((t x).n, (t x).m, (t x).gateList)) encIn encTopoData) (hfree : Turing.MultiTapeTM.ComputableInPolyTime free encIn Turing.MultiTapeTM.encBits) (hcoins : Turing.MultiTapeTM.ComputableInPolyTime coins encIn Turing.MultiTapeTM.encBits) (hA : ∀ (x : γ) (g : Fin (t x).q), 1 ≤ (t x).A g) (hAB : ∀ (x : γ) (g : Fin (t x).q), (t x).A g < (t x).B g) (hBg : ∀ (x : γ) (g : Fin (t x).q), (t x).B g < (t x).n + 1 + ↑g) :

simPropWords is computed in polynomial time for any polynomial-time topology satisfying the circuit ordering bounds.

The number of non-XOR gates in the first g gates is computed in polynomial time.

Library infrastructure (no cited result): polynomial-time gate-row prefixing shared between the Free-XOR simulator and CCR reduction.