Note that most of these notes are taken from incredibly accessible resources. They’re written by actual mathematicians and cryptographers, so please check those out.

FRI is a polynomial commitment scheme based on hashing, and can be combined with any PIOP to create a SNARK. Basic idea is to prove that a vector commitment is close to a Reed-Solomon codeword using low-degree testing.

Let’s first explain what the full form of FRI is:

**Fast**: corresponds to use Fast Fourier Transform algorithm used in folding property of FRI.**Reed-Solomon**: converts a polynomial evaluations at roots of unity to a reed solomon codeword.**IOPP**: Interactive Oracle Proofs of Proximity**Interactive**: soundness is proved in interactivity between Prover and Verifier.**TODO****Oracle Proofs**: Prover behaves like an oracle answering queries of the verifier at random points.**Proximity**: verifier rejects any codewords that are $δ$ far from original codeword.

Pros: post quantum secure, transparent (based on hashing), doesn’t require cryptographic groups, thus, can work with smaller fields (mersenne or babybear or goldilocks). Later, you’ll see that FRI does work with groups due to polynomials being evaluated at roots of unity but that’s just for performance.

Cons: proof size is large (order of 10s of KBs)

so, let’s start with a very naïve polynomial commitment scheme:

- you have a polynomial of degree d on a field with size $∣F∣>>d$
- evaluate polynomial evaluation on every field element
- encode in a merkle tree, prove merkle path for every leaf

cons: field size is too large to encode in a tree, prover time in equal to field size, want to reduce that to **linear time in polynomial degree**

improvement: take a specific group $Ω$ of size $ρ_{−1}k$ for some constant $ρ≤1/2$: which is group formed by root of unity, evaluate on that, and encode in a tree. $ρ_{−1}$ is termed as **FRI blowup factor**.

Now, one other transformation: we do not encode direct polynomial evaluations but rather its reed solomon encoding with rate $ρ$.

$ρ$ can be tweaked accordingly to tradeoff between prover time and verifier time. as more the $ρ$, more the prover cost as evaluations increase. Proof length of FRI-PCS is $λ/g(ρ_{−1})⋅g_{2}(k)$ where $g_{2}(k)$ is the proof length of one evaluation query from verifier and number of queries = $λ/g(ρ_{−1})$.

- $λ$ is the security parameter of the protocol, i.e. bits of security.

Now, the second problem is verifier doesn’t know if prover really committed to a degree $k−1$ polynomial. This is called FRI **low degree test**. But naïve way isn’t really ideal as proof size for each query will be $gn$ hash values of merkle tree path. Instead, low degree test will be interactive:

**folding phase**: $g(k)$ rounds, to reduce the vector evaluations of length $ρ_{−1}k$ to $ρ_{−1}$, thus making the reduced vector evaluations of a degree 0 polynomial.**query phase**: 1 round, because prover might not fold a length k vector evaluations and send artificial folded vector.

## Folding phase

let’s take all evaluations of size: $ρ_{−1}k$ the polynomial, we’ll use folding phase to reduce the evaluations vector to a degree 0 polynomial.

- take a vector of length $ρ_{−1}k$ and randomly combine the vector such that resultant vector has half length.
- create a merkle tree where the evaluations are leaves of the tree. send tree root as commitment.
- get random value $r$ from $V$
- get a random $i∈[0,N/2_{k}]$, where k is the current round value. do colinearity test and send $y$ values of $A,B,C$ where:
- $A:(ω_{i},f(ω_{i}))$
- $B:(ω_{N/2+i},f(ω_{N/2+i}))$
- $C:(r,f_{fold}(ω_{2i}))$

- repeat step $1−4$ until vector length reaches $ρ_{−1}$, i.e. $g(k)$ rounds. this means that degree of polynomial from this vector is 0

take use of FFT equation to divide polynomial into two polynomials of equal and half length:

$q(X)q_{even}(X_{2})q_{odd}(X_{2}) =q_{even}(X_{2})+Xq_{odd}(X_{2})=2q(X)+q(−X) =i=0∑(d+1)/2−1 c_{2i}X_{2i}=2Xq(X)−q(−X) =i=0∑(d+1)/2−1 c_{2i+1}X_{2i} $Now, let’s combine $q_{e}$ and $q_{o}$ in a random linear combination, where $r$ is sent by verifier to get half length poly: $q_{fold}(Z)=q_{e}(Z)+rq_{o}(Z)$. evaluating $q(X)$ at $x$ and $−x$, both being roots of unity and $z=x_{2}$, expanding above expression with the definitions of $q_{even(x)}$ and $q_{odd(x)}$, we get:

$q_{fold}(z)=2x(x+r) q(x)+2x(x−r) q(−x)$

Note: q takes values in $ω∈F$ where, $ω$ is nth root of unity. Thus $−1=ω_{N/2}$, so The above expression takes same values as initial expression of $q_{fold}(z)$ for $r={x,−x}$ and thus can be used to combine two poly into one.

## Query Phase

- $V$ take each folded vector from each step of folding procedure and demand $λ/g(ρ_{−1})$ entries.
- this happens for $g(k)$ rounds
- and each entry is accompanied with merkle verification path, i.e. $g(k)$ hash evaluations.

Total proof length and $V$ time: $λ/g(ρ_{−1})⋅g_{2}(k)$

- Difference between PC based on linear correcting codes and FRI?
- both are based on error correcting codes
- used cryptographic procedure is merkle hashing + fiat-shamir (non-interactivity)
- In linear codes one big folding for poly of degree $d$ is done to reduce proof size to $d $ and thus are field agnostic while In FRI, proofs are recursively reduced in half logarithmically.

Above image by Alan Szepieniec’s series anatomy of a stark proof: part 3 very clearly explains the different rounds of interaction between $P$ and $V$.

There is another very accessible diagram summarising FRI protocol by Hector.

Pseudocode:

```
1. take out all roots and generate alpha for all codewords
2. take out last codeword, check if last root equals last codeword merkle commitment
3. evaluate on last_omega to get evaluation
4. interpolate on domain to get last poly
5. check if last poly == last codeword
6. sample indices for colinearity test
7. for each codeword, do:
8. start each colinearity test:
9. take out ay, by, cy
10. create ax, bx, cx, and check if (ax, ay), (bx, by), (cx, cy) lie on same line
11. verify merkle authentication paths
```

why at step 2, do we need to check whether last codeword merkle commitment equals last root?

verifier doesn’t know that prover is honest and has committed to correct polynomial in merkle root as well as codeword is indeed a RS codeword. Thus, it verifies prover’s claim by first, checking that root commitment is correct and polynomial interpolation of last codeword indeed equals codeword.

## Security Analysis

$q$ - cheating polynomial ; $h$ - honest polynomial

$δ$ - relative hamming distance b/w $q$ and $h$, unique decoding radius of reed solomon code

$P$ passes all $t$ verifier queries with probability: $k/p+(1−δ)_{t}$

- interpretation of probability
- $k/p$ denotes adversarial prover creating a poly which has degree 0 in last folding round but starting with a poly with degree less than honest degree $k$. If prover has a incorrect poly which is $δ$ far of degree $k$, random linear combinations of two functions, one of which must also be $δ$ far from $d/2$ degree poly.
- $(1−δ)_{t}$ denotes prover passing all t queries when point doesn’t equal $δ$ distant points.

Each verifier query is conjectured to provide $g(ρ_{−1})$ bits of security but in practical scenarios, only provides half of that.

## Known attacks on FRI

let honest polynomial be $q$ with degree $k−1$.

Prover picks a set $T$ with size $k=ρn$ and computes a polynomial $s$ of degree $k−1$, i.e. same degree of original polynomial. then folds $s$ rather than $q$ during FRI folding phase

verifier will accept proof if all verifier queries lie within $T$ with probability $ρ_{t}$

## PCS from FRI

Problem with FRI is following two things:

- P merkle commit q to nth roots of unity in field but not the complete field. but verifier can send random point in the complete field, and thus, prover won’t be able to open the polynomial at that point. even if it opens, the commitment doesn’t have the property to prove from that random point.
- V after low degree test, only knows that q is
`not too far`

from degree k-1 honest polynomial, but doesn’t know if it’s exactly low degree.

How a PCS is described? create a quotient polynomial similar to done in KZG, and apply fold+query procedure on that quotient poly of degree k-1. So, to illustrate:

- take a degree $k$ poly $q$
- get a random variable from V: $r$
- compute degree $k−1$ poly: $w(X)=(q(X)−v)(X−r)_{−1}$
- to pass V’s checks in the FRI procedure for $w$, it has to equal $h(r)$ with high probability where $h$ is the degree-d poly that is closest to $q$.
- Also, reed-solomon decoding has unique decoding radius of $(1−ρ)/2$, and thus each verifier query bring less than 1 bit of security.
- This makes FRI PCS bound to small set of low degree polynomials $h$, rather than to a single one. This might violate binding property of PCS, but since probability is so low, and not proven formally, it suffices for SNARK security.

The above process can be repeated any number of times for opening a single polynomials at multiple points $z_{0},…,z_{n−1}$ and proving validity of evaluations $y_{0},…,y_{n−1}$.

- Prover computes $g(X)=∏_{i=0}X−z_{i}f(X)−p(X) $ where $p(X)$ is minimal polynomial that interpolates multiple points.
- Prove using FRI that $g(X)$ is a polynomial of degree $k−n$

## Polynomial IOP from FRI

If the prover wants to prove that polynomials $f_{0}(X),…,f_{n−1}(X)$ represent polynomial of degree $d_{1},…,d_{n−1}$, then it can do one FRI claim for polynomial which is a weighted non-linear sum of all the polynomials:

$g(x)=∑_{n−1}α_{i}f_{i}(X)+β_{i}X_{2_{k}−d_{i}−1}f_{i}(X)$

This *combination polynomial* proves that $g(X)$ is a polynomial of $deg(g(X))<2_{k}$ where $2_{k}>max(d_{i})$. A weighted sum is required so that polynomial evaluation don’t cancel each other in a field when codeword is created.

Quoting Alan’s FRI tutorial:

The intuition why this random nonlinear combination trick is secure is as follows. If all the polynomials $f_{i}(X)$ satisfy their proper degree bounds, then clearly $g(X)$ has degree less than $2_{k}$ and the FRI protocol succeeds. However, if any one $f_{i}(X)$ has degree larger than $d_{i}$, then with overwhelming probability over the randomly chosen $α_{i}$ and $β_{i}$, the degree of $g(X)$ will be larger than or equal to $2_{k}$. As a result, FRI will fail.

## Open questions

- what is the need of the offset for coset-FRI?
- what is the meaning of index folding? why folding phase is more secure when codewords are folded at particular index rather than random index at each step?
- when simulating a PCS from FRI: anatomy tutorial creates a new polynomial $g(X)=f(X)+X_{2_{k}−d−1}f(X)$, and then prove that $deg(g(X))<2_{k}$. Why another polynomial g(X) is required? why specifically $2_{k}$?
- Maybe because proving low-degree of a polynomial of 2th power is easier than some arbitrary number.