Things needed in order to create a SNARK:
- field: binary fields
- pcs: small field polynomial commitment using concatenated codes
- arithmetisation: virtual polynomial construction in multilinear setting similar to hyperplonk
Let’s write what i think about binius, it’s use case, and the efficiency that it promises.
Historically, proof systems based on IOPs have gone through various changes:
- starting with GGPR13, pinocchio that introduced R1CS
- then, came the PCP world of Groth16 based on pairings, with one of most efficient verifier that I know of.
- Bulletproofs got introduced to the world that completely removed the use of trusted setups based PCS, field-agnostic, truly ZK, but with just one caveat: linear verifier
- Came the world of PLONK [GWC19], it’s arithmetisation, world of KZG10, it’s modularity and arithmetisation allowed so many additional things on top: custom gates, lookup tables
- On another side of the coin, there was brewing a wildly theoretical yet promising idea of STARKs (BBSHR18) with their own world of arithmetisation called AIR, although very similar to plonkish arithmetisation used in Halo2, with a completely separate idea of IOPP, i.e. proofs of proximity based on RS codes. Although proof sizes were large, mainly due to logarithmic size of merkle path proofs.
Binius main ace is using binary field extensions. Arithmetic of binary fields is so rich and flexible, it’s addition is just XOR, and multiplication can be done efficiently using algorithm similar to karatsuba multiplication.
Let’s start with understanding field used in binius and it’s advantages over classical prime field and their extensions:
Binary Fields
Now, binary fields are an interesting area of research in implementation phase because it has multiple ways of representation, and each representation has different arithmetic asymptotic complexity.
field :
- addition: XOR
- multiplication: for , it’s just repeated xor.
- for extension fields, can be done efficiently using an algorithm similar to karatsuba-multiplication
Two ways of representing :
- univariate basis - two ways of representing in univariate basis as well, namely:
- polynomial basis: elements are represented as degree k-1 polynomial by equivalence class , where f(x) is any irreducible in the kth power.
- normal basis: elements are represented as taking powers of an element from the field
- multilinear basis - there’s one other way of representing elements, i.e. Multilinear basis, where elements are represented by monomials: , with each coefficient in .
Binary field towers
Binius realises binary extension field using towers formalised in Weidemann et al..
Basic idea is to derive sequence of polynomial rings inductively
- start with
- set , namely .
- set
- continue this further with , where is an irreducible in
Weidemann showed that is irreducible for each , and form a field isomorphic to and, by construction, , is a subfield of as constant polynomials (due to equivalence class). Ring construction for happens as:
Notation used in binius: , with initial and . This gets us a tower construction where is isomorphic to and . Monomials represent the basis of as vector space, i.e. , thus, is represented as boolean vector , and give .
For example: take , represents all the basis vector for monomials in multilinear basis of , i.e.
- :
- :
- …
- :
Main advantage of Binary field extensions:
- efficient embeddings
- small-to-large multiplication: multiplying a with takes only
Now, we have a field, using that we can derive polynomials in multilinear basis, let’s understand PCS needed to commit to these polynomials:
Error Correcting codes
- A code represents code of block length with message length such that any two code are distant to each other.
- linear code over field is a k-dimensional linear subspace
- fold interleaved code for any , defined as subset
- represents length-n block code over alphabet , represented as rows of matrices in
- RS code: , where the code is defined as
- Problem with RS codes, is that it requires alphabet of large length
why RS codes are not suitable for binary fields?
Extension Code
let be a code with generator matrix , and a vector space over .
So, message space for is a with alphabet in . Representing a vector space , containing each element as message from . Extension code is the image of map .
Let be the the dimension for over , then an element in vector space , can be defined as , where itself belongs to , and represents matrix multiplication of each element in to generator matrix of .
Basic PCS
consists of five methods: :
- : field , choose , write , and , return code where
- : evaluate at as lagrange basis coefficients: .
- express into matrix of dimension: .
- encode matrix row wise into with row length
- output a merkle root committing to each encoded column of matrix
Concatenated Codes
small field PCS
polynomial IOP
define Polynomial oracle:
- : submit a multilinear polynomial , outputs to , where is a unique handle/identifier for polynomial .
- : from , , outputs
define polynomial predicate as boolean valued function for a ary variate polynomial over :
Uses hyperplonk’s polynomial predicates as:
- , basically for all v in basis, T evaluates to 0.
- conditioned on the rule that neither evaluates to zero on the basis.
- : for ary multiset:
- : is a bijection such that , where
Virtual Polynomial: an l-variate virtual polynomial contains a list of handles , each over , and an arithmetic circuit with gates representing ary gate . This means gates can have arity greater than 2.
For example: for a polynomial containing three polynomials , each having arity . Let arity be:
- : 2-ary gate:
- : 1-ary gate:
- : 3-ary gate:
Now, putting these polynomials in an arithmetic circuit:
flowchart TB X0-->t0 X1-->t0 t0--X_0*X_1-->t2 X2-->t1 X2-->t2("t2=t0(X0,X1)-t1(X2)+X2") t1--X_2^2-->t2 t2-->out(out=X_0*X_1+X_2^2-X_2)
Polynomial protocol: takes list of virtual polynomials , and a ary predicate
- evaluation protocol: as
- composition polynomial: take list of variate handles , and a -variate composition polynomial such that .