Module kimchi::alphas

source ·
Expand description

This module implements an abstraction to keep track of the powers of alphas. As a recap, alpha is a challenge sent by the verifier in PLONK, and is used to aggregate multiple constraints into a single polynomial. It is important that different constraints use different powers of alpha, as otherwise they can interact and potentially cancel one another. (The proof is in the use of the Schwartz-Zippel lemma.) As such, we want two properties from this:

  • we should keep track of a mapping between type of constraint and range of powers
  • when powers of alphas are used, we should ensure that no more no less are used

We use powers of alpha in two different places in the codebase:

  • when creating the index, we do not know alpha at this point so we simply keep track of what constraints will use what powers
  • when creating a proof or verifying a proof, at this point we know alpha so we can use the mapping we created during the creation of the index.

For this to work, we use the type Alphas to register ranges of powers of alpha, for the various ArgumentTypes.

Structs

  • This type can be used to create a mapping between powers of alpha and constraint types. See Self::default to create one, and Self::register to register a new mapping. Once you know the alpha value, you can convert this type to a Alphas.
  • Wrapper around an iterator that warns you if not consumed entirely.