[ZKP] Freivalds’ Algorithm

Freivalds’ Algorithm

Freivalds, Rusins. “Probabilistic Machines Can Use Less Running Time.” IFIP congress. Vol. 839. 1977.

Problem Statement

Suppose we are given as input two n × n n \times n n×n matrices A A A and B B B over F p \mathbb{F}_p Fp, where p > n 2 p > n^2 p>n2 is a prime number. The fastest known algorithm for accomplishing this task in time roughly O ( n 2.37286 ) \mathcal{O}(n^{2.37286}) O(n2.37286).

Suppose someone hands us a matrix C C C. Our goal is to check whether or not the product matrix A ⋅ B = C A \cdot B = C AB=C in O ( n 2 ) \mathcal{O}(n^{2}) O(n2) time.

Algorithm

First, choose a random r ∈ F p r \in \mathbb{F}_p rFp, and let x = ( 1 , r , r 2 , . . . , r n − 1 ) x = (1,r,r^2,...,r^{n−1}) x=(1,r,r2,...,rn1). Then compute y = C x y =Cx y=Cx and z = A ⋅ B x z = A \cdot Bx z=ABx, outputting 1 1 1 if y = z y = z y=z and 0 0 0 otherwise.

Time Cost

  1. vector x = ( 1 , r , r 2 , . . . , r n − 1 ) x = (1,r,r^2,...,r^{n−1}) x=(1,r,r2,...,rn1) can be done with O ( n ) \mathcal{O}(n) O(n) total multiplication operations.
  2. Multiply an n × n n \times n n×n matrix by an n-dimensional vector can be done in O ( n 2 ) \mathcal{O}(n^{2}) O(n2) time.
    2.1. y = C x y = Cx y=Cx : O ( n 2 ) \mathcal{O}(n^{2}) O(n2) time
    2.2. w = B x w = Bx w=Bx : O ( n 2 ) \mathcal{O}(n^{2}) O(n2) time
    2.3. z = A w z = Aw z=Aw : O ( n 2 ) \mathcal{O}(n^{2}) O(n2) time

Explaination

Recall the Reed-Solomon Fingerprinting: Encode vector a a a and b b b with Reed-Solomon Encoding: p a ( x ) = ∑ i = 1 n a i r i − 1 p_a(x) = \sum_{i=1}^na_ir^{i-1} pa(x)=i=1nairi1, p b ( x ) = ∑ i = 1 n b i r i − 1 p_b(x) = \sum_{i=1}^nb_ir^{i-1} pb(x)=i=1nbiri1. If a i = b i a_i = b_i ai=bi for all i = 1 , . . . , n i = 1,...,n i=1,...,n, then p a ( r ) = p b ( r ) p_a(r)=p_b(r) pa(r)=pb(r) for every possible choice of r r r. Otherwise, if there is even one i i i such that a i ≠ b i a_i \neq b_i ai=bi, p a ( r ) = p b ( r ) p_a(r)=p_b(r) pa(r)=pb(r) with probability at least 1 − ( n − 1 ) / p 1 − (n − 1)/p 1(n1)/p. (It can be proved by Schwartz-Zippel Lemma.)

The encoding is distance-amplifying: if a a a and b b b differ on even a single coordinate, then their encodings will differ on a 1 − ( n − 1 ) / p 1−(n−1)/p 1(n1)/p fraction of coordinates. Due to the distanceamplifying nature of the code, checking equality of two vectors a and b was reduced to checking equality of a single randomly chosen entry of the encodings.

在这里插入图片描述

  • 28
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值