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