There is a trade-off between selecting finite fields that allow for:
Efficient Arithmetic Implementations: Smaller prime fields, particularly those of special forms like Mersenne primes, enable faster arithmetic operations on standard hardware architectures.
Efficient FFT Support: Fields need to have smooth multiplicative groups with large two-adic subgroups to support efficient FFTs, which are crucial for STARKs' encoding processes.
One of the most efficient fields for arithmetic seem to be Mersenne fields, defined by primes of the form p=2e−1. In particular, the prime p=231−1 enables very efficient arithmetic on 32-bit architectures. Since 232=2modp, a widened product encoded as 232⋅xhi+xlo is trivially reduced to a much smaller quantity, 2⋅xhi+xlo. However, as p−1=2⋅32⋅7⋅11⋅31⋅151⋅331, the multiplicative group lacks two-adic subgroups, which are useful for efficient Cooley-Tukey Fast Fourier Transforms (FFTs).
Circle Group
For p=3mod4 , a complex extension field Fp/(X2+1) can be defined as:
C(Fp)={x+i⋅y:x,y∈Fp}
For p=1mod4, X2+1=0 has a solution since by : p−1=(−1)2p−1=1. This means that −1 is a and X2+1 can be written as (X−a)(X+a) making Fp/(X2+1) not a field.
The unit circle over Fp is the algebraic set C(Fp)={(x,y)∈Fp2:x2+y2=1}, or in complex representation:
C(Fp)={z∈C(Fp)×:z⋅zˉ=1}
where zˉ denotes the conjugate x−iy of z=x+iy.
Lemma 1 (Unit circle group). Let Fp be a prime field with p=3mod4. Then the unit circle groupC(Fp) equals the group of (p+1)-th roots of unity in C(Fp)×, and has order p+1.
Proof: Notice that zp=(x+iy)p=xp+(iy)p=x+(ip)y=x−iy=zˉ so x2+y2=z⋅zˉ=zp+1. Therefore, C(Fp)={z∈C(Fp)×:zp+1=1} which means C(Fp) is set of all (p+1)-th roots of unity. Since ∣C(Fp)×∣=p2−1 is divisible by p+1, the unit circle group must be the unique subgroup of order p+1.
Group Operations
The p+1 points of C(Fp) form a group with the group operation:
The group has (1,0) as its identity element, and for any P=(Px,Py)∈C(Fp), we shall call
TP(x,y):=P⋅(x,y)=(Px⋅x−Py⋅y,Px⋅y+Py⋅x)
the translation(rotation) by P.
The squaring map with respect to the group operation is the quadratic map
π(x,y):=(x,y)⋅(x,y)=(x2−y2,2⋅x⋅y)=(2⋅x2−1,2⋅x⋅y)
and group inverses are given by the degree-one map J(x,y):=(x,−y)
So you can think of π as doubling the angle it forms with the x-axis and J as a reflection by the x-axis.
Twin-coset and Standard Position Coset
First, Figure 2 shows how the subgroups would look like in the circle group.
Taking a coset of a subgroup means that each point in the subgroup will be rotated by the same amount.
Definition Let Gn−1 be a cyclic subgroup of C(Fp) of size ∣Gn−1=2n−1∣ for n≥1. Any disjoint union D=Q⋅Gn−1∪Q−1⋅Gn−1 with Q⋅Gn−1∩Q−1⋅Gn−1=∅ is called twin-coset of sizeN=2n.
Remark Twin-coset maps to itself under inverse, since
J(D)=J(Q⋅Gn−1)∪J(Q−1⋅Gn−1)=Q−1⋅Gn−1∪Q⋅Gn−1
Definition In the exceptional case that a twin-coset D of subgroup Gn−1 is again a coset of the subgroup Gn, we call D a standard position coset. Lemma 3 If D is a twin-coset of size 2n,n≥2 then its image π(D) is a twin-coset of size 2n−1. In addition, if D is a standard position coset, so is π(D).
Lemma 3 from the paper. If D is a twin-coset of size 2n,n≥2 then its image π(D) is a twin-coset of size 2n−1. In addition, if D is a standard position coset, so is π(D).
Proof: π(D)=π(Q⋅Gn−1∪Q−1⋅Gn−1)=π(Q)⋅Gn−2∪π(Q−1)Gn−2 and if D=Q⋅Gn is a standard position coset, then π(Q⋅Gn)=π(Q)⋅Gn−1, which means π(D) is also a standard position coset.
Space of Polynomials
Definition Let F be an extension field of Fp. Over the circle curve, for any even integer n≥0 we define LN(F) as the space of all bi-variate polynomials with coefficients in F, and of total degree at most N/2,
LN(F)={p(X,Y)∈F[X,Y]/(X2+Y2−1):degp≤N/2}
For a circle STARK the bi-variate polynomials from LN(F) are what low-degree extensions are for classical univariate proofs. The crucial properties of LN(F) are:
rotation invariance, which is needed for the next-neighbour relation and efficient encoding
good separability, leading to maximum distance separable codes.
Vanishing Polynomial
Definition Let D be a subset of C(Fp) of even size N, where 2≤N<p+1. We call any non-zero polynomial from LN=LN(Fp), which evaluates to zero over D a vanishing polynomial of the set D. Decomposing D into pairs of points Pk,Qk,1≤k≤N/2 and taking the product of linear functions going through these pairs,
vD(x,y)=∏k((x−Pkx)⋅(Qky−Pky)−(y−Pky)(Qkx−Pkx))shows that vanishing polynomials do exist.
Given a twin-coset D=Q⋅Gn−1∪Q−1⋅Gn−1, using Lemma 3, we can see πn−1(D) will result in a twin-coset of size 2. In other words, it is in the form of πn−1(D)={(xD,yD),(xD,−yD)} for some xD,yD∈D. We therefore may take
vD(x,y):=vn(x,y)−xD
with vn(x,y):=πx∘πn−1(x,y) where πx is the projection onto the x-axis.
And when D is a standard position coset, its image πn−1(D) is again a standard position coset and thus xD=0 (see Figure 4, rightmost image). In this case vD(x,y):=vn(x,y) and vD can be evaluated by only O(n) field operations (2 addition and 1 multiplication in each step).
Definition The circle code with values in F and evaluation domain D, is linear code with code words from the space:
CN(F,D)={f(P)∣P∈D:f∈LN(F)}
Circle FFT
Definition 1 from the paper. (CFFT-friendly prime). Any prime p for which (p+1) is divisible by 2n+1 for sufficiently large n≥1, will be called CFFT-friendly, and any such n is a supported order, and N=2n a supported domain size.
Definition 4 from the paper. For any integer j from the interval 0≤j≤2n−1, let (j0,...,jn−1)∈{0,1}n denote its bit representation. The FFT-basis of order n is the family Bn of polynomials:
Consider bi-variate polynomials modulo x2+y2−1: F[X,Y]/(x2+y2−1). Here y2≡1−x2 so we can replace all y2 by 1−x2 and hence, all polynomials in F[X,Y]/(x2+y2−1) can be represented with polynomials with deg(y)≤1.
This means f(X,Y)∈F[X,Y]/(x2+y2−1) can be represented as canonical form:
This step is repeated recursively until we get constant functions of the form:
fk0k1k2…kn−1
These make up a constant ck=fk0,...,kn−1∈F, for each k in the interval 0≤k≤2n−1, where k=k0+k12+...+kn−12n−1.
In Figure 6, f0(x) suddenly has only 4 points. This is because f0(x) actually has only 4 evaluation points (−A,−B,B,A) and is only parametrized by x. It is visualized on a circle for easier group operation visualization. To elaborate:
f00(C) is the average of f0(A) and f0(−A).
f00(−C) is the average of f0(B) and f0(−B).
But where did C come from? It denotes 2A2−1, while −C is 2B2−1 since A2+B2=1 because they are from a standard position coset.
Theorem 2 Let p be a CFFT-friendly prime supporting the order n≥1, take D⊂C(Fp) a twin-coset of size ∣D∣=2n. Given f∈FD a function over D with values in an extension field F of Fp, the above described algorithm outputs the coefficients ck∈F, 0≤k≤2n−1, with respect to the FFT basis Bn, so that ∑2n−1k=0ck⋅bk evaluates to f over D.
Low degree test over the Circle
Protocol 1 (Circle FRI). Let D be a standard position coset of size ∣D∣=2B+n, where B≥1 and n≥1, and let C=CN(F,D) be the circle code with rate ho=∣D∣N+1, where N=2n. For given proximity parameter θ∈(0,1−ρ), the interactive oracle proof of a function f∈FD being θ-close to the circle code C, consists of a commit phase and a subsequent query phase, which are as follows.
COMMIT phase:
(Decomposition) The prover compute the decomposition of f∈LN(F) into f=f(0)+λ⋅vn with f(0)∈L(0):=LN′(F) and λ∈F. It sends λ and commitment to f(0) to the verifier.
(J-folding) For i=1:
The verifier picks uniformly random βi∈F and sends it to the prover.
The prover commits to a function f(i)∈L(i) (In the case of an honest prover, f(i)=f0(i−1)+βif1(i−1) where
f0(i−1)∘πx=2f(i−1)+f(i−1)∘Jf1(i−1)∘πx=2yf(i−1)−f(i−1)∘J
(π-folding) For i=2 to r:
The verifier picks uniformly random βi∈F and sends it to the prover.
The prover commits to a function f(i):L(i)→F. (In the case of an honest prover, f(i)=f0(i−1)+βif1(i−1) where
Query f(i) at xi and check if
f(i)(xi)=f0(i−1)(xi)+βif1(i−1)(xi)
ACCEPT if all checks passed. REJECT otherwise
Batch Circle FRI
Protocol 2 (batch Circle FRI). Under the same assumptions as Protocol 1, the interactive oracle proof for a batch of functions f1,…,fL∈FD having correlated (1−θ)-agreement to a codeword from CN(F,D), is as follows. In the first step, given a random challenge λb←F from the verifier, the prover computes the values of the linear combination:
f=i=1∑Lλbk−1⋅fi
over D. Now, both prover and verifier run Protocol 1 on f , with its query phase extended by a check of the batching at each of the queries.
CircleSTARK
In circle STARK, the trace domain is the standard position coset H⊂C(Fp) of a cyclic and proper subgroup G=Gn of the circle curve C(Fp), of size N=2n, with n≥1, and the trace is organised column-wise t1,…,tw∈FpN, each placed over the domain H in the usual manner, using the group translation T by a generator of G for the timeline. The trace columns are interpolated by polynomials
p1,…,pw∈Fp[x,y]/(x2+y2−1)
of total degree at most N/2, meaning that pi∈LN(Fp) (actually, they are from the FFT-space LN′(Fp)), and these polynomials are subject to set of constraints, say
Pi(si,p1,…,pw,p1∘T,…,pw∘T)=0
for i=1,…,C, holding over the entire domain H, where si∈LN(Fp) is a predefined selector polynomial.
Each constraint is a polynomial
Pi∈Fp[S,X1,…,Xw,Y1,…,Yw]
Pi∈Fp[S,X1,…,Xw,Y1,…,Yw]of total degree at most the maximum number of twin-coset of size N, degPi≤Np2+1−1 and the degree in the selector variable S is at most degSPi≤1.
Definition. The evaluation domain is a standard position coset D⊆C(Fp), of at least double the size of trace domain H. The polynomials in the circle STARK will be generally committed by their values over this domain.
Lemma 2 from the paper. Let p be a CFFT-friendly prime supporting the order m≥1, and Gk denote the subgroup of order 2k for k≤m. Then any subset of D⊆C(Fp)/Gm which is invariant under and J can be decomposed into twin-cosets of size N=2n, for any n≤m. In particular for a standard position coset D of size M=2m,
D=Q⋅Gm=k=0⋃M/N−1(Q4k+1⋅Gn−1∪Q−4k−1⋅Gn−1)
where Q is an element from C(Fp) of order 2m+1.
IOP for AIR
Now, once we have all these, the interactive oracle proof for the satisfiability of the AIR can be constructed as follows:
In the first round, the prover computes the values of its trace polynomials p1,…,pw∈LN(Fp) over the evaluation domain D using its decomposition into twin-cosets and shares their oracles denoted by
[p1],…,[pw]
with their verifier.
In the second round, the verifier sends random challenge β←F, drawn uniformly from a suitably large extension field F of Fp, which is used to reduce the constraint polynomials into a single one:
i=1∑Cβi−1⋅Pi(si,p1,…,pw,p1∘T,…,pw∘T)=0
which should hold over trace domain H. To prove this, the vanishing polynomial over H, vH, is computed so the composite constraint polynomial can now be written as:
i=1∑Cβi−1⋅Pi(si,p1,…,pw,p1∘T,…,pw∘T)=q⋅vH
To keep with the degree bound imposed by the size of H, the quotient q∈L(d−1)N(F) needs to be split into polynomials q1,…,qd−1∈LN(F):
q=λ⋅vHˉ+k=1∑d−1vHkvHˉ⋅qk
Recall that L(d−1)N has (d−1)N+1 dimension. On the other hand, the quotient q∈L(d−1)N(F) is computed by value from those of f1,…,fw over a union of twin-cosets Hk of size N. Thus the union Hˉ=⋃k=1d−1Hk is one point too small to uniquely determine a polynomial from L(d−1)N. In our decomposition, this missing point is characterized by an additional scalar multiple of the vanishing polynomial of Hˉ.
Then, the prover sets up the oracles
[q1],…,[qd−1]
for their values over the evaluation domain D, and sends them, together with λ, to the verifier.
Having all oracles in place, the next step is DEEP ALI, which reduces satisfiability of the constraints to a low-degree test on single-point quotients. (In lose terms, this step turns low-degree test into a polynomial commitment scheme.)
In this step, the verifier responds with a random point γ→C(F)∖(D∪H). In return, the prover opens the values vi,0=pi(γ),vi,1=pi(T(γ)) for each i=1,…,w as well as v1,…,vd−1 of q1,…,qd−1 at γ. Eventually, both prover and verifier engage in a low-degree test for the real and imaginary parts of the DEEP quotients:
The initial implementation of CircleFFT demonstrated a performance improvement by a factor of 1.4 in a single-threaded setup. Building on this foundation, Starknet’s next-generation prover, Stwo (“STARK Two”), is designed to enhance and eventually replace the current prover, Stone (“STARK One”).
Notice that this equation resembles the cos(α+β) and sin(α+β) and is equivalent to rotation over the unit circle.