Expand description
Standard type library.
std_types is prism’s realization of the wiki’s
Building Block View § Whitebox prism
component named “standard type library” — the catalog of pre-declared
types built from uor-foundation’s vocabulary, available so
application authors do not have to derive common shape patterns
from first principles. Per ADR-017 the catalog is canonical: it
is the addressing surface that schema-import tools and applications
target so traces and certificates address consistently across the
ecosystem.
The catalog is layered:
- Foundation-supplied surface (re-exports). The ten morphism
kinds (
BinaryGroundingMap, …,Utf8ProjectionMap), the structural marker traits (Total,Invertible,PreservesStructure,PreservesMetric), the sealedGroundedValue/GroundedShapefamily,ConstrainedTypeInput,CartesianProductShapeand itskunneth_composehelper, the partition-algebra families (*Witness,*Evidence,*MintInputs,PartitionResolver,PartitionHandle,NullPartition,VerifiedMint), and theOntologyVerifiedMintsealed mint trait. - First-class prism-defined surface.
FixedSites<N>,Bytes<N>, and the byte-aligned numeric / character / boolean primitives (U8…I256,F32,F64,Bool,Char).
§IRI rule (closure under uor-foundation)
The IRI of every prism-defined stdlib type is derived from its
constraint declaration, not from the Rust type name — this is the
direct quote from
Concepts § Closure Under uor-foundation
and the binding rule of ADR-017. Concretely: every prism stdlib
type with empty CONSTRAINTS shares the same IRI
(https://uor.foundation/type/ConstrainedType, the foundation’s
ontology class for ConstrainedTypeShape instances). Instance
identity flows through (SITE_COUNT, CONSTRAINTS), so distinct
site counts produce distinct content-addresses while same-shape
Rust types (e.g., U32 and I32) produce identical
content-addresses by design — the Rust name is for the developer,
the IRI is for content-addressing.
See AGENTS.md § 11 for the inclusion / exclusion criteria, the catalog growth tracks (baseline vs. specialized), and the implementation pattern every stdlib type follows.
§See also
- Wiki: 05 Building Block View § Whitebox
prism - Wiki: 09 Architecture Decisions § ADR-017
- Wiki: 12 Glossary § Term Definitions
§Constraints
- TC-02 — the morphism-kind traits are sealed by foundation; no downstream extension is permitted
- TC-04 — the kind classification participates in compile-time
UORassembly enforcement (a
Groundingimpl whoseMapdoes not inhabitGroundingMapKindfails to compile) - ADR-017 — addresses are content-deterministic; the catalog is operational, not declarative
§C4 placement
Component standard type library (Level 3) inside container prism
(Level 2). It is consumed by application authors implementing
uor_foundation::enforcement::Grounding or
uor_foundation::enforcement::Sinking.
§Behavior
// Given: the ten morphism-kind marker types
// When: each is used as a phantom type parameter
// Then: the foundation's sealed trait family classifies them
// identically to the foundation's own use sites
use prism::std_types::{
BinaryGroundingMap, BinaryProjectionMap, DigestGroundingMap,
DigestProjectionMap, IntegerGroundingMap, IntegerProjectionMap,
JsonGroundingMap, JsonProjectionMap, Utf8GroundingMap,
Utf8ProjectionMap,
};
fn _accepts_grounding<M: prism::std_types::GroundingMapKind>() {}
fn _accepts_projection<M: prism::std_types::ProjectionMapKind>() {}
_accepts_grounding::<BinaryGroundingMap>();
_accepts_grounding::<DigestGroundingMap>();
_accepts_grounding::<IntegerGroundingMap>();
_accepts_grounding::<JsonGroundingMap>();
_accepts_grounding::<Utf8GroundingMap>();
_accepts_projection::<BinaryProjectionMap>();
_accepts_projection::<DigestProjectionMap>();
_accepts_projection::<IntegerProjectionMap>();
_accepts_projection::<JsonProjectionMap>();
_accepts_projection::<Utf8ProjectionMap>();
// And: the structural marker traits classify each kind as the
// ontology declares. `BinaryGroundingMap` is total and invertible;
// `IntegerGroundingMap` additionally preserves structure; the
// foundation rejects (at compile time) any attempt to claim a
// structural property a kind does not carry.
use prism::std_types::{Invertible, PreservesStructure, Total};
fn _total_invertible<M: prism::std_types::GroundingMapKind + Total + Invertible>() {}
fn _preserves_structure<M: prism::std_types::GroundingMapKind + PreservesStructure>() {}
_total_invertible::<BinaryGroundingMap>();
_total_invertible::<IntegerGroundingMap>();
_preserves_structure::<IntegerGroundingMap>();
_preserves_structure::<JsonGroundingMap>();
_preserves_structure::<Utf8GroundingMap>();Structs§
- Binary
Grounding Map - v0.2.2 W4: kind for raw byte ingestion. Total and invertible; preserves bit identity only.
- Binary
Projection Map - Target §3: kind for raw byte projections. Total and invertible; preserves bit identity only.
- Bool
- Boolean (1 byte at
WittLevel::W8). The value-in-{0, 1} contract is enforced host-side by the application’sGroundingimpl; the distinct IRI separatesBoolfromU8at the content-address level. - Bytes
Bytes<N>— byte-buffer admission intent of widthN.- Cartesian
Product Evidence - Evidence bundle for
CartesianProductWitness. Carries the CPT_1 / CPT_3 / CPT_4 / CPT_5 input values used at mint time, pluscombined_entropy_nats— the CartesianProductWitness itself does not store entropy (see §1a), so the evidence sidecar preserves the verification target value for re-audit. - Cartesian
Product Mint Inputs - Inputs to
CartesianProductWitness::mint_verified. Matches the CartesianProduct mint primitive’s parameter list. - Cartesian
Product Witness - Sealed CartesianPartitionProduct witness — content-addressed
assertion that a shape is
CartesianPartitionProduct(left, right)per CPT_2a. Minting verifies CPT_1, CPT_3, CPT_4, CPT_5, and the foundationCartesianLayoutWidthinvariant. The witness stores a snapshot of the combined topological invariants (χ, Betti profile) because the construction is axiomatic at the invariant level per §3c. Entropy is not stored here (f64 has no Eq/Hash); use the pairedCartesianProductEvidencefor entropy re-audit. - Char
- Unicode codepoint (4 bytes at
WittLevel::W8, UTF-32 width). Unicode validity (codepoint range, surrogate exclusion) is enforced host-side by the application’sGroundingimpl. - Constrained
Type Input - Input shim for
type:ConstrainedType. Used asCertify::Inputfor InhabitanceResolver, TowerCompletenessResolver, and IncrementalCompletenessResolver. - Digest
Grounding Map - v0.2.2 W4: kind for one-way digest functions (e.g., SHA-256). Total but not invertible; preserves no structure.
- Digest
Projection Map - Target §3: kind for fixed-size digests projected outward. Total but not invertible; preserves no structure.
- F32
- IEEE 754 binary32 floating-point (4 bytes at
WittLevel::W8). Well-formedness (NaN, subnormal, and infinity policy) is enforced host-side by the application’sGroundingimpl. - F64
- IEEE 754 binary64 floating-point (8 bytes at
WittLevel::W8). Well-formedness is enforced host-side. - Fixed
Sites FixedSites<N>— admit exactlyNsites, unconstrained per-site.- Grounded
Coord - A single grounded coordinate value.
Not a
Datum[this is the narrow intermediate that aGroundingimpl produces]. The foundation validates and mints it into aDatum. Uses the same closed level-tagged family asDatum, ensuring that coordinate width matches the target Witt level. - Grounded
Tuple - A grounded tuple: a fixed-size array of
GroundedCoordvalues. Represents a structured type (e.g., the 8 coordinates of an E8 lattice point). Not aDatumuntil the foundation validates and mints it. Stack-resident, no heap allocation. - I8
- Signed 8-bit integer (1 byte at
WittLevel::W8). - I16
- Signed 16-bit integer (2 bytes at
WittLevel::W8). - I32
- Signed 32-bit integer (4 bytes at
WittLevel::W8). - I64
- Signed 64-bit integer (8 bytes at
WittLevel::W8). - I128
- Signed 128-bit integer (16 bytes at
WittLevel::W8). - I256
- Signed 256-bit integer (32 bytes at
WittLevel::W8). - Integer
Grounding Map - v0.2.2 W4: kind for integer surface symbols. Total, invertible, structure-preserving.
- Integer
Projection Map - Target §3: kind for integer surface symbols projected outward. Invertible, structure-preserving.
- Json
Grounding Map - v0.2.2 W4: kind for JSON host strings. Invertible on its image, structure-preserving.
- Json
Projection Map - Target §3: kind for JSON host strings projected outward. Invertible, structure-preserving.
- Null
Partition - Resolver-absent default
Partition<H>. Embeds inline stubs for every sub-trait associated type soPartition<H>accessors return references to fields rather than to statics. The only meaningful state is thefingerprint; everything else usesHostTypes::EMPTY_*defaults. Returned by the three witness trait impls’left_factor/right_factor/left_summand/ etc. accessors as the resolver-absent value pathway. Consumers needing real partition data pair the siblingPartitionHandlewith aPartitionResolverinstead. - Partition
Coproduct Evidence - Evidence bundle for
PartitionCoproductWitness. Carries the ST_1 / ST_2 / ST_9 / ST_10 input values used at mint time. - Partition
Coproduct Mint Inputs - Inputs to
PartitionCoproductWitness::mint_verified. Adds three structural fields beyond the other two MintInputs: the combined constraint array, the boundary index between L and R regions, and the tag site layout index. These feedvalidate_coproduct_structureat mint time so ST_6 / ST_7 / ST_8 are verified numerically rather than trusted from the caller. DerivesDebug,Clone,Copyonly — noPartialEq.ConstraintRefdoes not implementPartialEq, so deriving equality on a struct with a&[ConstraintRef]field would not compile. MintInputs is not used as an equality target in practice; downstream consumers compare the minted witness (which derivesEq+Hash) instead. - Partition
Coproduct Witness - Sealed PartitionCoproduct witness — content-addressed assertion that a
partition decomposes as
PartitionCoproduct(left, right)per PT_2b. Minting verifies ST_1, ST_2, ST_6, ST_7, ST_8, ST_9, ST_10, the foundationCoproductLayoutWidthinvariant, and — for ST_6/ST_7/ST_8 — walks the supplied constraint array throughvalidate_coproduct_structure. - Partition
Handle - Content-addressed identity token for a partition. Carries only a
fingerprint; partition data is recovered by pairing the handle with a
PartitionResolverviaresolve_with. Handles compare and hash by fingerprint, so they can serve as keys in content-addressed indices without resolver access. - Partition
Product Evidence - Evidence bundle for
PartitionProductWitness. Carries the PT_1 / PT_3 / PT_4 input values used at mint time. DerivesPartialEqonly becausef64entropy fields excludeEq/Hash; this is the auditing surface, not a hash-map key. - Partition
Product Mint Inputs - Inputs to
PartitionProductWitness::mint_verified. Mirrors the underlying primitive’s parameter list; each field is supplied by the caller (typically aproduct_shape!macro expansion or a manual construction following the amendment’s Gap 2 pattern). DerivesPartialEqonly because of thef64entropy fields. - Partition
Product Witness - Sealed PartitionProduct witness — content-addressed assertion that a
partition decomposes as
PartitionProduct(left, right)per PT_2a. Minting is gated on PT_1, PT_3, PT_4, and the foundationProductLayoutWidthinvariant being verified against component shapes. Existence of an instance is the attestation — there is no partial or unverified form. - Partition
Record - Data record of a partition’s runtime-queried properties. Produced at
witness-mint time and consulted by consumer code that holds a
PartitionHandleand aPartitionResolver. Phase 9 stores entropy as the IEEE-754u64bit-pattern (entropy_nats_bits) so the record derivesEq + Hashcleanly; consumers project toH::Decimalvia<H::Decimal as DecimalTranscendental>::from_bits. - U8
- Unsigned 8-bit integer (1 byte at
WittLevel::W8). - U16
- Unsigned 16-bit integer (2 bytes at
WittLevel::W8). - U32
- Unsigned 32-bit integer (4 bytes at
WittLevel::W8). Width of a Bitcoin block-header nonce. - U64
- Unsigned 64-bit integer (8 bytes at
WittLevel::W8). - U128
- Unsigned 128-bit integer (16 bytes at
WittLevel::W8). - U256
- Unsigned 256-bit integer (32 bytes at
WittLevel::W8). Width of a SHA-256 output and a Bitcoin difficulty target. - Utf8
Grounding Map - v0.2.2 W4: kind for UTF-8 host strings. Invertible on its image, structure-preserving.
- Utf8
Projection Map - Target §3: kind for UTF-8 host strings projected outward. Invertible, structure-preserving.
Traits§
- Cartesian
Product Shape - Marker for a
ConstrainedTypeShapethat is the Cartesian product of two component shapes. Selecting this trait routes nerve-Betti computation through Künneth composition of component Betti profiles rather than flat enumeration of (constraint, constraint) pairs. Introduced by the Product/Coproduct Completion Amendment §3c for CartesianPartitionProduct (CPT_1–CPT_6). - Grounded
Shape - Sealed marker trait identifying type:ConstrainedType subclasses that may
appear as the parameter of
Grounded<T>. Per wiki ADR-027, the seal is the same__sdk_seal::Sealedsupertrait foundation uses forFoundationClosed,PrismModel, andIntoBindingValue: only foundation and the SDK shape macros emit impls. The foundation-sanctioned identity outputConstrainedTypeInputretains its direct impl; application authors declaring custom Output shapes invoke theoutput_shape!SDK macro, which emits__sdk_seal::Sealed,GroundedShape,IntoBindingValue, andConstrainedTypeShapetogether. - Grounded
Value - Sealed marker trait for grounded intermediates.
Implemented only for
GroundedCoordandGroundedTuple<N>. Prism code cannot implement this [the sealed module pattern prevents it]. - Grounding
MapKind - v0.2.2 W4: sealed marker trait for the kind of a
Groundingmap. Implemented by exactly themorphism:GroundingMapindividuals declared in the ontology; downstream cannot extend the kind set. - Invertible
- v0.2.2 W4: kinds whose map is injective and admits an inverse on its image.
- Morphism
Kind - Target §3: sealed marker trait shared by all morphism kinds.
GroundingMapKind(inbound) andProjectionMapKind(outbound) both extend this trait; the four structural markers (Total,Invertible,PreservesStructure,PreservesMetric) are bounded onMorphismKind. - Ontology
Verified Mint - Phase 10 — sealed mint trait for ontology-derived Path-2 witnesses.
Distinct from
VerifiedMint(used by the partition-algebra amendment): the new trait carries aHostTypes-parameterized GATInputs<H>so witness inputs can holdH::Decimal/{Range}Handle<H>fields without leaking f64 into the trait shape. Sealed via theCertificatesupertrait. - Partition
Resolver - Resolver mapping content fingerprints to
PartitionRecords. Provided by the host application — typically a persistent store, an in-memory registry populated from witness mint-time data, or a chain-of-witnesses trail that can reconstruct properties. - Preserves
Metric - v0.2.2 W4: kinds whose map preserves the metric of the source domain (isometry-like).
- Preserves
Structure - v0.2.2 W4: kinds whose map preserves the algebraic structure of the source domain (homomorphism-like).
- Projection
MapKind - Target §3: sealed marker trait for the kind of a
Sinkingprojection. Implemented by exactly themorphism:ProjectionMapindividuals declared in the ontology; downstream cannot extend the kind set. - Total
- v0.2.2 W4: kinds whose image is total over the input domain (every input maps successfully).
- Verified
Mint - Sealed mint path for certificates that require multi-theorem verification
before minting. Introduced by the Product/Coproduct Completion Amendment
§1c; distinct from
MintWithLevelFingerprint(which is the generic partial-mint path for sealed shims).VerifiedMintimplementors are the three partition-algebra witnesses, each routing through a foundation-internal mint primitive that verifies the relevant theorems. The trait is public so external callers can invokemint_verifieddirectly, but theCertificatesupertrait’scertificate_sealed::Sealedbound keeps the implementor set closed to this crate.
Functions§
- kunneth_
compose - Künneth composition of two Betti profiles.
Computes
out[k] = Σ_{i + j = k} a[i] · b[j]over[0, MAX_BETTI_DIMENSION). All arithmetic uses saturating operations so the function is total on[u32; MAX_BETTI_DIMENSION]inputs without panicking.