Skip to main content

Crate prism_numerics

Crate prism_numerics 

Source
Expand description

Prism standard-library numerics sub-crate.

prism-numerics realizes the numerics Layer-3 of the standard library named in Wiki ADR-031: it declares the arithmetic-domain axis traits (BigIntAxis, FixedPointAxis, FieldAxis, RingAxis) through the axis! SDK macro and supplies parametric reference impls plus matching ConstrainedTypeShape carriers per the wiki’s ADR-031 roster.

§Scope

Every axis kernel takes (input: &[u8], out: &mut [u8]) per ADR-030’s signature contract. Axis impls are generic in their natural axis (byte-width, Q-format split) so applications can instantiate the impl their model needs without re-rolling the kernel body.

§ConstrainedTypeShape declarations

Per ADR-031’s shape-declaration commitment (BigInt<MaxBits>, FixedPoint<I, F>, FieldElement<P>, …), each axis has a matching ConstrainedTypeShape carrier so downstream prism_model! invocations can use the shape as Input / Output through the SDK macros. Every shape is GroundedShape + IntoBindingValue-bound for use as a model Output per ADR-027. Per ADR-017’s closure rule, shape identity flows through (SITE_COUNT, CONSTRAINTS) — distinct parametric instantiations with the same site count content-address identically.

§Closure under uor-foundation (ADR-013)

Every axis trait has ::uor_foundation::pipeline::AxisExtension as a supertrait (enforced by axis!). Parametric axis impls hand-write their AxisExtension impl since the axis!-emitted companion macro takes :ident and cannot apply to generic types (the hand-written impls replicate the companion macro’s dispatch arms verbatim).

§See also

Re-exports§

pub use bigint::BigInt128Numeric;
pub use bigint::BigInt256Numeric;
pub use bigint::BigInt512Numeric;
pub use bigint::BigInt64Numeric;
pub use bigint::BigIntAxis;
pub use bigint::BigIntModularNumeric;
pub use bigint::BigIntShape;
pub use bigint::MAX_BIG_INT_BYTES;
pub use field::FieldAxis;
pub use field::FieldElementShape;
pub use field::PrimeFieldNumericSecp256k1;
pub use fixed_point::FixedPointAxis;
pub use fixed_point::FixedPointQ16_16Numeric;
pub use fixed_point::FixedPointQ1_31Numeric;
pub use fixed_point::FixedPointQ32_32Numeric;
pub use fixed_point::FixedPointQ48_16Numeric;
pub use fixed_point::FixedPointQNumeric;
pub use fixed_point::FixedPointShape;
pub use polynomial::Polynomial15Mod256;
pub use polynomial::Polynomial7Mod256;
pub use polynomial::PolynomialShape;
pub use ring::Gf2NumericAxis;
pub use ring::Gf2NumericAxis128;
pub use ring::Gf2NumericAxis512;
pub use ring::Gf2NumericAxisN;
pub use ring::Gf2RingShape;
pub use ring::RingAxis;
pub use ring::MAX_GF2_BYTES;

Modules§

bigint
BigIntAxis declaration + parametric modular-arithmetic impls + shape.
field
FieldAxis declaration, secp256k1 base-field reference impl, and parametric FieldElementShape<BYTES>.
fixed_point
FixedPointAxis declaration + parametric Q-format impl + shape.
polynomial
PolynomialShape<MAX_DEGREE, COEFF_BYTES> — ADR-031 named numerics shape carrier.
ring
RingAxis declaration + parametric GF(2)-over-N-bytes impl + shape.
verbs
Layer-3 substrate-Term verb bodies per Wiki ADR-024 + Wiki ADR-031 + Wiki ADR-055 (universal substrate-Term verb body discipline, supersedes ADR-054 RA2).

Macros§

axis_extension_impl_for_big_int_axis
Wiki ADR-030 companion macro: instantiate AxisExtension for a concrete struct implementing this axis trait. The macro emits an impl AxisExtension for <StructIdent> block that delegates dispatch_kernel to the axis-trait methods per KERNEL_* id. The orphan-rule-conformant per-struct impl mechanism replacing the blanket impl<T: <axis>> AxisExtension for T (which would violate Rust’s orphan rule from any crate that does not define AxisExtension).
axis_extension_impl_for_field_axis
Wiki ADR-030 companion macro: instantiate AxisExtension for a concrete struct implementing this axis trait. The macro emits an impl AxisExtension for <StructIdent> block that delegates dispatch_kernel to the axis-trait methods per KERNEL_* id. The orphan-rule-conformant per-struct impl mechanism replacing the blanket impl<T: <axis>> AxisExtension for T (which would violate Rust’s orphan rule from any crate that does not define AxisExtension).
axis_extension_impl_for_fixed_point_axis
Wiki ADR-030 companion macro: instantiate AxisExtension for a concrete struct implementing this axis trait. The macro emits an impl AxisExtension for <StructIdent> block that delegates dispatch_kernel to the axis-trait methods per KERNEL_* id. The orphan-rule-conformant per-struct impl mechanism replacing the blanket impl<T: <axis>> AxisExtension for T (which would violate Rust’s orphan rule from any crate that does not define AxisExtension).
axis_extension_impl_for_ring_axis
Wiki ADR-030 companion macro: instantiate AxisExtension for a concrete struct implementing this axis trait. The macro emits an impl AxisExtension for <StructIdent> block that delegates dispatch_kernel to the axis-trait methods per KERNEL_* id. The orphan-rule-conformant per-struct impl mechanism replacing the blanket impl<T: <axis>> AxisExtension for T (which would violate Rust’s orphan rule from any crate that does not define AxisExtension).

Constants§

STANDARD_LIBRARY_VERSION
Wiki ADR-031 standard-library version banner.