You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

291 lines
11 KiB

  1. \documentclass{article}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage{amsfonts}
  4. \usepackage{amsthm}
  5. \usepackage{amsmath}
  6. \usepackage{mathtools}
  7. \usepackage{enumerate}
  8. \usepackage{hyperref}
  9. \usepackage{xcolor}
  10. % prevent warnings of underfull \hbox:
  11. \usepackage{etoolbox}
  12. \apptocmd{\sloppy}{\hbadness 4000\relax}{}{}
  13. \theoremstyle{definition}
  14. \newtheorem{definition}{Def}[section]
  15. \newtheorem{theorem}[definition]{Thm}
  16. % custom lemma environment to set custom numbers
  17. \newtheorem{innerlemma}{Lemma}
  18. \newenvironment{lemma}[1]
  19. {\renewcommand\theinnerlemma{#1}\innerlemma}
  20. {\endinnerlemma}
  21. \title{Notes on FRI}
  22. \author{arnaucube}
  23. \date{February 2023}
  24. \begin{document}
  25. \maketitle
  26. \begin{abstract}
  27. Notes taken from \href{https://sites.google.com/site/vincenzoiovinoit/}{Vincenzo Iovino} \cite{vincenzoiovino} explainations about FRI \cite{fri}, \cite{cryptoeprint:2022/1216}, \cite{cryptoeprint:2019/1020}.
  28. These notes are for self-consumption, are not complete, don't include all the steps neither all the proofs.
  29. An implementation of FRI can be found at\\ \href{https://github.com/arnaucube/fri-commitment}{https://github.com/arnaucube/fri-commitment} \cite{fri-impl}.
  30. \end{abstract}
  31. \tableofcontents
  32. \section{Preliminaries}
  33. \subsection{General degree d test}
  34. Query at points $\{ x_i \}_0^{d+1},~z$ (with rand $z \overset{R}{\in} \mathbb{F}$).
  35. Interpolate $p(x)$ at $\{f(x_i)\}_0^{d+1}$ to reconstruct the unique polynomial $p$ of degree $d$ such that $p(x_i)=f(x_i)~\forall i=1, \ldots, d+1$.
  36. V checks $p(z)=f(z)$, if the check passes, then V is convinced with high probability.
  37. This needs $d+2$ queries, is linear, $\mathcal{O}(n)$. With FRI we will have the test in $\mathcal{O}(\log{}d)$.
  38. \section{FRI protocol}
  39. Allows to test if a function $f$ is a poly of degree $\leq d$ in $\mathcal{O}(\log{}d)$.
  40. Note: "P \emph{sends} $f(x)$ to V", "\emph{sends}", in the ideal IOP model means that all the table of $f(x)$ is sent, in practice is sent a commitment to $f(x)$.
  41. \subsection{Intuition}
  42. V wants to check that two functions $g,~h$ are both polynomials of degree $\leq d$.
  43. Consider the following protocol:
  44. \begin{enumerate}
  45. \item V sends $\alpha \in \mathbb{F}$ to P. P sends $f(x) = g(x) + \alpha h(x)$ to V.
  46. \item P sends $f(x)=g(x) + \alpha h(x)$ to V.
  47. \item V queries $f(r), ~g(r), ~h(r)$ for rand $r \in \mathbb{F}$.
  48. \item V checks $f(r)=g(r) + \alpha h(r)$. (Schwartz-Zippel lema).
  49. If holds, V can be certain that $f(x)=g(x)+ \alpha h(x)$.
  50. \item P proves that $deg(f) \leq d$.
  51. \item If V is convinced that $deg(f) \leq d$, V belives that both $g, h$ have $deg \leq d$.
  52. \end{enumerate}
  53. %/// TODO tabulate this next lines
  54. With high probablility, $\alpha$ will not cancel the coeffs with $deg \geq d+1$. % TODO check which is the name of this theorem or why this is true
  55. Let $g(x)=a \cdot x^{d+1}, ~~ h(x)=b \cdot x^{d+1}$, and set $f(x) = g(x) + \alpha h(x)$.
  56. Imagine that P can chose $\alpha$ such that $a x^{d+1} + \alpha \cdot b x^{d+1} = 0$, then, in $f(x)$ the coefficients of degree $d+1$ would cancel.
  57. %///
  58. \quad
  59. Here, P proves $g,~h$ both have $deg \leq d$, but instead of doing $2 \cdot (d+2)$ queries ($d+2$ for $g$, and $d+2$ for $h$), it is done in $d+2$ queries (for $f$).
  60. So we halved the number of queries.
  61. \subsection{FRI-LDT}\label{sec:fri-ldt}
  62. FRI low degree testing.\\
  63. Both P and V have oracle access to function $f$.
  64. V wants to test if $f$ is polynomial with $deg(f) \leq d$.
  65. Let $f_0(x)=f(x)$.
  66. Each polynomial $f(x)$ of degree that is a power of $2$, can be written as
  67. $$f(x) = f^L(x^2) + x f^R(x^2)$$
  68. for some polynomials $f^L,~f^R$ of degree $\frac{deg(f)}{2}$, each one containing the even and odd degree coefficients as follows:
  69. % $f^L(x)$ is built from the even degree coefficients divided by $x$, and $f^R(x)$ from the odd degree coefficients divided by $x$.
  70. $$f^L(x)= \sum_0^{\frac{d+1}{2}-1} c_{2i} x^i ,~~ f^R(x)= \sum_0^{\frac{d+1}{2}-1} c_{2i+1} x^i$$
  71. eg. for $f(x)=x^4+x^3+x^2+x+1$,
  72. \begin{align*}
  73. \begin{rcases}
  74. f^L(x)=x^2+x+1\\
  75. f^R(x)=x+1
  76. \end{rcases}
  77. ~f(x) = f^L(x^2) &+ x \cdot f^R(x^2)\\
  78. = (x^2)^2 + (x^2) + 1 &+ x \cdot ((x^2) + 1)\\
  79. = x^4 + x^2 + 1 &+ x^3 + x
  80. \end{align*}
  81. % \begin{enumerate}
  82. % \item V sends to P some $\alpha_0 \in \mathbb{F}$.
  83. % Let
  84. % \begin{equation}\tag{$A_0$}
  85. % f_0(x) = f_0^L(x^2) + x f_0^R(x^2)
  86. % \end{equation}
  87. % \item P sends
  88. % \begin{equation}\tag{$B_0$}
  89. % f_1(x) = f_0^L(x) + \alpha_0 f_0^R(x)
  90. % \end{equation}
  91. % to V.
  92. %
  93. % (remember that "sends" in IOP model is that P commits to it)
  94. % \item V sends to P some $\alpha_1 \in \mathbb{F}$.
  95. % Let
  96. % \begin{equation}\tag{$A_1$}
  97. % f_1(x) = f_1^L(x^2) + x f_1^R(x^2)
  98. % \end{equation}
  99. % \item P sends
  100. % \begin{equation}\tag{$B_1$}
  101. % f_2(x) = f_1^L(x) + \alpha_1 f_1^R(x)
  102. % \end{equation}
  103. % to V.
  104. % \item Keep repeating the process, eg. let
  105. % \begin{equation}\tag{$A_2$}
  106. % f_2(x) = f_2^L(x^2) + x f_2^R(x^2)
  107. % \end{equation}
  108. % until $f_i^L,~ f_i^R$ are constant (degree 0 polynomials).
  109. % \item Once $f_i^L,~ f_i^R$ are constant, P sends them to V.
  110. % \end{enumerate}
  111. %
  112. % Notice that at each step, $deg(f_i)$ halves.
  113. \vspace{30px}
  114. \paragraph{Proof generation}
  115. \emph{(Commitment phase)}
  116. P starts from $f(x)$, and for $i=0$ sets $f_0(x)=f(x)$.
  117. \begin{enumerate}
  118. \item $\forall~i \in \{0, log(d)\}$, with $d = deg~f(x)$,\\
  119. P computes $f_i^L(x),~ f_i^R(x)$ for which
  120. \begin{equation}\tag{eq. $A_i$}
  121. f_i(x) = f_i^L(x^2) + x f_i^R(x^2)
  122. \end{equation}
  123. holds.
  124. \item V sends challenge $\alpha_i \in \mathbb{F}$
  125. \item P commits to the random linear combination $f_{i+1}$, for
  126. \begin{equation}\tag{eq. $B_i$}
  127. f_{i+1}(x) = f_i^L(x) + \alpha_i f_i^R(x)
  128. \end{equation}
  129. \item P sets $f_i(x) := f_{i+1}(x)$ and starts again the iteration.
  130. \end{enumerate}
  131. Notice that at each step, $deg(f_i)$ halves.
  132. This is done until the last step, where $f_i^L(x),~ f_i^R(x)$ are constant (degree 0 polynomials). For which P does not commit but gives their values directly to V.
  133. \emph{(Query phase)}
  134. P would receive a challenge $z \in D$ set by V (where $D$ is the evaluation domain, $D \in \mathbb{F}$), and P would open the commitments at $\{z^{2^i}, -z^{2^i}\}$ for each step $i$.
  135. (Recall, "opening" means that would provide a proof (MerkleProof) of it).
  136. \paragraph{Data sent from P to V}
  137. \begin{itemize}
  138. \item[] Commitments: $\{Comm(f_i)\}_0^{log(d)}$\\
  139. {\scriptsize eg. $\{Comm(f_0),~ Comm(f_1),~ Comm(f_2),~ ...,~ Comm(f_{log(d)})\}$ }
  140. \item[] Openings: $\{ f_i(z^{2^i}),~f_i(-(z^{2^i})) \}_0^{log(d)}$\\
  141. for a challenge $z \in D$ set by V\\
  142. {\scriptsize eg. $f_0(z),~ f_0(-z),~ f_1(z^2),~ f_1(-z^2),~ f_2(z^4),~ f_2(-z^4),~ f_3(z^8),~ f_3(-z^8),~ \ldots$}
  143. \item[] Constant values of last iteration: $\{f_k^L,~f_k^R\}$, for $k=log(d)$
  144. \end{itemize}
  145. \paragraph{Verification}
  146. V receives:
  147. \begin{align*}
  148. \text{Commitments:}~ &Comm(f_i),~ \forall i \in \{0, log(d)\}\\
  149. \text{Openings:}~ &\{o_i, o_i'\}=\{ f_i(z^{2^i}),~f_i(-(z^{2^i})) \},~ \forall i \in \{0, log(d)\}\\
  150. \text{Constant vals:}~ &\{f_k^L,~f_k^R\}
  151. \end{align*}
  152. \vspace{20px}
  153. For all $i \in \{0, log(d)\}$, V knows the openings at $z^{2^i}$ and $-(z^{2^i})$ for\\
  154. $Comm(f_i(x))$, which are $o_i=f_i(z^{2^i})$ and $o_i'=f_i(-(z^{2^i}))$ respectively.
  155. V, from (eq. $A_i$), knows that
  156. $$f_i(x)=f_i^L(x^2) + x f_i^R(x^2)$$
  157. should hold, thus
  158. $$f_i(z)=f_i^L(z^2) + z f_i^R(z^2)$$
  159. where $f_i(z)$ is known, but $f_i^L(z^2),~f_i^R(z^2)$ are unknown.
  160. But, V also knows the value for $f_i(-z)$, which can be represented as
  161. $$f_i(-z)=f_i^L(z^2) - z f_i^R(z^2)$$
  162. (note that when replacing $x$ by $-z$, it loses the negative in the power, not in the linear combination).
  163. Thus, we have the system of independent linear equations
  164. \begin{align*} % TODO add braces on left
  165. f_i(z)&=f_i^L(z^2) + z f_i^R(z^2)\\
  166. f_i(-z)&=f_i^L(z^2) - z f_i^R(z^2)
  167. \end{align*}
  168. for which V will find the value of $f_i^L(z^{2^i}),~f_i^R(z^{2^i})$.
  169. Equivalently it can be represented by
  170. $$
  171. \begin{pmatrix}
  172. 1 & z\\
  173. 1 & -z
  174. \end{pmatrix}
  175. \begin{pmatrix}
  176. f_i^L(z^2)\\
  177. f_i^R(z^2)
  178. \end{pmatrix}
  179. =
  180. \begin{pmatrix}
  181. f_i(z)\\
  182. f_i(-z)
  183. \end{pmatrix}
  184. $$
  185. where V will find the values of $f_i^L(z^{2^i}),~f_i^R(z^{2^i})$ being
  186. \begin{align*}
  187. f_i^L(z^{2^i})=\frac{f_i(z) + f_i(-z)}{2}\\
  188. f_i^R(z^{2^i})=\frac{f_i(z) - f_i(-z)}{2z}\\
  189. \end{align*}
  190. Once, V has computed $f_i^L(z^{2^i}),~f_i^R(z^{2^i})$, can use them to compute the linear combination of
  191. $$
  192. f_{i+1}(z^{2^i}) = f_i^L(z^{2^i}) + \alpha_i f_i^R(z^{2^i})
  193. $$
  194. obtaining then $f_{i+1}(z^{2^i})$. This comes from (eq. $B_i$).
  195. Now, V checks that the obtained $f_{i+1}(z^{2^i})$ is equal to the received opening $o_{i+1}=f_{i+1}(z^{2^i})$ from the commitment done by P.
  196. V checks also the commitment of $Comm(f_{i+1}(x))$ for the opening $o_{i+1}=f_{i+1}(z^{2^i})$.\\
  197. If the checks pass, V is convinced that $f_1(x)$ was committed honestly.
  198. Now, sets $i := i+1$ and starts a new iteration.
  199. For the last iteration, V checks that the obtained $f_i^L(z^{2^i}),~f_i^R(z^{2^i})$ are equal to the constant values $\{f_k^L,~f_k^R\}$ received from P.
  200. \vspace{10px}
  201. It needs $log(d)$ iterations, and the number of queries (commitments + openings sent and verified) needed is $2 \cdot log(d)$.
  202. \subsection{Parameters}
  203. P commits to $f_i$ restricted to a subfield $F_0 \subset \mathbb{F}$.
  204. Let $0<\rho<1$ be the \emph{rate} of the code, such that
  205. $$|F_0| = \rho^{-1} \cdot d$$
  206. \begin{theorem}
  207. For $\delta \in (0, 1-\sqrt{\rho})$, we have that if V accepts, then w.v.h.p. (with very high probability) $\Delta(f_0,~ p^d) \leq \delta$.
  208. \end{theorem}
  209. \section{FRI as polynomial commitment scheme}
  210. This section overviews the trick from \cite{cryptoeprint:2019/1020} to convert FRI into a polynomial commitment.
  211. Want to check that the evaluation of $f(x)$ at $r$ is $f(r)$, which is equivalent to proving that $\exists ~Q \in \mathbb{F}[x]$ with $deg(Q)=d-1$, such that
  212. $$
  213. f(x)-f(r) = Q(x) \cdot (x-r)
  214. $$
  215. note that $f(x)-f(r)$ evaluated at $r$ is $0$, so $(x-r) | (f(x)-f(r))$, in other words
  216. $(f(x)-f(r))$ is a multiple of $(x-r)$ for a polynomial $Q(x)$.
  217. Let us define $g(x) = \frac{f(x)-f(r)}{x-r}$.
  218. Prover uses FRI-LDT \ref{sec:fri-ldt} to commit to $g(x)$, and then prove w.v.h.p that $deg(g) \leq d-1$ ($\Longleftrightarrow \Delta(g,~ p^{d-1} \leq \delta$).
  219. Prover was already proving that $deg(f) \leq d$.
  220. Now, the missing thing to prove is that $g(x)$ has the right shape. We can relate $g$ to $f$ as follows:
  221. V does the normal FRI-LDT, but in addition, at the first iteration:
  222. V has $f(z)$ and $g(z)$ openings, so can verify
  223. $$g(z) = (f(z)-f(r))\cdot (z-r)^{-1}$$
  224. \bibliography{paper-notes.bib}
  225. \bibliographystyle{unsrt}
  226. \end{document}