Arithmetic circuit

对于只有加法门和乘法门的arithmetic circuit,可将其理解为是“一系列的乘法门+一系列表示gate输入输出关系的linear consistency equations”。

一个 arithmetic circuit 可理解为是一个有向无环图,其中每个顶点称为gate。in-degree为0的gate为circuit的输入,可表示为 a i a_i 或者a constant field element。其它的gate可标示为 + + × \times

对于 fan-in 2 circuits,其所有 + + 门和 × \times 门均具有 in-degree 2。

任何可表述为有向无环图的circuit均可转换为:
“一系列的乘法门+一系列表示gate输入输出关系的linear consistency equations”。

  • 首先,需要将arithmetic circuit A A 中的加法门和常量乘法门替换为:
    bilinear consistency equations on the inputs and outputs of the remaining gates
    从而保证这些equations的satisfiability与原始circuit的satisfiability等同。
    假设 B B A A 的sub-circuit, B B 中包含了一个乘法门之前的所有wires和gates。 B B m m 个input wires和 n n 个output wires。这 m m 个inputs可以单位向量表示 e i = ( 0 , , 1 , , 0 ) \vec{e}_i=(0,\cdots,1,\cdots,0) ,其中 i [ 1 , m ] , e i = m i\in[1,m],|\vec{e}_i|=m
    – 对于每个加法门,其input表示为 x , y \vec{x},\vec{y} ,其output表示为 x + y \vec{x}+\vec{y}
    – 对于每个常量乘法门,其input表示为 x \vec{x} 和常量 c c ,其output表示为 c x c\vec{x}
    以此执行, B B n n 个output均可以length为 m m 的向量来表示linear combinations of the inputs。
    最多需要 m B m|B| 个arithmetic operations。注意, B B 的所有output均为linear combinations of the inputs,所以 B B 可表示为具有 n ( 2 m 1 ) n(2m-1) 个 fan-in 2 gates,使得consistency equations可直接从circuit description中获取。
    注意,形如 i = 1 m a i x i \sum_{i=1}^{m}a_ix_i 的linear combination,可由 m m 个常量乘法门和 m 1 m-1 个加法门组成。

  • 其次,将 B B 的gates 从 A A 中移除,同时移除 any multiplication gates whose inputs are the inputs of the new circuit。

  • 重复以上过程,知道找出所有的consistency equations。repeat the process of finding consistency equations until we have considered the whole of A A

注意,circuit A A 的第一个(input)和最后一个(output)sub-circuit需要增加额外操作。
以 output sub-circuit为例(input sub-circuit类似):

  • 假设 B B 为the output sub-circuit,其 m m 个input表示为 a = ( a 1 , , a m ) T \vec{a}=(a_1,\cdots,a_m)^T n n 个output表示为 b = ( b 1 , , b n ) T \vec{b}=(b_1,\cdots,b_n)^T
    其中,每个output b i b_i 均可表示为 j = 1 m q i j a j + p i \sum_{j=1}^{m}q_{ij}a_j+p_i ,所有的可表示为:
    b = Q a + p \vec{b}=\mathbf{Q}\vec{a}+\vec{p}
    其中 Q \mathbf{Q} n × m n\times m 矩阵, p \vec{p} 为size为 n n 的列向量。
    假设矩阵 Q \mathbf{Q} 的rank为 r r ,则可将 Q \mathbf{Q} reduce 为 row echelon form R \mathbf{R} ,可表示为:
    b = R a \vec{b}''=\mathbf{R}\vec{a}

附注:

  • 所谓matrix rank是指:通过行列式转换,非零行的数量。matrix的rank最大可能值为 m i n ( m , n ) min(m,n)
  • 所谓row echelon form matrix是指:通过行列式转换,将矩阵左下角的所有元素均表示为0的过程。
    在这里插入图片描述

参考资料:
[1] How to Reduce a Matrix to Row Echelon Form
[2] Bootle和Groth等人2016年论文《Efficient Zero-Knowledge Arguments for Arithmetic Circuits in the Discrete Log Setting
[3] matrix rank

猜你喜欢

转载自blog.csdn.net/mutourend/article/details/107776103
今日推荐