1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//! Operation-declaration vocabulary.
//!
//! `operation` exposes the closed primitive vocabulary the application
//! author composes when declaring a constrained type: the [`Term`] AST
//! and its arena ([`TermArena`]), the [`TermList`] container, and the
//! eighteen-element closed set of [`PrimitiveOp`] discriminants (the
//! original fifteen plus `Div`/`Mod`/`Pow` per ADR-053). The
//! [`TermValue`] byte-sequence carrier on `Term::Literal` per ADR-051
//! lets wide-Witt-level literals (up to `TERM_VALUE_MAX_BYTES`) sit
//! directly in the AST.
//!
//! Per ADR-014, `prism`'s `operation` module surfaces the *primitive
//! operation vocabulary* — the closed `PrimitiveOp` set that the
//! catamorphism's per-variant fold-rules evaluate. Application-author
//! operation *libraries* are declared at Layer 3 via the SDK macros
//! `verb!` (ADR-024 — named compositions of prism operators) and
//! `axis!` (ADR-030 — substrate-extension vocabularies); the
//! standard-library Layer-3 sub-crates published from this repository
//! (`prism::{crypto, numerics, tensor, fhe}` per ADR-031) ship the
//! canonical reference impls. The foundation guarantees the closed
//! `PrimitiveOp` set is exhaustive — kind-typed discriminants with no
//! proc-macro back-doors per the substrate's W4 conformance check.
//!
//! # See also
//!
//! - [Wiki: 05 Building Block View § Whitebox `prism`](https://github.com/UOR-Foundation/UOR-Framework/wiki/05-Building-Block-View#whitebox-prism)
//! - [Wiki: 08 Concepts § Operation Declaration](https://github.com/UOR-Foundation/UOR-Framework/wiki/08-Concepts#operation-declaration)
//! - [Wiki: 09 Architecture Decisions § ADR-014](https://github.com/UOR-Foundation/UOR-Framework/wiki/09-Architecture-Decisions)
//!
//! # Constraints
//!
//! - **TC-01** — operation declaration is a compile-time activity; no
//! runtime dispatch is generated for the declared primitives
//! - **TC-04** — the closed set of primitives is part of the
//! bilateral compile-time UORassembly contract
//! - **ADR-014** — `prism`'s `operation` module declares the
//! `PrimitiveOp` vocabulary; operation libraries (verb declarations
//! per ADR-024 + axis declarations per ADR-030) are Layer-3 surfaces
//! the standard-library sub-crates per ADR-031 supply canonical
//! impls for
//!
//! # C4 placement
//!
//! Component `operation declaration` (Level 3) inside container `prism`
//! (Level 2). The vocabulary is consumed by [`crate::pipeline`] and by
//! application-author code that constructs [`Term`] expressions.
//!
//! # Behavior
//!
//! ```rust
//! // Given: the closed set of primitive operations
//! // When: matched exhaustively
//! // Then: every variant is named exactly once and the match compiles
//! use prism::operation::PrimitiveOp;
//! fn _arity_class(op: PrimitiveOp) -> &'static str {
//! match op {
//! PrimitiveOp::Neg | PrimitiveOp::Bnot | PrimitiveOp::Succ | PrimitiveOp::Pred => "unary",
//! PrimitiveOp::Add
//! | PrimitiveOp::Sub
//! | PrimitiveOp::Mul
//! | PrimitiveOp::Xor
//! | PrimitiveOp::And
//! | PrimitiveOp::Or
//! | PrimitiveOp::Le
//! | PrimitiveOp::Lt
//! | PrimitiveOp::Ge
//! | PrimitiveOp::Gt
//! | PrimitiveOp::Concat
//! | PrimitiveOp::Div
//! | PrimitiveOp::Mod
//! | PrimitiveOp::Pow => "binary",
//! }
//! }
//! assert_eq!(_arity_class(PrimitiveOp::Add), "binary");
//! assert_eq!(_arity_class(PrimitiveOp::Neg), "unary");
//!
//! // And: the author-implemented admission and projection traits are
//! // reachable as trait bounds. The generic functions compile only
//! // because `Grounding` and `Sinking` are public traits at this path.
//! use prism::operation::{Grounding, Sinking};
//! fn _accepts_grounding<G: Grounding>() {}
//! fn _accepts_sinking<S: Sinking>() {}
//! ```
pub use TermValue;
pub use PrimitiveOp;
pub use ;
// Author-implemented admission and projection traits. Per ADR-014 these
// are vocabulary the application author composes to declare how host
// bytes are admitted into the principal data path (`Grounding`) and how
// `Grounded<T>` values are projected back to host carriers (`Sinking`).
// `GroundingExt` is the foundation-supplied sealed extension trait that
// drives admission via `ground(host_bytes) -> Option<Self::Output>`.
pub use ;
// `GroundingProgram` is the combinator-builder for `Grounding::program()`,
// the kind-typed program a `Grounding` impl returns. Re-exported so
// authors can name the type without depending on `uor-foundation`'s
// `enforcement` module path directly.
pub use GroundingProgram;