The commitment phase contains two parts; AHP commitment and PFR commitment. After reviewing the algorithm, we will provide an example to clarify each parts.
Let Mf be a functional set which contains triple matrices mf=(A,B,C)∈(Fn×n)3 such that for each input vector X, there is a unique output vector Y as well as a witness (intermediate) W where AzoBz=Cz considering z=(1,X,W,Y).
The triplet (A,B,C)∈(Fn×n)3 is a functional set if and only if A and B are t−strictly lower triangular matrices (t−SLT) and C is t-diagonal matrix (t−Diag) [1]. Here, t=∣X∣+1 .
The Prover obtains t−SLT matrices A, B and t−Diag matrix C for the arithmetic circuit that is a directed acyclic graph of gates and wire inputs. Wires carry values from F and gates are add or multiplication. This work is done based on the two steps of the following construction:
Initialize three zero square matrices A,B,C over F of order n=ng+ni+1 where ng is the number of gates and ni is the number of inputs. Rows and columns of matrices are indexed on {0,1,...,ng+ni}. Also, Gate i with two left L and right R inputs and a selector S. We show the Gate i with a tuple (li,ri,si) where li and ri are the left and right inputs' indexes in z, respectively. Note that z is indexed on {0,1,..,ng+ni}. Hence, li and ri are between 0 and ng+ni. Also, si is either "Addition" or "Multiplication". Note, if the left input is a value v, then li=0 or if the right input is a value v, then ri=0.
For i=0..,ng−1:a) Set C1+ni+i,1+ni+i=1b) If si is "Addition"
- A1+ni+i,0=1
- B1+ni+i,li={left inputli=01otherwise
- B1+ni+i,ri={right inputri=01otherwiseb) If si is multiplication
- A1+ni+i,li={left inputli=01otherwise
- B1+ni+i,ri={right inputri=01otherwise
If our processing machine has 32 registers, then the size of the input vector X will be 32. Therefore, ni=32 and X=(x1,x2,...,x32) where xi corresponds to ith register, Ri. Also, z=(1,x1,x2,..x32,w1,..,wng−nr,y1,..,ynr) where nr is the number of registers that change during a program execution. For example, assume the first gate in a computation is the instruction "add R1 , R1, 5", which means R1(2)=R1(1)+5 . In the above "for" loop in step i=0, s0="Addition", l0=1, and r0=0, hence C1+32,1+32=1 , A1+32,0=1, , and B1+32,0=5.
2-1- PFR Commitment
PFR aims to prove the target program is a function with mentioned characteristics in A,B,C. PFR function will be edited later.
Commit(ck,mf=(A,B,C)∈Mf,s∈R): This function outputs
1 - The Prover selects randomness s=(s1,...,ssAHP(0)) of randomness space R .
2- The Prover calculates OPFR=Enc(mf=(A,B,C)) as encoded index as following:
The Prover encodes each matrix A,B and C by three polynomials. The matrix N, N∈{A,B,C}, is encoded by polynomials rowPFRN(x), colPFRN(x) and valPFRN(x) so that rowPFRN(γi)=ωri, colPFRN(γi)=ωci and valPFRN(γi)=vi for i∈{0,1,2,..,m−1} where m=2ng is maximum of the number of nonzero entries in the matrix N, The value of n=ng+ni+1 is the order of the matrix. Also, γ is a generator of multiplicative subgroup K of F of order m (K=<γ> and ∣K∣=m) and ω is a generator of multiplicative subgroup H of F of order n (H=<ω> and ∣H∣=n). Also ri,ci∈{0,1,...,n−1} and vi∈F are row number, column number and value of ith nonzero entry, respectively. Then, lets OPFR=(rowPFRA0,....,rowPFRAm−1,colPFRA0,...,colPFRAm−1,valPFRA0,...,valPFRAm−1,rowPFRB0,...,rowPFRBm−1,colPFRB0,...,colPFRBm−1,valPFRB0,....,valPFRCm−1,rowPFRC0,...,rowPFRCm−1,colPFRC0,...colPFRCm−1,valPFRC0,...,valPFRCm−1)
where rowPFRNi, colPFRNiand valPFRNi are coefficient of xi of polynomials rowPFRN(x), colPFRN(x)and valPFRN(x) , respectively. The vector OPFR is called as encoded index.
3- The Prover calculates ComPFRT=PC.Commit(ck,T,dAHP(N,0,i)=m,rT) for each polynomial T(x). Note that T∈{rowPFRN,colPFRN,valPFRN∣N∈{A,B,C}}.
For example, if the polynomial commitment scheme KZG is used, then
ComT=∑i=0degTaigτi=∑i=0degTaick(i) where ai is coefficient of xi in polynomial T(x).
As mentioned before AHP phase aims, without revealing any information about function f, to prove that y=f(x) for public x and y. Now, we create a commitment for Algebraic Holographic Proof (AHP), AHPCom , in this section.
Commit(ck′,mf=(A,B,C)∈Mf,s∈R): This function outputs AHPCom=(AHPCom0,AHPCom1,AHPCom2,AHPCom3,AHPCom4,AHPCom5,AHPCom6,AHPCom7,AHPCom8)
where ck′(i)=ck(i)r′i with random r′.
1 - The Prover selects random s=(s1,...ssAHP(0)) from random space R. Note that sAHP(0)=9 as explained in the setup phase.
2- The Prover calculates OAHP=Enc(mf=(A,B,C)) as encoded index as following:
Considering γ as a generator of multiplicative subgroup K of F of order m (i.e., K=<γ> and ∣K∣=m), ω as a generator of multiplicative subgroup H of F of order n (i.e., H=<ω> and ∣H∣=n), for each matrix N∈{A,B,C}, we generate 3 polynomials AHProwN(x), AHPcolN(x), and AHPvalN(x) as described in the following steps:
The polynomial AHProwN:K→H is constructed by AHProwN(k=γi)=ωri for 0≤i≤∣∣N∣∣−1 where ∣∣N∣∣ is the number of nonzero entries in N, and ri∈{0,1,...,n−1} is the row number of ith nonzero entry and otherwise, AHProwN(k) is an arbitrary element in H. Note that i starts from zero. This step generate 3 polynomials; AHProwA(x), AHProwB(x), AHProwC(x).
The polynomial AHPcolN:K→H is constructed by AHPcolN(k=γi)=ωci for 0≤i≤∣∣N∣∣−1 and ci∈{0,1,...,n−1} is column number of ith nonzero entry and otherwise AHPcolN(k) returns an arbitrary element in H. This step generate 3 polynomials; AHPcolA(x), AHPcolB(x), AHPcolC(x).
The polynomial AHPvalN:K→H is constructed by AHPvalN(k=γi)=uH(AHProwN(k),AHProwN(k))uH(AHPcolN(k),AHPcolN(k))vi for 0≤i≤∣∣N∣∣−1 where vi is value of ith nonzero entry and otherwise AHPvalN(k) returns zero where for each x∈H, uH(x,x)=∣H∣x∣H∣−1.
Now, we define AHProwN^, AHPcolN^ and AHPvalN^ as domain-extend of polynomials AHProwN, AHPcolN and AHPvalN where their domains are extended from subgroup K to filed F. Therefore, ∀k∈K, AHProwN(k)=AHProwN^(k), AHPcolN(k)=AHPcolN^(k), and AHPvalN(k)=AHPvalN^(k).
OAHP=(AHProw^A0,....,AHProw^Am−1,AHPcol^A0,...,AHPcol^Am−1,AHPval^A0,...,AHPval^Am−1,AHProw^B0,...,AHProw^Bm−1,AHPcol^B0,....,AHPcol^Bm−1,AHPval^B0,...,AHPval^Bm−1,AHProw^C0,...,AHProw^Cm−1,AHPcol^C0,...,AHPcol^Cm−1,AHPval^C0,....,AHPval^Cm−1)
where AHProw^Ni, AHPcol^Niand AHPval^Ni are coefficient of xi of polynomials AHProw^N(x), AHPcol^N(x) and AHPval^N(x), respectively. The vector OAHP is called the encoded index.
3- The Prover calculates commitment for polynomial T∈{AHProw^N,AHPcol^N,AHPval^N∣N∈{A,B,C}} as AHPComT=PC.Commit(ck′,T,dAHP(N,0,i)=m,si).
For example, if the polynomial commitment scheme KZG is used, then
AHPcomT=∑i=0degTaick′(i) where ai is coefficient of xi in polynomial T(x) are calculated by the Prover as follows:
AHPCom0=∑i=0degAHProw^A(x)AHProw^Aick′(i),
AHPCom1=∑i=0degAHPcol^A(x)AHPcol^Aick′(i),
AHPCom2=∑i=0degAHPval^A(x)AHPval^Aick′(i),
AHPCom3=∑i=0degAHProw^B(x)AHProw^Bick′(i),
AHPCom4=∑i=0degAHPcol^B(x)AHPcol^Bick′(i),
AHPCom5=∑i=0degAHPval^B(x)AHPval^Bick′(i),
AHPCom6=∑i=0degAHProw^C(x)AHProw^Cick′(i),
AHPCom7=∑i=0degAHPcol^C(x)AHPcol^Cick′(i),
AHPCom8=∑i=0degAHPval^C(x)AHPval^Cick′(i).
4- The prover send the calculated commitment values to the Verifier.