Documentation

CslibFrontier.Crypto.Computational.GMW.Sequential

Sequential soundness amplification for the 3-copy GMW zero-knowledge protocol #

This module sequentially composes k n independent executions of the 3-copy masked-3SAT GMW protocol (CslibFrontier.Crypto.Computational.GMW.Protocol), where generator maps seeds of length m to words of length length m. Perfect completeness (acceptProb = 1) is preserved for every k. If 3 * m + 1 ≤ length m for all m, the soundness error drops from 1 / 3 to (1 / 3) ^ (k n) against arbitrary unbounded stateful provers, again for every k.

Computational zero-knowledge is proved in CslibFrontier.Crypto.Computational.GMW.Sequential.Simulator, which builds gmwSeqSimulator from the single-session attempts of CslibFrontier.Crypto.Computational.GMW.Simulator and the machine-slicing primitives of Section 2 below. It holds against arbitrary uniform strict oracle PPT malicious verifiers when the map f from instances to formulas is computable in polynomial time and k is computable in polynomial time in unary (ComputableInPolyTime k encUnary encUnary), and it is conditional: under PseudorandomGenerator it covers instance, witness and auxiliary-input families computable in polynomial time from the unary parameter, and under AdvicePRG it covers arbitrary such families of polynomially bounded length. In both cases the witnesses are valid ThreeSAT witnesses.

Main definitions #

Main results #

Section 1: Sequential multi-session prover, verifier, completeness, and soundness #

Multi-session deterministic transition for sequential two-round GMW executions. The state (inRound2, coinsList) tracks whether the current session is waiting for its first query (false) or second query (true), together with the remaining list of per-session prover ProverCoins. Once coinsList is exhausted, subsequent queries return [].

Run a WordOracleComp Unit program against seqStep with honest GMW reply functions inside ProbComp.

@[simp]
theorem Cslib.Crypto.GMW.runSeq_pure {α : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (a : α) (st : Bool × List ProverCoins) :
runSeq generator s m φ (pure a) st = pure (a, st)
theorem Cslib.Crypto.GMW.runSeq_bind {α β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (prog : Probability.WordOracleComp Unit α) (next : α → Probability.WordOracleComp Unit β) (st : Bool × List ProverCoins) :
runSeq generator s m φ (prog >>= next) st = do let x ← runSeq generator s m φ prog st runSeq generator s m φ (next x.1) x.2
theorem Cslib.Crypto.GMW.runSeq_map {α β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (f : α → β) (prog : Probability.WordOracleComp Unit α) (st : Bool × List ProverCoins) :
runSeq generator s m φ (f <$> prog) st = Prod.map f id <$> runSeq generator s m φ prog st
@[simp]
theorem Cslib.Crypto.GMW.runSeq_sample {α : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (prog : ProbComp α) (st : Bool × List ProverCoins) :
runSeq generator s m φ (ProbOracleComp.sample prog) st = (fun (x : α) => (x, st)) <$> prog
@[simp]
theorem Cslib.Crypto.GMW.runSeq_query (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (q : Unit × List Bool) (st : Bool × List ProverCoins) :
runSeq generator s m φ (ProbOracleComp.query q) st = pure (seqStep (honestReply1 generator m φ) (honestReply2 s φ) q.2 st)
theorem Cslib.Crypto.GMW.eval_runSeq {α : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (prog : Probability.WordOracleComp Unit α) (st : Bool × List ProverCoins) :
(runSeq generator s m φ prog st).eval = ProbOracleComp.runWith (fun (q : Unit × List Bool) (state : Bool × List ProverCoins) => PMF.pure (seqStep (honestReply1 generator m φ) (honestReply2 s φ) q.2 state)) prog st
noncomputable def Cslib.Crypto.GMW.gmwSeqProver (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (k : ℕ) :

The honest sequential GMW prover for k executions on a 3SAT formula φ and witness w. On the first query it samples k independent ProverCoins from sampleHonestCoins s φ w and answers up to k two-round sessions via seqStep.

theorem Cslib.Crypto.GMW.run_gmwSeqProver_fst {α : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (k : ℕ) (prog : Probability.WordOracleComp Unit α) :
PMF.map Prod.fst ((gmwSeqProver generator s m φ w k).run prog (gmwSeqProver generator s m φ w k).init) = (do let coinsList ← OracleComp.replicate k (sampleHonestCoins s φ w) Prod.fst <$> runSeq generator s m φ prog (false, coinsList)).eval
noncomputable def Cslib.Crypto.GMW.gmwSeqInteract (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (k : ℕ) (prog : Probability.WordOracleComp Unit (List Bool)) :

The PPT program realizing gmwSeqProver's interaction with a verifier prog.

theorem Cslib.Crypto.GMW.eval_gmwSeqInteract (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (k : ℕ) (prog : Probability.WordOracleComp Unit (List Bool)) :
(gmwSeqInteract generator s m φ w k prog).eval = PMF.map Prod.fst ((gmwSeqProver generator s m φ w k).run prog (gmwSeqProver generator s m φ w k).init)
@[reducible, inline]

Encode the multi-session prover state (inRound2, coinsList).

theorem Cslib.Crypto.GMW.isPPTOn_gmwSeqInteract {α : Type} {enc : α ↪ List Bool} {generator : List Bool → List Bool} {length k : ℕ → ℕ} {f : α → Logic.PL.CNF ℕ} {Vstar : ℕ → α → List Bool → Probability.WordOracleComp Unit (List Bool)} (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) (hk : Turing.MultiTapeTM.ComputableInPolyTime k Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hV : Probability.IsOraclePPTOn (encInstanceAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => Vstar n a z) :
Probability.IsPPTOn (encInstanceWitnessAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool × List Bool) => match x with | (n, a, w, z) => gmwSeqInteract generator (n + 7) (length (n + 7)) (f a) w (k n) (Vstar n a z)

gmwSeqInteract is uniform strict PPT whenever k is computable in polynomial time.

theorem Cslib.Crypto.GMW.isOraclePPTOn_replicate_bool {Operation α : Type} [DecidableEq Operation] {input : α ↪ List Bool} {program : α → Probability.WordOracleComp Operation Bool} {count : α → ℕ} (hprog : Probability.IsOraclePPTOn input Turing.MultiTapeTM.encBool program) (hcount : Turing.MultiTapeTM.ComputableInPolyTime count input Turing.MultiTapeTM.encUnary) :
noncomputable def Cslib.Crypto.GMW.gmwSeqVerifier {α : Type} (generator : List Bool → List Bool) (length : ℕ → ℕ) (f : α → Logic.PL.CNF ℕ) (k : ℕ → ℕ) (n : ℕ) (a : α) :

The sequentially amplified GMW verifier: execute gmwVerifier k n times and accept iff all k n executions accept.

theorem Cslib.Crypto.GMW.acceptProb_gmwSeqVerifier_gmwSeqProver {α : Type} {generator : List Bool → List Bool} {length : ℕ → ℕ} (hlen : ∀ (seed : List Bool), (generator seed).length = length seed.length) (f : α → Logic.PL.CNF ℕ) (k : ℕ → ℕ) (n : ℕ) (a : α) {w : List Bool} (hw : Complexity.ThreeSAT.verifier (f a, w) = true) :
Complexity.acceptProb (gmwSeqVerifier generator length f k n a) (gmwSeqProver generator (n + 7) (length (n + 7)) (f a) w (k n)) = 1

Completeness of the sequentially amplified GMW protocol. When ThreeSAT.verifier (f a, w) = true, gmwSeqProver makes gmwSeqVerifier accept with probability 1.

theorem Cslib.Crypto.GMW.acceptProb_replicate_all_le {Operation : Type} {verifier : Probability.WordOracleComp Operation Bool} {c : ENNReal} (hV : ∀ (P : Complexity.Prover Operation), Complexity.acceptProb verifier P ≤ c) (k : ℕ) (P : Complexity.Prover Operation) :
Complexity.acceptProb ((fun (bs : List Bool) => bs.all id) <$> OracleComp.replicate k verifier) P ≤ c ^ k

Sequential soundness amplification for interactive proofs. If no stateful prover makes verifier accept with probability greater than c, then running verifier k times sequentially and accepting iff all k executions accept has soundness error at most c ^ k against every unbounded stateful prover P.

theorem Cslib.Crypto.GMW.acceptProb_gmwSeqVerifier_le {α : Type} {generator : List Bool → List Bool} {length : ℕ → ℕ} (hlen : ∀ (seed : List Bool), (generator seed).length = length seed.length) (hstretch : ∀ (m : ℕ), 3 * m + 1 ≤ length m) (f : α → Logic.PL.CNF ℕ) (k : ℕ → ℕ) (n : ℕ) (a : α) (hnot : f a ∉ Complexity.ThreeSAT) (P : Complexity.Prover Unit) :
Complexity.acceptProb (gmwSeqVerifier generator length f k n a) P ≤ (1 / 3) ^ k n

Soundness of the sequentially amplified GMW protocol. When f a ∉ ThreeSAT and 3 * m + 1 ≤ length m for all m, no unbounded stateful prover P makes gmwSeqVerifier accept with probability greater than (1 / 3) ^ (k n).

Section 2: Query-budgeted machine slicing (sessionStep) #

Query handler for oneSessionStep: truncates the oracle reply to limit bits and decrements the remaining query budget q by 1.

One step of the query-budgeted machine simulation: if both the remaining step budget rem and query budget q are positive, executes one machine step via OpenOracleSimulation.step with sessionQueryHandler limit and decrements rem; otherwise returns (rem, q, cfg) unchanged.

Run machine for up to rem steps or until q oracle queries have been made, truncating each oracle reply to limit bits, and returning the remaining step count and finite configuration.

@[simp]
theorem Cslib.Crypto.GMW.sessionStep_zero_rem {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (limit q : ℕ) (cfg : Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit) :
sessionStep machine limit 0 q cfg = pure (0, cfg)
@[simp]
theorem Cslib.Crypto.GMW.sessionStep_zero_q {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (limit rem : ℕ) (cfg : Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit) :
sessionStep machine limit rem 0 cfg = pure (rem, cfg)
theorem Cslib.Crypto.GMW.sessionStep_succ {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (limit rem q : ℕ) (cfg : Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit) :
sessionStep machine limit (rem + 1) (q + 1) cfg = do let p ← Probability.OpenOracleSimulation.step machine sessionQueryHandler limit (cfg, q + 1) sessionStep machine limit rem p.2 p.1
theorem Cslib.Crypto.GMW.sessionStep_eq_finiteRunFrom {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (limit rem q : ℕ) (cfg : Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit) (h : rem ≤ q) :
(fun (p : ℕ × Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit) => p.2.tapes.output) <$> sessionStep machine limit rem q cfg = Turing.MultiTapeMachine.finiteRunFrom machine (fun (choices : ReaderT Bool Id (Turing.MultiTapeMachine.Action k Bool Control Unit)) => choices <$> ProbOracleComp.sample (ProbComp.uniform Bool)) (fun (op : Unit) (word : List Bool) => List.take limit <$> ProbOracleComp.query (op, word)) rem cfg

When rem ≤ q, the query budget q is never exhausted before rem steps, so sessionStep produces the exact same output program as machine.finiteRunFrom with limit-truncated replies.

theorem Cslib.Crypto.GMW.sessionStep_init_eq_runOracle {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (T q : ℕ) (word : List Bool) (h : T ≤ q) :

Starting from FiniteConfig.init machine.initial word with T ≤ q, sessionStep produces the exact same ProbOracleComp program as machine.runOracle T word.

Every finite configuration cfg satisfies FiniteConfig.SpaceBound L L 0 cfg where L := (encFiniteConfig cfg).length.

theorem Cslib.Crypto.GMW.mem_support_oneSessionStep {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (limit : ℕ) {W T rem q rem' q' : ℕ} {cfg cfg' : Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit} (hrem : rem ≤ T) (hcfg : Turing.MultiTapeMachine.FiniteConfig.SpaceBound W (T - rem) limit cfg) (hnext : (rem', q', cfg') ∈ OracleComp.support (oneSessionStep machine limit (rem, q, cfg))) :
rem' ≤ rem ∧ q' ≤ q ∧ Turing.MultiTapeMachine.FiniteConfig.SpaceBound W (T - rem') limit cfg'

One step of oneSessionStep preserves the countdown and FiniteConfig.SpaceBound.

@[reducible, inline]

State (rem, q, cfg) of oneSessionStep, with both budgets in unary: the remaining step budget rem, the remaining query budget q, then the machine's finite configuration encoded by encFiniteConfig. Both budgets are framed.

theorem Cslib.Crypto.GMW.mem_support_sessionStep {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (limit q : ℕ) {W T : ℕ} {st st' : ℕ × Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit} (hrem : st.1 ≤ T) (hcfg : Turing.MultiTapeMachine.FiniteConfig.SpaceBound W (T - st.1) limit st.2) (hst' : st' ∈ OracleComp.support (sessionStep machine limit st.1 q st.2)) :

Every state reachable by sessionStep preserves the countdown and FiniteConfig.SpaceBound.

theorem Cslib.Crypto.GMW.runSeq_nil_fst {α : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (prog : Probability.WordOracleComp Unit α) :
Prod.fst <$> runSeq generator s m φ prog (false, []) = ProbOracleComp.run prog fun (x : Unit × List Bool) => pure []

Running runSeq from the exhausted prover state (false, []) answers every query with [], independently of generator, s, m, and φ.

noncomputable def Cslib.Crypto.GMW.finishSessionRun {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (limit : ℕ) (st : ℕ × Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit) :

Complete any remaining steps of a sliced machine run against the exhausted prover state (false, []) and return the final output tape.

theorem Cslib.Crypto.GMW.mem_support_runTwoRound {β : Type} (f1 f2 : List Bool → List Bool) (prog : Probability.WordOracleComp Unit β) (s s' : TwoRoundState) {result : β} (h : (result, s') ∈ (runTwoRound f1 f2 prog s).eval.support) :

Any result in the support of runTwoRound lies in OracleComp.support prog.

theorem Cslib.Crypto.GMW.mem_support_acceptGuess_runTwoRound {β : Type} (f1 f2 : List Bool → List Bool) (prog : Probability.WordOracleComp Unit β) (ch_guess : List Bool) (s : TwoRoundState) {result : β} (h : some result ∈ (acceptGuess ch_guess <$> runTwoRound f1 f2 prog s).eval.support) :

An output that acceptGuess keeps from runTwoRound lies in OracleComp.support prog.

theorem Cslib.Crypto.GMW.mem_support_gmwSimWithPads {β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (prog : Probability.WordOracleComp Unit β) (pads : List (List Bool)) {result : β} (h : some result ∈ (gmwSimWithPads generator s m φ prog pads).eval.support) :
theorem Cslib.Crypto.GMW.mem_support_gmwSimAttempt {β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (prog : Probability.WordOracleComp Unit β) {result : β} (h : some result ∈ (gmwSimAttempt generator s m φ prog).eval.support) :
theorem Cslib.Crypto.GMW.mem_support_gmwRealWithPads {β : Type} (generator : List Bool → List Bool) (s m : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (prog : Probability.WordOracleComp Unit β) (pads : List (List Bool)) {result : β} (h : some result ∈ (gmwRealWithPads generator s m φ w prog pads).eval.support) :
noncomputable def Cslib.Crypto.GMW.realSessionStep {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (generator : List Bool → List Bool) (s m limit : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (st : ℕ × Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit) :

One session of the honest sequential execution on (rem, cfg) with fresh prover coins.

noncomputable def Cslib.Crypto.GMW.simSessionStep {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (generator : List Bool → List Bool) (s m limit att : ℕ) (φ : Logic.PL.CNF ℕ) (st : ℕ × Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit) :

One session of the simulated sequential execution on (rem, cfg), repeating gmwSimAttempt att times and falling back to st on failure.

theorem Cslib.Crypto.GMW.eval_replicate_runSeq_sessionStep {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (generator : List Bool → List Bool) (s m limit : ℕ) (φ : Logic.PL.CNF ℕ) (w : List Bool) (K : ℕ) (st : ℕ × Turing.MultiTapeMachine.FiniteConfig k Bool Control Unit) :
(do let coinsList ← OracleComp.replicate K (sampleHonestCoins s φ w) Prod.fst <$> runSeq generator s m φ (sessionStep machine limit st.1 (limit + 2 * K) st.2) (false, coinsList)).eval = (do let st' ← OracleComp.iterate K (realSessionStep machine generator s m limit φ w) st ProbOracleComp.run (sessionStep machine limit st'.1 limit st'.2) fun (x : Unit × List Bool) => pure []).eval

Peeling K sessions of runSeq on sessionStep into OracleComp.iterate K realSessionStep followed by running against fun _ => pure [].

theorem Cslib.Crypto.GMW.eval_gmwSeqInteract_runOracle_eq_iterate_realSessionStep {k : ℕ} {Control : Type} (machine : Turing.MultiTapePTM k Bool Control Unit) (generator : List Bool → List Bool) (s m T K : ℕ) (φ : Logic.PL.CNF ℕ) (w word : List Bool) :
(gmwSeqInteract generator s m φ w K (machine.runOracle T word)).eval = (do let st' ← OracleComp.iterate K (realSessionStep machine generator s m T φ w) (T, Turing.MultiTapeMachine.FiniteConfig.init machine.initial word) finishSessionRun machine T st').eval

gmwSeqInteract on a clocked machine run machine.runOracle T word has the exact same output distribution as K iterations of realSessionStep followed by finishSessionRun.