Skip to main content

Module expr

Module expr 

Source

Modulesยง

constraints
A number of useful constraints
prologue
You can import this module like use kimchi::circuits::expr::prologue::* to obtain a number of handy aliases and helpers

Macrosยง

auto_clone
Auto clone macro - Helps make constraints more readable by eliminating requirement to .clone() all the time
auto_clone_array

Structsยง

Cache
A cache
CacheId
A key for a cached value
Constants
The collection of constants required to evaluate an Expr.
FCol ๐Ÿ”’
A witness-column access resolved for the fused evaluator: at row i it reads evals[(scale * i + offset) % len] โ€“ the same indexing as SubEvals.
Linearization
A โ€œlinearizationโ€, which is linear combination with E coefficients of columns.
RowOffset
Variable
A type representing a variable which can appear in a constraint. It specifies a column and a relative position (Curr or Next)

Enumsยง

ConstantExprInner
ConstantTerm
Define the constant terms an expression can use. It can be any constant term (Literal), a matrix (Mds - used by the permutation used by Poseidon for instance), or endomorphism coefficients (EndoCoefficient - used as an optimisation). As for challengeTerm, it has been used initially to implement the PLONK IOP, with the custom gate Poseidon. However, the terms have no built-in semantic in the expression framework. TODO: we should generalize the expression type over challenges and constants. See https://github.com/MinaProtocol/mina/issues/15287
Either ๐Ÿ”’
Use as a result of the expression evaluations routine. For now, the left branch is the result of an evaluation and the right branch is the ID of an element in the cache
EvalResult ๐Ÿ”’
ExprError
ExprInner
FOp ๐Ÿ”’
Flat bytecode for the fused evaluator: a stack machine walked once per domain row, with intermediates living in a register frame rather than full-domain arrays.
FeatureFlag
The feature flags that can be used to enable or disable parts of constraints.
Operations
PolishToken
For efficiency of evaluation, we compile expressions to reverse Polish notation expressions, which are vectors of the below tokens.

Constantsยง

_DERIVE_ocaml_FromValue_from_value_lifetime_FOR_FeatureFlag ๐Ÿ”’
_DERIVE_ocaml_IntoValue_FOR_FeatureFlag ๐Ÿ”’

Traitsยง

AlphaChallengeTerm
The Challenge term that contains an alpha. Is used to make a random linear combination of constraints
ColumnEnvironment
ColumnEvaluations
FormattedOutput
Literal

Functionsยง

fused_eval_mode ๐Ÿ”’
Execution mode for the experimental fused row-wise evaluator. KIMCHI_FUSED_EVAL=1 uses it (falling back to the vectorised path for expressions it does not handle); =verify runs both and asserts they agree.
l0_1
Computes prod_{j != n} (1 - omega^j) Assure we donโ€™t multiply by (1 - omega^n) = (1 - omega^0) = (1 - 1) = 0
mul_monomials ๐Ÿ”’
unnormalized_lagrange_basis
unnormalized_lagrange_evals ๐Ÿ”’
Compute the evaluations of the unnormalized lagrange polynomial on H_8 or H_4. Taking H_8 as an example, we show how to compute this polynomial on the expanded domain.

Type Aliasesยง

ConstantExpr
Expr
An multi-variate polynomial over the base ring C with variables
Monomials ๐Ÿ”’