This post is a continuation of a previous post, and will proceed with the material from Bar Ilan’s 2019 Winter School.

Introduction

In this post, our objective is to show that there exists a zero-knowledge interactive proof system for any language in NP. In order to do so, we will need to loosen our definition of zero-knowledge slightly. We will define statistical zero-knowledge and computational zero-knowledge, both of which are relaxations of perfect zero-knowledge (which we defined in the previous post). We will then take an NP-complete language, HAM\mathsf{HAM}, and give an interactive proof system which satisfies computational zero-knowledge. It will then follow that any language in NP has a computational zero-knowledge proof, since any language in NP can reduced to an instance of HAM\mathsf{HAM}.

The problem with perfect zero-knowledge for NP

Why do we need relaxations on our definition of perfect zero-knowledge at all? Why can’t we just construct proof system which satisfies perfect zero-knowledge for an NP-complete language?

Well it’s very very strongly believed that such a proof system cannot exist. In 1987, just a couple years after the original discovery of the concept of zero-knowledge, Fortnow [1]The complexity of perfect zero-knowledge [link]
Lance Fortnow. Proceedings of the Nineteenth Annual ACM Symposium on Theory of Computing. 1987.
showed that if such a proof system exists, then the polynomial hierarchy collapses. Don’t worry if you don’t know what this means – just take my word that theoretical computer scientists believe very very strongly that the polynomial hierarchy does not collapse (quite similar to the strong belief that PNP\mathsf{P} \neq \mathsf{NP}).

Thus, if we want to achieve zero-knowledge protocols for all languages in NP, we’re going to need to relax our definition of zero-knowledge.

In order to do tinker with the definition of zero-knowledge, we need to discuss some different notions of indistinguishability.

Notions of indistinguishability

Consider two random variables X,YX, Y over the domain Ω={0,1}n\Omega = \{ 0,1\}^{n}. We want to formally define some notions of indistinguishability between these two variables.

The first notion is that of perfect indistinguishability: the distributions XX and YY are exactly the same. Thus any algorithm will behave exactly the same whether its input is XX or YY.

X,YX,Y are perfectly-indistinguishable if for any algorithm AA (even a computationally unbounded algorithm), Pr[A(X)=1]Pr[A(Y)=1]=0\lvert \Pr[A(X)=1] - \Pr[A(Y)=1] \rvert = 0.

Relaxing this definition a little, we get statistical indistinguishability: the distributions XX and YY are almost the same, and their difference is bounded by a negligible value. Any algorithm will behave almost the same whether its input is XX or YY.

X,YX,Y are statistically-indistinguishable if for any algorithm AA (even a computationally unbounded algorithm), Pr[A(X)=1]Pr[A(Y)=1]ϵ(n)\lvert \Pr[A(X)=1] - \Pr[A(Y)=1] \rvert \leq \epsilon(n), for some negligible function ϵ(n)\epsilon(n).

In the real world, it is reasonable to assume adversaries have limited computation power. We can apply this idea to get computational indistinguishability: any polynomially-bounded algorithm will behave almost the same whether its input is XX or YY.

X,YX,Y are computationally-indistinguishable if for any PPT algorithm AA, Pr[A(X)=1]Pr[A(Y)=1]ϵ(n)\lvert \Pr[A(X)=1] - \Pr[A(Y)=1] \rvert \leq \epsilon(n), for some negligible function ϵ(n)\epsilon(n).

Relaxing perfect zero-knowledge

Now that we have these relaxed notions of indistinguishability, we can use them to define a relaxed notion of zero-knowledge.

First recall the definition of perfect zero-knowledge:

An interactive proof system P,VP, V for LL is perfect zero-knowledge if for all PPT VV^*, there exists a PPT simulator SS such that xL\forall x \in L, S(x)(P,V)(x)S(x) \cong (P,V^*)(x).

Note that this definition requires the simulator’s output and the transcript to be perfectly-indistinguishable.

We can relax this to only require them to be statistically-indistinguishable:

An interactive proof system P,VP, V for LL is statistical zero-knowledge if for all PPT VV^*, there exists a PPT simulator SS such that xL\forall x \in L, S(x)S(P,V)(x)S(x) \cong_S (P,V^*)(x).

However, it turns out that this definition is still not loose enough to use for NP. Fortnow [1]The complexity of perfect zero-knowledge [link]
Lance Fortnow. Proceedings of the Nineteenth Annual ACM Symposium on Theory of Computing. 1987.
additionally showed that if there exists statistical zero-knowledge proofs for all problems in NP, then the polynomial hierarchy collapses.

Thus, we need another level of relaxation. This time, we allow the simulator’s output and the transcript to be computationally-indistinguishable:

An interactive proof system P,VP, V for LL is computational zero-knowledge if for all PPT VV^*, there exists a PPT simulator SS such that xL\forall x \in L, S(x)C(P,V)(x)S(x) \cong_C (P,V^*)(x).

This definition will be loose enough, as we will be able to show that every language in NP has a computational zero-knowledge proof system. We’re almost ready to show such a construction, but we need to first discuss an important tool: commitment schemes.

Commitment schemes

A commitment scheme is a two-phase protocol between two parties: a committer, and a receiver. The idea is to have the committer commit to some value mm without revealing to receiver what mm is. To achieve this, the committer computes some value c=Com(m,r)c = \mathsf{Com}(m,r) (where rr is some randomness) and sends cc to the receiver. At a later time, the committer can “decommit”, revealing the original message mm and randomness r:r\text{:} Dec(c)=(m,r)\mathsf{Dec}(c) = (m, r). The receiver can verify that c=Com(Dec(c))c = \mathsf{Com}(\mathsf{Dec}(c)).

There are a couple properties that are desirable for commitment schemes to have:

  1. Hiding: the receiver should not be able to learn any information about the committed message mm from seeing the commit value cc
  2. Binding: the committer should be bound to the originally committed message mm

For each of these properties, we can define them using a computationally unbounded model (“statistical”), or a computationally bounded model (“computational”).

A commitment scheme Com\mathsf{Com} is statistically-hiding if for all pairs of distinct messages m1,m2m_1, m_2, Com(m1)SCom(m2)\mathsf{Com}(m_1) \cong_S \mathsf{Com}(m_2).

A commitment scheme Com\mathsf{Com} is computationally-hiding if for all pairs of distinct messages m1,m2m_1, m_2, Com(m1)CCom(m2)\mathsf{Com}(m_1) \cong_C \mathsf{Com}(m_2).

To formally define binding, we’ll describe the “binding game.” Given two distinct messages m1,m2m_1, m_2, an algorithm CC “wins the binding game” if CC generates values c,r1,r2c, r_1, r_2 such that Com(m1,r1)=c=Com(m2,r2)\mathsf{Com}(m_1, r_1) = c = \mathsf{Com}(m_2, r_2).

A commitment scheme Com\mathsf{Com} is statistically-binding if for any algorithm CC (even a computationally unbounded one), for all pairs of distinct messages m1,m2m_1, m_2, Pr[C winning the binding game]ϵ(n)\Pr[C \text{ winning the binding game}] \leq \epsilon(n), where ϵ(n)\epsilon(n) is some negligible function.

A commitment scheme Com\mathsf{Com} is computationally-binding if for any PPT CC, for all pairs of distinct messages m1,m2m_1, m_2, Pr[C winning the binding game]ϵ(n)\Pr[C \text{ winning the binding game}] \leq \epsilon(n), where ϵ(n)\epsilon(n) is some negligible function.

In an ideal world, it’d be great to have a commitment scheme which is both statistically-hiding and statistically-binding. However, such an awesome commitment scheme cannot exist. In fact, it’s a nice exercise to show that a scheme can never satisfy both properties simultaneously.

As a result, we are limited to working with two flavors of commitment schemes:

  • statistically-hiding schemes, which are statistically-hiding and computationally-binding
  • statistically-binding schemes, which are statistically-binding and computationally-hiding

Ok, we’re just about done with the dry definitions. Good job if you stuck through it. We’re almost at the finish line.

Hamiltonian cycles

Define HAM={GG contains a Hamiltonian cycle}\mathsf{HAM} = \{ G | G \text{ contains a Hamiltonian cycle}\}. A Hamiltonian cycle is a cycle through the graph which visits each vertex exactly once. This language HAM\mathsf{HAM} is NP complete – any language in NP can be reduced to HAM\mathsf{HAM} in polynomial time.

For this post, we will consider a graph with nn vertices as being represented by an n×nn \times n adjacency matrix, where the (i,j)th(i,j)^{th} entry is a 1 if the graph contains the edge iji \rightarrow j, and 0 otherwise.

Adjacency matrix representation of a graph G with a Hamiltonian cycle w (bolded)
[Source: Lecture 2, Slide 25[2]Zero knowledge for all NP [link]
Alon Rosen. YouTube. 2019.
]

ZK proof for HAM

Computationally zero-knowledge proof for HAM
[Source: Lecture 2, Slide 27[2]Zero knowledge for all NP [link]
Alon Rosen. YouTube. 2019.
]
  • PP draws a random permutation ΠSn\Pi \in S_n
  • PP commits to c=Com(Π(G))c = \mathsf{Com}(\Pi(G)), and sends it to VV
    • Π(G)\Pi(G) represents the original graph GG after permuting the vertices according to Π\Pi
    • PP can commit to Π(G)\Pi(G) by committing to each bit of the adjacency matrix for Π(G)\Pi(G)
  • VV then draws a random challenge bit b{0,1}b \in \{ 0, 1\}, and sends it to PP
  • If b=0:b=0\text{:}
    • PP only reveals the cycle within the permuted graph, i.e. that u=Π(w)Dec(c)u = \Pi(w) \in \mathsf{Dec}(c)
      • PP does this by revealing only the particular bits in Π(G)\Pi(G) which correspond to the cycle u=Π(w)u = \Pi(w)
    • VV verifies that uDec(c)u \in \mathsf{Dec}(c) and that uu is a cycle
  • If b=1:b=1\text{:}
    • PP sends the permutation Π\Pi and reveals the permuted graph H=Π(G)H = \Pi(G)
      • PP does this by revealing all the bits of H=Π(G)H=\Pi(G)
    • VV verifies that H=Dec(c)H = \mathsf{Dec}(c), and that H=Π(G)H = \Pi(G)

Completeness: Completeness is straightforward. Suppose that GG has a Hamiltonian cycle ww. A prover PP who follows the protocol honestly by drawing a random permutation Π\Pi and sending c=Com(Π(G))c = \mathsf{Com}(\Pi(G)) will be able to answer both challenges correctly:

  • u=Π(w)u = \Pi(w) is a cycle in Π(G)\Pi(G) since ww is a cycle in GG. u=Π(w)u = \Pi(w) is contained in H=Π(G)H = \Pi(G), and therefore uDec(c)u \in \mathsf{Dec}(c). So the b=0b=0 challenge is successful.
  • H=Dec(c)H = \mathsf{Dec}(c) where H=Π(G)H=\Pi(G) by construction, so the b=1b=1 challenge is successful.

Soundness: The claim is that if Com\mathsf{Com} is statistically-binding, then soundness holds.

Assume that GHAMG \notin \mathsf{HAM}. Now suppose for contradiction that Prb[(P,V) accepts G]>1/2\Pr_b[(P^*, V) \text{ accepts } G] > 1/2. Then it must be the case that both challenges succeed, and hence uu is a Hamiltonian cycle in HH and H=Π(G)H = \Pi(G). But then Π1(u)\Pi^{-1}(u) would give a valid Hamiltonian cycle in GG, which would imply GHAMG \in \mathsf{HAM}. This is a contradiction, and hence we conclude that Prb[(P,V) accepts G]1/2\Pr_b[(P^*, V) \text{ accepts } G] \leq 1/2.

Note that this argument only holds if we assume Com\mathsf{Com} to be statistically-binding. If not, then PP^* could commit to some value cc, and then reveal different values (both compatible with cc) depending on which challenge bit was sent by VV. Remember that in this model, the computation of PP^* is not bounded. That’s why a computationally-binding commitment is not good enough here.

Computational zero-knowledge: We’ll construct a simulator SV(G)S^{V^*}(G) as follows:

  1. Set G0=uG_0 = u for some random cycle uu over nn vertices
  2. Set G1=Π(G)G_1 = \Pi(G) for some random permutation ΠSn\Pi \in S_n
  3. Sample bb randomly from {0,1}\{ 0, 1 \}
    • If b=0b=0, set c=Com(G0)c = \mathsf{Com}(G_0)
    • If b=1b=1, set c=Com(G1)c = \mathsf{Com}(G_1)
  4. If V(c)=bV^*(c) = b
    • If b=0b=0, output (c,b,u)(c, b, u)
    • If b=1b=1, output (c,b,(Π,G1))(c, b, (\Pi, G_1))
  5. Otherwise, repeat

The output of this simulator SV(G)S^{V^*}(G) is computationally-indistinguishable from a real transcript (P,V)(G):(P, V)(G)\text{:}

  • The two distributions of the commit message cc are computationally-indistinguishable because the commitment scheme Com\mathsf{Com} is computationally-hiding.
    • Note that if Com\mathsf{Com} were not computationally-hiding, then a PPT adversary might be able to distinguish between Com(G0)\mathsf{Com}(G_0) and Com(G1)\mathsf{Com}(G_1), and could therefore distinguish between the commit cc’s simulated distribution vs its transcript distribution (the simulator commits to the cycle G0G_0 about half of the time, while the real protocol always commits to the fully permuted graph G1G_1).
  • The two distributions of the challenge bit bb are identical, as SS matches the distribution of VV^{*}.
  • The distributions of uu and (Π,G1)(\Pi, G_1), as they are drawn in effectively the same way (uniformly random) in both the simulator and the real protocol.

Next, we argue that if Com\mathsf{Com} is computationally-hiding, then Prc,b[V(Com(Gb))=b]1/2\Pr_{c, b}[V^*(\mathsf{Com}(G_b)) = b] \approx 1/2 (where the approximation sign \approx indicates that the difference between the two values is negligible). If this were not the case, then VV^*’s output distribution would be non-negligibly different when running on input Com(G0)\mathsf{Com}(G_0) and Com(G1)\mathsf{Com}(G_1), and therefore VV^* could distinguish between the two inputs Com(G0)\mathsf{Com}(G_0) and Com(G1)\mathsf{Com}(G_1). But this violates the assumption that Com\mathsf{Com} is computationally-hiding.

From Prc,b[V(Com(Gb))=b]1/2\Pr_{c, b}[V^*(\mathsf{Com}(G_b)) = b] \approx 1/2, it follows that the expected number of repetitions the simulator makes is 2 (this analysis is similar to that done in the previous post for the quadratic residuosity proof).

Alright! That’s it, we’re done!

Conclusion

We started by establishing a limitation of our definition of perfect zero-knowledge, namely that there cannot exist (well, we really strongly believe that there cannot exist) perfect zero-knowledge proofs for all languages in NP. This motivated us to relax our definition to computational zero-knowledge: zero-knowledge that holds for polynomially-bounded machines. We then defined commitment schemes and their useful properties, all in preparation for our zero-knowledge proof of HAM\mathsf{HAM}.

HAM\mathsf{HAM} is an NP-complete language, meaning any language in NP can be mapped to HAM\mathsf{HAM} in polynomial time. Thus, if we can create a computational zero-knowledge proof for HAM\mathsf{HAM}, then this proof can be used to prove any language in NP! And that’s indeed what we did! Using statistically-hiding commitment schemes, we constructed an elegant interactive proof for HAM\mathsf{HAM} satisfying computational zero-knowledge.

References

References cited in the text are listed first, in order of citation; additional references follow, ordered alphabetically.

  1. The complexity of perfect zero-knowledge [link]
    Lance Fortnow. Proceedings of the Nineteenth Annual ACM Symposium on Theory of Computing. 1987.
  2. Zero knowledge for all NP [link]
    Alon Rosen. YouTube. 2019.
  3. How to prove a theorem so no one else can claim it [link]
    Manuel Blum. Proceedings of the International Congress of Mathematicians. 1986.
  4. Computational indistinguishability [link]
    Ryan O’Donnell. YouTube. 2020.