Skip to main content

uor_addr_1/
lib.rs

1//! `uor-addr-1` — the prism implementor for JSON content addressing.
2//!
3//! Content-address derivation end-to-end through prism's typed-iso
4//! surface. The address transform is the canonical k-invariant branch
5//! of the ψ-pipeline (wiki ADR-035) applied to the canonical-form JSON
6//! byte sequence; foundation's catamorphism dispatches each
7//! resolver-bound ψ-stage through [`resolvers::AddressResolverTuple`]
8//! (ADR-036). No σ-enumeration in the verb body per ADR-035's
9//! ψ-residuals discipline.
10//!
11//! ## Validation & verification against the wiki specification
12//!
13//! Each architectural commitment names the wiki ADR or concept it
14//! satisfies. The wiki at
15//! `https://github.com/UOR-Foundation/UOR-Framework/wiki` is the
16//! normative source; this crate is one V&V instance on the JSON
17//! content-addressing problem.
18//!
19//! | Wiki commitment                                            | Crate realisation                                         |
20//! |------------------------------------------------------------|-----------------------------------------------------------|
21//! | ADR-007 / ADR-010 pluggable Hasher (foundation ships none) | [`Sha256Hasher`] (`impl Hasher<32>`, FIPS-180-4)          |
22//! | ADR-018 / ADR-037 HostBounds capacity ceilings             | [`AddrBounds`] (24 ADR-037 constants)                     |
23//! | ADR-020 PrismModel<H, B, A, R> declaration                 | [`AddressModel`] (via `prism_model!`)                     |
24//! | ADR-024 implementation closure (verb!-emitted bodies)      | [`address_inference`] (via `verb!`)                       |
25//! | ADR-027 sealed Output shape (output_shape!-emitted)        | [`AddressLabel`] (via `output_shape!`)                    |
26//! | ADR-035 canonical k-invariants branch ψ_1 → ψ_7 → ψ_8 → ψ_9 | the verb body                                            |
27//! | ADR-035 verb-body ψ-residuals discipline                   | `verbs::tests::verb_arena_contains_no_sigma_residuals`    |
28//! | ADR-036 ResolverTuple (eight resolver categories)          | [`AddressResolverTuple<H>`] (via `resolver!`)             |
29//! | ADR-041 typed-coordinate carriers                          | `SimplicialComplexBytes` … `HomotopyGroupsBytes` chain    |
30//! | ADR-046 resolver-body iterative-resolution discipline      | hash-axis invocation inside [`AddressKInvariantResolver`] |
31//! | TC-02 mechanism sealing                                    | [`AddressWitness`] borrows the sealed `Grounded<…>`       |
32//! | Algebraic closure (ADR-024 / ADR-026)                      | 71 disjoint `Site` constraints; χ(N(C)) = 71 = SITE_COUNT |
33//!
34//! ## Quick reference
35//!
36//! - [`address`] — the public entry point: canonicalises raw JSON
37//!   bytes, builds a [`JsonInput`], and invokes the model's
38//!   `forward()` method (from the foundation `PrismModel` trait).
39//! - [`AddressModel`] — `PrismModel<HostTypes, HostBounds, Hasher,
40//!   ResolverTuple>` whose route is `address_inference(input)`.
41//! - [`JsonInput`] — the canonical-form JCS+NFC JSON byte sequence.
42//! - [`AddressLabel`] — the ψ-pipeline label (71 W8 sites — the
43//!   wire-format `sha256:<64hex>` width).
44//! - [`Sha256Hasher`] — the canonical hash axis (content-addressing
45//!   primitive).
46//! - [`AddrBounds`] — the `HostBounds` profile (`WITT_LEVEL_MAX_BITS = 32`,
47//!   `NERVE_SITES_MAX = 71`).
48
49#![cfg_attr(not(feature = "std"), no_std)]
50#![forbid(unsafe_code)]
51
52extern crate alloc;
53
54pub mod model;
55pub mod ops;
56pub mod pipeline;
57pub mod resolvers;
58pub mod shapes;
59pub mod verbs;
60
61// Public façade — typed surface.
62pub use model::{
63    AddressLabel, AddressModel, AddressRoute, JsonInput, ADDRESS_LABEL_BYTES, JSON_INPUT_MAX_BYTES,
64};
65pub use pipeline::{address, AddressFailure, AddressOutcome, AddressWitness};
66pub use resolvers::{
67    AddressChainComplexResolver, AddressCochainComplexResolver, AddressCohomologyGroupResolver,
68    AddressHomologyGroupResolver, AddressHomotopyGroupResolver, AddressKInvariantResolver,
69    AddressNerveResolver, AddressPostnikovResolver, AddressResolverTuple,
70};
71pub use shapes::{AddrBounds, Sha256Hasher};
72
73// Layer-3 verb declaration. `address_inference_term_arena()` returns
74// the ψ-chain term-tree fragment foundation evaluates.
75pub use verbs::{address_inference, VERB_TERMS_ADDRESS_INFERENCE};
76
77// Boundary helpers — not part of the ψ-pipeline transform.
78pub use ops::canonicalize::jcs_nfc;
79pub use ops::sha256::{sha256, SHA256_INITIAL_STATE};