This article aims to provide an intuitive explanation of the goals and processes of the Basefold protocol.
Introduction
BaseFold is a new Polynomial Commitment Scheme that is field-agnostic, with verifier complexity of O(log2n) and prover complexity of O(nlogn). While the RS-code used in FRI-IOPP requires an FFT-friendly field, BaseFold eliminates this constraint by introducing the concept of random foldable code, making it usable with sufficiently large fields.
Background
Constant Polynomial in FRI-IOPP
In FRI, the following polynomial is folded using a random value α0.
It is well-known that RS (Reed-Solomon) codes are a type of linear code, and the encoding of linear codes can be represented as a matrix-vector multiplication. For example, the encoding of an [n,k,d]-RS code, when n=16 and k=8, can be represented as follows:
The matrix on the left can be transformed into the matrix on the right by applying a row permutation.
If we divide the matrix on the right into four parts, the red and yellow-colored sections are identical and correspond to the matrix used in RS encoding when n=8 and k=4. The green-colored section is equivalent to multiplying the red matrix by a diagonal matrixT=diag(1,ω,ω2,…,ω7). Similarly, the blue-colored section is equivalent to multiplying the red matrix by another diagonal matrix T′=diag(ω8,ω9,ω10,…,ω15).
If the matrix used in the encoding of a linear code takes the form above, it is referred to as a foldable linear code. Let us define this more formally.
Let c,k0,d∈N, ki=k0⋅2i−1,ni=c⋅ki for every i∈[1,d]. A (c,k0,d)-foldable linear code is a linear code with a generator matrix Gd and rate c1 with the following properties:
the diagonal matrices Ti−1,Ti−1′∈Fni−1×ni−1 satisfies that diag(Ti−1)[j]=diag(Ti−1′)[j] for every j∈[0,ni−1−1].
the matrix Gi∈Fki×ni equals (up to row permutation)\
Gi=[Gi−1Gi−1⋅Ti−1Gi−1Gi−1⋅Ti−1′]
Random Foldable Code
To design a linear code that is foldable and efficiently encodable regardless of its finite field, BaseFold uses this algorithm:
Set G0←D0, where D0 is a distribution that outputs with 100% probability. Such a Di is referred to as a (c,k0)-foldable distribution.
Sample Ti←$(F×)ni and set Ti′=−Ti.
Generate Gi+1 using Gi,Ti,Ti′.
Repeat steps 2 and 3 until a Gi of the desired size is obtained.
This type of code is called a Random Foldable Code (RFC). The paper demonstrates that this code has good relative minimum distance. For those interested, refer to Section 3.1 of the paper. Additionally, it is noted that this is a special case of punctured Reed-Muller codes. For further details, consult Appendix D of the paper.
Encoding Algorithm
The encoding can be computed recursively as follows:
If i=0, return Enc0(m).
Unpack 1×ki matrix m into a pair of 1×ki/2 matrix (ml,mr).
Set l=Enci−1(ml), t=diag(Ti−1), and then pack a pair of ki×ni/2 matrices (l+t∘r,l−t∘r) to ki×ni matrix.
This approach is valid and can be proven inductively:
If i=0, Enc0(m)=m⋅G0, which holds by definition.
If i>0, Enci(m)=m⋅Gi holds because of the recursive construction of Gi.
To use this in IOPP, we need to ensure that πi is indeed an encoded random linear combination derived from mi+1. To demonstrate this, let mi represent the message at the i-th layer and πi the oracle (or block) at the i-th layer. Then, the following holds:
The values πi+1[j] and πi+1[j+ni] are evaluations of the polynomial f(X)=Enci(mi+1,l)[j]+X⋅Enci(mi+1,r)[j] at diag(Ti)[j] and diag(Ti′)[j], respectively. When using the sampled value αi at each i-th layer, f(αi) can be constructed as follows, ensuring that πi encodes the message mi,l+αi⋅mi,r:
Using this property, an IOPP (Interactive Oracle Proof of Proximity) can be designed. Here, interpolate((x1,y1),(x2,y2)) refers to the computation of a degree-1 polynomial P such that P(x1)=y1,P(x2)=y2.
If π0 is a valid codeword w.r.t. generator matrix G0, output accept, otherwise output reject.
Multilinear PCS based on interleaving BaseFold IOPP
When performing the sumcheck protocol, the problem is reduced to an evaluation claim. Interestingly, the BaseFold IOPP shares a similar structure: given an input oracle that encodes a polynomial f∈F[X0,X1,…,Xd−1], the final oracle sent by the honest prover in the IOPP protocol is precisely an encoding of a random evaluation f(r), where r=(r0,r1,…,rd−1).
Thus, the sumcheck protocol and the IOPP protocol can be executed interleaved, sharing the same random challenge. At the end, the verifier needs to check whether the evaluation claim f(r)=y, obtained through the sumcheck protocol, matches the final prover message from the IOPP protocol. It performs as follows:
PC.Eval
Public input: oracle πf:=Encd(f)∈Fnd, point r, claimed evaluation y=f(r)∈F
Prover witness: the polynomial f∈F[X0,X1,…,Xd−1]