uor_addr/composition/mod.rs
1//! **`uor_addr::composition` — the five categorical operations on the
2//! Atlas image inside E₈** (wiki [ADR-061]).
3//!
4//! UOR-ADDR addresses *content*; this module addresses *compositions of
5//! content*. Each operation takes one or two operand κ-labels and mints a
6//! new κ-label for the composed object, by:
7//!
8//! 1. **canonicalize** ([`canonicalize`]) — apply the operation's
9//! byte-level discipline to the operand digest bytes (ADR-061 §(3); the
10//! realization commitment per CA-5);
11//! 2. **ground** — fold the canonical form through the same σ-axis the
12//! operands carry (CA-3 σ-axis homogeneity), via a per-operation
13//! [`PrismModel`](prism::pipeline::PrismModel) whose output shape's IRI
14//! records the operation's provenance (ADR-001 / ADR-017 typed-iso).
15//!
16//! The framework (ADR-061 §(3), ADR-059) names each operation's algebraic
17//! structure; the realization commits the specific byte-level relation
18//! that implements it:
19//!
20//! | op | algebraic structure (framework) | byte-level discipline (realization) |
21//! |----|----------------------------------|-------------------------------------|
22//! | [`g2`] CS-G2 | commutative binary product (ADR-059) | lex-min-first concatenation |
23//! | [`f4`] CS-F4 | 2-element equivalence relation (± mirror) | bitwise-complement lex-min |
24//! | [`e6`] CS-E6 | 2-class partition, 8:1 population (ADR-059) | `first_byte mod 9` degree tag |
25//! | [`e7`] CS-E7 | 24-element equivalence relation (S₄ orbit) | quarter-permutation lex-min |
26//! | [`e8`] CS-E8 | identity relation | identity on canonical-form bytes |
27//!
28//! Every operation is offered on each of the five σ-axes ([`crate::hash`]);
29//! the operand and composed κ-labels share the axis.
30//!
31//! [ADR-061]: https://github.com/UOR-Foundation/UOR-Framework/wiki/ADR-061
32
33#![cfg(feature = "alloc")]
34
35pub mod canonicalize;
36pub mod e6;
37pub mod e7;
38pub mod e8;
39pub mod f4;
40pub mod g2;
41
42pub use e6::{
43 compose_e6_filtration, compose_e6_filtration_blake3, compose_e6_filtration_keccak256,
44 compose_e6_filtration_sha3_256, compose_e6_filtration_sha512,
45};
46pub use e7::{
47 compose_e7_augmentation, compose_e7_augmentation_blake3, compose_e7_augmentation_keccak256,
48 compose_e7_augmentation_sha3_256, compose_e7_augmentation_sha512,
49};
50pub use e8::{
51 compose_e8_embedding, compose_e8_embedding_blake3, compose_e8_embedding_keccak256,
52 compose_e8_embedding_sha3_256, compose_e8_embedding_sha512,
53};
54pub use f4::{
55 compose_f4_quotient, compose_f4_quotient_blake3, compose_f4_quotient_keccak256,
56 compose_f4_quotient_sha3_256, compose_f4_quotient_sha512,
57};
58pub use g2::{
59 compose_g2_product, compose_g2_product_blake3, compose_g2_product_keccak256,
60 compose_g2_product_sha3_256, compose_g2_product_sha512,
61};
62
63/// Failure modes from the composition operations.
64#[derive(Debug, Clone, Copy, PartialEq, Eq)]
65pub enum CompositionFailure {
66 /// An operand is not a well-formed κ-label (no `:` separator, an
67 /// odd-length or non-lowercase-hex digest body).
68 MalformedOperand,
69 /// An operand's σ-axis does not match the operation's axis (CA-3
70 /// σ-axis homogeneity). For the binary product, this also fires when
71 /// the two operands carry different axes.
72 OperandSigmaAxisMismatch {
73 /// The σ-axis the operation expects.
74 expected_axis: &'static str,
75 /// The σ-axis the offending operand carries.
76 operand_axis: &'static str,
77 },
78 /// Defensive: foundation's catamorphism or a resolver returned a shape
79 /// violation. Unreachable for well-formed operands.
80 PipelineFailure,
81}