Small fields (koala bear)

Linea and Gnark aim to operate over the koalabear field (over prime modulus 2^31 - 2^24 + 1). The usage of this field as the proving field (outer field) in modern proving backends may require implementing a field extension that increases the field size to ~128 bits. The goal they aim to achieve — enable the usage of fields where the field operation requires fewer uint64/uint32 manipulations than in default fields, where the element is a big integer represented by several smaller integers (that implements math in ).

The Gnark team has already implemented such extensions ( both 64 and 128 bit). This fields operate over for ~64 bits extension and for ~128 bits extension.

Let’s overview what does construction exactly mean:

  1. — means our koalabear field
  2. — means the field of all univariate polynomials with coefficients in
  3. Starting from the beginning, the notation represents a ring’s ideal — the analog structure to a coset in group theory. Basically, for the sub-ring it represents a sub-ring with elements where and . The notation represents a factor-ring — the ring of all possible ideals by sub-ring . In our case , so the factor-ring contains all possible ideals by sub-ring .
  4. Note that the ideal has a form of where not in . Otherwise, if then , which makes no sense. The only elements in that does not appear in are the polynomials of form . All other polynomials with degree already exist in .
  5. So, each element of such extension can be represented using two field elements and .

As an example of such field extension operation, let’s check how multiplication is done for two elements and . We can represent them as and which is equivalent to and . The multiplication of equals to and we also should take it by modulus to represent a unique element (check 4 above). So finally, .

In the koalabear case, the usage of enables only ~64-bit field, so we can enable the usage of two elements to act over . You can understand it as the same extension but over instead of