pub trait Uair: Clone {
type Ideal: Ideal;
type FqIdeal: Ideal;
type Scalar: Semiring;
type Prime: Semiring;
// Required methods
fn signature() -> UairSignature<Self::Prime>;
fn constrain_general<C, B, FromR, MulByScalar, IFromR, IFqFromR>(
b: &mut B,
expr_cfg: &C,
up: TraceRow<'_, C::Element>,
down: TraceRow<'_, C::Element>,
from_ref: FromR,
mbs: MulByScalar,
ideal_from_ref: IFromR,
fq_ideal_from_ref: IFqFromR,
)
where C: SemiringConfig,
B: ConstraintBuilder<Expr = C::Element>,
FromR: Fn(&Self::Scalar) -> C::Element,
MulByScalar: Fn(&C::Element, &Self::Scalar) -> Option<C::Element>,
IFromR: Fn(&Self::Ideal) -> B::Ideal,
IFqFromR: Fn(&Self::FqIdeal) -> B::FqIdeal;
}Expand description
The trait that a universal AIR description has to implement. This must include all the constraint description logic of an UAIR.
One type might implement different UAIR logics for different underlying semirings hence the generic type parameter.
Required Associated Types§
Sourcetype Ideal: Ideal
type Ideal: Ideal
The ideal type the AIR operates with.
Since a ConstraintBuilder is “opaque” for a Uair
a Uair has to have a means to create ideals
so ideals are fixed by this associated types.
At the constrain* methods a Uair is given
a way to convert its own ideals into builder’s ideals
via the FromRef trait.
Sourcetype FqIdeal: Ideal
type FqIdeal: Ideal
The ideal type for $F_{q_i}[X]$-constraints emitted via
ConstraintBuilder::assert_in_fq_ideal. UAIRs that do not declare
any primes should set this to ideal::ImpossibleIdeal.
Required Methods§
Sourcefn signature() -> UairSignature<Self::Prime>
fn signature() -> UairSignature<Self::Prime>
Signature of the UAIR.
TODO: Consider caching the signature to avoid recomputing it at every call site. Currently negligible since shifts are small (e.g. ~12 for SHA/ECDSA), but may matter if signatures grow more expensive to construct.
Sourcefn constrain_general<C, B, FromR, MulByScalar, IFromR, IFqFromR>(
b: &mut B,
expr_cfg: &C,
up: TraceRow<'_, C::Element>,
down: TraceRow<'_, C::Element>,
from_ref: FromR,
mbs: MulByScalar,
ideal_from_ref: IFromR,
fq_ideal_from_ref: IFqFromR,
)
fn constrain_general<C, B, FromR, MulByScalar, IFromR, IFqFromR>( b: &mut B, expr_cfg: &C, up: TraceRow<'_, C::Element>, down: TraceRow<'_, C::Element>, from_ref: FromR, mbs: MulByScalar, ideal_from_ref: IFromR, fq_ideal_from_ref: IFqFromR, )
A general method for describing constraints.
§Arguments
b: a builder encapsulating the constraint storing logic. Its typeBhas to have compatibleB::Idealwith theSelf::Ideal, i.e. it must implementFromRef<Self::Ideal>trait.expr_cfg: the [SemiringConfig] providing arithmetic operations onB::Expr. Per-family builder runs pass the family’s config (e.g. azinc_poly::univariate::dynamic::DynamicPolynomialConfigover the family’s field, or the field config itself); static analyses pass aFixedConfig.up: aTraceRowof expressions representing the current row of UAIR.down: aTraceRowof expressions representing the shifted (down) row of the UAIR. Its layout matchesUairSignature::down(), which may have fewer columns thanupwhen only a subset of columns are shifted.from_ref: a closure that turns the underlying ringRintoB::Expr. Sometimes (e.g. when dealing with random fields) it is convenient to provide a closure instead of aFromRefimplementation.mbs: a closure that allows to multiply expressions byR. Same rationale as forfrom_ref.ideal_from_ref: a closure that turns aSelf::IdealintoB::Idealfor the $Q[X]$-ideal-membership family.fq_ideal_from_ref: a closure that turns aSelf::FqIdealintoB::FqIdealfor the new $F_{q_i}[X]$-ideal-membership family emitted viaConstraintBuilder::assert_in_fq_ideal. UAIRs without $F_q[X]$-constraints can ignore this closure.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.