Documentation

CslibFrontier.Crypto.Computational.ZeroKnowledge

Computational zero-knowledge interactive proofs for NP #

This module defines computational zero-knowledge interactive proofs (ZKProof enc A soundness) bundling uniform GenerableZeroKnowledge only (zero knowledge restricted to (instance, witness) families generated from 1^n in deterministic polynomial time, #6044, rather than Goldreich's auxiliary-input GMW zero knowledge of [Gol98], Definition 4.3.8 and Theorem 4.4.10, proved under nonuniform one-way functions in NonuniformOneWay.exists_zkProof_of_mem_NP), alongside the separate general predicate AuxiliaryInputZeroKnowledge over arbitrary polynomially bounded valid families. Goldreich, Micali, and Wigderson [GMW91] introduced zero-knowledge interactive proofs for NP from bit commitments; here we construct the single-session masked-3SAT ZKProof system, with soundness 1 / 3 and uniform GenerableZeroKnowledge (#6044), for ThreeSAT and for every language Karp-reducible to it using Naor's bit commitment scheme [Nao91] (CslibFrontier.Crypto.Computational.Commitment). Sequential repetition to negligible soundness is in CslibFrontier.Crypto.Computational.ZeroKnowledge.Amplification. The statements compare the real view zkRealView with the simulator's output against distinguishers of type ZKDistinguisher, both from CslibFrontier.Crypto.Computational.ZeroKnowledge.View.

Protocol design and source credit #

While the theorem that every language in NP has a computational zero-knowledge interactive proof system from one-way functions is due to Goldreich, Micali, and Wigderson [GMW91] using Naor's commitment scheme [Nao91], the concrete underlying ThreeSAT protocol formalized in CslibFrontier.Crypto.Computational.GMW is a direct 3-copy masked-3SAT truth-table commitment protocol rather than GMW's original 3-coloring protocol: each of 3 parallel copies commits to a random variable mask, the XOR-masked assignment, and the 8-entry masked truth table of each clause, and a random 3-bit challenge selects for each copy whether to open the mask and full truth tables or the masked assignment and the active truth-table entries.

Restricted versus general auxiliary-input zero-knowledge and witness conventions #

Main definitions #

Main results #

References #

Restricted versus general auxiliary-input zero-knowledge predicates #

def Cslib.Crypto.GenerableZeroKnowledge {α : Type} (enc : α ↪ List Bool) (prover : ℕ → α → List Bool → Complexity.Prover Unit) (isWitness : α → List Bool → Bool) :

Uniform computational zero-knowledge restricted to (instance, witness) and auxiliary-input families generated from 1^n in deterministic polynomial time (#6044), rather than auxiliary-input zero knowledge over arbitrary inputs ([Gol98], Definition 4.3.8). For every uniform strict oracle PPT malicious verifier Vstar (taking security parameter n, instance a, and auxiliary input z, charged for the complete encoded input (1^n, (a, z))), there exists a single uniform strict PPT witness-free simulator S (chosen before the families and charged for (1^n, (a, z))) whose output ensemble is computationally indistinguishable from the real interaction output across all deterministic polynomial-time-generable families of instances a : ℕ → α, valid witnesses w : ℕ → List Bool (∀ n, isWitness (a n) (w n) = true), and auxiliary inputs z : ℕ → List Bool (ComputableInPolyTime · encUnary _).

This notion is novel to this library, and incomparable with [Gol98], Definition 4.3.8, pp. 151–152. It is weaker in ranging only over families generated from 1^n in deterministic polynomial time, where the source quantifies over all instances, witnesses and auxiliary inputs; the distinguisher receives only n and a sample, from which it can compute those families itself. It is stronger in decoupling the security parameter from the instance, as AuxiliaryInputZeroKnowledge does: every party runs in time polynomial in n and the gap is negligible in n, so on generable instances much shorter than n the prover must withstand verifiers and distinguishers that run in time superpolynomial in the instance length.

Relation to standard assumptions. It follows from AuxiliaryInputZeroKnowledge (AuxiliaryInputZeroKnowledge.generableZeroKnowledge). Unlike that notion, it is not shown to imply the library's instance-indexed form of Definition 4.3.8, InstanceAuxiliaryInputZeroKnowledge, since it covers only generable families.

Why it is plausible. Every ZKProof carries it, and OneWay.exists_generableZKProof_of_mem_NP builds a ZKProof with uniform GenerableZeroKnowledge only (#6044; auxiliary-input GMW is NonuniformOneWay.exists_zkProof_of_mem_NP) for every language in NP from any uniform one-way function.

def Cslib.Crypto.AuxiliaryInputZeroKnowledge {α : Type} (enc : α ↪ List Bool) (prover : ℕ → α → List Bool → Complexity.Prover Unit) (isWitness : α → List Bool → Bool) :

General auxiliary-input computational zero-knowledge for arbitrary polynomially bounded valid families. For every uniform strict oracle PPT malicious verifier Vstar (charged for its complete encoded input (1^n, (a, z))), there exists a single uniform strict PPT witness-free simulator S (chosen before the families and distinguisher, charged for (1^n, (a, z))) such that for all arbitrary polynomially bounded families of instances a : ℕ → α, valid witnesses w : ℕ → List Bool (∀ n, isWitness (a n) (w n) = true), verifier auxiliary inputs z : ℕ → List Bool, and distinguisher auxiliary inputs z' : ℕ → List Bool, and for every uniform strict PPT distinguisher adversary (charged for its complete encoded input ((1^n, (a, z')), view)), the distinguishing advantage between the real interaction view and the simulated view is negligible.

This notion is novel to this library. It strengthens [Gol98], Definition 4.3.8, pp. 151–152, which compares, as here, the malicious verifier's output with the simulator's, in two ways.

  • The distinguisher's auxiliary input z' is chosen independently of the verifier's z, while the verifier is clocked in, and may read, all of z. The source gives the distinguisher the verifier's z (p. 152), the case z' = z here. It obtains independent advice for the distinguisher only by hiding it in a padding of z that the verifier and simulator, clocked in |x|, cannot reach (pp. 152–153), and that fails for a verifier that reads all of z.
  • The security parameter is decoupled from the instance. The source indexes its ensembles by the instance x, admits auxiliary inputs of every length, clocks the verifier, simulator and distinguisher in |x| alone and measures the gap in |x|. Here every party also receives n in unary, the instances, witnesses and auxiliary inputs are polynomially bounded families indexed by n and clocked as part of the input, and the gap is negligible in n. So on instances much shorter than n, the prover must withstand verifiers and distinguishers that run in time superpolynomial in |x|.

The prover's private input ranges over valid witnesses (isWitness), where the source's ranges over every string with which the prover meets the completeness condition. That weakens the notion but does not offset the two strengthenings.

Relation to standard assumptions. It implies the library's instance-indexed form, InstanceAuxiliaryInputZeroKnowledge, which follows the source's indexing, clocks and distinguisher input, with the prover's security parameter set to |x| (AuxiliaryInputZeroKnowledge.instanceAuxiliaryInputZeroKnowledge). It also implies UnboundedAuxiliaryInputZeroKnowledge and GenerableZeroKnowledge.

Why it is plausible. From any nonuniformly one-way function, the library's Goldreich–Micali–Wigderson theorem NonuniformOneWay.exists_zkProof_of_mem_NP builds a proof system with this property for every language in NP. Its commitments use generator seeds of length n + 7, set by the security parameter rather than by the instance.

theorem Cslib.Crypto.AuxiliaryInputZeroKnowledge.generableZeroKnowledge {α : Type} {enc : α ↪ List Bool} {prover : ℕ → α → List Bool → Complexity.Prover Unit} {isWitness : α → List Bool → Bool} (h : AuxiliaryInputZeroKnowledge enc prover isWitness) :
GenerableZeroKnowledge enc prover isWitness

General auxiliary-input zero-knowledge implies poly-time-generable zero-knowledge. Every deterministic polynomial-time-generable family has polynomially bounded encoded output length, and every unary-indexed ComputationallyIndistinguishable distinguisher lifts to a full-input distinguisher by ignoring the extra (a, z) component.

theorem Cslib.Crypto.GenerableZeroKnowledge.advantage_negligible {α : Type} {enc : α ↪ List Bool} {prover : ℕ → α → List Bool → Complexity.Prover Unit} {isWitness : α → List Bool → Bool} (h : GenerableZeroKnowledge enc prover isWitness) {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) :
∃ (S : ℕ → α → List Bool → ProbComp (List Bool)), (Probability.IsPPTOn (encInstanceAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => S n a z) ∧ ∀ (a : ℕ → α) (w z : ℕ → List Bool), Turing.MultiTapeTM.ComputableInPolyTime a Turing.MultiTapeTM.encUnary enc → Turing.MultiTapeTM.ComputableInPolyTime w Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits → Turing.MultiTapeTM.ComputableInPolyTime z Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits → (∀ (n : ℕ), isWitness (a n) (w n) = true) → ∀ (adversary : ZKDistinguisher α), ZKDistinguisher.IsPPT enc adversary → Negligible fun (n : ℕ) => (distinguishingGame (zkRealView (prover n (a n) (w n)) (Vstar n (a n) (z n))) (adversary n (a n) (z n))).advantage (distinguishingGame (S n (a n) (z n)).eval (adversary n (a n) (z n)))

Under GenerableZeroKnowledge, any full-input uniform strict PPT distinguisher adversary n (a n) (z n) also has negligible distinguishing advantage on deterministic polynomial-time-generable families a, w, z, since (a n, z n) can be recomputed from 1^n.

Bundled computational zero-knowledge proof systems #

structure Cslib.Crypto.ZKProof {α : Type} (enc : α ↪ List Bool) (A : Set α) (soundness : ℕ → ENNReal) :

Interactive proof system for a language A : Set α (with instance encoding enc : α ↪ List Bool), indexed by a security parameter n : ℕ, with soundness bound soundness : ℕ → ENNReal, bundling uniform GenerableZeroKnowledge only (#6044; general auxiliary-input zero knowledge over arbitrary inputs, cf. [Gol98], Definition 4.3.8, is stated separately as ZKProof.AuxiliaryInputZeroKnowledge). The single-session masked-3SAT builders have soundness := fun _ => 1 / 3; sequential repetition gives fun n => (1 / 3) ^ (k n) (CslibFrontier.Crypto.Computational.ZeroKnowledge.Amplification).

  • verifier n a: the honest verifier's interactive program on security parameter n and instance a, certified uniform strict oracle PPT in (1^n, a) by isOraclePPT_verifier.
  • prover n a w: the honest prover strategy on security parameter n, instance a, and witness w, certified efficient by interact, eval_interact, and isPPT_interact.
  • isWitness a w: the bundled polynomial-time witness predicate characterizing membership in A (mem_iff_exists_witness). No witness-length bound is imposed, so isWitness by itself need not be an NP relation (in zero_knowledge, w is polynomial-time-generable in 1^n). When constructed via a Karp reduction f : α → CNF ℕ to ThreeSAT (PseudorandomGenerator.singleZKProofOfReduction), isWitness a w is ThreeSAT.verifier (f a, w), checking a ThreeSAT witness for f a.
  • complete and sound: completeness 1 for valid witnesses and soundness error at most soundness n against all computationally unbounded stateful provers P : Prover Unit.
  • zero_knowledge: uniform zero-knowledge with poly-time-generable families (GenerableZeroKnowledge enc prover isWitness). For every uniform strict oracle PPT malicious verifier Vstar (taking security parameter n, instance a, and auxiliary input z), there is a uniform strict PPT simulator S (taking (1^n, a, z) without any witness) whose output ensemble is computationally indistinguishable from the real interaction output across all deterministic polynomial-time-generable families of instances a : ℕ → α, valid witnesses w : ℕ → List Bool, and auxiliary inputs z : ℕ → List Bool (ComputableInPolyTime · encUnary _). The stronger general auxiliary-input property over arbitrary polynomially bounded valid families is stated separately as ZKProof.AuxiliaryInputZeroKnowledge.
def Cslib.Crypto.ZKProof.mono {α : Type} {enc : α ↪ List Bool} {A : Set α} {soundness soundness' : ℕ → ENNReal} (zk : ZKProof enc A soundness) (hle : ∀ (n : ℕ), soundness n ≤ soundness' n) :
ZKProof enc A soundness'

Weaken the soundness bound of a ZKProof along a pointwise inequality.

theorem Cslib.Crypto.ZKProof.generableZeroKnowledge {α : Type} {enc : α ↪ List Bool} {A : Set α} {soundness : ℕ → ENNReal} (zk : ZKProof enc A soundness) :

Named projection for the restricted polynomial-time-generable zero-knowledge property bundled by ZKProof.

def Cslib.Crypto.ZKProof.AuxiliaryInputZeroKnowledge {α : Type} {enc : α ↪ List Bool} {A : Set α} {soundness : ℕ → ENNReal} (zk : ZKProof enc A soundness) :

General auxiliary-input computational zero-knowledge for a bundled ZKProof system, ranging over arbitrary polynomially bounded instance, valid-witness, and auxiliary-input families: Cslib.Crypto.AuxiliaryInputZeroKnowledge for the bundled prover and witness predicate.

Like that notion, this one is novel to this library: it strengthens [Gol98], Definition 4.3.8, pp. 151–152, by giving the distinguisher an auxiliary input independent of the verifier's and by decoupling the security parameter from the instance. It implies the bundled instance-indexed form ZKProof.InstanceAuxiliaryInputZeroKnowledge, which follows the source's indexing (ZKProof.AuxiliaryInputZeroKnowledge.instanceAuxiliaryInputZeroKnowledge). It is plausible because the library's Goldreich–Micali–Wigderson theorem NonuniformOneWay.exists_zkProof_of_mem_NP builds systems with this property for every language in NP from any nonuniformly one-way function.

General auxiliary-input zero-knowledge for zk implies the bundled restricted GenerableZeroKnowledge guarantee.

theorem Cslib.Crypto.ZKProof.AuxiliaryInputZeroKnowledge.zero_knowledge_const {α : Type} {enc : α ↪ List Bool} {A : Set α} {soundness : ℕ → ENNReal} {zk : ZKProof enc A soundness} (h : zk.AuxiliaryInputZeroKnowledge) {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) :
∃ (S : ℕ → α → List Bool → ProbComp (List Bool)), (Probability.IsPPTOn (encInstanceAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => S n a z) ∧ ∀ (a : α) (w : List Bool) (z : ℕ → List Bool), zk.isWitness a w = true → (PolynomiallyBounded fun (n : ℕ) => (z n).length) → ∀ (adversary : ZKDistinguisher α), ZKDistinguisher.IsPPT enc adversary → Negligible fun (n : ℕ) => (distinguishingGame (zkRealView (zk.prover n a w) (Vstar n a (z n))) (adversary n a (z n))).advantage (distinguishingGame (S n a (z n)).eval (adversary n a (z n)))

Fixed-instance auxiliary-input zero-knowledge under zk.AuxiliaryInputZeroKnowledge: for any fixed instance a, valid witness w, and arbitrary polynomially bounded auxiliary-input family z : ℕ → List Bool, the real and simulated views have negligible distinguishing advantage against every full-input uniform strict PPT distinguisher.

theorem Cslib.Crypto.ZKProof.isInteractiveProof {α : Type} {enc : α ↪ List Bool} {A : Set α} {soundness : ℕ → ENNReal} (zk : ZKProof enc A soundness) (n : ℕ) :
Complexity.IsInteractiveProof (zk.verifier n) A (2 / 3) (soundness n)

At any security parameter n, the honest verifier of a ZKProof is an interactive proof for A with completeness 2 / 3 and soundness soundness n.

theorem Cslib.Crypto.ZKProof.mem_IP {α : Type} {enc : α ↪ List Bool} {A : Set α} {soundness : ℕ → ENNReal} (zk : ZKProof enc A soundness) (h : ∃ (n : ℕ), soundness n ≤ 1 / 3) :

Any ZKProof whose soundness bound is at most 1 / 3 at some security parameter n places A ∈ IP enc.

theorem Cslib.Crypto.ZKProof.zero_knowledge_const {α : Type} {enc : α ↪ List Bool} {A : Set α} {soundness : ℕ → ENNReal} (zk : ZKProof enc A soundness) {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) :
∃ (S : ℕ → α → List Bool → ProbComp (List Bool)), (Probability.IsPPTOn (encInstanceAuxInput enc) Turing.MultiTapeTM.encBits fun (x : ℕ × α × List Bool) => match x with | (n, a, z) => S n a z) ∧ ∀ (a : α) (w : List Bool) (z : ℕ → List Bool), zk.isWitness a w = true → Turing.MultiTapeTM.ComputableInPolyTime z Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits → ComputationallyIndistinguishable (fun (n : ℕ) => zkRealView (zk.prover n a w) (Vstar n a (z n))) fun (n : ℕ) => (S n a (z n)).eval

Fixed-instance computational zero-knowledge: for every fixed instance a and valid witness w (zk.isWitness a w = true), and every polynomial-time auxiliary input family z : ℕ → List Bool, the real interaction output and simulator output are computationally indistinguishable.

Single-session masked-3SAT ZKProof builders #

noncomputable def Cslib.Crypto.PseudorandomGenerator.singleZKProofOfReduction {α : Type} {enc : α ↪ List Bool} {A : Set α} {generator : List Bool → List Bool} {length : ℕ → ℕ} (hG : PseudorandomGenerator generator length) (hstretch : ∀ (k : ℕ), 3 * k + 1 ≤ length k) {f : α → Logic.PL.CNF ℕ} (hf : Turing.MultiTapeTM.ComputableInPolyTime f enc Complexity.encCNF) (hred : ∀ (a : α), a ∈ A ↔ f a ∈ Complexity.ThreeSAT) :
ZKProof enc A fun (x : ℕ) => 1 / 3

Single-session masked-3SAT ZKProof builder with uniform GenerableZeroKnowledge only (#6044; see GenerableZeroKnowledge) and soundness 1 / 3 for any language A Karp-reducible via f : α → CNF ℕ to ThreeSAT, from a pseudorandom generator with stretch at least 3 * k + 1. The bundled witness check isWitness a w is ThreeSAT.verifier (f a, w) on the reduced formula f a.

theorem Cslib.Crypto.PseudorandomGenerator.auxiliaryInputZeroKnowledge_singleZKProofOfReduction_of_advicePRG {α : Type} {enc : α ↪ List Bool} {A : Set α} {generator : List Bool → List Bool} {length : ℕ → ℕ} (hG : PseudorandomGenerator generator length) (hstretch : ∀ (k : ℕ), 3 * k + 1 ≤ length k) {f : α → Logic.PL.CNF ℕ} (hf : Turing.MultiTapeTM.ComputableInPolyTime f enc Complexity.encCNF) (hred : ∀ (a : α), a ∈ A ↔ f a ∈ Complexity.ThreeSAT) (hAdv : GMW.AdvicePRG enc generator length) :

A step toward the Goldreich–Micali–Wigderson theorem, not that theorem: it rests on GMW.AdvicePRG, a premise novel to this library. Under GMW.AdvicePRG enc generator length, the GMW proof system hG.singleZKProofOfReduction hstretch hf hred satisfies general auxiliary-input zero-knowledge (ZKProof.AuxiliaryInputZeroKnowledge) across all arbitrary polynomially bounded valid instance, witness, and auxiliary-input families. A nonuniform PRG satisfies the premise (NonuniformPRG.advicePRG); the library's GMW theorem is NonuniformOneWay.exists_zkProof_of_mem_NP.

noncomputable def Cslib.Crypto.PseudorandomGenerator.singleZKProofThreeSAT {generator : List Bool → List Bool} {length : ℕ → ℕ} (hG : PseudorandomGenerator generator length) (hstretch : ∀ (k : ℕ), 3 * k + 1 ≤ length k) :

Single-session masked-3SAT ZKProof builder for ThreeSAT with uniform GenerableZeroKnowledge only (#6044; see GenerableZeroKnowledge) and soundness 1 / 3, from any pseudorandom generator with stretch at least 3 * k + 1.

theorem Cslib.Crypto.PseudorandomGenerator.auxiliaryInputZeroKnowledge_singleZKProofThreeSAT_of_advicePRG {generator : List Bool → List Bool} {length : ℕ → ℕ} (hG : PseudorandomGenerator generator length) (hstretch : ∀ (k : ℕ), 3 * k + 1 ≤ length k) (hAdv : GMW.AdvicePRG Complexity.encCNF generator length) :

A step toward the Goldreich–Micali–Wigderson theorem, not that theorem: it rests on GMW.AdvicePRG, a premise novel to this library. Under GMW.AdvicePRG encCNF generator length, the GMW proof system hG.singleZKProofThreeSAT hstretch satisfies general auxiliary-input zero-knowledge (ZKProof.AuxiliaryInputZeroKnowledge). The library's GMW theorem is NonuniformOneWay.exists_zkProof_of_mem_NP.