There is no commentSelect some text and then click Comment, or simply add a comment to this page from below to start a discussion.
Circle FFT and its implementation
Abstract: This paper primarily examines the work of Ulrich Haböck et al. titled "Circle STARKs," interpreting Circle FFT and its implementation aspects. The analysis focuses on three main areas: 1) the foundation for accelerating basic operations with CFFT; 2) the implementation of CFFT calculations; and 3) the coding implementation of CFFT.
1. Introduction
In traditional STARKs, Fast Fourier Transform (FFT) is used to efficiently perform interpolation and write adjacent row constraints. To utilize FFT for fundamental polynomial operations, the finite field must possess a smooth-order root of unity. Besides the FFT itself, the choice of finite field directly influences the complexity of arithmetic operations, thereby impacting the efficiency of STARKs. The most effective field for arithmetic operations is the Mersenne prime field, specifically . Notably, allows for highly efficient arithmetic operations on 32-bit computers. For these reasons, traditional FFT is inadequate in meeting the efficiency demands of STARKs. In reference [1], the authors continue the ECFFT [2][3] approach, constructing Circle STARKs based on the Mersenne prime on the circle defined by the equation . The core innovation lies in the introduction of Circle FFT (CFFT) within STARKs.
2. Circle FFT
2.1 Fundamentals of CFFT
The choice of field significantly affects the efficiency of FFT acceleration and the feasibility of using FFT for this purpose. A prime that is friendly to CFFT possesses the property . The set of points on the curve forms a group, defined by the group operation , where the circular group is a cyclic group. Additionally, we define the rotation operation , the squaring map , and the group inverse .
When using FFT acceleration, the length of the coefficients to be computed must be . For CFFT, we define a double coset of size as . Here, is a subgroup of size of , and . When the prime , we have . When is a coset of the subgroup , it is the standard position coset of size . Furthermore, under the squaring map, the set of size shares the same properties as , meaning it is also a double coset or standard coset. The standard position coset is illustrated in Figure 1, where the elements are evenly distributed along the circle, corresponding to the binary size of the set. For , contains only two elements.
Image Not ShowingPossible Reasons
The image was uploaded to a note which you don't have access to
The note which the image was originally uploaded to has been deleted
Figure 1: Diagram of the three minimal standard position cosets in the affine plane over
In Circle STARKs, prior to CFFT acceleration, we first define the space of bivariate polynomials whose coefficients belong to the extension field :
where is an even number. The space has rotational invariance and good separability. These key properties are necessary for efficient encoding. By repeatedly substituting into the polynomial derived from , we obtain
, where and . Equation is referred to as the canonical form of the polynomial derived from . The canonical form indicates that the set of monomials
spans the space . Based on the dimension of , the canonical form must be a basis, specifically a monomial basis. Additionally, for details on the cyclic code, refer to reference [1].
For the double coset , with , CFFT completes the interpolation of functions derived from by calculating the coefficients corresponding to the basis of Circle FFT . The basis for Circle FFT consists of N-dimensional polynomial bases that depend solely on the size of the field. We define the -th order FFT basis as
where and ; is the vanishing polynomial of the standard position coset of size [1]. The family formed by constitutes the set .
According to the definitions above, the double coset exhibits invariance under the wrapping operation , and each -orbit in contains only two points. Consequently, the quotient mapping
is a two-to-one mapping. The double coset obtained through recursion is given by , for , corresponding to the descending chain of subgroups . Since the operations and are commutative, we can obtain the commutative diagram:
Image Not ShowingPossible Reasons
The image was uploaded to a note which you don't have access to
The note which the image was originally uploaded to has been deleted
Figure 2: Commutative diagram of the J and 𝜋 mappings: each mapping is two-to-one, and the coset size is halved.
Alternatively, the quotient can be considered as a subset of the x-axis, and serves as the projection onto the x-axis. Thus, the commutative diagram can be transformed into
Image Not ShowingPossible Reasons
The image was uploaded to a note which you don't have access to
The note which the image was originally uploaded to has been deleted
In the diagram, the squaring homomorphism mapping is a two-to-one mapping given by .
2.2 Mathematical Description of CFFT
Given a double coset of size , FFT is a divide-and-conquer algorithm that iteratively simplifies the interpolation problem for along the projection chain: From the projection chain, it is evident that the entire chain is divided into two stages.
In the first stage, we use as the "reference odd function" to decompose into "odd" and "even" parts according to the wrapping function , resulting in two unique functions and defined on the univariate domain , specifically:
and
If we factor out the coefficient from equations (7) and (8) and consider as the rotation factor, this decomposition is quite similar to the butterfly operation in traditional FFT.
In the second stage, we select as the "reference odd function." On the projection domain , the iterative decomposition yields:
and
where . This decomposition process continues until the projection domain reduces to the single point .
The output of the CFFT algorithm is a constant , where and are the binary representation bits of . Thus, for a given basis space :
We have:
When , represents the output of the CFFT.
3. CFFT Implementation
In Algorithm [1], the authors provide the algorithm's pseudocode.
Image Not ShowingPossible Reasons
The image was uploaded to a note which you don't have access to
The note which the image was originally uploaded to has been deleted
From the pseudocode, it is evident that the entire algorithm is divided into two stages: 1) operations at the first level; and 2) operations in the subsequent layers. The primary difference lies in the calculation of the rotation factors.
3.1 Calculation of Rotation Factors
As seen in the pseudocode, although the implementation of CFFT differs between the first layer and the subsequent layers, the inconsistency mainly arises from the calculation of rotation factors, while the butterfly operation remains consistent. In the RUST implementation, the calculation of rotation factors is
Image Not ShowingPossible Reasons
The image was uploaded to a note which you don't have access to
The note which the image was originally uploaded to has been deleted
From lines 132 to 142 of the code, it can be observed that the calculation of rotation factors distinguishes between the first layer and the remaining layers. It is necessary to differentiate between the first step and the second step, which are completed in init_domain and working_domain, respectively. This represents a significant difference from the calculation of rotation factors in traditional FFT. The generation of the initial domain is accomplished by calling the cfft_domain function.
Image Not ShowingPossible Reasons
The image was uploaded to a note which you don't have access to
The note which the image was originally uploaded to has been deleted
In the implementation, the butterfly operation is realized using direct code. Alternatively, it can be called directly using fn butterfly_cfft().
References: [1] Ulrich Haböck and David Levit and Shahar Papini. Circle STARKs. In Cryptology ePrint Archive, Paper 2024/278, 2024. https://eprint.iacr.org/2024/278 [2] Eli Ben-Sasson, Dan Carmon, Swastik Kopparty, and David Levit. Elliptic Curve Fast Fourier Transform (ECFFT) Part I: Fast polynomial algorithms over all finite fields. In Electronic Colloquium on Computational Complexity, volume TR21-103, 2021. https: //eccc.weizmann.ac.il/report/2021/103/. [3] Eli Ben-Sasson, Dan Carmon, Swastik Kopparty, and David Levit. Scalable and transparent proofs over all large fields, via elliptic curves (ECFFT part II). In IACR preprint archive, 2022. https://eprint.iacr.org/2022/1542. [4] GitHub - Plonky3/Plonky3 at Circle-Fast-Fourier-Transform. https://github.com/Plonky3/Plonky3