{"author":{"address":"0x6b5067C8dd6876eA31919F48Ad2Bb3A4554ba615","user":"https://learnblockchain.cn/people/15677"},"content":{"body":"\u003e Originates from my hackmd [note](https://hackmd.io/@70xfCGp1QViTYYJh3AMrQg/SJrem_VKC)\r\n\r\n# Domain\r\n\r\nFirstly we need to look into domain $D$, which the polynomial $p(x)$ defines over. \r\n\r\n\u003cbr /\u003e\r\n\r\n## Traditional Domain\r\n\r\nUsually the domain $D$ is a cyclic multiplicative sub-group $H$ defined over finite prime field $F_p$, say $F_{13}$, then $|F_{13}^{\\times}| = |\\langle 6 \\rangle| = 12$, there is a order-$4$ subgroup:\r\n$$\r\nH = \\langle 6^3 \\rangle\r\n$$\r\ngenerally speaking:\r\n$$\r\nD = H = \\langle g^m \\rangle = \\langle g_m \\rangle\r\n$$\r\nwhere $g$ is generator of multiplicative group $F_{p}^{\\times}$, and $g_m$ is the generator of $D$ or $H$.\r\n\r\n\u003cbr /\u003e\r\n\r\nTherefore we have the belowing evaluation table $Y = p(X)$,  where $X \\in D$:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   X \u0026 1 \u0026 g_m \u0026 g_m^2 \u0026 ... \u0026 g_m^{n - 1} \\\\ \\hline\r\n   Y \u0026 e_0 \u0026 e_1 \u0026 e_2 \u0026 ... \u0026 e_{n - 1}\r\n\\end{array}\r\n$$\r\n \r\n\u003cbr /\u003e\r\n \r\nObviousely $p(X)$ is a **univariate** polynomial, as $X$ is one-diamentional coordinate, and evaluation domain $D$ is a **multiplicative** group.\r\n\r\n\u003cbr /\u003e\r\n\r\n## Circle Domain\r\n\r\nWhile in circle domain, $X$ is not one-diamentional coordinate anymore, it's two-diamentional coordinates, it's a **bivariate** polynomial $p(x, y)$, and its domain $D$ is a **additive** group rather a **multiplicative** group. \r\n\r\n\u003cbr /\u003e\r\n\r\nAssuming there's a **additive** cyclic group $G$:\r\n$$\r\nG = \\{(x, y); x^2 + y^2 = 1, x, y \\in F_p \\}\r\n$$\r\nwhere $|G| = |\\langle g \\rangle| = 64$. There is subgroup:\r\n$$\r\nD = H = \\{ g + [i]g_2, i \u003c 32 \\}\r\n$$\r\nwhere $g_2 = [2] g$, we must have $|D| = 32$.\r\n\r\n\u003cbr /\u003e\r\n\r\nTherefore we have the following evaluation table $Y = p(X)$, where $X \\in H$:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   X \u0026 g = (x_0, y_0) \u0026 [3]g = [3](x_0, y_0) \u0026 [5]g = [5](x_0, y_0) \u0026 ... \u0026 [63]g = [63](x_0, y_0) \\\\ \\hline\r\n   Y \u0026 e_0 \u0026 e_1 \u0026 e_2 \u0026 ... \u0026 e_{n - 1}\r\n\\end{array}\r\n$$\r\n\r\n\u003cbr /\u003e\r\n\r\nEverthing looks well? actually it's not. \r\n\r\n\u003cbr /\u003e\r\n\r\nIf you take a close look at its domain $D$:\r\n$$\r\nD = H = \\{ g + [i]g_2, i \u003c 32 \\}\r\n$$\r\nyou'll notice that, it's not a **additive** cyclic group, as it does not even have a generator! So we must correct it, we can not call $D$ as a group anymore, maybe **domain** is more accurate.\r\n\r\n\u003cbr /\u003e\r\n\r\n# FFT\r\n\r\nSecondly, given a vector of evaluations:\r\n$$\r\ne = [e_0, e_1, e_2, e_3, ..., e_{31}]\r\n$$\r\nwe want to get its coefficient represented polynomial $p(x)$, aka polynomial coefficient vector, through a interpolation algorithm, say:\r\n$$\r\nc = [c_0, c_1, c_2, c_3, ..., c_{31}]\r\n$$\r\n\r\nThis is what **FFT** does.\r\n\r\n\u003cbr /\u003e\r\n\r\n## Traditional FFT\r\n\r\n#### First Round\r\n\r\nGiven **univairate polynomial** evaluation table $Y = p(X), X \\in D = \\{ g_m^i, i \u003c n \\}$:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   X \u0026 1 \u0026 g_m \u0026 g_m^2 \u0026 ... \u0026 g_m^{n - 1} \\\\ \\hline\r\n   Y \u0026 e_0 \u0026 e_1 \u0026 e_2 \u0026 ... \u0026 e_{n - 1}\r\n\\end{array}\r\n$$\r\nwe need to solve the coefficients of polynomial $p(X)$ through $FFT$ interpolation.\r\n\r\n\u003cbr /\u003e\r\n\r\nDivide $p(X)$ into two sub-polynomials $f_0(X)$ and $f_1(X)$:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   X^2 \u0026 1 \u0026 g_m^2 \u0026 g_m^4 \u0026 ... \u0026 g_m^{n - 2} \\\\ \\hline\r\n   f_0(X^2) \u0026 \\frac{e_0 + e_{n - 1}}{2} \u0026 \\frac{e_1 + e_{n - 2}}{2} \u0026 \\frac{e_2 + e_{n - 3}}{2} \u0026 ... \u0026 \\frac{e_{n / 2 - 1} + e_{n / 2}}{2} \\\\ \\hdashline\r\n   f_1(X^2) \u0026 \\frac{e_0 - e_{n - 1}}{2 \\cdot 1} \u0026 \\frac{e_1 - e_{n - 2}}{2 \\cdot g_m} \u0026 \\frac{e_2 - e_{n - 3}}{2 \\cdot g_m^2} \u0026 ... \u0026 \\frac{e_{n / 2 - 1} - e_{n / 2}}{2 \\cdot g_m^{n / 2 - 1}} \\\\\r\n\\end{array} \r\n$$\r\nwhere : \r\n$$\r\n\\begin{aligned}\r\np(X) = f_0(X^2) + X \\cdot f_1(X^2) \\\\\r\n\\Longrightarrow \\begin{cases}\r\nf_0(X^2) = \\frac{p(X) + p(-X)}{2} \\\\\r\nf_1(X^2) = \\frac{p(X) - p(-X)}{2 \\cdot X} \\\\\r\n\\end{cases}\r\n\\end{aligned}\r\n$$\r\n.\r\n\r\n\u003cbr /\u003e\r\n\r\nThe coefficient vector of polynomial $p(X)$ is reduced into coefficient vectors of $f_0(X^2)$ and $f_1(X^2)$ with halved domain size. \r\n\r\n\u003cbr /\u003e\r\n\r\nEvaluation vector becomes:\r\n$$\r\n\\begin{aligned}\r\np(X) = \\{ e_0, e_1, e_2, e_3, ..., e_{31} \\} \\\\\r\n\\Longrightarrow \\begin{cases}\r\nf_0(X^2) = \\{ \\frac{e_0 + e_{31}}{2}, \\frac{e_1 + e_{30}}{2}, ... \\} \\\\\r\nf_1(X^2) = \\{ \\frac{e_0 - e_{31}}{2 \\cdot 1}, \\frac{e_1 + e_{30}}{2 \\cdot g_2}, ... \\} \\\\\r\n\\end{cases}\r\n\\end{aligned}\r\n$$\r\nDomain becomes:\r\n$$\r\n\\begin{aligned}\r\nD = \\{ 1, g_2, g_4, g_6, ..., g_{62} \\} \\\\\r\n\\Longrightarrow  D_1 = \\{ 1, g_4, g_8, g_{12}, ..., g_{60} \\} \\\\\r\n\\end{aligned}\r\n$$\r\n\r\n\u003cbr /\u003e\r\n\r\n#### Second and The Rest Rounds\r\n\r\nGiven the evaluation table of $f_0(X)$:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   X \u0026 1 \u0026 g_4 \u0026 g_8 \u0026 ... \u0026 g_{60} \\\\ \\hline\r\n   Y \u0026 \\frac{e_0 + e_{31}}{2} \u0026 \\frac{e_1 + e_{30}}{2} \u0026 \\frac{e_2 + e_{29}}{2} \u0026 ... \u0026 \\frac{e_{15} + e_{16}}{2} \r\n\\end{array}\r\n$$\r\n\r\n\u003cbr /\u003e\r\n\r\nThen coefficient vector of $f_0(X)$ is reduced into $f_{00}(X^2)$ and $f_{01}(X^2)$ with halved domain size again after applying **FFT** algorithm, similarily works for $f_1(X)$:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   X \u0026 1 \u0026 g_4 \u0026 g_8 \u0026 ... \u0026 g_{60} \\\\ \\hline\r\n   Y \u0026 \\frac{e_0 - e_{31}}{2 \\cdot 1} \u0026 \\frac{e_1 - e_{30}}{2 \\cdot g_2} \u0026 \\frac{e_2 - e_{29}}{2 \\cdot g_4} \u0026 ... \u0026 \\frac{e_{15} - e_{16}}{2 \\cdot g_{30}} \r\n\\end{array}\r\n$$\r\napply **FFT** algorithm recursively on $f_0(X)$ and $f_1(X)$ $log{n}$ times, we'll get the final coefficients of **univaritate** polynomial $p(X)$.\r\n\r\n\u003cbr /\u003e\r\n\r\n## Circle FFT\r\n\r\n#### First Round\r\n\r\nGiven **bivairate polynomial** evaluation table $Y = p(X), X \\in D = \\{ g + [i]g_2, i \u003c n \\}$:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   X \u0026 g = (x_0, y_0) \u0026 [3]g = [3](x_0, y_0) \u0026 [5]g = [5](x_0, y_0) \u0026 ... \u0026 [2n - 1]g = [2n - 1](x_0, y_0) \\\\ \\hline\r\n   Y \u0026 e_0 \u0026 e_1 \u0026 e_2 \u0026 ... \u0026 e_{n - 1}\r\n\\end{array}\r\n$$\r\nsimilarily we need to solve the coefficients of polynomial $p(X)$ through interpolation.\r\n\r\n\u003cbr /\u003e\r\n\r\nBut the problem in front of us is that $X$ is a two-diamentional coordinates, say $X = (x, y)$, so the polynomial would be more complex than the one with one-diamentional coordinates. say:\r\n$$\r\np(X) = p(x, y)= 3x + 2x^2 + y \\cdot 5x^2 + y^2 \\cdot 4 + y^3 \\cdot 4x^3\r\n$$\r\nLuckly any $p(x, y)$ can also be converted into two sub-polynomials $f_0(x)$ and $f_1(x)$ as traditional **FFT** does:\r\n$$\r\np(x, y) = f_0(x) + y \\cdot f_1(x)\r\n$$\r\nsince $(x, y)$ is circle points satisfying:\r\n$$\r\nx^2 + y^2 = 1\r\n$$\r\nwe must have $y^2 = 1 - x^2$. so the above toy polynomial case can be divided into:\r\n$$\r\n\\begin{aligned}\r\nf_0(x) \u0026= 3x + 2x^2 + (1 - x^2) \\cdot 4\\\\\r\nf_1(x) \u0026= 5x^2 + (1 - x^2) \\cdot 4x^3 \\\\\r\n\\end{aligned}\r\n$$\r\nIt's a amazing property for circle domain, isn't it? \r\n\r\n\u003cbr /\u003e\r\n\r\nThe **bivariate** polynomial $p(x, y)$ can also be splitted into two **univariate** polynomials $f_0(x)$ and $f_1(x)$:\r\n$$\r\n\\begin{aligned}\r\nf_0(x) = \\frac{p(x, y) + p(x, -y)}{2} \\\\\r\nf_1(x) = \\frac{p(x, y) - p(x, -y)}{2 \\cdot y} \\\\\r\n\\end{aligned}\r\n$$\r\nthe evaluation table of them would be like below:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   X \u0026 g \u0026 g_3 = [3]g \u0026 g_5 = [5]g \u0026 ... \u0026 g_{n - 1} = [n - 1]g \\\\ \\hline\r\n   f_0(x) = f_0(X.x) \u0026 \\frac{e_0 + e_{31}}{2} \u0026 \\frac{e_1 + e_{30}}{2} \u0026 \\frac{e_2 + e_{29}}{2} \u0026 ... \u0026 \\frac{e_{15} + e_{16}}{2} \\\\ \\hdashline\r\n   f_1(x) = f_1(X.x) \u0026 \\frac{e_0 - e_{31}}{2 \\cdot g.y} \u0026 \\frac{e_1 - e_{30}}{2 \\cdot g_3.y} \u0026 \\frac{e_2 - e_{29}}{2 \\cdot g_5.y} \u0026 ... \u0026 \\frac{e_{15} - e_{16}}{2 \\cdot g_{n - 1}.y} \\\\\r\n\\end{array}\r\n$$\r\nand the domain $X$ has already been halved.\r\n\r\n\u003cbr /\u003e\r\n\r\n#### Second and The Rest Rounds\r\n\r\nGiven evaluation table of polynomial $f_0(x)$ (not **bivariate** polynomial anymore):\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   x \u0026 g.x \u0026 g_3.x \u0026 g_5.x \u0026 ... \u0026 g_{n - 1}.x \\\\ \\hline\r\n   f_0(x) \u0026 \\frac{e_0 + e_{31}}{2} \u0026 \\frac{e_1 + e_{30}}{2} \u0026 \\frac{e_2 + e_{29}}{2} \u0026 ... \u0026 \\frac{e_{15} + e_{16}}{2} \\\\\r\n\\end{array}\r\n$$\r\nwe need to resolve the coefficients of **univariate** polynomial $f_0(x)$ through **FFT** algorithm:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   x^2 \u0026 g_2.x \u0026 g_6.x \u0026 g_{10}.x \u0026 ... \u0026 g_{n - 2}.x \\\\ \\hline\r\n   f_{00}(x^2) \u0026 \\frac{((e_0 + e_{31}) / 2) + ((e_{15} + e_{16}) / 2)}{2} \u0026 \\frac{((e_1 + e_{30}) / 2) + ((e_{14} + e_{17}) / 2)}{2} \u0026 ... \u0026 ... \u0026 \\frac{((e_7 + e_{24}) / 2) + ((e_8 + e_{23}) / 2)}{2} \\\\ \\hline\r\n   f_{01}(x^2) \u0026 \\frac{((e_0 + e_{31}) / 2) - ((e_{15} + e_{16}) / 2)}{2 \\cdot g.x} \u0026 ... \u0026 ... \u0026 ... \u0026 ... \\\\ \r\n\\end{array}\r\n$$\r\nsimilarly it works for $f_1(x)$. Then apply **FFT** algorithm recursively $\\log{n}$ times, we will finally get the coefficients of **bivariate** polynomial $p(x, y)$.\r\n\r\n\u003cbr /\u003e\r\n\r\n## Circle iFFT\r\n\r\n#### First Round\r\n\r\nGivent coefficients of **bivariate** polynomials:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   C_{p(x, y)} \u0026 c_0 \u0026 c_1 \u0026 c_2 \u0026 ... \u0026 c_{n - 1} \\\\ \\hdashline\r\n\\end{array}\r\n$$\r\nwe want to get the evaluations on the entire circle domain:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   p(x, y) \u0026 e_0 \u0026 e_1 \u0026 e_2 \u0026 ... \u0026 e_{n - 1} \\\\ \\hline\r\n\\end{array}\r\n$$\r\n\r\n\r\n\u003cbr /\u003e\r\n\r\nThe original polynomial is composed of two sub-polynomials:\r\n$$\r\np(x, y) = f_0(x) + y \\cdot f_1(x), (x, y) \\in \\{ g + [i]g_2, i \u003c n \\}\r\n$$\r\n\r\nthanks to its symmetry property, we can divide it into two parts: \r\n$$\r\n\\begin{aligned}\r\np_L(x, y) = f_0(x) + y \\cdot f_1(x), (x, y) \\in \\{ g + [i]g_2, i \u003c n / 2 \\} \\\\\r\np_R(x, y) = f_0(x) - y \\cdot f_1(x), (x, y) \\in \\{ g + [i]g_2, i \u003c n / 2 \\} \\\\\r\n\\end{aligned}\r\n$$\r\nwhere $p_L(x, y)$ is the left (above $x$-coordinate) part, $p_R(x, y)$ is the right (below $x$-coordinate) part.\r\n\r\n\u003cbr /\u003e\r\n\r\nTherefore solving the evaluations of original **bivariate** polynomial is reduced into the evaluations of **univariate** sub-polynomials $f_0(x)$ and $f_1(x)$.\r\n\r\n\u003cbr /\u003e\r\n\r\n----\r\n\r\n#### Second and The Rest Rounds\r\n\r\nGiven coefficients of **univariate** polynomial $f_0(x)$:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   C_{f_0(x)} \u0026 c_0 \u0026 c_2 \u0026 ... \u0026 c_{n - 2} \\\\ \\hdashline\r\n\\end{array}\r\n$$\r\nsimilarly the univariate polynomial $f_0(x)$ consists two parts:\r\n$$\r\n\\begin{aligned}\r\n{f_0}_L(x) = f_{00}(x) + x \\cdot f_{01}(x), x = t.x, t \\in \\{ g_2 + [i] g_4, i \u003c n / 2 \\} \\\\\r\n{f_0}_R(x) = f_{00}(x) - x \\cdot f_{01}(x), x = t.x, t \\in \\{ g_2 + [i] g_4, i \u003c n / 2 \\} \\\\\r\n\\end{aligned}\r\n$$\r\napply **iFFT** algorithm recursively we will finally get the evaluations over entire circle domain $D$:\r\n$$\r\n\\def\\arraystretch{1.5}\r\n   \\begin{array}{c:c:c}\r\n   p(x, y) \u0026 e_0 \u0026 e_1 \u0026 e_2 \u0026 ... \u0026 e_{n - 1} \\\\ \\hdashline\r\n\\end{array}\r\n$$\r\n\r\n\u003cbr /\u003e\r\n\r\n# FRI\r\n\r\n## How FRI Works\r\n\r\nOriginally, FRI prover needs to prove that $p_0(x, y)$ (evaluation vector) is close to a low-degree (trace) polynomial $t(x)$ with certain degree-bound $d$, where the evaluation domain size $|D|$ is blow-up factor $s$ times of $d$, say $|D| = s \\cdot d$.\r\n\r\n\u003cbr /\u003e\r\n\r\nFor the purpose of hidden for witness, say $p_0(x, y)$, prover compress this evaluation vector into ONE field element through merkle commitment, say $C_0$. Concequently, prover prove that $C_0$ is close to a low-degree (trace) polynomial $t(x)$ with degree-bound $d$. Accordingly, verifier need to check consistency of commitment $C_0$ as well.\r\n\r\n\u003cbr /\u003e\r\n\r\nUnfortunately, degree $d$ is too big, **low degree testing** on this would be much too costy, so FRI operator comes. FRI operator reduce evaluation vector $p_0(x, y)$ into half-sized $p_1(x, y)$, then prover need to prove $p_1(x, y)$ is close to low-degree polynomial $t_1(x)$ with degree-bound $d/2$. Recursively apply FRI operator more times until the final degree-bound $d / 2^{k}$ is small enough, prover only need to prove that $p_k(x, y)$ is close to low-degree polynomial $t_k(x)$ with degree-bound $d / 2^k$ .\r\n\r\n\u003cbr /\u003e\r\n\r\nActually the folding process of FRI operator is non-succinct, prover need to prove the folding is correctly executed. And the verifier need to check ths consistency of folding as well, besides lower-degree testing.\r\n\r\n\u003cbr /\u003e\r\n\r\nSum up, prover needs to finish three tasks:\r\n- commit evaluation vector $p_i(x, y)$ into $C_k$ with merkle hash, and provide merkle proofs for openings (merkle tree path)\r\n\r\n- FRI operator, fold original evaluation vector $p_0(x, y)$ into $p_k(x, y)$, and provide folding proofs for openings (leaves of folding tree), and also need to provide merkle proof for these folding proofs (leaves of folding tree) \r\n\r\n- low degree testing, check whether the final evaluation vector $p_k(x, y)$ is close to polynomial $t_k(x)$ with low degree-bound $d / 2^k$.\r\n\r\n\u003cbr /\u003e\r\n\r\nVerifier needs to finish three tasks:\r\n- check consistency of merkle commititment $C_k$, with provided merkle proof \r\n\r\n- check consistency of FRI folding, through pre-defined query times' folding **non-succinctly** with provided folding proofs\r\n\r\n- check consistency of low degree testing on $p_k(x, y)$, through one time **FFT** interpolation\r\n\r\n\u003cbr /\u003e\r\n\r\n## Circle FRI \r\n\r\nCircle FRI is a FRI protocol based on circle domain (satisfying $x^2 + y^2 = 1$), not single prime field based domain anymore.\r\n\r\n\u003cbr /\u003e\r\n\r\n#### Merkle Commitment and FRI Operator \r\n\r\nMainly consists two parts, preparaion of folding and fold:\r\n\r\n- prepare domain/evaluation vector to be folded\r\n    \r\n    assuming there's a evaluation domain with cardinality-$32$:\r\n    $$\r\n    D = \\{ g + [i] g_2, i \u003c 32 \\} = \\{ g, g_3, g_5, ..., g_{63} \\}\r\n    $$\r\n\r\n    \u003cbr /\u003e\r\n\r\n    - half-sized circle domain\r\n        $$\r\n        D_L = \\{ g, g_5, g_9,..., g_{61} \\}\r\n        $$\r\n    \r\n        Due to symmetry of circle domain, there's no need to store all elements of domain, half-sized circle domain is enough.\r\n\r\n        The remaining part is reversed of circle domain $D_L$, say $D_R = -D_L = \\{ g_{63}, g_{59}, g_{55}, ..., g_3 \\}$\r\n    \r\n        \u003cbr /\u003e\r\n    \r\n    - bit-reverse ordered circle domain\r\n    $$\r\n    \\begin{aligned}\r\n    D_L' \u0026= \\{ g, g_{33}, g_{17}, ..., g_{61} \\} \\\\\r\n    D_R' \u0026= \\{ g_{63}, g_{31}, g_{47}, ..., g_3 \\} \\\\\r\n    \\end{aligned}\r\n    $$\r\n    \r\n    - combine the bit-reverse ordered circle domain\r\n    $$\r\n    D_0 = \\{g, g_{63}, g_{33}, g_{31}, g_{17}, g_{47}, ..., g_{61}, g_3 \\}\r\n    $$\r\n\r\n    - similarily works for evaluations\r\n    $$\r\n    E_0 = \\{ e_0, e_{31}, e_{16}, e_{15}, e_8, e_{23}, ..., e_{30}, e_1 \\}\r\n    $$\r\n\r\n    \u003cbr /\u003e\r\n\r\n- fold evaluation vector round-by-round\r\n\r\n    - Merkle commit with concat and hashes\r\n    \r\n    - Squeeze a folding factor $\\alpha$ after pushing the merkle root\r\n\r\n    - FRI operator, fold evaluation vector constant times per-round\r\n        \r\n        \u003cbr /\u003e\r\n\r\n        **First fold** :-1: \r\n        given evaluation table of **bivariate** polynomial $p_0(X) = p_0(x, y)$:\r\n        $$\r\n        \\def\\arraystretch{1.5}\r\n           \\begin{array}{c:c:c}\r\n           X \u0026 g \u0026 g_{63} \u0026 g_{33} \u0026 g_{31} \u0026 ...\u0026 g_{61} \u0026 g_3 \\\\ \\hline\r\n           p_0(X) \u0026 e_0 \u0026 e_{31} \u0026 e_{16} \u0026 e_{15} \u0026 ...\u0026 e_{30} \u0026 e_1 \\\\\r\n        \\end{array}\r\n        $$\r\n        where $g$ is defined in circle domain.\r\n        \r\n        \u003cbr /\u003e\r\n        \r\n        In first layer, since:\r\n        $$\r\n        \\begin{aligned}\r\n            {p_0}_L(X) = f_0(X.x) + y \\cdot f_1(X.x), X \\in \\{g + [i]g_2, i \u003c n / 2 \\} \\\\\r\n            {p_0}_R(X) = f_0(X.x) - y \\cdot f_1(X.x), X \\in \\{ g + [i]g_2, i \u003c n / 2 \\} \\\\\r\n        \\end{aligned}\r\n        $$\r\n        the **bivariate** polynomial $p_0(X)$ can be splitted into two **univariate** polynomials $f_0(X.x)$ and $f_1(X.x)$:\r\n        $$\r\n        \\def\\arraystretch{1.5}\r\n           \\begin{array}{c:c:c}\r\n           X \u0026 g \u0026 g_{33} \u0026 ... \u0026 g_3 \\\\ \\hline\r\n           f_0(X.x) \u0026 \\frac{e_0 + e_{31}}{2} \u0026 \\frac{e_{16} + e_{15}}{2} \u0026 ... \u0026 \\frac{e_{30} + e_1}{2} \\\\ \\hdashline\r\n           f_1(X.x) \u0026 \\frac{e_0 - e_{31}}{2 \\cdot g.y} \u0026 \\frac{e_{16} - e_{15}}{2 \\cdot g_{33}.y} \u0026 ... \u0026 \\frac{e_{30} - e_1}{2 \\cdot g_3.y} \\\\ \\hdashline\r\n           p_1(X.x) \u0026 \\frac{e_0 + e_{31}}{2} + \\alpha \\cdot \\frac{e_0 - e_{31}}{2 \\cdot g.y} \u0026 \\frac{e_{16} + e_{15}}{2} + \\alpha \\cdot \\frac{e_{16} - e_{15}}{2 \\cdot g_{33}.y} \u0026 ... \u0026 \\frac{e_{30} + e_1}{2} + \\alpha \\cdot \\frac{e_{30} - e_1}{2 \\cdot g_3.y} \\\\\r\n        \\end{array}\r\n        $$\r\n    \r\n        \u003cbr /\u003e\r\n\r\n        **Second and the rest folds** :-1:\r\n\r\n        Given (pre-folded) evaluation table of **univariate** polynomial $p_1(X.x)$:\r\n        $$\r\n        \\def\\arraystretch{1.5}\r\n           \\begin{array}{c:c:c}\r\n           X \u0026 g \u0026 g_{33} \u0026 ... \u0026 g_3 \\\\ \\hline\r\n           p_1(X.x) \u0026 \\frac{e_0 + e_{31}}{2} + \\alpha \\cdot \\frac{e_0 - e_{31}}{2 \\cdot g.y} \u0026 \\frac{e_{16} + e_{15}}{2} + \\alpha \\cdot \\frac{e_{16} - e_{15}}{2 \\cdot g_{33}.y} \u0026 ... \u0026 \\frac{e_{30} + e_1}{2} + \\alpha \\cdot \\frac{e_{30} - e_1}{2 \\cdot g_3.y} \\\\\r\n        \\end{array}\r\n        $$\r\n        \r\n        \u003cbr /\u003e\r\n        \r\n        In second layer, since:\r\n        $$\r\n        \\begin{aligned}\r\n        {p_1}_L(X.x) = f_0(X^2.x) + X.x \\cdot f_1(X^2.x) \\\\\r\n        {p_1}_R(X.x) = f_0(X^2.x) - X.x \\cdot f_1(X^2.x) \\\\\r\n        \\end{aligned}\r\n        $$\r\n        the **univariate** polynomial $p_1(X.x)$ can be splitted into two **univariate** polynomials $f_0(X^2.x)$ and $f_1(X^2.x)$ where $X^2$ is the doubled of $X$ in circle domain. Similarily we do the linear folding as well, obtain a new half-sized **univariate** polynomial $p_2(X.x)$. \r\n        \r\n        \u003cbr /\u003e\r\n\r\n#### Decommitment\r\n\r\n![fri_folding_proof.drawio](https://hackmd.io/_uploads/ByEwocPtA.png)\r\n\r\n\r\nVerifier sample $m$ points $q = \\{ q_0, q_1, ..., q_{m - 1} \\}$ within evaluation domain and send them to prover, prover provide two kinds of proofs for these points, and proof of low-degree test:\r\n\r\n- folding proof for consistency check of sample values\r\n\r\n   If FRI operator continues until low-degree bound reaches the bottom, say $d / 2^k = 1$, then the maximum number of folding would be $N = \\log{d}$. We get the exact number of folding proof, say $2 N - 1$.\r\n\r\n   \u003cbr /\u003e\r\n\r\n   The total size of folding proof of $m$-queries would be $m \\cdot (2N - 1)$.\r\n\r\n   \u003cbr /\u003e\r\n\r\n- merkle proof for authentication of sample values and their folding proof (consistency of merkle commitment)\r\n\r\n   If we also take the **ultimate** folding, we need to provide merkle proof for each folding proof, including the sample values themselves. Therefore we can also get the exact number of merkle proof for this, say $N + (N - 1) + (N - 2) + ... + 1 = \\frac{(1 + N)N}{2}$ .\r\n\r\n   \u003cbr /\u003e\r\n\r\n   The total size of merkle proof of $m$-queries would be $m \\cdot \\frac{(1 + N)N}{2}$ .\r\n\r\n   \u003cbr /\u003e\r\n\r\n- low-degree test proof, that's the final folded evaluation vector $p_k(x, y)$\r\n\r\n   If we take the **ultimate** folding as well, we can get the exact number of low-degree test proof, that is what we called *blow-up factor* . \r\n\r\n\u003cbr /\u003e\r\n\r\nIn summary, the time complexity of single query is $O(N^2) = O(\\log^2{d})$. Actually there's no need to do the **ultimate** folding, it's all fine as long as the low-degree bound $d / 2^k$ is small enough.\r\n\r\n\u003cbr /\u003e\r\n\r\n# Quotient Polynomial\r\n\r\nRecall that, there's a polynomial $f(x)$ ($x$ is defined over some evaluation domain $D$), prover want to prove $f(u) = v$. Then the quotient polynomial comes:\r\n$$\r\nq(x) = \\frac{f(x) - v}{x - u}; u, v \\in D\r\n$$\r\nwhere $x \\in F$, and $D \\subset F$. Prover need to prove existence of the quotient polynomial.\r\n\r\n\u003cbr /\u003e\r\n\r\nIf polynomial $f(x)$ is not a univariate-based domain anymore, how about $f(X)$ and $X$ is a bivariate-based domain, say circle domain?\r\n\r\n\u003cbr /\u003e\r\n\r\n## Circle Quotient\r\n\r\nLet's take a toy example, say:\r\n$$\r\nf(X) = f(x, y) = 3 x + 4 y, X \\in D = \\{ g + [i]g_2, i \u003c n \\}\r\n$$\r\nevaluate on one point $P$, we get $f(P) = v$, namely:\r\n$$\r\n3 P.x + 4 P.y - v = 0\r\n$$\r\nSimilarily the quotient polynomial comes:\r\n$$\r\nq(X) = \\frac{f(X) - v}{X - P}; P \\in D\r\n$$\r\nwhere $X \\in F$, and $F$ is the entire **circle domain**.\r\n\r\n\u003cbr /\u003e\r\n\r\nThe problem is how to represent this quotient polynomial, which is a *line* through one point $P$? It seems impossible, since there are uncountable lines through one point. Indeed it is true in **univariate** coordinate space. But it also holds in **bivariate** coordinate, what we need is a trick.\r\n\r\n\u003cbr /\u003e\r\n\r\nLet's fix the $x$-part of $f(x, y)$, say:\r\n$$\r\nf(y) = 4 y = v - 3 x\r\n$$\r\nthis is what'd love to see, as $f(y)$ is a **univariate** polynomial, not a **bivariate** one anymore. So, evaluation on $P.y$, it would be like:\r\n$$\r\nf(P.y) = 4 P.y = v_0\r\n$$\r\nBut it is not enough to determine $f(P) = v$, since there are two solutions $P.x$ and $-P.x$ for $P.y$ in circle domain, satisfying $x^2 + y^2 = 1$. So we need another point $P'$ (Vitalik call it [dummy point](https://vitalik.eth.limo/general/2024/07/23/circlestarks.html)), who's relevant to $P$, to make this *line* uniqueness.\r\n\r\n\u003cbr /\u003e\r\n\r\nActually there're many solutions to this, in [Stwo](https://github.com/starkware-libs/stwo) implementation, they provide a extreme cheap method **Conjugation**, namely to say:\r\n$$\r\nP' = \\bar{P} = (P.\\bar{x}, P.\\bar{y})\r\n$$\r\nas $P.x, P.y$ are **QM31** field elements, conjugation of $P.\\bar{y}$ is just a negation of **CM31** field, cheaper enough! So, we can interpolate the polynomial $f(X)$ with these points $P$ and $\\bar{P}$:\r\n$$\r\n\\begin{vmatrix}\r\nf(X) \u0026 X \u0026 1 \\\\\r\nf(P) \u0026 P \u0026 1 \\\\\r\nf(\\bar{P}) \u0026 \\bar{P} \u0026 1 \\\\\r\n\\end{vmatrix}\r\n$$\r\n\r\n\u003cbr /\u003e\r\n\r\nTheoretically $[2]P$, $[3]P$, ..., $[k]P$ all are fine, let's take $[2]P$ as a example:\r\n$$\r\n[2]P = (2 \\cdot P.x^2 - 1, 2 \\cdot P.x \\cdot P.y)\r\n$$\r\nit requires one multiplication of **QM31** field, much more expensive than **conjugation**, so we choose **conjugation** method instead.\r\n\r\n\u003cbr /\u003e\r\n\r\nThe circle quotient is formalized as:\r\n$$\r\nq(X) = \\frac{f(X) - f(P)}{V_{P}(X)}\r\n$$\r\nbut how to compute this it anyway? Let's split it into two parts, **nominator** part $f(X) - f(P)$, and **denominator** part $V_P(X)$.\r\n\r\n\u003cbr /\u003e\r\n\r\n#### Nominator of Circle Quotient\r\n\r\n$f(X) - f(P)$ is a **bivariate** polynomial who vanishes at single point $P$, $f(X)$ can be converted into a **univariate** line through $(P.y, v)$ and $(\\bar{P}.y, \\bar{v})$ as what we've already illustrated above:\r\n$$\r\nf(X) = \r\n\\begin{vmatrix}\r\nf(X) \u0026 X.y \u0026 1 \\\\\r\nv \u0026 P.y \u0026 1 \\\\\r\n\\bar{v} \u0026 \\bar{P}.y \u0026 1 \\\\\r\n\\end{vmatrix} \r\n= v + (\\bar{v} - v) \\cdot \\frac{X.y - P.y}{\\bar{P}.y - P.y}\r\n$$\r\n\r\n\u003cbr /\u003e\r\n\r\n#### Denominator of Circle Quotient\r\n\r\nVanishing polynomial can be represented as:\r\n$$\r\nV_P(X) = \\frac{(P - X).y}{1 + (P - X).x}\r\n$$\r\nwhere $P - X$ is arithemtic on additive circle group.\r\n\r\n\u003cbr /\u003e\r\n\r\nPut it all together, we have the final circle quotient polynomial:\r\n$$\r\nq(X) = \\frac{f(X) - f(P)}{V_P(X)} = (v + (\\bar{v} - v) \\cdot \\frac{X.y - P.y}{\\bar{P}.y - P.y}) \\cdot \\frac{1 + (P - X).x}{(P - X).y} \r\n$$\r\nwhere $X \\in F$.\r\n\r\n\u003cbr /\u003e\r\n\r\n# Folding Paradigm\r\n\r\n![fri_fold.drawio](https://hackmd.io/_uploads/HJbUocvFA.png)\r\n\r\n\r\nIn folding paradigm, we often see one word **non-succinct**. Yes, the folding helps prover compress a big proof into a much smaller proof, so verifier can verify it efficiently. But what we must not ignore is the overhead folding induces. And folding is not always succinct, in FRI, verifier need to do the same folding as prover did, fortunately verifier only need to do few times' folding depending on the number of queries.\r\n\r\n\u003cbr /\u003e\r\n\r\nIf the cost of verifying original proof $\\pi_0$ is $t_0$, verifying the final compressed proof $\\pi_2$ is $t_2$, and cost of folding on query points is $t_k$. Then we must have:\r\n$$\r\nt_0 \\ll t_2 + t_k\r\n$$\r\n\r\n\u003cbr /\u003e\r\n\r\n# Thanks \r\n\r\nSpecial thanks to weikengchen for his input on circle quotients, and learns a lot from his work on [Bitcoin Wildlife Sanctuary](https://github.com/Bitcoin-Wildlife-Sanctuary), finally give great thanks to victor from starkware for his inputs during implementing stwo with bitcoin scripts.\r\n\r\n\u003cbr /\u003e\r\n\r\n# References \r\n\r\n[1] [Circle Stark]( https://eprint.iacr.org/2024/278.pdf)\r\n\r\n[2] [Stwo](https://github.com/starkware-libs/stwo)\r\n\r\n[3] [Stark 101](https://starkware.co/stark-101/)\r\n\r\n[4] [Bitcoin Circle Stark](https://github.com/Bitcoin-Wildlife-Sanctuary/bitcoin-circle-stark)\r\n\r\n[5] [Vitalik Circle Stark Blog](https://vitalik.eth.limo/general/2024/07/23/circlestarks.html)","title":"Circle Stark: from a new Starker"},"history":null,"timestamp":1723787470,"version":1}