Documentation

CslibFrontier.Crypto.Computational.GMW.Simulator

Pointwise reduction and zero-knowledge simulation for the 3-copy GMW protocol #

gmwViewReduction is one uniform PRG-challenge test whose ordinary input contains the unary security parameter, instance, witness, auxiliary word and challenge. For every valid tuple, gmwView_advantage_le bounds the real/simulated view advantage by (7 / 8) ^ (n + 1) plus dyadicSize (n + 1) * dyadicSize (totalLen (f a)) times this test's PRG advantage at seed parameter n + 7. No security or efficient-generation assumption is used in that finite bound. The final view test receives the instance and auxiliary word in both games. The simulator gmwSimulator remains witness-free.

isPPTOn_gmwViewReduction charges the complete encoded input, both hybrid selections, all surrounding samples and the malicious verifier's adaptive computation and retained private state. The existing uniform-family theorem gmwView_indistinguishable_gmwSimulator follows from this finite bound and certificate under uniform PRG security, for deterministic polynomial-time instance/witness/auxiliary families.

gmwView_negligible_of_advice_prg instead permits arbitrary families with three separate polynomial encoding-length bounds, under AdvicePRG: a PRG premise, novel to this library, against uniform full-input tests supplied those families as advice. It follows from a nonuniform PRG (Cslib.Crypto.NonuniformPRG.advicePRG), and is not known to follow from uniform one-wayness. Unbounded auxiliary input with a clock independent of its length, witness-level Levin reductions, and sequential soundness amplification remain separate.

The proof uses four distribution transformations:

  1. Guess a uniform 3-bit challenge in each of n + 1 independent attempts. Each attempt is the honest view tagged by an independent guessCoin (eval_game0), so the shared retry bound Game.advantage_bind_firstSuccess_replicate_le charges (7 / 8) ^ (n + 1).
  2. Factor the commitment seeds into active seeds and pseudorandom unopened pads without changing the attempt distribution (eval_game0Pads_eq_eval_game0).
  3. Apply sequenceTest_advantage once to attempts and once to unopened pads. The resulting product of dyadic-range losses is exact (gmwViewReduction_advantage), including zero pads.
  4. Uniform unopened pads eliminate the witness from each attempt (eval_game1_eq_eval_gmwSimAttempt), giving the existing witness-free simulator.

Main definitions #

Main results #

References #

Step 1: Replacing the verifier's challenge in runTwoRound by a random guess #

Whether a uniform 3-bit guess hits the challenge [false, false, false]. By symmetry it has the law of a guess hitting any fixed 3-bit challenge (uniformList_map_beq_eq_guessCoin).

A uniform 3-bit guess misses a fixed challenge with probability 7 / 8.

noncomputable def Cslib.Crypto.GMW.game0 {β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (prog : Probability.WordOracleComp Unit β) :

Single-attempt hybrid 0: guess a 3-bit challenge ch_guess, sample honest prover coins, run prog against honestReply1 and fun _ => honestReply2 ... ch_guess, and return the verifier's output when its challenge equals ch_guess.

theorem Cslib.Crypto.GMW.eval_game0 {β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (prog : Probability.WordOracleComp Unit β) :
(game0 generator s m φ w prog).eval = (do let coins ← sampleHonestCoins s φ w Prod.fst <$> runTwoRound (honestReply1 generator m φ coins) (honestReply2 s φ coins) prog TwoRoundState.init).eval.bind (tagWith guessCoin)

An attempt of hybrid 0 returns the honest view tagged by an independent guessCoin: answering the guessed challenge instead of the verifier's leaves the accepted views unchanged.

Step 2: Introducing unopened pads via naorSelectPads #

noncomputable def Cslib.Crypto.GMW.gmwRealWithPads {β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (prog : Probability.WordOracleComp Unit β) (pads : List (List Bool)) :

Run one attempt with pre-sampled unopened pads pads and active flags allOpenFlags φ ch_guess bits.

noncomputable def Cslib.Crypto.GMW.gmwRealPRGPads {β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (prog : Probability.WordOracleComp Unit β) :

Single-attempt hybrid with pseudorandom unopened pads.

noncomputable def Cslib.Crypto.GMW.gmwRealUniformPads {β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (prog : Probability.WordOracleComp Unit β) :

Single-attempt hybrid with uniform unopened pads.

theorem Cslib.Crypto.GMW.eval_game0Pads_eq_eval_game0 {β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (prog : Probability.WordOracleComp Unit β) :
(gmwRealPRGPads generator s m φ w prog).eval = (game0 generator s m φ w prog).eval

Masking unopened committed bits and eliminating the witness #

theorem Cslib.Crypto.GMW.eval_game1_eq_eval_gmwSimAttempt {β : Type} (generator : List Bool → List Bool) {s m : ℕ} {φ : Logic.PL.CNF ℕ} {w : List Bool} (hw : Complexity.ThreeSAT.verifier (φ, w) = true) (prog : Probability.WordOracleComp Unit β) :
(gmwRealUniformPads generator s m φ w prog).eval = (gmwSimAttempt generator s m φ prog).eval

A pointwise finite reduction #

noncomputable def Cslib.Crypto.GMW.gmwViewReduction {α : Type} (generator : List Bool → List Bool) (length : ℕ → ℕ) (f : α → Logic.PL.CNF ℕ) (Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit (List Bool)) (adversary : ℕ → α → List Bool → List Bool → ProbComp Bool) (n : ℕ) (a : α) (w z challenge : List Bool) :

A single PRG-challenge test for the complete GMW view. The ordinary input is the security parameter n, instance a, witness w, auxiliary word z, and PRG challenge. Two independently sampled dyadic indices select an attempt and an unopened pad. The remaining attempts and pads are generated by this program, including the verifier's adaptive queries and private randomness.

The simulator remains witness-free; only the reduction is given w. No security or validity assumption is needed to define this program. Its PRG challenge has seed parameter n + 7.

theorem Cslib.Crypto.GMW.gmwView_advantage_le {α : Type} (generator : List Bool → List Bool) (length : ℕ → ℕ) (f : α → Logic.PL.CNF ℕ) (Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit (List Bool)) (adversary : ZKDistinguisher α) (n : ℕ) (a : α) (w z : List Bool) (hw : Complexity.ThreeSAT.verifier (f a, w) = true) :
(distinguishingGame (zkRealView (gmwProver generator (n + 7) (length (n + 7)) (f a) w) (Vstar n a z)) (adversary n a z)).advantage (distinguishingGame (gmwSimulator generator length f Vstar n a z).eval (adversary n a z)) ≤ (7 / 8) ^ (n + 1) + ↑(Probability.dyadicSize (n + 1)) * ↑(Probability.dyadicSize (totalLen (f a))) * Game.advantage (generator <$> BitString.sampleList (n + 7) >>= gmwViewReduction generator length f Vstar adversary n a w z).eval (BitString.sampleList (length (n + 7)) >>= gmwViewReduction generator length f Vstar adversary n a w z).eval

Pointwise finite GMW view reduction for every valid instance, witness and auxiliary word. The two dyadic factors are exact hybrid losses; the remaining term bounds failure of all n + 1 challenge guesses. The PRG challenge uses the protocol's shifted seed size n + 7.

This is an unconditional reduction identity and statistical bound, not a PRG-security premise. In particular no efficient generation of a, w or z is assumed. The test receives the same public instance and auxiliary word in both views, and the simulator receives no witness.

theorem Cslib.Crypto.GMW.isPPTOn_gmwViewReduction {α : Type} {enc : α ↪ List Bool} {generator : List Bool → List Bool} {length : ℕ → ℕ} {f : α → Logic.PL.CNF ℕ} {Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit (List Bool)} {adversary : ZKDistinguisher α} (hg : Turing.MultiTapeTM.ComputableInPolyTime generator Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) (hlen : ∀ (s : List Bool), (generator s).length = length s.length) (hf : Turing.MultiTapeTM.ComputableInPolyTime f enc Complexity.encCNF) (hV : Probability.IsOraclePPTOn (encInstanceAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => Vstar n a z) (hadv : ZKDistinguisher.IsPPT enc adversary) :
Probability.IsPPTOn (Turing.MultiTapeTM.encPair (encInstanceWitnessAuxInput enc) Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool fun (x : (ℕ × α × List Bool × List Bool) × List Bool) => match x with | ((n, a, w, z), challenge) => gmwViewReduction generator length f Vstar adversary n a w z challenge

The reduction has a strict uniform clock polynomial in its entire ordinary input. In particular the encoded witness and auxiliary word are charged, without requiring either to be generated efficiently from n. The certificate includes both hybrid indices, all surrounding samples, and the verifier interaction; the verifier may retain its private coins in its output.

def Cslib.Crypto.GMW.AdvicePRG {α : Type} (enc : α ↪ List Bool) (generator : List Bool → List Bool) (length : ℕ → ℕ) :

The advice-PRG premise of the GMW auxiliary-input steps. This assumption is novel to this library: no cited source states it. For an instance encoding enc, generator has output length length, is computable in polynomial time, and its output at seed length n + 7 is indistinguishable from uniform strings of length length (n + 7) against every full-input uniform strict PPT test that also reads arbitrary polynomially bounded instance, witness and auxiliary-input families (a, w, z).

Relation to standard assumptions. It follows from a nonuniform pseudorandom generator (NonuniformPRG.advicePRG), so a nonuniform one-way function yields a generator satisfying it (NonuniformOneWay.exists_nonuniformPRG_three_mul). That is how the library's Goldreich–Micali–Wigderson theorem, NonuniformOneWay.exists_zkProof_of_mem_NP, discharges it. It is not known to follow from a uniform PseudorandomGenerator or a uniform OneWay function: the families are arbitrary, so the tests it covers are nonuniform.

Why it is plausible. It is the special case of nonuniform PRG security in which the advice is the tuple (a n, w n, z n) and the seed length is shifted by 7; any generator secure against tests with polynomially bounded advice satisfies it.

theorem Cslib.Crypto.GMW.AdvicePRG.negligible_encoded {α γ : Type} {enc : α ↪ List Bool} {encAux : γ ↪ List Bool} {generator : List Bool → List Bool} {length : ℕ → ℕ} (hAdv : AdvicePRG enc generator length) {test : (ℕ × α × List Bool × γ) × List Bool → ProbComp Bool} (htest : Probability.IsPPTOn (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encPair enc (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits encAux))) Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool test) {a : ℕ → α} {w : ℕ → List Bool} {aux : ℕ → γ} (ha : PolynomiallyBounded fun (n : ℕ) => (enc (a n)).length) (hw : PolynomiallyBounded fun (n : ℕ) => (w n).length) (haux : PolynomiallyBounded fun (n : ℕ) => (encAux (aux n)).length) :
Negligible fun (n : ℕ) => Game.advantage (do let challenge ← generator <$> BitString.sampleList (n + 7) test ((n, a n, w n, aux n), challenge)).eval (do let challenge ← BitString.sampleList (length (n + 7)) test ((n, a n, w n, aux n), challenge)).eval

AdvicePRG covers any uniform strict PPT challenge test taking an auxiliary advice value aux n : γ under an arbitrary encoding encAux : γ ↪ List Bool, via IsPPTOn.exists_bool_factor.

theorem Cslib.Crypto.GMW.AdvicePRG.gmwView_negligible {α : Type} {enc : α ↪ List Bool} {generator : List Bool → List Bool} {length : ℕ → ℕ} {f : α → Logic.PL.CNF ℕ} {Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit (List Bool)} {adversary : ZKDistinguisher α} (hAdv : AdvicePRG enc generator length) (hf : Turing.MultiTapeTM.ComputableInPolyTime f enc Complexity.encCNF) (hV : Probability.IsOraclePPTOn (encInstanceAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => Vstar n a z) (hadv : ZKDistinguisher.IsPPT enc adversary) {a : ℕ → α} {w z z' : ℕ → List Bool} (ha : PolynomiallyBounded fun (n : ℕ) => (enc (a n)).length) (hw : PolynomiallyBounded fun (n : ℕ) => (w n).length) (hz : PolynomiallyBounded fun (n : ℕ) => (z n).length) (hz' : PolynomiallyBounded fun (n : ℕ) => (z' n).length) (hw_sat : ∀ (n : ℕ), Complexity.ThreeSAT.verifier (f (a n), w n) = true) :
Negligible fun (n : ℕ) => (distinguishingGame (zkRealView (gmwProver generator (n + 7) (length (n + 7)) (f (a n)) (w n)) (Vstar n (a n) (z n))) (adversary n (a n) (z' n))).advantage (distinguishingGame (gmwSimulator generator length f Vstar n (a n) (z n)).eval (adversary n (a n) (z' n)))

Under AdvicePRG enc generator length, the real GMW interaction view and gmwSimulator have negligible distinguishing advantage against every full-input uniform strict PPT distinguisher across all polynomially bounded valid instance, witness, verifier-auxiliary, and distinguisher-auxiliary families.

theorem Cslib.Crypto.GMW.gmwView_negligible_of_advice_prg {α : Type} {enc : α ↪ List Bool} {generator : List Bool → List Bool} {length : ℕ → ℕ} {f : α → Logic.PL.CNF ℕ} {Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit (List Bool)} {adversary : ZKDistinguisher α} (hg : Turing.MultiTapeTM.ComputableInPolyTime generator Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) (hlen : ∀ (s : List Bool), (generator s).length = length s.length) (hf : Turing.MultiTapeTM.ComputableInPolyTime f enc Complexity.encCNF) (hV : Probability.IsOraclePPTOn (encInstanceAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => Vstar n a z) (hadv : ZKDistinguisher.IsPPT enc adversary) (hPRG : ∀ (test : (ℕ × α × List Bool × List Bool) × List Bool → ProbComp Bool), Probability.IsPPTOn (Turing.MultiTapeTM.encPair (encInstanceWitnessAuxInput enc) Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool test → ∀ (a : ℕ → α) (w z : ℕ → List Bool), (PolynomiallyBounded fun (n : ℕ) => (enc (a n)).length) → (PolynomiallyBounded fun (n : ℕ) => (w n).length) → (PolynomiallyBounded fun (n : ℕ) => (z n).length) → Negligible fun (n : ℕ) => Game.advantage (do let challenge ← generator <$> BitString.sampleList (n + 7) test ((n, a n, w n, z n), challenge)).eval (do let challenge ← BitString.sampleList (length (n + 7)) test ((n, a n, w n, z n), challenge)).eval) {a : ℕ → α} {w z : ℕ → List Bool} (ha : PolynomiallyBounded fun (n : ℕ) => (enc (a n)).length) (hw : PolynomiallyBounded fun (n : ℕ) => (w n).length) (hz : PolynomiallyBounded fun (n : ℕ) => (z n).length) (hw_sat : ∀ (n : ℕ), Complexity.ThreeSAT.verifier (f (a n), w n) = true) :
Negligible fun (n : ℕ) => (distinguishingGame (zkRealView (gmwProver generator (n + 7) (length (n + 7)) (f (a n)) (w n)) (Vstar n (a n) (z n))) (adversary n (a n) (z n))).advantage (distinguishingGame (gmwSimulator generator length f Vstar n (a n) (z n)).eval (adversary n (a n) (z n)))

Auxiliary-input consequence under an explicitly stronger PRG premise. The three families may be arbitrary, subject to their separate polynomial encoding-length bounds. hPRG supplies those families as ordinary advice to every full-input PPT challenge test, at seed size n + 7. It is not a consequence established here of uniform PRG security or uniform one-wayness.

Both the verifier and final test have clocks polynomial in their complete encoded inputs. This does not cover unbounded auxiliary words with clocks bounded only in the security parameter and common-input length. Witness-level Levin reductions and sequential amplification are separate from this single-execution masked-3SAT view theorem.

theorem Cslib.Crypto.GMW.gmwView_indistinguishable_gmwSimulator {α : Type} {enc : α ↪ List Bool} {generator : List Bool → List Bool} {length : ℕ → ℕ} (hG : PseudorandomGenerator generator length) {f : α → Logic.PL.CNF ℕ} (hf : Turing.MultiTapeTM.ComputableInPolyTime f enc Complexity.encCNF) {Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit (List Bool)} (hV : Probability.IsOraclePPTOn (encInstanceAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => Vstar n a z) {a : ℕ → α} {w z : ℕ → List Bool} (ha : Turing.MultiTapeTM.ComputableInPolyTime a Turing.MultiTapeTM.encUnary enc) (hw_comp : Turing.MultiTapeTM.ComputableInPolyTime w Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) (hz : Turing.MultiTapeTM.ComputableInPolyTime z Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits) (hw_sat : ∀ (n : ℕ), Complexity.ThreeSAT.verifier (f (a n), w n) = true) :
ComputationallyIndistinguishable (fun (n : ℕ) => zkRealView (gmwProver generator (n + 7) (length (n + 7)) (f (a n)) (w n)) (Vstar n (a n) (z n))) fun (n : ℕ) => (gmwSimulator generator length f Vstar n (a n) (z n)).eval

Zero-knowledge simulation of the 3-copy GMW protocol. For any uniform strict oracle PPT malicious verifier Vstar and any deterministic polynomial-time families of instances a, valid ThreeSAT witnesses w, and auxiliary inputs z, the real interaction view of Vstar with gmwProver is computationally indistinguishable from gmwSimulator.