Skip to main content

Crate prism

Crate prism 

Source
Expand description

prism — the Prism standard library (wiki ADR-031).

Per Wiki ADR-031, the prism crate is the standard library: a façade re-exporting uor_foundation’s substrate together with the built-in axes and built-in types the Layer-3 sub-crates of the standard library declare. The wiki’s user-facing promise is “depend on uor-prism, write a prism_model!, done” — application authors do not need to add uor-foundation, uor-foundation-sdk, or the individual uor-prism-<domain> crates to their dependency list. Everything composes through use prism::*; (or finer-grained imports like use prism::crypto::Sha256Hasher).

Per ADR-024, the standard library is Layer 2 of the three-layer algebraic closure spine: substrate (uor-foundation) is Layer 1; verbs and axes declared by application crates are Layer 3.

§Standard-library Layer-3 sub-crate roster

Per ADR-031’s roster commitment, the standard library publishes four canonical sub-crates from the Prism repository, each consumed through the façade re-exports below. Every axis impl is parametric in its natural axis (byte-width, Q-format split, hasher, dimension) so application authors instantiate the impl their model needs without re-rolling the kernel body; canonical type aliases (e.g., Sha256Hasher, BigInt256Numeric, CpuI8Tensor4x4Matmul) name the most common instantiations.

  • crypto — wiki: hashes, curves, signatures, commitments. HashAxis impls: Sha256Hasher, Sha512Hasher, Sha3_256Hasher, Keccak256Hasher, Blake3Hasher. CommitmentAxis impl: MerkleRoot<H, LEAF_BYTES> (parametric over HashAxis), default alias MerkleRootCommitment = SHA-256. Shapes: Digest<N>, PublicKey<N>, Signature<N>, MerkleProofShape<MAX_DEPTH, LEAF_BYTES>.
  • numerics — wiki: integer, fixed-point, prime-field, GF(2) arithmetic. Parametric: BigIntModularNumeric<BYTES> (8..=512 bits), FixedPointQNumeric<I, F> (any Q-format split ≤ 64 bits total), Gf2NumericAxisN<BYTES> (1..=128 bytes). Concrete: PrimeFieldNumericSecp256k1. Shapes: BigIntShape<N>, FixedPointShape<I, F>, FieldElementShape<N>, Gf2RingShape<N>.
  • tensor — wiki: tensor compute + activations. Parametric: CpuI8MatmulSquare<DIM> (1..=16 square i8i16 matmul), CpuI8VectorActivation<N> (1..=256-length i8 vector ReLU / Q1.7 sigmoid). Shapes: MatrixShape<R, C, ELEM_BYTES>, VectorShape<N, ELEM_BYTES>.
  • fhe — wiki: homomorphic encryption. Parametric reference impl: OneTimePadFhe<BLOCK_BYTES> (1..=256). Shape: CiphertextShape<N>.

§SDK macros (re-exported)

Per ADR-031’s façade commitment, the SDK macros declared by uor-foundation-sdk are re-exported through pipeline so a single use prism::pipeline::prism_model; reaches the canonical application-author surface:

  • prism_model! (ADR-020 / ADR-022) — declare a typed route
  • verb! (ADR-024) — declare a Layer-3 verb (named composition)
  • axis! (ADR-030) — declare a Layer-3 axis (substrate-extension vocabulary)
  • resolver! (ADR-036) — declare a ResolverTuple value
  • output_shape! (ADR-027) — declare a custom Output shape
  • use_verbs! (ADR-024) — import verbs from another implementation
  • product_shape!, coproduct_shape!, cartesian_product_shape!, partition_product!, partition_coproduct! (ADR-026 / ADR-033) — shape constructors

§See also

§Constraints

This crate is normatively bound by:

  • TC-01 — zero-cost runtime; no Prism interpreter layer at execution
  • TC-02 — sealing of Validated, Grounded, Certified via the Rust type system, enforced through pub(crate) constructors in the substrate
  • TC-03 — singular principal data path; exactly one constructor for Grounded<T>, reached only through pipeline::run
  • TC-04 — bilateral compile-time UORassembly enforcement
  • TC-05 — replayability without invoking author deciders or hash functions; surfaced through replay::certify_from_trace
  • TC-06 — no application-author infrastructure at runtime
  • ADR-006 — UORassembly is enforced bilaterally at compile time through the Rust type system; this is the architectural commitment that makes TC-04 enforceable rather than aspirational

Substitution axes per ADR-007/030/036: HostTypes, HostBounds, AxisTuple, ResolverTuple, TypedCommitment.

Additionally:

  • ADR-019uor-foundation’s vocabulary is the signature category, Term is its initial algebra, pipeline::run is the catamorphism.
  • ADR-020 — application authors declare a Prism application by implementing the sealed pipeline::PrismModel trait; the prism_model! macro derives forward’s body via initiality.
  • ADR-024 — three-layer algebraic closure (substrate, prism, implementation).
  • ADR-030 — the axis! SDK macro is the universal substrate-extension declaration mechanism.
  • ADR-031prism IS the standard library: a façade over uor-foundation plus Layer-3 sub-crates published from the Prism repository.
  • ADR-040 — closed BoundShape catalog (7 individuals) with type:LexicographicLessEqBound for byte-sequence-valued observables; 1:1 correspondence with the foundation-published ObservablePredicate impl surface per ADR-049.
  • ADR-048 — typed-commitment substrate: the TypedCommitment trait with three built-in impls (EmptyCommitment, SingletonCommitment<P>, AndCommitment<A, B>) and the canonical TargetCommitment = SingletonCommitment<LexicographicLessEqThreshold> alias. The 5th model-declaration parameter C on PrismModel.
  • ADR-049 — five foundation-published typed UOR observable primitives (Stratum<P>, WalshHadamardParity, UltrametricCloseTo<P>, AffineParity, LexicographicLessEqThreshold) realizing the four taxonomy subclasses of ADR-038’s closed observable catalog. Each is Copy + Sealed and consumable as a SingletonCommitment<P> operand per ADR-048.
  • ADR-057 — bounded recursive structural typing via ConstraintRef::Recurse { shape_iri, descent_bound } plus the foundation shape-IRI registry (RegisteredShape, ShapeRegistryProvider, EmptyShapeRegistry, lookup_shape, lookup_shape_in). Apps emit a registry via the register_shape! SDK macro; partition_product! / partition_coproduct! operand grammar admits recurse[(<bound>)]:T to declare recursive references without const-eval cycles. The registry-aware nerve / Betti substrate primitives shipped in foundation 0.4.15 — primitive_simplicial_nerve_betti_in::<T, R>, primitive_cartesian_nerve_betti_in::<S, R>, and expand_constraints_in::<R> — walk Recurse entries through R’s registry plus foundation’s built-in registry, giving the structurally-correct nerve / Betti reading of recursively-expanded constraint sets. Wire-format trace events gain a Recurse discriminant; TRACE_REPLAY_FORMAT_VERSION bumps to 10.

§C4 placement

Container prism (Level 2) of the Prism system. The submodules mirror the Level 2 components named in the wiki’s Building Block View § Whitebox prism, with the ADR-031-introduced standard-library Layer-3 sub-crate re-exports sitting beside the foundation runtime surface:

  • pipeline — the principal data path + SDK macro re-exports
  • seal — the sealed Prism-mechanism types
  • replay — trace-replay verification surface
  • operation — operation declaration vocabulary
  • std_types — standard type library (baseline primitives)
  • vocabulary — foundation surface re-exports
  • crypto — standard-library cryptography axes (ADR-031)
  • numerics — standard-library numerics axes (ADR-031)
  • tensor — standard-library tensor-compute axes (ADR-031)
  • fhe — standard-library homomorphic-encryption axes (ADR-031)

§Behavior

// Given: the substrate dependency `uor-foundation` is in scope
// When:  the prism standard-library façade is loaded
// Then:  every wiki Level 2 module of `prism` AND every ADR-031
//        standard-library sub-crate is reachable through `use prism::*;`
use prism::{operation as _, pipeline as _, replay as _};
use prism::{seal as _, std_types as _, vocabulary as _};
use prism::{crypto as _, fhe as _, numerics as _, tensor as _};
use uor_foundation as _;
assert_eq!(prism::WIKI, "https://github.com/UOR-Foundation/UOR-Framework/wiki");

Re-exports§

pub use uor_foundation;

Modules§

crypto
Cryptography axes per Wiki ADR-031 (re-export of uor-prism-crypto).
fhe
Homomorphic-encryption axes per Wiki ADR-031 (re-export of uor-prism-fhe).
numerics
Numerics axes per Wiki ADR-031 (re-export of uor-prism-numerics).
operation
Operation-declaration vocabulary.
pipeline
The principal data path: admission, validation, and grounding.
replay
Trace-replay verification surface.
seal
The seal regime: the three sealed Prism-mechanism types.
std_types
Standard type library.
tensor
Tensor-compute axes per Wiki ADR-031 (re-export of uor-prism-tensor).
vocabulary
Foundation surface re-exports — the single-import vocabulary.

Constants§

MSRV
Minimum supported Rust version of this crate.
WIKI
Canonical URL of the UOR-Framework wiki, the normative source for the Prism architecture realized by this crate.