Skip to main content

prism/
std_types.rs

1//! Standard type library.
2//!
3//! `std_types` is `prism`'s realization of the wiki's
4//! [Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
5//! component named "standard type library" — the catalog of pre-declared
6//! types built from `uor-foundation`'s vocabulary, available so
7//! application authors do not have to derive common shape patterns
8//! from first principles. Per ADR-017 the catalog is **canonical**: it
9//! is the addressing surface that schema-import tools and applications
10//! target so traces and certificates address consistently across the
11//! ecosystem.
12//!
13//! The catalog is layered:
14//!
15//! - **Foundation-supplied surface (re-exports).** The ten morphism
16//!   kinds (`BinaryGroundingMap`, …, `Utf8ProjectionMap`), the
17//!   structural marker traits (`Total`, `Invertible`,
18//!   `PreservesStructure`, `PreservesMetric`), the sealed
19//!   `GroundedValue`/`GroundedShape` family, `ConstrainedTypeInput`,
20//!   `CartesianProductShape` and its `kunneth_compose` helper, the
21//!   partition-algebra families (`*Witness`, `*Evidence`,
22//!   `*MintInputs`, `PartitionResolver`, `PartitionHandle`,
23//!   `NullPartition`, `VerifiedMint`), and the `OntologyVerifiedMint`
24//!   sealed mint trait.
25//! - **First-class prism-defined surface.** [`FixedSites<N>`],
26//!   [`Bytes<N>`], and the byte-aligned numeric / character / boolean
27//!   primitives (`U8` … `I256`, `F32`, `F64`, `Bool`, `Char`).
28//!
29//! ## IRI rule (closure under `uor-foundation`)
30//!
31//! The IRI of every prism-defined stdlib type is **derived from its
32//! constraint declaration, not from the Rust type name** — this is the
33//! direct quote from
34//! [Concepts § Closure Under uor-foundation][08-closure]
35//! and the binding rule of ADR-017. Concretely: every prism stdlib
36//! type with empty `CONSTRAINTS` shares the same IRI
37//! (`https://uor.foundation/type/ConstrainedType`, the foundation's
38//! ontology class for `ConstrainedTypeShape` instances). Instance
39//! identity flows through `(SITE_COUNT, CONSTRAINTS)`, so distinct
40//! site counts produce distinct content-addresses while same-shape
41//! Rust types (e.g., `U32` and `I32`) produce **identical**
42//! content-addresses by design — the Rust name is for the developer,
43//! the IRI is for content-addressing.
44//!
45//! See [AGENTS.md § 11](../../../AGENTS.md#11-standard-type-library-policy)
46//! for the inclusion / exclusion criteria, the catalog growth tracks
47//! (baseline vs. specialized), and the implementation pattern every
48//! stdlib type follows.
49//!
50//! [08-closure]: https://github.com/UOR-Foundation/UOR-Framework/wiki/08-Concepts#closure-under-uor-foundation
51//!
52//! # See also
53//!
54//! - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
55//! - [Wiki: 09 Architecture Decisions § ADR-017](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
56//! - [Wiki: 12 Glossary § Term Definitions](https://github.com/UOR-Foundation/UOR-Framework/wiki/12-Glossary#term-definitions)
57//!
58//! # Constraints
59//!
60//! - **TC-02** — the morphism-kind traits are sealed by foundation; no
61//!   downstream extension is permitted
62//! - **TC-04** — the kind classification participates in compile-time
63//!   UORassembly enforcement (a `Grounding` impl whose `Map` does not
64//!   inhabit [`GroundingMapKind`] fails to compile)
65//! - **ADR-017** — addresses are content-deterministic; the catalog is
66//!   operational, not declarative
67//!
68//! # C4 placement
69//!
70//! Component `standard type library` (Level 3) inside container `prism`
71//! (Level 2). It is consumed by application authors implementing
72//! [`uor_foundation::enforcement::Grounding`] or
73//! [`uor_foundation::enforcement::Sinking`].
74//!
75//! # Behavior
76//!
77//! ```rust
78//! // Given: the ten morphism-kind marker types
79//! // When:  each is used as a phantom type parameter
80//! // Then:  the foundation's sealed trait family classifies them
81//! //        identically to the foundation's own use sites
82//! use prism::std_types::{
83//!     BinaryGroundingMap, BinaryProjectionMap, DigestGroundingMap,
84//!     DigestProjectionMap, IntegerGroundingMap, IntegerProjectionMap,
85//!     JsonGroundingMap, JsonProjectionMap, Utf8GroundingMap,
86//!     Utf8ProjectionMap,
87//! };
88//! fn _accepts_grounding<M: prism::std_types::GroundingMapKind>() {}
89//! fn _accepts_projection<M: prism::std_types::ProjectionMapKind>() {}
90//! _accepts_grounding::<BinaryGroundingMap>();
91//! _accepts_grounding::<DigestGroundingMap>();
92//! _accepts_grounding::<IntegerGroundingMap>();
93//! _accepts_grounding::<JsonGroundingMap>();
94//! _accepts_grounding::<Utf8GroundingMap>();
95//! _accepts_projection::<BinaryProjectionMap>();
96//! _accepts_projection::<DigestProjectionMap>();
97//! _accepts_projection::<IntegerProjectionMap>();
98//! _accepts_projection::<JsonProjectionMap>();
99//! _accepts_projection::<Utf8ProjectionMap>();
100//!
101//! // And: the structural marker traits classify each kind as the
102//! // ontology declares. `BinaryGroundingMap` is total and invertible;
103//! // `IntegerGroundingMap` additionally preserves structure; the
104//! // foundation rejects (at compile time) any attempt to claim a
105//! // structural property a kind does not carry.
106//! use prism::std_types::{Invertible, PreservesStructure, Total};
107//! fn _total_invertible<M: prism::std_types::GroundingMapKind + Total + Invertible>() {}
108//! fn _preserves_structure<M: prism::std_types::GroundingMapKind + PreservesStructure>() {}
109//! _total_invertible::<BinaryGroundingMap>();
110//! _total_invertible::<IntegerGroundingMap>();
111//! _preserves_structure::<IntegerGroundingMap>();
112//! _preserves_structure::<JsonGroundingMap>();
113//! _preserves_structure::<Utf8GroundingMap>();
114//! ```
115
116pub use uor_foundation::enforcement::{
117    BinaryGroundingMap, BinaryProjectionMap, DigestGroundingMap, DigestProjectionMap,
118    GroundingMapKind, IntegerGroundingMap, IntegerProjectionMap, JsonGroundingMap,
119    JsonProjectionMap, MorphismKind, ProjectionMapKind, Utf8GroundingMap, Utf8ProjectionMap,
120};
121
122// Sealed structural marker traits that classify morphism kinds. Authors
123// use these in trait bounds to require, for example, an invertible
124// grounding map without naming the concrete kind. The traits are
125// foundation-sealed; downstream cannot add new structural classes.
126pub use uor_foundation::enforcement::{Invertible, PreservesMetric, PreservesStructure, Total};
127
128// The two sealed `GroundedValue` variants returned by `Grounding` impls,
129// plus their sealed marker traits. `GroundedValue` is the closed set
130// of permitted intermediates (`GroundedCoord` and `GroundedTuple<N>`);
131// `GroundedShape` is the closed-set bound on the `T` of `Grounded<T>`.
132pub use uor_foundation::enforcement::{GroundedCoord, GroundedShape, GroundedTuple, GroundedValue};
133
134// `ConstrainedTypeInput` is the foundation's pre-declared canonical
135// constrained-type shape: a built-in `ConstrainedTypeShape` impl that
136// participates in the principal data path without the application
137// author having to declare a fresh shape. It is the closest thing the
138// standard type library has to a "prelude" type and is the canonical
139// example used in the trace-replay round-trip scenario.
140pub use uor_foundation::enforcement::ConstrainedTypeInput;
141
142// `CartesianProductShape` is the foundation's canonical
143// `ConstrainedTypeShape` for products of two component shapes (added in
144// uor-foundation 0.3.1). It routes nerve-Betti computation through
145// Künneth composition of component Betti profiles rather than flat
146// pair-enumeration. Selecting it in a `result_type::<P>()` call admits
147// a CartesianPartitionProduct unit through the principal data path.
148pub use uor_foundation::pipeline::kunneth_compose;
149pub use uor_foundation::pipeline::CartesianProductShape;
150
151// Partition-algebra evidence, witness, and mint-input families. These
152// are the cross-crate construction inputs and outputs for product,
153// coproduct, and Cartesian-product partitions added by foundation
154// 0.3.1's Product/Coproduct Completion Amendment. `PartitionResolver`,
155// `PartitionRecord`, `PartitionHandle`, and `NullPartition` are the
156// runtime-side carriers; `*Evidence`, `*Witness`, and `*MintInputs`
157// classify the verified-mint bundles.
158pub use uor_foundation::enforcement::{
159    CartesianProductEvidence, CartesianProductMintInputs, CartesianProductWitness, NullPartition,
160    PartitionCoproductEvidence, PartitionCoproductMintInputs, PartitionCoproductWitness,
161    PartitionHandle, PartitionProductEvidence, PartitionProductMintInputs, PartitionProductWitness,
162    PartitionRecord, PartitionResolver, VerifiedMint,
163};
164
165// `OntologyVerifiedMint` is the sealed mint trait introduced in 0.3.1
166// for ontology-derived Path-2 witnesses. It carries a `HostTypes`-
167// parameterized GAT `Inputs<H>` so witness inputs can hold
168// host-decimal and handle fields without leaking concrete types.
169pub use uor_foundation::OntologyVerifiedMint;
170
171// ---- First-class stdlib types (§ 11 of AGENTS.md) ----
172
173use uor_foundation::pipeline::{ConstrainedTypeShape, ConstraintRef};
174
175/// `FixedSites<N>` — admit exactly `N` sites, unconstrained per-site.
176///
177/// The simplest non-trivial standard-type-library citizen: a generic
178/// `ConstrainedTypeShape` that fixes a site count and imposes no
179/// per-site constraint. It is the parametric building block under any
180/// downstream shape that wants "this many sites, my own grounding
181/// admission decides what each site contains" — for example, a 32-byte
182/// hash output (32 sites at `WittLevel::W8`), an 80-byte Bitcoin block
183/// header (80 sites at `WittLevel::W8`), or a 16-element
184/// integer-vector at `WittLevel::W64`.
185///
186/// At any instantiation, `<FixedSites<N> as ConstrainedTypeShape>::SITE_COUNT == N`
187/// and `<FixedSites<N> as ConstrainedTypeShape>::CONSTRAINTS` is the empty
188/// slice (foundation reads "empty `CONSTRAINTS`" as "unconstrained" per
189/// the trait's normative documentation). The IRI is the foundation's
190/// `ConstrainedType` class IRI — shared across every empty-constraint
191/// stdlib type per [ADR-017][09-adr-017] and the closure rule documented
192/// in this module's header — so instance identity flows entirely
193/// through `(SITE_COUNT, CONSTRAINTS)`.
194///
195/// [09-adr-017]: https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions
196///
197/// # See also
198///
199/// - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
200/// - [Wiki: 09 Architecture Decisions § ADR-017](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
201///
202/// # Constraints
203///
204/// - **TC-01** — admission is a compile-time activity; `SITE_COUNT` and
205///   `CONSTRAINTS` are `const`-evaluable
206/// - **TC-04** — bilateral compile-time enforcement: a downstream
207///   author who consumes `FixedSites<N>` cannot violate the contract
208///   without the toolchain rejecting their program
209/// - **ADR-013** — closure under `uor-foundation`: the body uses only
210///   foundation vocabulary (`ConstrainedTypeShape`, `ConstraintRef`)
211/// - **ADR-017** — content-addressed identity: the
212///   `(IRI, SITE_COUNT, CONSTRAINTS)` triple deterministically encodes
213///   each instantiation
214///
215/// # Behavior
216///
217/// ```rust
218/// // Given: a fixed-32-sites shape
219/// // When:  its trait constants are read
220/// // Then:  SITE_COUNT reflects N and CONSTRAINTS is empty
221/// use prism::pipeline::ConstrainedTypeShape;
222/// use prism::std_types::FixedSites;
223/// assert_eq!(<FixedSites<32> as ConstrainedTypeShape>::SITE_COUNT, 32);
224/// assert!(<FixedSites<32> as ConstrainedTypeShape>::CONSTRAINTS.is_empty());
225/// assert_eq!(
226///     <FixedSites<32> as ConstrainedTypeShape>::IRI,
227///     "https://uor.foundation/type/ConstrainedType",
228/// );
229/// // And: a different N produces a distinct content-address — same
230/// // IRI, different SITE_COUNT — so the (IRI, SITE_COUNT, CONSTRAINTS)
231/// // triple distinguishes the two instantiations.
232/// assert_eq!(<FixedSites<80> as ConstrainedTypeShape>::SITE_COUNT, 80);
233/// assert_eq!(
234///     <FixedSites<80> as ConstrainedTypeShape>::IRI,
235///     <FixedSites<32> as ConstrainedTypeShape>::IRI,
236/// );
237/// ```
238pub struct FixedSites<const N: usize>;
239
240impl<const N: usize> ConstrainedTypeShape for FixedSites<N> {
241    const IRI: &'static str = "https://uor.foundation/type/ConstrainedType";
242    const SITE_COUNT: usize = N;
243    const CONSTRAINTS: &'static [ConstraintRef] = &[];
244    // ADR-032: cardinality of the value-set under the discrete-clock
245    // model. Empty-constraint shapes at W8 semantics carry 256 values
246    // per site; `cartesian_product_shape` (homogeneous power) raises
247    // the per-site cycle to `SITE_COUNT` saturating. `FixedSites<0>`
248    // collapses to the identity (`CYCLE_SIZE = 1`), matching
249    // `ConstrainedTypeInput` and the foundation convention. The
250    // truncation of `N: usize` to `u32` is harmless: SITE_COUNT values
251    // that approach `u32::MAX` would already overflow `u64` and
252    // saturate to `u64::MAX` long before the cast loses information.
253    #[allow(clippy::cast_possible_truncation)]
254    const CYCLE_SIZE: u64 = 256u64.saturating_pow(N as u32);
255}
256
257/// `Bytes<N>` — byte-buffer admission intent of width `N`.
258///
259/// Structurally identical to [`FixedSites<N>`] and content-address-
260/// identical at equal `N` (closure rule: same constraint declaration ⇒
261/// same IRI ⇒ same UOR address). Use `Bytes<N>` when the unit's intent
262/// is "this is a byte sequence" and `FixedSites<N>` when the intent is
263/// "this is a generic site container of width N"; the Rust type name
264/// distinguishes intent at the call site, the IRI does not.
265///
266/// # See also
267///
268/// - [`crate::std_types`] — the family contract and IRI namespace
269/// - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
270/// - [AGENTS.md § 11](../../../AGENTS.md#11-standard-type-library-policy)
271///
272/// # Constraints
273///
274/// - **TC-01** — admission is compile-time
275/// - **TC-04** — bilateral compile-time enforcement
276/// - **ADR-013** — closure under `uor-foundation`
277/// - **ADR-017** — content-addressed identity via the IRI
278///
279/// # Behavior
280///
281/// ```rust
282/// use prism::pipeline::ConstrainedTypeShape;
283/// use prism::std_types::{Bytes, FixedSites};
284/// // Same SITE_COUNT and same IRI as FixedSites<N> per closure.
285/// assert_eq!(<Bytes<32> as ConstrainedTypeShape>::SITE_COUNT, 32);
286/// assert_eq!(
287///     <Bytes<32> as ConstrainedTypeShape>::IRI,
288///     "https://uor.foundation/type/ConstrainedType",
289/// );
290/// assert_eq!(
291///     <Bytes<32> as ConstrainedTypeShape>::IRI,
292///     <FixedSites<32> as ConstrainedTypeShape>::IRI,
293/// );
294/// ```
295pub struct Bytes<const N: usize>;
296
297impl<const N: usize> ConstrainedTypeShape for Bytes<N> {
298    const IRI: &'static str = "https://uor.foundation/type/ConstrainedType";
299    const SITE_COUNT: usize = N;
300    const CONSTRAINTS: &'static [ConstraintRef] = &[];
301    // ADR-032: per closure, identical to `FixedSites<N>`. Truncation
302    // bounded as in `FixedSites<N>` above.
303    #[allow(clippy::cast_possible_truncation)]
304    const CYCLE_SIZE: u64 = 256u64.saturating_pow(N as u32);
305}
306
307// ---- Typed primitives (baseline per AGENTS.md § 11.4) ----
308//
309// Each typed primitive is a unit struct that impls `ConstrainedTypeShape`
310// with a stable IRI under `uor.foundation/prism/std_types/<TypeName>`,
311// `SITE_COUNT` set to its byte width when used at `WittLevel::W8`, and
312// empty `CONSTRAINTS`. Value-level invariants (IEEE 754 well-formedness,
313// `Bool ∈ {0, 1}`, UTF-32 codepoint validity) are host-side decisions
314// enforced by the application's `Grounding` impl per the family contract
315// laid out in this module's docs and in AGENTS.md § 11.
316
317macro_rules! typed_primitive {
318    (
319        $(#[$brief:meta])*
320        $name:ident, $iri:literal, $sites:literal
321    ) => {
322        $(#[$brief])*
323        ///
324        /// # See also
325        ///
326        /// - [`crate::std_types`] for the family contract and IRI namespace.
327        /// - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
328        /// - [AGENTS.md § 11](../../../AGENTS.md#11-standard-type-library-policy)
329        ///
330        /// # Constraints
331        ///
332        /// - **TC-01** — admission is compile-time
333        /// - **TC-04** — bilateral compile-time enforcement
334        /// - **ADR-013** — closure under `uor-foundation`
335        /// - **ADR-017** — content-addressed identity via the IRI
336        ///
337        /// # Behavior
338        ///
339        /// ```rust
340        /// use prism::pipeline::ConstrainedTypeShape;
341        #[doc = concat!("use prism::std_types::", stringify!($name), ";")]
342        #[doc = concat!(
343            "assert_eq!(<", stringify!($name), " as ConstrainedTypeShape>::SITE_COUNT, ",
344            stringify!($sites), ");"
345        )]
346        #[doc = concat!(
347            "assert_eq!(<", stringify!($name), " as ConstrainedTypeShape>::IRI, \"", $iri, "\");"
348        )]
349        #[doc = concat!(
350            "assert!(<", stringify!($name), " as ConstrainedTypeShape>::CONSTRAINTS.is_empty());"
351        )]
352        /// ```
353        pub struct $name;
354
355        impl ConstrainedTypeShape for $name {
356            const IRI: &'static str = $iri;
357            const SITE_COUNT: usize = $sites;
358            const CONSTRAINTS: &'static [ConstraintRef] = &[];
359            // ADR-032: 256-per-site at W8 raised to SITE_COUNT, saturating.
360            const CYCLE_SIZE: u64 = 256u64.saturating_pow($sites as u32);
361        }
362    };
363}
364
365// Unsigned integers — byte-aligned widths from 8 to 256 bits.
366typed_primitive!(
367    /// Unsigned 8-bit integer (1 byte at `WittLevel::W8`).
368    U8, "https://uor.foundation/type/ConstrainedType", 1
369);
370typed_primitive!(
371    /// Unsigned 16-bit integer (2 bytes at `WittLevel::W8`).
372    U16, "https://uor.foundation/type/ConstrainedType", 2
373);
374typed_primitive!(
375    /// Unsigned 32-bit integer (4 bytes at `WittLevel::W8`).
376    /// Width of a Bitcoin block-header nonce.
377    U32, "https://uor.foundation/type/ConstrainedType", 4
378);
379typed_primitive!(
380    /// Unsigned 64-bit integer (8 bytes at `WittLevel::W8`).
381    U64, "https://uor.foundation/type/ConstrainedType", 8
382);
383typed_primitive!(
384    /// Unsigned 128-bit integer (16 bytes at `WittLevel::W8`).
385    U128, "https://uor.foundation/type/ConstrainedType", 16
386);
387typed_primitive!(
388    /// Unsigned 256-bit integer (32 bytes at `WittLevel::W8`).
389    /// Width of a SHA-256 output and a Bitcoin difficulty target.
390    U256, "https://uor.foundation/type/ConstrainedType", 32
391);
392
393// Signed integers — same byte widths, distinct IRIs to self-document
394// signed admission intent.
395typed_primitive!(
396    /// Signed 8-bit integer (1 byte at `WittLevel::W8`).
397    I8, "https://uor.foundation/type/ConstrainedType", 1
398);
399typed_primitive!(
400    /// Signed 16-bit integer (2 bytes at `WittLevel::W8`).
401    I16, "https://uor.foundation/type/ConstrainedType", 2
402);
403typed_primitive!(
404    /// Signed 32-bit integer (4 bytes at `WittLevel::W8`).
405    I32, "https://uor.foundation/type/ConstrainedType", 4
406);
407typed_primitive!(
408    /// Signed 64-bit integer (8 bytes at `WittLevel::W8`).
409    I64, "https://uor.foundation/type/ConstrainedType", 8
410);
411typed_primitive!(
412    /// Signed 128-bit integer (16 bytes at `WittLevel::W8`).
413    I128, "https://uor.foundation/type/ConstrainedType", 16
414);
415typed_primitive!(
416    /// Signed 256-bit integer (32 bytes at `WittLevel::W8`).
417    I256, "https://uor.foundation/type/ConstrainedType", 32
418);
419
420// IEEE 754 floating-point — IEEE well-formedness (NaN, subnormal
421// handling) is the application's `Grounding` impl's responsibility.
422typed_primitive!(
423    /// IEEE 754 binary32 floating-point (4 bytes at `WittLevel::W8`).
424    /// Well-formedness (NaN, subnormal, and infinity policy) is enforced
425    /// host-side by the application's `Grounding` impl.
426    F32, "https://uor.foundation/type/ConstrainedType", 4
427);
428typed_primitive!(
429    /// IEEE 754 binary64 floating-point (8 bytes at `WittLevel::W8`).
430    /// Well-formedness is enforced host-side.
431    F64, "https://uor.foundation/type/ConstrainedType", 8
432);
433
434// Boolean — value-in-{0, 1} contract is enforced host-side; the
435// distinct IRI separates `Bool` from `U8` at the content-address level.
436typed_primitive!(
437    /// Boolean (1 byte at `WittLevel::W8`). The value-in-{0, 1} contract
438    /// is enforced host-side by the application's `Grounding` impl;
439    /// the distinct IRI separates `Bool` from `U8` at the content-address
440    /// level.
441    Bool, "https://uor.foundation/type/ConstrainedType", 1
442);
443
444// Character — UTF-32 codepoint width; Unicode validity is host-side.
445typed_primitive!(
446    /// Unicode codepoint (4 bytes at `WittLevel::W8`, UTF-32 width).
447    /// Unicode validity (codepoint range, surrogate exclusion) is
448    /// enforced host-side by the application's `Grounding` impl.
449    Char, "https://uor.foundation/type/ConstrainedType", 4
450);
451
452// ---- Decentralized publication-graph shapes ----
453//
454// The Prism standard library's catalog gains structural shapes for
455// decentralized content-addressing networks built atop UOR-native
456// primitives. Per the framework's commitments:
457//
458// - `UorTime` (foundation, re-exported as `prism::vocabulary::UorTime`)
459//   supplies substrate-independent temporal ordering via the joint
460//   Landauer-budget and rewrite-step partial order, with
461//   `UorTime::min_wall_clock` under a `Calibration` deriving the
462//   provable physical lower-bound wall-clock duration.
463// - `SignatureAxis` (re-exported as `prism::crypto::SignatureAxis`)
464//   supplies signing/verification per wiki ADR-031.
465// - `CommitmentAxis` (re-exported as `prism::crypto::CommitmentAxis`)
466//   supplies commitment surfaces (Merkle, Pedersen, KZG) per
467//   wiki ADR-031.
468// - `FheAxis` (re-exported as `prism::fhe::FheAxis`) supplies
469//   homomorphic-encryption surface per wiki ADR-031.
470//
471// `RouteShape` and `RevocationShape` are the structural shape
472// identities applications use to publish route declarations on a
473// decentralized data bus and to revoke previously-published routes.
474// Per `AGENTS.md § 11.3`'s closure rule, the shapes carry no
475// semantic content beyond their `(IRI, SITE_COUNT, CONSTRAINTS)`
476// triple; the Rust type-name distinction is the developer-facing
477// surface. Applications give the sites meaning through their
478// realization's canonicalize discipline. The const-generic
479// parameters fix the per-component byte widths the application's
480// realization commits to, so the type-system distinguishes
481// instances whose component widths differ.
482
483/// A publication-graph **route declaration** shape — the structural
484/// type identity an application uses to publish a route from a
485/// content κ-label to a service endpoint over a `UorTime` validity
486/// window, witnessed by a signature κ-label and bound to a
487/// commitment-root κ-label.
488///
489/// Per `AGENTS.md § 11.1`, the shape carries no operation logic and
490/// no resolvers — it is the typed-distinction surface only. The
491/// application's realization supplies the operational semantics:
492/// the canonicalize function that serializes the five components
493/// into the shape's `SITE_COUNT` sites, the `SignatureAxis` impl
494/// that authenticates the signature κ-label, the `CommitmentAxis`
495/// impl that verifies the commitment-root κ-label, and the
496/// `Calibration` that interprets the time-pair's physical bounds.
497///
498/// The five const-generic parameters fix the per-component byte
499/// widths:
500///
501/// - `TARGET_LABEL_BYTES` — the κ-label being routed
502///   (71 for sha256/blake3, 73 for sha3-256, 74 for keccak256;
503///   see `uor_addr::hash::label_bytes`).
504/// - `ENDPOINT_BYTES` — application-encoded service endpoint width;
505///   application-policy (e.g., 32 for a fixed-width peer identifier,
506///   wider for a multiaddr).
507/// - `TIME_PAIR_BYTES` — width of the realization's encoding of the
508///   `(valid-from, valid-until)` `UorTime` pair. The foundation
509///   exposes no fixed wire format for `UorTime`; the realization
510///   architect commits the encoding (e.g., big-endian f64 + big-endian
511///   u64 per value, yielding 32 bytes; or a compact varint encoding
512///   yielding less).
513/// - `SIG_LABEL_BYTES` — the signature κ-label width (per chosen σ-axis).
514/// - `COMMIT_LABEL_BYTES` — the commitment-root κ-label width
515///   (per chosen σ-axis).
516///
517/// `SITE_COUNT` is the sum of all five widths. The Rust type system
518/// distinguishes `RouteShape<A,B,C,D,E>` from any
519/// `RouteShape<A',B',C',D',E'>` with different widths, even when
520/// `SITE_COUNT` is numerically equal — this is the
521/// type-system-level naming that gives applications a typed handle
522/// distinguishing route declarations from other shapes carrying the
523/// same byte count.
524///
525/// The shape's IRI is `https://uor.foundation/type/ConstrainedType`
526/// per the closure rule (`AGENTS.md § 11.3`) — empty-`CONSTRAINTS`
527/// shapes share the foundation's class IRI.
528///
529/// # See also
530///
531/// - [`crate::std_types`] for the family contract and IRI namespace.
532/// - [`crate::vocabulary::UorTime`] for the temporal-ordering primitive.
533/// - [`crate::crypto::SignatureAxis`] for signature verification.
534/// - [`crate::crypto::CommitmentAxis`] for commitment proofs.
535/// - [`crate::fhe::FheAxis`] for content-ciphertext composition.
536/// - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
537/// - [Wiki: 09 Architecture Decisions § ADR-031](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
538/// - [AGENTS.md § 11](../../../AGENTS.md#11-standard-type-library-policy)
539///
540/// # Constraints
541///
542/// - **TC-01** — admission is compile-time.
543/// - **TC-04** — bilateral compile-time enforcement.
544/// - **ADR-013** — closure under `uor-foundation`.
545/// - **ADR-017** — content-addressed identity via the IRI.
546/// - **ADR-031** — composes with `prism-crypto` + `prism-fhe` Layer-3 axes.
547///
548/// # Behavior
549///
550/// ```rust
551/// use prism::pipeline::ConstrainedTypeShape;
552/// use prism::std_types::RouteShape;
553///
554/// // Given an application committing the sha256 σ-axis across all three
555/// // κ-label positions, a 32-byte peer-id endpoint, and a 32-byte
556/// // time-pair encoding (big-endian f64 + big-endian u64 per value):
557/// type R = RouteShape<71, 32, 32, 71, 71>;
558/// // When SITE_COUNT is queried,
559/// // Then it equals the sum of the five widths.
560/// assert_eq!(<R as ConstrainedTypeShape>::SITE_COUNT, 71 + 32 + 32 + 71 + 71);
561/// // And the shape shares the closure-under-foundation class IRI.
562/// assert_eq!(
563///     <R as ConstrainedTypeShape>::IRI,
564///     "https://uor.foundation/type/ConstrainedType",
565/// );
566/// // And carries no embedded constraints.
567/// assert!(<R as ConstrainedTypeShape>::CONSTRAINTS.is_empty());
568///
569/// // Given a different application choosing keccak256 across the κ-labels:
570/// type RK = RouteShape<74, 32, 32, 74, 74>;
571/// // When SITE_COUNT is queried,
572/// // Then the shape widens to reflect the wider keccak256 labels.
573/// assert_eq!(<RK as ConstrainedTypeShape>::SITE_COUNT, 74 + 32 + 32 + 74 + 74);
574/// ```
575pub struct RouteShape<
576    const TARGET_LABEL_BYTES: usize,
577    const ENDPOINT_BYTES: usize,
578    const TIME_PAIR_BYTES: usize,
579    const SIG_LABEL_BYTES: usize,
580    const COMMIT_LABEL_BYTES: usize,
581>;
582
583impl<
584        const TARGET_LABEL_BYTES: usize,
585        const ENDPOINT_BYTES: usize,
586        const TIME_PAIR_BYTES: usize,
587        const SIG_LABEL_BYTES: usize,
588        const COMMIT_LABEL_BYTES: usize,
589    > ConstrainedTypeShape
590    for RouteShape<
591        TARGET_LABEL_BYTES,
592        ENDPOINT_BYTES,
593        TIME_PAIR_BYTES,
594        SIG_LABEL_BYTES,
595        COMMIT_LABEL_BYTES,
596    >
597{
598    const IRI: &'static str = "https://uor.foundation/type/ConstrainedType";
599    const SITE_COUNT: usize = TARGET_LABEL_BYTES
600        + ENDPOINT_BYTES
601        + TIME_PAIR_BYTES
602        + SIG_LABEL_BYTES
603        + COMMIT_LABEL_BYTES;
604    const CONSTRAINTS: &'static [ConstraintRef] = &[];
605    // ADR-032: empty-constraint shape at W8 semantics — 256 values per site,
606    // raised to SITE_COUNT saturating. Same path as `Bytes<N>`/`FixedSites<N>`.
607    #[allow(clippy::cast_possible_truncation)]
608    const CYCLE_SIZE: u64 = 256u64.saturating_pow(Self::SITE_COUNT as u32);
609}
610
611/// A publication-graph **revocation declaration** shape — the
612/// structural type identity an application uses to revoke a
613/// previously-published [`RouteShape`].
614///
615/// A revocation carries the same five-component surface as the route
616/// it revokes, plus one additional κ-label position: the κ-label of
617/// the route being revoked. The revocation's own `(valid-from,
618/// valid-until)` `UorTime` pair determines from when the revocation
619/// is in effect; the revocation's signature κ-label authenticates
620/// the revocation per the publishing node's identity discipline.
621///
622/// A revocation supersedes the route it references when, under the
623/// application's `Calibration`, the revocation's `valid-from`
624/// `UorTime` is `>=` the targeted route's `valid-from` per the
625/// partial-order of `UorTime`. Two parties evaluating the same
626/// (route, revocation) pair under the same `Calibration` reach the
627/// same supersession decision — substrate-independent per the
628/// `UorTime` discipline.
629///
630/// The first five const-generic parameters mirror [`RouteShape`]'s
631/// per-component widths; `REVOKED_LABEL_BYTES` is the κ-label width
632/// of the route being revoked (which may differ from
633/// `TARGET_LABEL_BYTES` if the revoking publisher uses a different
634/// σ-axis than the original publisher).
635///
636/// `SITE_COUNT` is the sum of the six widths. As with [`RouteShape`],
637/// the Rust type system distinguishes a `RevocationShape` from any
638/// `RouteShape` even when their `SITE_COUNT` values are numerically
639/// equal.
640///
641/// # See also
642///
643/// - [`RouteShape`] for the route declaration this revokes.
644/// - [`crate::std_types`] for the family contract and IRI namespace.
645/// - [`crate::vocabulary::UorTime`] for the temporal-ordering primitive.
646/// - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
647/// - [Wiki: 09 Architecture Decisions § ADR-031](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
648/// - [AGENTS.md § 11](../../../AGENTS.md#11-standard-type-library-policy)
649///
650/// # Constraints
651///
652/// - **TC-01** — admission is compile-time.
653/// - **TC-04** — bilateral compile-time enforcement.
654/// - **ADR-013** — closure under `uor-foundation`.
655/// - **ADR-017** — content-addressed identity via the IRI.
656/// - **ADR-031** — composes with `prism-crypto` Layer-3 axes.
657///
658/// # Behavior
659///
660/// ```rust
661/// use prism::pipeline::ConstrainedTypeShape;
662/// use prism::std_types::{RevocationShape, RouteShape};
663///
664/// // Given a route shape and a same-axis revocation shape over it:
665/// type ROUTE = RouteShape<71, 32, 32, 71, 71>;
666/// type REV   = RevocationShape<71, 32, 32, 71, 71, 71>;
667/// // When the revocation's SITE_COUNT is queried,
668/// // Then it equals the route's SITE_COUNT plus the revoked-label width.
669/// assert_eq!(
670///     <REV as ConstrainedTypeShape>::SITE_COUNT,
671///     <ROUTE as ConstrainedTypeShape>::SITE_COUNT + 71,
672/// );
673/// // And the revocation shares the closure-under-foundation class IRI.
674/// assert_eq!(
675///     <REV as ConstrainedTypeShape>::IRI,
676///     "https://uor.foundation/type/ConstrainedType",
677/// );
678/// // And carries no embedded constraints.
679/// assert!(<REV as ConstrainedTypeShape>::CONSTRAINTS.is_empty());
680/// ```
681pub struct RevocationShape<
682    const TARGET_LABEL_BYTES: usize,
683    const ENDPOINT_BYTES: usize,
684    const TIME_PAIR_BYTES: usize,
685    const SIG_LABEL_BYTES: usize,
686    const COMMIT_LABEL_BYTES: usize,
687    const REVOKED_LABEL_BYTES: usize,
688>;
689
690impl<
691        const TARGET_LABEL_BYTES: usize,
692        const ENDPOINT_BYTES: usize,
693        const TIME_PAIR_BYTES: usize,
694        const SIG_LABEL_BYTES: usize,
695        const COMMIT_LABEL_BYTES: usize,
696        const REVOKED_LABEL_BYTES: usize,
697    > ConstrainedTypeShape
698    for RevocationShape<
699        TARGET_LABEL_BYTES,
700        ENDPOINT_BYTES,
701        TIME_PAIR_BYTES,
702        SIG_LABEL_BYTES,
703        COMMIT_LABEL_BYTES,
704        REVOKED_LABEL_BYTES,
705    >
706{
707    const IRI: &'static str = "https://uor.foundation/type/ConstrainedType";
708    const SITE_COUNT: usize = TARGET_LABEL_BYTES
709        + ENDPOINT_BYTES
710        + TIME_PAIR_BYTES
711        + SIG_LABEL_BYTES
712        + COMMIT_LABEL_BYTES
713        + REVOKED_LABEL_BYTES;
714    const CONSTRAINTS: &'static [ConstraintRef] = &[];
715    #[allow(clippy::cast_possible_truncation)]
716    const CYCLE_SIZE: u64 = 256u64.saturating_pow(Self::SITE_COUNT as u32);
717}
718
719// ---- Composition shapes (ADR-061) ----
720//
721// The Prism standard library's catalog gains five `ConstrainedTypeShape`
722// impls realizing the categorical operations on the Atlas image inside
723// E₈ per wiki ADR-059's codomain-structure commitment. Each shape is
724// the typed-input identity for a composition realization in uor-addr
725// (the 10th realization, joining json, sexp, xml, asn1, ring,
726// codemodule, gguf, onnx, cbor).
727//
728// Per wiki ADR-061's structural commitment, each categorical operation
729// on the Atlas IS a composition shape — not a marker type parameterizing
730// a separate shape. The Rust type system distinguishes the five shapes;
731// each shape's `SITE_COUNT` formula reflects its natural arity per
732// ADR-059's construction:
733//
734// - G₂ via product (Klein quartet × ℤ/3 → 12 roots, rank 2): binary
735//   product. `G2ProductShape::SITE_COUNT = 2 × N`.
736// - F₄ via quotient (96 / ± mirror symmetry → 48 sign classes, rank 4):
737//   unary quotient. `F4QuotientShape::SITE_COUNT = N`.
738// - E₆ via filtration (64 degree-5 + 8 degree-6 vertices → 72 roots,
739//   rank 6): unary filtration. `E6FiltrationShape::SITE_COUNT = N`.
740// - E₇ via augmentation (96 vertices + 30 S₄ orbits → 126 roots,
741//   rank 7): unary augmentation. `E7AugmentationShape::SITE_COUNT = N`.
742// - E₈ via direct embedding (φ: Atlas ↪ E₈ injective → 240 roots,
743//   rank 8): unary direct embedding. `E8EmbeddingShape::SITE_COUNT = N`.
744//
745// Multi-operand compositions of arity > 2 iterate via
746// `ConstraintRef::Recurse` per ADR-057 — a three-operand product
747// decomposes into two iterated `G2ProductShape` applications. The
748// per-shape canonical ordering is the realization architect's
749// commitment (the uor-addr composition realization), grounded in the
750// operation's algebraic structure; the framework commits the
751// constraint, the realization commits the exact rule.
752
753/// `G₂-via-product` composition shape — the binary product
754/// construction on the Atlas image inside E₈ per wiki [ADR-059]'s
755/// categorical-operation vocabulary.
756///
757/// G₂ is the rank-2 exceptional Lie algebra reached from the Atlas by
758/// the Klein quartet × ℤ/3 construction (12 roots). As a categorical
759/// operation, G₂ is a *product* of two algebraic objects — the shape
760/// is therefore binary by structural necessity:
761/// `SITE_COUNT = 2 × COMPONENT_LABEL_BYTES`. Two operand κ-labels at
762/// the chosen σ-axis byte width concatenate in the canonical order
763/// the realization architect commits to (typically lexicographic for
764/// symmetric operands).
765///
766/// The composed κ-label produced by the corresponding uor-addr
767/// composition realization addresses the operand pair under the G₂
768/// product's algebraic identity. Cross-substrate convergence holds
769/// per ADR-058 + ADR-059 + ADR-061: two substrates composing the same
770/// two operands under the same σ-axis emit byte-identical composed
771/// κ-labels.
772///
773/// # See also
774///
775/// - [`crate::std_types`] for the family contract and IRI namespace.
776/// - [`F4QuotientShape`] / [`E6FiltrationShape`] /
777///   [`E7AugmentationShape`] / [`E8EmbeddingShape`] for the other
778///   four categorical operations on the Atlas.
779/// - [`crate::convergence`] for the convergence-tower vocabulary
780///   ADR-059 commits.
781/// - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
782/// - [Wiki: 09 Architecture Decisions § ADR-059](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
783/// - [Wiki: 09 Architecture Decisions § ADR-061](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
784/// - [AGENTS.md § 11](../../../AGENTS.md#11-standard-type-library-policy)
785///
786/// # Constraints
787///
788/// - **TC-01** — admission is compile-time.
789/// - **TC-04** — bilateral compile-time enforcement.
790/// - **ADR-013** — closure under `uor-foundation`.
791/// - **ADR-017** — content-addressed identity via the IRI.
792/// - **ADR-058** — κ-derivation produces the composed κ-label.
793/// - **ADR-059** — codomain factors through the Atlas image inside E₈.
794/// - **ADR-061** — operational composition surface for κ-labels.
795///
796/// # Behavior
797///
798/// ```rust
799/// use prism::pipeline::ConstrainedTypeShape;
800/// use prism::std_types::G2ProductShape;
801///
802/// // Given a binary G₂ product over two sha256 κ-labels (71 bytes each),
803/// type G = G2ProductShape<71>;
804/// // When SITE_COUNT is queried,
805/// // Then it equals 2 × 71 — the binary product's structural width.
806/// assert_eq!(<G as ConstrainedTypeShape>::SITE_COUNT, 2 * 71);
807/// assert_eq!(
808///     <G as ConstrainedTypeShape>::IRI,
809///     "https://uor.foundation/type/ConstrainedType",
810/// );
811/// assert!(<G as ConstrainedTypeShape>::CONSTRAINTS.is_empty());
812/// ```
813pub struct G2ProductShape<const COMPONENT_LABEL_BYTES: usize>;
814
815impl<const COMPONENT_LABEL_BYTES: usize> ConstrainedTypeShape
816    for G2ProductShape<COMPONENT_LABEL_BYTES>
817{
818    const IRI: &'static str = "https://uor.foundation/type/ConstrainedType";
819    const SITE_COUNT: usize = 2 * COMPONENT_LABEL_BYTES;
820    const CONSTRAINTS: &'static [ConstraintRef] = &[];
821    #[allow(clippy::cast_possible_truncation)]
822    const CYCLE_SIZE: u64 = 256u64.saturating_pow(Self::SITE_COUNT as u32);
823}
824
825/// `F₄-via-quotient` composition shape — the unary quotient
826/// construction on the Atlas image inside E₈ per wiki [ADR-059]'s
827/// categorical-operation vocabulary.
828///
829/// F₄ is the rank-4 exceptional Lie algebra reached from the Atlas by
830/// the 96 / ± mirror-symmetry quotient (48 sign classes). As a
831/// categorical operation, F₄ is a *quotient* of one Atlas structure
832/// under mirror symmetry — the shape is therefore unary by structural
833/// necessity: `SITE_COUNT = COMPONENT_LABEL_BYTES`. A single operand
834/// κ-label is canonicalized into its mirror-symmetry equivalence
835/// class before σ-projection.
836///
837/// The composed κ-label addresses the operand's equivalence class
838/// under the quotient, not the operand directly. Two operands that
839/// are mirror-symmetric per the realization's commitment compose to
840/// byte-identical composed κ-labels.
841///
842/// # See also
843///
844/// - [`crate::std_types`] for the family contract and IRI namespace.
845/// - [`G2ProductShape`] / [`E6FiltrationShape`] /
846///   [`E7AugmentationShape`] / [`E8EmbeddingShape`] for the other
847///   four categorical operations on the Atlas.
848/// - [`crate::convergence`] for the convergence-tower vocabulary
849///   ADR-059 commits.
850/// - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
851/// - [Wiki: 09 Architecture Decisions § ADR-059](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
852/// - [Wiki: 09 Architecture Decisions § ADR-061](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
853/// - [AGENTS.md § 11](../../../AGENTS.md#11-standard-type-library-policy)
854///
855/// # Constraints
856///
857/// - **TC-01** — admission is compile-time.
858/// - **TC-04** — bilateral compile-time enforcement.
859/// - **ADR-013** — closure under `uor-foundation`.
860/// - **ADR-017** — content-addressed identity via the IRI.
861/// - **ADR-058** — κ-derivation produces the composed κ-label.
862/// - **ADR-059** — codomain factors through the Atlas image inside E₈.
863/// - **ADR-061** — operational composition surface for κ-labels.
864///
865/// # Behavior
866///
867/// ```rust
868/// use prism::pipeline::ConstrainedTypeShape;
869/// use prism::std_types::F4QuotientShape;
870///
871/// // Given a unary F₄ quotient over one sha256 κ-label (71 bytes),
872/// type F = F4QuotientShape<71>;
873/// // When SITE_COUNT is queried,
874/// // Then it equals the operand width — F₄'s quotient is unary.
875/// assert_eq!(<F as ConstrainedTypeShape>::SITE_COUNT, 71);
876/// assert_eq!(
877///     <F as ConstrainedTypeShape>::IRI,
878///     "https://uor.foundation/type/ConstrainedType",
879/// );
880/// assert!(<F as ConstrainedTypeShape>::CONSTRAINTS.is_empty());
881/// ```
882pub struct F4QuotientShape<const COMPONENT_LABEL_BYTES: usize>;
883
884impl<const COMPONENT_LABEL_BYTES: usize> ConstrainedTypeShape
885    for F4QuotientShape<COMPONENT_LABEL_BYTES>
886{
887    const IRI: &'static str = "https://uor.foundation/type/ConstrainedType";
888    const SITE_COUNT: usize = COMPONENT_LABEL_BYTES;
889    const CONSTRAINTS: &'static [ConstraintRef] = &[];
890    #[allow(clippy::cast_possible_truncation)]
891    const CYCLE_SIZE: u64 = 256u64.saturating_pow(Self::SITE_COUNT as u32);
892}
893
894/// `E₆-via-filtration` composition shape — the unary filtration
895/// construction on the Atlas image inside E₈ per wiki [ADR-059]'s
896/// categorical-operation vocabulary.
897///
898/// E₆ is the rank-6 exceptional Lie algebra reached from the Atlas by
899/// the degree-partition filtration (64 degree-5 vertices + 8 degree-6
900/// vertices → 72 roots). As a categorical operation, E₆ is a
901/// *filtration* of one Atlas structure by vertex degree — the shape
902/// is therefore unary by structural necessity:
903/// `SITE_COUNT = COMPONENT_LABEL_BYTES`. A single operand κ-label is
904/// canonicalized with respect to the realization's commitment to the
905/// degree-partition before σ-projection.
906///
907/// The composed κ-label respects the filtration's degree-partition
908/// structure. Two operands whose canonical forms admit the same
909/// degree-partition compose to byte-identical composed κ-labels.
910///
911/// # See also
912///
913/// - [`crate::std_types`] for the family contract and IRI namespace.
914/// - [`G2ProductShape`] / [`F4QuotientShape`] /
915///   [`E7AugmentationShape`] / [`E8EmbeddingShape`] for the other
916///   four categorical operations on the Atlas.
917/// - [`crate::convergence`] for the convergence-tower vocabulary
918///   ADR-059 commits.
919/// - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
920/// - [Wiki: 09 Architecture Decisions § ADR-059](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
921/// - [Wiki: 09 Architecture Decisions § ADR-061](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
922/// - [AGENTS.md § 11](../../../AGENTS.md#11-standard-type-library-policy)
923///
924/// # Constraints
925///
926/// - **TC-01** — admission is compile-time.
927/// - **TC-04** — bilateral compile-time enforcement.
928/// - **ADR-013** — closure under `uor-foundation`.
929/// - **ADR-017** — content-addressed identity via the IRI.
930/// - **ADR-058** — κ-derivation produces the composed κ-label.
931/// - **ADR-059** — codomain factors through the Atlas image inside E₈.
932/// - **ADR-061** — operational composition surface for κ-labels.
933///
934/// # Behavior
935///
936/// ```rust
937/// use prism::pipeline::ConstrainedTypeShape;
938/// use prism::std_types::E6FiltrationShape;
939///
940/// // Given a unary E₆ filtration over one sha256 κ-label (71 bytes),
941/// type E6 = E6FiltrationShape<71>;
942/// // When SITE_COUNT is queried,
943/// // Then it equals the operand width — E₆'s filtration is unary.
944/// assert_eq!(<E6 as ConstrainedTypeShape>::SITE_COUNT, 71);
945/// assert_eq!(
946///     <E6 as ConstrainedTypeShape>::IRI,
947///     "https://uor.foundation/type/ConstrainedType",
948/// );
949/// assert!(<E6 as ConstrainedTypeShape>::CONSTRAINTS.is_empty());
950/// ```
951pub struct E6FiltrationShape<const COMPONENT_LABEL_BYTES: usize>;
952
953impl<const COMPONENT_LABEL_BYTES: usize> ConstrainedTypeShape
954    for E6FiltrationShape<COMPONENT_LABEL_BYTES>
955{
956    const IRI: &'static str = "https://uor.foundation/type/ConstrainedType";
957    const SITE_COUNT: usize = COMPONENT_LABEL_BYTES;
958    const CONSTRAINTS: &'static [ConstraintRef] = &[];
959    #[allow(clippy::cast_possible_truncation)]
960    const CYCLE_SIZE: u64 = 256u64.saturating_pow(Self::SITE_COUNT as u32);
961}
962
963/// `E₇-via-augmentation` composition shape — the unary augmentation
964/// construction on the Atlas image inside E₈ per wiki [ADR-059]'s
965/// categorical-operation vocabulary.
966///
967/// E₇ is the rank-7 exceptional Lie algebra reached from the Atlas by
968/// the S₄-orbit augmentation (96 vertices + 30 S₄ orbits → 126 roots).
969/// As a categorical operation, E₇ is an *augmentation* of one Atlas
970/// structure with S₄-orbit data — the shape is therefore unary by
971/// structural necessity: `SITE_COUNT = COMPONENT_LABEL_BYTES`. The
972/// augmentation data is part of the realization's canonical-form
973/// derivation, internal to the canonicalize function, not an
974/// additional operand position.
975///
976/// The composed κ-label respects the augmentation's S₄-orbit structure.
977///
978/// # See also
979///
980/// - [`crate::std_types`] for the family contract and IRI namespace.
981/// - [`G2ProductShape`] / [`F4QuotientShape`] /
982///   [`E6FiltrationShape`] / [`E8EmbeddingShape`] for the other
983///   four categorical operations on the Atlas.
984/// - [`crate::convergence`] for the convergence-tower vocabulary
985///   ADR-059 commits.
986/// - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
987/// - [Wiki: 09 Architecture Decisions § ADR-059](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
988/// - [Wiki: 09 Architecture Decisions § ADR-061](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
989/// - [AGENTS.md § 11](../../../AGENTS.md#11-standard-type-library-policy)
990///
991/// # Constraints
992///
993/// - **TC-01** — admission is compile-time.
994/// - **TC-04** — bilateral compile-time enforcement.
995/// - **ADR-013** — closure under `uor-foundation`.
996/// - **ADR-017** — content-addressed identity via the IRI.
997/// - **ADR-058** — κ-derivation produces the composed κ-label.
998/// - **ADR-059** — codomain factors through the Atlas image inside E₈.
999/// - **ADR-061** — operational composition surface for κ-labels.
1000///
1001/// # Behavior
1002///
1003/// ```rust
1004/// use prism::pipeline::ConstrainedTypeShape;
1005/// use prism::std_types::E7AugmentationShape;
1006///
1007/// // Given a unary E₇ augmentation over one sha256 κ-label (71 bytes),
1008/// type E7 = E7AugmentationShape<71>;
1009/// // When SITE_COUNT is queried,
1010/// // Then it equals the operand width — E₇'s augmentation is unary.
1011/// assert_eq!(<E7 as ConstrainedTypeShape>::SITE_COUNT, 71);
1012/// assert_eq!(
1013///     <E7 as ConstrainedTypeShape>::IRI,
1014///     "https://uor.foundation/type/ConstrainedType",
1015/// );
1016/// assert!(<E7 as ConstrainedTypeShape>::CONSTRAINTS.is_empty());
1017/// ```
1018pub struct E7AugmentationShape<const COMPONENT_LABEL_BYTES: usize>;
1019
1020impl<const COMPONENT_LABEL_BYTES: usize> ConstrainedTypeShape
1021    for E7AugmentationShape<COMPONENT_LABEL_BYTES>
1022{
1023    const IRI: &'static str = "https://uor.foundation/type/ConstrainedType";
1024    const SITE_COUNT: usize = COMPONENT_LABEL_BYTES;
1025    const CONSTRAINTS: &'static [ConstraintRef] = &[];
1026    #[allow(clippy::cast_possible_truncation)]
1027    const CYCLE_SIZE: u64 = 256u64.saturating_pow(Self::SITE_COUNT as u32);
1028}
1029
1030/// `E₈-via-direct-embedding` composition shape — the universal
1031/// embedding construction on the Atlas image inside E₈ per wiki
1032/// [ADR-059]'s categorical-operation vocabulary.
1033///
1034/// E₈ is the rank-8 exceptional Lie algebra reached from the Atlas by
1035/// the direct embedding φ: Atlas ↪ E₈ (injective, adjacency-preserving,
1036/// 240 roots). As a categorical operation, E₈ is the *direct embedding*
1037/// of one Atlas structure into the full E₈ root system — the shape is
1038/// therefore unary by structural necessity:
1039/// `SITE_COUNT = COMPONENT_LABEL_BYTES`. The embedding is the universal
1040/// target — any single operand factors through E₈ without further
1041/// algebraic constraint per ADR-059's Atlas-as-initial-object commitment.
1042///
1043/// The composed κ-label addresses the operand's E₈ image directly.
1044/// Two operands at the same Atlas-image position modulo E₈ Weyl-orbit
1045/// equivalence compose to byte-identical composed κ-labels under
1046/// fixed σ-axis selection per ADR-047.
1047///
1048/// # See also
1049///
1050/// - [`crate::std_types`] for the family contract and IRI namespace.
1051/// - [`G2ProductShape`] / [`F4QuotientShape`] /
1052///   [`E6FiltrationShape`] / [`E7AugmentationShape`] for the other
1053///   four categorical operations on the Atlas.
1054/// - [`crate::convergence`] for the convergence-tower vocabulary
1055///   ADR-059 commits.
1056/// - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
1057/// - [Wiki: 09 Architecture Decisions § ADR-059](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
1058/// - [Wiki: 09 Architecture Decisions § ADR-061](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
1059/// - [AGENTS.md § 11](../../../AGENTS.md#11-standard-type-library-policy)
1060///
1061/// # Constraints
1062///
1063/// - **TC-01** — admission is compile-time.
1064/// - **TC-04** — bilateral compile-time enforcement.
1065/// - **ADR-013** — closure under `uor-foundation`.
1066/// - **ADR-017** — content-addressed identity via the IRI.
1067/// - **ADR-058** — κ-derivation produces the composed κ-label.
1068/// - **ADR-059** — codomain factors through the Atlas image inside E₈.
1069/// - **ADR-061** — operational composition surface for κ-labels.
1070///
1071/// # Behavior
1072///
1073/// ```rust
1074/// use prism::pipeline::ConstrainedTypeShape;
1075/// use prism::std_types::E8EmbeddingShape;
1076///
1077/// // Given a unary E₈ direct embedding over one sha256 κ-label (71 bytes),
1078/// type E8 = E8EmbeddingShape<71>;
1079/// // When SITE_COUNT is queried,
1080/// // Then it equals the operand width — E₈'s direct embedding is unary.
1081/// assert_eq!(<E8 as ConstrainedTypeShape>::SITE_COUNT, 71);
1082/// assert_eq!(
1083///     <E8 as ConstrainedTypeShape>::IRI,
1084///     "https://uor.foundation/type/ConstrainedType",
1085/// );
1086/// assert!(<E8 as ConstrainedTypeShape>::CONSTRAINTS.is_empty());
1087/// ```
1088pub struct E8EmbeddingShape<const COMPONENT_LABEL_BYTES: usize>;
1089
1090impl<const COMPONENT_LABEL_BYTES: usize> ConstrainedTypeShape
1091    for E8EmbeddingShape<COMPONENT_LABEL_BYTES>
1092{
1093    const IRI: &'static str = "https://uor.foundation/type/ConstrainedType";
1094    const SITE_COUNT: usize = COMPONENT_LABEL_BYTES;
1095    const CONSTRAINTS: &'static [ConstraintRef] = &[];
1096    #[allow(clippy::cast_possible_truncation)]
1097    const CYCLE_SIZE: u64 = 256u64.saturating_pow(Self::SITE_COUNT as u32);
1098}