[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.

在这里插入图片描述

相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-27 19:28:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-27 19:28:02       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-27 19:28:02       87 阅读
  4. Python语言-面向对象

    2024-03-27 19:28:02       96 阅读

热门阅读

  1. 零基础Web3入门到精通

    2024-03-27 19:28:02       41 阅读
  2. 2024.3.26力扣刷题记录-二叉树学习记录1(未完)

    2024-03-27 19:28:02       44 阅读
  3. String、StringBuffer和StringBuilder之间的区别

    2024-03-27 19:28:02       40 阅读
  4. 精简版节流防抖实现

    2024-03-27 19:28:02       44 阅读
  5. 解释一下文件I/O的错误处理

    2024-03-27 19:28:02       47 阅读
  6. 内存泄漏导致Hard_Fault问题记录

    2024-03-27 19:28:02       43 阅读
  7. Tomcat 启动闪退问题解决方法

    2024-03-27 19:28:02       42 阅读