Documentation

CslibFrontier.Crypto.Computational.ZeroKnowledge.Levin

Zero knowledge for NP relations through Levin reductions #

Cslib.Crypto.PseudorandomGenerator.levinSingleZKProof builds a single-session masked-3SAT ZKProof with uniform GenerableZeroKnowledge only (zero knowledge restricted to (instance, witness) families generated from 1^n in deterministic polynomial time, #6044, rather than auxiliary-input GMW zero knowledge of [Gol98], Definition 4.3.8 and Theorem 4.4.10) for the language of an NP relation R, given a Levin reduction r of R to the NP relation of 3SAT. Its bundled witness check is R's own (decide (R.IsWitness a w)): the honest prover receives a witness of R and maps it through the forward witness map of r to a 3SAT witness for the reduced formula r.toFun a, on which it runs the masked-3SAT protocol. The verifier, the simulator and the soundness argument are those of the Karp-reduction construction Cslib.Crypto.PseudorandomGenerator.singleZKProofOfReduction for the instance map of r.

The change of witnesses is one generic step, Cslib.Crypto.ZKProof.withRelationWitness, which applies to any proof system for R.language and any Levin reduction whose mapped witnesses pass the system's witness check. The sequential system of CslibFrontier.Crypto.Computational.ZeroKnowledge.Amplification uses the same step. Zero knowledge carries over because the mapped witnesses stay in the families that the definitions quantify over: a polynomial-time-generable witness family remains polynomial-time-generable after the forward map (GenerableZeroKnowledge), and a polynomially bounded one remains polynomially bounded (AuxiliaryInputZeroKnowledge).

This single-session system has soundness 1 / 3. Its sequential repetition with negligible soundness, and the existence theorems for every NP relation through Cslib.Complexity.CookLevin.ThreeSAT_levinHard, are in CslibFrontier.Crypto.Computational.ZeroKnowledge.Amplification. The auxiliary-input form here is a step conditional on Cslib.Crypto.GMW.AdvicePRG, a premise novel to this library; the library's GMW theorem for NP relations is Cslib.Crypto.NonuniformOneWay.exists_zkProof_of_npRelation.

Main definitions #

Main results #

References #

Deciding the relation of an NP relation is polynomial-time: compare the certificate length with the prescribed one and run the verifier.

Through the instance map of a Levin reduction r of R to the NP relation of 3SAT, an instance is in the language of R exactly when its image is in ThreeSAT.

Changing the witnesses of a proof system along a Levin reduction #

noncomputable def Cslib.Crypto.ZKProof.withRelationWitness {α : Type} {enc : α ↪ List Bool} {R : Complexity.NPRelation enc} {β : Type} {encB : β ↪ List Bool} {S : Complexity.NPRelation encB} {soundness : ℕ → ENNReal} (zk : ZKProof enc R.language soundness) (r : Complexity.LevinReduction R S) (hw : ∀ (a : α) (w : List Bool), R.IsWitness a w → zk.isWitness a (r.forwardWitness (a, w)) = true) :
ZKProof enc R.language soundness

A zero-knowledge proof system zk for R.language whose honest prover is fed witnesses of R mapped by the forward witness map of a Levin reduction r of R to S. Its bundled witness check is decide (R.IsWitness a w); the verifier, the soundness bound and the simulators are those of zk. The hypothesis hw says that mapped witnesses pass the witness check of zk.

@[simp]
theorem Cslib.Crypto.ZKProof.isWitness_withRelationWitness {α : Type} {enc : α ↪ List Bool} {R : Complexity.NPRelation enc} {β : Type} {encB : β ↪ List Bool} {S : Complexity.NPRelation encB} {soundness : ℕ → ENNReal} (zk : ZKProof enc R.language soundness) (r : Complexity.LevinReduction R S) (hw : ∀ (a : α) (w : List Bool), R.IsWitness a w → zk.isWitness a (r.forwardWitness (a, w)) = true) (a : α) (w : List Bool) :

The bundled witness check of zk.withRelationWitness r hw is the relation R itself.

theorem Cslib.Crypto.ZKProof.AuxiliaryInputZeroKnowledge.withRelationWitness {α : Type} {enc : α ↪ List Bool} {R : Complexity.NPRelation enc} {β : Type} {encB : β ↪ List Bool} {S : Complexity.NPRelation encB} {soundness : ℕ → ENNReal} {zk : ZKProof enc R.language soundness} (h : zk.AuxiliaryInputZeroKnowledge) (r : Complexity.LevinReduction R S) (hw : ∀ (a : α) (w : List Bool), R.IsWitness a w → zk.isWitness a (r.forwardWitness (a, w)) = true) :

General auxiliary-input zero knowledge carries over to zk.withRelationWitness r hw: polynomially bounded witness families of R map to polynomially bounded witness families of zk.

The single-session system #

noncomputable def Cslib.Crypto.PseudorandomGenerator.levinSingleZKProof {α : Type} {enc : α ↪ List Bool} {R : Complexity.NPRelation enc} {generator : List Bool → List Bool} {length : ℕ → ℕ} (hG : PseudorandomGenerator generator length) (hstretch : ∀ (k : ℕ), 3 * k + 1 ≤ length k) (r : Complexity.LevinReduction R Complexity.ThreeSAT.npRelation) :
ZKProof enc R.language fun (x : ℕ) => 1 / 3

Single-session masked-3SAT ZKProof builder for the language of an NP relation R with uniform GenerableZeroKnowledge only (#6044; see GenerableZeroKnowledge) and soundness 1 / 3, from a pseudorandom generator with stretch at least 3 * k + 1 and a Levin reduction r of R to ThreeSAT.npRelation. Built as PseudorandomGenerator.singleZKProofOfReduction for the instance map of r with witnesses changed by ZKProof.withRelationWitness: the honest prover maps a witness w of R for a to r.forwardWitness (a, w), and the bundled witness check is decide (R.IsWitness a w).

@[simp]
theorem Cslib.Crypto.PseudorandomGenerator.isWitness_levinSingleZKProof {α : Type} {enc : α ↪ List Bool} {R : Complexity.NPRelation enc} {generator : List Bool → List Bool} {length : ℕ → ℕ} (hG : PseudorandomGenerator generator length) (hstretch : ∀ (k : ℕ), 3 * k + 1 ≤ length k) (r : Complexity.LevinReduction R Complexity.ThreeSAT.npRelation) (a : α) (w : List Bool) :
(hG.levinSingleZKProof hstretch r).isWitness a w = true ↔ R.IsWitness a w

The bundled witness check of the Levin-reduction proof system is the relation itself.

theorem Cslib.Crypto.PseudorandomGenerator.auxiliaryInputZeroKnowledge_levinSingleZKProof_of_advicePRG {α : Type} {enc : α ↪ List Bool} {R : Complexity.NPRelation enc} {generator : List Bool → List Bool} {length : ℕ → ℕ} (hG : PseudorandomGenerator generator length) (hstretch : ∀ (k : ℕ), 3 * k + 1 ≤ length k) (r : Complexity.LevinReduction R Complexity.ThreeSAT.npRelation) (hAdv : GMW.AdvicePRG enc generator length) :

A step toward the Goldreich–Micali–Wigderson theorem for NP relations, not that theorem: it rests on GMW.AdvicePRG, a premise novel to this library. Under GMW.AdvicePRG enc generator length, the Levin-reduction proof system satisfies general auxiliary-input zero knowledge: polynomially bounded witness families of R map to polynomially bounded 3SAT witness families. A nonuniform PRG satisfies the premise (NonuniformPRG.advicePRG); the library's GMW theorem for relations is NonuniformOneWay.exists_zkProof_of_npRelation.