【二】GKR 协议系列之Sum-Check

  • 白菜
  • 发布于 2023-07-22 00:16
  • 阅读 4075

GKR协议在InteractiveProtocol框架里是一套非常经典的协议,里面有很多细节值得关注一下,本系列专题会逐一detail出来:MultilinearExtensionsSum-CheckExtendedMUL/ADD...本章节,我们就一个数气球的toycas

GKR 协议在Interactive Protocol框架里是一套非常经典的协议,里面有很多细节值得关注一下,本系列专题主要通过手推的方式明确各个模块执行的时间成本:

本章节,我们就一个数气球的toy case 来detail 一下Sum-Check的逻辑。

背景


假定有这么一个场景:


公园里的某个活动中有nn 个气球,只有两种颜色,红色和绿色,红色气球上标记为11,绿色气球上标记为00。现在有个任务,需要统计一下一共多少个红色气球。


我们邀请到Bob来完成这个任务,如果仅有他一个人的话,他只能挨个把所有气球上的标记数字加起来,得到最终结果CC。这时对于Bob而言,时间成本为O(n)O(n),那么有没有效率更高的算法呢?


Sum-Check可以把效率提高到 $O(\log{n})$,但前提是需要引入另外一个人Alice。那么,Sum-Check 在这里的intuitive overview是什么呢?



Bob把这个任务代理给Alice,具体让她来执行这个统计任务,期间Bob他可以做自己事情,等Alice 把最终的统计结果传过来之后,Bob只需要花较低的时间成本去校验这个结果的就行了,这个校验的时间成本就是 O(logn)O(\log{n})

问题算术化


要解决的问题:

l=logngFlFC=b1{0,1}b2{0,1}...bl{0,1}g(b1,b2,...,bl)\begin{aligned} & l = \lceil {\log{n}} \rceil \\ & g \in \mathbb{F^l} \longrightarrow \mathbb{F} \\ & C = \sum_{b_1 \in \{0, 1\}} \sum_{b_2 \in \{0, 1\}} ... \sum_{b_l \in \{0, 1\}} g(b_1, b_2, ..., b_l) \\ \end{aligned}

如果第i i 个气球为红色,(b1,b2,...,bl) (b1​,b2​,...,bl​) 代表着i i 的二进制编码,则:​

g(b1(i),b2(i),...,bl(i))=1g(b_1^{(i)}, b_2^{(i)}, ..., b_l^{(i)}) = 1

反之如果是绿色,则:​

g(b1(i),b2(i),...,bl(i))=0g(b_1^{(i)}, b_2^{(i)}, ..., b_l^{(i)}) = 0

在Sum-Check 协议中,对于Verifier Bob而言,他是不知道这nn个气球的颜色或者标记的数字,或者说他不知道函数gg 的所有取值,但是Prover Alice 知道。


Sum-Check的overview 是,Prover Alice通过brute force的方式把问题的解求出来,得到结果CC,其时间成本为O(n)O(n),并把结果告之Verifier Bob。Verifier Bob要做的是验证这个结果CC对不对,整个验证的成本为O(logn)O(\log{n}),对比之前自己独自完成任务的时间成本O(n)O(n)要低很多。那如何验证呢?


为了方便理解,假定n=14,C=5q=11n=14,C=5,q=11,则l=4l=4


气球编号012345678910111213
二进制编码00000001001000110100010101100111100010011010101111001101
数字标记00101000110010

详尽的执行过程


The Start

Prover 把上面 length 为14的vector data encode 进一个MLE polynomial:

g~(X1,X2,...,X4)=1(1X1)X2(1X3)(1X4)+1(1X1)(1X2)X3(1X4)+1(1X1)(1X2)(1X3)X4+1X1(1X2)(1X3)X4+1(1X1)(1X2)X3X4\begin{aligned} \widetilde{g}(X_1, X_2, ..., X_4) = & 1 \cdot (1 - X_1)*X_2*(1 - X_3)*(1 - X_4) \\ &+ 1 \cdot (1 - X_1) * (1 - X_2) * X_3 * (1 - X_4) \\ &+ 1 \cdot (1 - X_1) * (1 - X_2) * (1 - X_3) * X_4 \\ &+ 1 \cdot X_1 * (1 - X_2) * (1 - X_3) * X_4 \\ &+ 1 \cdot (1 - X_1) * (1 - X_2) * X_3 * X_4 \\ \end{aligned} \\

同时Prover 初始的claim 值为5:​

Prover claims: H0=b1{0,1}b2{0,1}...b4{0,1}g(b1,b2,...,b4)=5\begin{aligned} \text{Prover claims: } H_0 &= \sum_{b_1 \in \{0, 1\}} \sum_{b_2 \in \{0, 1\}} ... \sum_{b_4 \in \{0, 1\}} g(b_1, b_2, ..., b_4) \\ &= 5 \end{aligned} \\

Round One


Prover 首先需要证明初始的claim: H0=?5H_0 \overset{?} = 5, then:

Prover owns the actual MLE function:h1(X1)=b2{0,1}...b4{0,1}g~(X1,b2,...,b4)=3(1X1)+1Prover provide proof for H0=5 claims again:H1(X1)=h1(X1)=b2{0,1}...b4{0,1}g~(X1,b2,...,b4)=3(1X1)+1Verifier verify the proof:H1(0)+H1(1)=?H0, if true continues ...\begin{aligned} & \text{Prover owns the actual MLE function}: h_1(X_1) = \sum_{b_2 \in \{0, 1\}} ... \sum_{b_4 \in \{0, 1\}} \widetilde{g}(X_1, b_2, ..., b_4) = 3(1 - X_1) + 1 \\ & \text{Prover provide proof for } H_0 =5 \\ & \text{ claims again}: \textcolor{red} {H_1(X_1) = h_1(X_1)} = \sum_{b_2 \in \{0, 1\}} ... \sum_{b_4 \in \{0, 1\}} \widetilde{g}(X_1, b_2, ..., b_4) = 3(1 - X_1) + 1 \\ & \text{Verifier verify the proof}: H_1(0) + H_1(1) \overset{?} = H_0, \text{ if true continues ...} \\ \end{aligned}

Round Two


Prover need to prove what he claims last round:H1(X1)=?h1(X1)H_1​(X_1​) \overset{?} = h_1​(X_1​),according to the principle of probabilistic proof system then:

Verifier generate a challenge factor say:r1=4 and sends to Prover{H1(X1)=h1(X1) with high probability, continues if H1(4)=h1(4)H1(X1)h1(X1) with high probability, breaks while othersProver owns the actual MLE function:h2(X2)=b3{0,1}...b4{0,1}g~(4,X2,...,b4)=2X25Prover provides proof for H1(4)=h1(4), claims again :H2(X2)=h2(X2)=b3{0,1}...b4{0,1}g~(4,X2,...,b4)=2X25Verifier verify the proof: H2(0)+H2(1)=H1(4)=?h1(4), if true continues ...\begin{aligned} & \text{Verifier generate a challenge factor say}: r_1 = 4 \text{ and sends to Prover} \\ & \Longrightarrow \begin{cases} H_1(X_1) = h_1(X_1) \textbf{ with high probability}, \text{ continues if } H_1(4) = h_1(4) \\ H_1(X_1) \neq h_1(X_1) \textbf{ with high probability}, \text{ breaks while others} \\ \end{cases} \\ & \text{Prover owns the actual MLE function}: h_2(X_2) = \sum_{b_3 \in \{0, 1\}} ... \sum_{b_4 \in \{0, 1\}} \widetilde{g}(4, X_2, ..., b_4) = 2X_2 - 5 \\ & \text{Prover provides proof for } H_1(4) = h_1(4), \\ & \text{ claims again }: \textcolor{red} {H_2(X_2) = h_2(X_2)} = \sum_{b_3 \in \{0, 1\}} ... \sum_{b_4 \in \{0, 1\}} \widetilde{g}(4, X_2, ..., b_4) = 2X_2 - 5 \\ & \text{Verifier verify the proof: } H_2(0) + H_2(1) = H_1(4) \overset{?} = h_1(4), \text{ if true continues ...} \\ \end{aligned}

Round Three


Prover need to prove what he claims last round:H2(X2)=?h2(X2)H_2​(X_2​) \overset{?} = h_2​(X_2​),according to the principle of probabilistic proof system then:

Verifier generate a challenge factor say:r2=3 and sends to Prover{H2(X2)=h2(X2) with high probability, continues if H2(3)=h2(3)H2(X2)h2(X2) with high probability, breaks while othersProver owns the actual MLE function:h3(X3)=b4{0,1}g~(4,3,X3,b4)=23X311Prover provides proof for H2(3)=h2(3), claims again :H3(X3)=h3(X3)=b4{0,1}g~(4,3,X3,b4)=23X311Verifier verify the proof: H3(0)+H3(1)=H2(3)=?h2(3), if true continues ...\begin{aligned} & \text{Verifier generate a challenge factor say}: r_2 = 3 \text{ and sends to Prover} \\ & \Longrightarrow \begin{cases} H_2(X_2) = h_2(X_2) \textbf{ with high probability}, \text{ continues if } H_2(3) = h_2(3) \\ H_2(X_2) \neq h_2(X_2) \textbf{ with high probability}, \text{ breaks while others} \\ \end{cases} \\ & \text{Prover owns the actual MLE function}: h_3(X_3) = \sum_{b_4 \in \{0, 1\}} \widetilde{g}(4, 3, X_3, b_4) = 23X_3 - 11 \\ & \text{Prover provides proof for } H_2(3) = h_2(3), \\ & \text{ claims again }: \textcolor{red} {H_3(X_3) = h_3(X_3)} = \sum_{b_4 \in \{0, 1\}} \widetilde{g}(4, 3, X_3, b_4) = 23X_3 - 11 \\ & \text{Verifier verify the proof: } H_3(0) + H_3(1) = H_2(3) \overset{?} = h_2(3), \text{ if true continues ...} \\ \end{aligned}

Round Four

Prover need to prove what he claims last round:H3(X3)=?h3(X3)H_3​(X_3​) \overset{?} = h_3​(X_3​),according to the principle of probabilistic proof system then:

Verifier generate a challenge factor say:r3=2 and sends to Prover{H3(X3)=h3(X3) with high probability, continues if H3(2)=h3(2)H3(X3)h3(X3) with high probability, breaks while othersProver owns the actual MLE function:h4(X4)=g~(4,3,2,X4)=217X4Prover provides proof for H3(2)=h3(2), claims again :H4(X4)=h4(X4)=g~(4,3,2,X4)=217X4Verifier verify the proof: H4(0)+H4(1)=H3(2)=?h3(2), if true continues ...\begin{aligned} & \text{Verifier generate a challenge factor say}: r_3 = 2 \text{ and sends to Prover} \\ & \Longrightarrow \begin{cases} H_3(X_3) = h_3(X_3) \textbf{ with high probability}, \text{ continues if } H_3(2) = h_3(2) \\ H_3(X_3) \neq h_3(X_3) \textbf{ with high probability}, \text{ breaks while others} \\ \end{cases} \\ & \text{Prover owns the actual MLE function}: h_4(X_4) = \widetilde{g}(4, 3, 2, X_4) = 21 - 7X_4 \\ & \text{Prover provides proof for } H_3(2) = h_3(2), \\ & \text{ claims again }: \textcolor{red} {H_4(X_4) = h_4(X_4)} = \widetilde{g}(4, 3, 2, X_4) = 21 - 7X_4 \\ & \text{Verifier verify the proof: } H_4(0) + H_4(1) = H_3(2) \overset{?} = h_3(2), \text{ if true continues ...} \\ \end{aligned}

The End


Prover need to prove what he claims last round:H4(X4)=?h4(X4)H_4​(X_4​) \overset{?} = h4_​(X_4​),according to the principle of probabilistic proof system then:

Verifier generate a challenge factor say:r4=1 and sends to Oracle{H4(X4)=h4(X4) with high probability, continues if H4(1)=h4(1)H4(X4)h4(X4) with high probability, breaks while othersVerifier retrives from Orcale:h4(1)=g~(4,3,2,1)=14mod5=4Verifier verify that :H4(1)=?h4(1), if true accepts, otherwise rejects\begin{aligned} & \text{Verifier generate a challenge factor say}: r_4 = 1 \text{ and sends to Oracle} \\ & \Longrightarrow \begin{cases} H_4(X_4) = h_4(X_4) \textbf{ with high probability}, \text{ continues if } H_4(1) = h_4(1) \\ H_4(X_4) \neq h_4(X_4) \textbf{ with high probability}, \text{ breaks while others} \\ \end{cases} \\ & \text{Verifier retrives from Orcale}: h_4(1) = \widetilde{g}(4, 3, 2, 1) = 14 \mod 5 = 4 \\ & \text{Verifier verify that }: H_4(1) \overset{?} = h_4(1), \text{ if true accepts, otherwise rejects} \\ \end{aligned}

参考文献

【1】Libra: Succinct Zero-Knowledge Proofs with Optimal Prover Computation
【2】Proofs, Arguments, and Zero-Knowledge

点赞 0
收藏 0
分享
本文参与登链社区写作激励计划 ,好文好收益,欢迎正在阅读的你也加入。

0 条评论

请先 登录 后评论