Skip to main content

Module builder

Module builder 

Source
Expand description

Constraint Builder DSL.

Provides ConstraintSystem and Expr for writing algebraic constraints with operator overloading.

§Example

let cs = ConstraintSystem::<F>::new();
let [a, b, q] = [cs.col(0), cs.col(1), cs.col(2)];
let [na, nb] = [cs.next(0), cs.next(1)];

cs.constrain(q * (na + b));       // next_a = b
cs.constrain(q * (nb + a + b));   // next_b = a + b

let ast = cs.build();

Expr is Copy — same expression reused in multiple constraints shares the underlying DAG node. Cell references are auto-deduplicated.

Sub delegates to Add because in GF(2^k), subtraction is addition (XOR). This is correct for binary tower fields only.

Structs§

ConstraintSystem
Builder context for algebraic constraints.
Expr
Lightweight handle to a DAG node in a ConstraintSystem.