Applied Math
Zero-Knowledge Proofs
Prove you know a secret without revealing it. Interactive proofs, the simulation paradigm, ZK completeness, SNARKs, and connections to complexity theory and verifiable computation.
Prerequisites
Why This Matters
A zero-knowledge proof lets a prover convince a verifier that a statement is true without revealing any information beyond the truth of the statement. This is a precise cryptographic notion, not a vague idea. The prover demonstrates knowledge (e.g., "I know the factorization of ") without leaking the knowledge itself (the factors and ).
The applications span cryptography, blockchain, and increasingly ML. Verifiable computation lets a client outsource a computation to an untrusted server and verify the result efficiently, without re-doing the work. Zero-knowledge proofs are the mechanism. In ML, this enables verifiable inference: proving that a model output was computed correctly from a specific model and input, without revealing the model weights.
Interactive Proof Systems
Interactive Proof System
An interactive proof system for a language consists of two parties:
- A prover (computationally unbounded) who wants to convince the verifier that
- A verifier (probabilistic polynomial-time) who interacts with and either accepts or rejects
The interaction proceeds in rounds: the verifier sends a challenge, the prover responds, and this repeats for polynomially many rounds.
Completeness and Soundness
An interactive proof system for language satisfies:
- Completeness: For every , the honest prover convinces to accept with probability at least :
- Soundness: For every and every (possibly cheating) prover :
The constants and are conventional and can be amplified to and by independent repetitions.
Zero-Knowledge Property (Simulation Paradigm)
An interactive proof for is zero-knowledge if for every probabilistic polynomial-time verifier , there exists a probabilistic polynomial-time simulator such that for all :
where is the transcript of messages and 's random coins during the interaction, and denotes computational indistinguishability.
The simulator produces a fake transcript without access to the prover or any witness. If such a simulator exists, then the verifier learns nothing from the interaction that it could not have generated on its own.
The three variants of "zero-knowledge" depend on the strength of the relation:
- Perfect ZK: the distributions are identical
- Statistical ZK: the distributions are statistically close (negligible total variation distance)
- Computational ZK: the distributions are computationally indistinguishable (no polynomial-time algorithm can tell them apart)
The Classic Example: Graph Isomorphism
Zero-knowledge proof for graph isomorphism
Setup: The prover knows an isomorphism between two graphs. The verifier has both graphs but not .
Protocol (one round):
- The prover picks a random permutation of the vertices and sends (a random relabeling of ) to the verifier.
- The verifier picks a random bit and sends it to the prover.
- The prover must produce an isomorphism from to :
- If : send (since )
- If : send (since )
- The verifier checks the isomorphism and accepts if it is valid.
Completeness: The honest prover always answers correctly, so the verifier accepts with probability 1.
Soundness: If , then is isomorphic to but not (or vice versa). A cheating prover can answer correctly for only one value of , so the verifier rejects with probability at least . After rounds, the cheating probability drops to .
Zero-knowledge: The simulator works as follows. Pick a random bit . Compute for a random permutation . Set the verifier's challenge to . The simulated transcript is . This has the same distribution as the real transcript because is a random relabeling of (equivalently, of since ), and the challenge is a uniform random bit. The simulator never uses .
ZK Completeness for NP
Zero-Knowledge Completeness for NP
Statement
Assuming the existence of one-way functions, every language has a computational zero-knowledge proof system. That is, there exists an interactive proof for that is complete, sound, and computational zero-knowledge.
Intuition
The proof reduces any NP language to graph 3-coloring (which is NP-complete). A zero-knowledge proof for graph 3-coloring is constructed using commitment schemes (which exist if one-way functions exist). The prover commits to a random permutation of a valid 3-coloring, the verifier picks a random edge, and the prover reveals the colors of that edge's endpoints. The verifier checks that the colors differ. After enough rounds, soundness is exponentially high. Zero-knowledge follows because a simulator can fake the commitments (since it only needs to show one consistent edge per round).
Proof Sketch
- Reduce to graph 3-coloring via the NP-completeness of 3-coloring.
- Construct a ZK proof for 3-coloring: the prover has a valid 3-coloring . In each round: a. Pick a random permutation of . Commit to for each vertex using a hiding and binding commitment scheme. b. The verifier picks a random edge . c. The prover opens the commitments for and , revealing and . d. The verifier checks that the two revealed colors are different and that the commitments were opened correctly.
- Soundness: If the graph is not 3-colorable, every coloring has at least one monochromatic edge. The verifier catches it with probability at least per round. After rounds, the cheating probability is exponentially small.
- Zero-knowledge: The simulator picks a random edge , assigns two random distinct colors to and and arbitrary colors elsewhere, and commits. Since only one edge is revealed per round, the simulator's transcript is computationally indistinguishable from the real one (hiding property of the commitment scheme).
Why It Matters
This theorem says zero-knowledge proofs are a general-purpose tool: any statement that can be verified efficiently (i.e., any NP statement) can be proved in zero-knowledge. This is the theoretical foundation for all ZK applications. You do not need a specialized protocol for each problem; the general construction (though inefficient) guarantees existence.
Failure Mode
The theorem requires one-way functions to exist. If P = NP (which would imply no one-way functions exist), then ZK proofs become trivial (the verifier can find witnesses on its own) or impossible (depending on the formalization). The constructed protocol is also highly impractical: it requires many rounds and the reduction through 3-coloring blows up the instance size. Practical ZK systems use specialized constructions, not this generic reduction.
The Simulation Paradigm
The simulation paradigm is the conceptual core of zero-knowledge. It defines "learning nothing" rigorously.
The verifier's view of the interaction consists of: the input , the verifier's random coins , and the sequence of prover messages . A proof is zero-knowledge if this entire view can be simulated by a polynomial-time algorithm that has access only to (not to the prover's witness or the prover itself).
If such a simulator exists, then anything the verifier could compute from the real interaction, it could also compute from the simulated transcript. Since the simulator runs without the witness, the verifier gains no information about the witness.
This idea extends far beyond ZK proofs. Simulation-based security definitions appear throughout cryptography: secure multi-party computation, oblivious transfer, and garbled circuits all use the simulation paradigm to define what it means for a protocol to be "secure."
From Interactive to Non-Interactive: Fiat-Shamir
Fiat-Shamir Heuristic
The Fiat-Shamir transform converts an interactive public-coin proof (where the verifier's messages are just random strings) into a non-interactive one. Replace the verifier's random challenges with the output of a cryptographic hash function applied to the transcript so far:
The prover computes the entire proof non-interactively by simulating the verifier's challenges using . The result is a single proof string that anyone can verify.
In the random oracle model (where is modeled as a truly random function), this transform preserves soundness. In the standard model (with a concrete hash function), provable security requires additional assumptions.
The Fiat-Shamir transform is the bridge between the theoretical world of interactive proofs and the practical world of blockchain and verifiable computation, where proofs must be transmitted as static objects.
SNARKs and STARKs
Modern zero-knowledge systems go far beyond the basic interactive framework.
SNARKs (Succinct Non-interactive Arguments of Knowledge) produce proofs that are:
- Succinct: proof size is or regardless of the computation size
- Non-interactive: a single message from prover to verifier
- Arguments of knowledge: the prover must "know" a witness, not just convince the verifier of existence
The succinctness is the key property. A SNARK for a computation of size can be verified in time or even , while the computation itself takes time . This compression is what makes verifiable computation practical.
STARKs (Scalable Transparent Arguments of Knowledge) replace trusted setup with hash functions only (transparency) and achieve verification time . They are post-quantum secure (relying on hash functions rather than elliptic curves) but produce larger proofs than SNARKs.
Connections to Verifiable ML
Zero-knowledge proofs enable several ML applications:
- Verifiable inference: prove that a neural network output was computed correctly from specific weights and inputs, without revealing the weights. The computation is encoded as an arithmetic circuit, and a SNARK proves correct execution.
- Private model auditing: prove that a model satisfies certain properties (fairness constraints, accuracy thresholds) without revealing the model.
- Federated learning verification: prove that a gradient update was computed correctly from local data, without revealing the data.
Current limitations: encoding neural network inference as arithmetic circuits is expensive. A single forward pass through a moderate network can produce circuits with billions of gates. Proof generation time is orders of magnitude slower than inference itself. This is an active area of engineering optimization.
Common Confusions
Zero-knowledge does not mean the verifier learns nothing at all
The verifier does learn one thing: that the statement is true. "Zero-knowledge" means the verifier learns nothing beyond the truth of the statement. Formally, anything the verifier can compute after the interaction, it could have computed before (given only the statement and the fact that it is true). The simulator captures this: it produces a valid-looking transcript without knowing the witness.
Soundness protects the verifier, not the prover
Soundness guarantees that a cheating prover cannot convince the verifier of a false statement. Zero-knowledge protects the prover's secret from the verifier. These are independent properties. A proof system could be sound but not zero-knowledge (the verifier learns extra information). Or it could be zero-knowledge but not sound (a cheating prover can always succeed). A useful ZK proof must be both.
The simulator does not run the real protocol
The simulator produces a transcript that looks like a real protocol execution but is generated without any prover. The simulator is a thought experiment: its existence is what proves the protocol is zero-knowledge. The simulator is not executed in practice. It is a proof technique, not a protocol component.
Exercises
Problem
In the graph isomorphism ZK protocol, why must the prover send a freshly random permutation in each round? What goes wrong if the prover reuses the same across rounds?
Problem
Explain why the soundness error of the graph isomorphism ZK protocol is per round. What is the soundness error after rounds?
Problem
Construct a simulator for the graph 3-coloring ZK proof. The simulator does not know a valid 3-coloring. Describe precisely how it generates a transcript indistinguishable from a real execution.
Problem
The Fiat-Shamir transform replaces the verifier's random challenges with . Explain why this is sound in the random oracle model but problematic in the standard model. What is a concrete attack if is not modeled as a random oracle?
References
Canonical:
- Goldreich, Foundations of Cryptography, Volume 1 (2001), Chapter 4 for zero-knowledge definitions and the completeness theorem
- Goldwasser, Micali, Rackoff, "The Knowledge Complexity of Interactive Proof Systems" (1989), the original paper defining ZK proofs
Foundational:
- Goldreich, Micali, Wigderson, "Proofs that Yield Nothing But Their Validity" (1991), proving ZK completeness for NP via graph 3-coloring
- Fiat & Shamir, "How To Prove Yourself" (1987), the Fiat-Shamir heuristic for non-interactive proofs
Current:
- Thaler, Proofs, Arguments, and Zero-Knowledge (2023), Chapters 1-8, a modern textbook covering SNARKs and verifiable computation
- Ben-Sasson et al., "Scalable, transparent, and post-quantum secure computational integrity" (2018), introducing STARKs
Next Topics
- Public-key cryptography: the number-theoretic hardness assumptions that zero-knowledge proofs build on
- P vs NP: the complexity-theoretic context for why NP completeness matters for ZK proofs
Last reviewed: April 2026
Prerequisites
Foundations this topic depends on.
- Public-Key CryptographyLayer 2
- Sets, Functions, and RelationsLayer 0A
- Basic Logic and Proof TechniquesLayer 0A
- Common Probability DistributionsLayer 0A
- P vs NPLayer 0A
- Sorting AlgorithmsLayer 0A