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
102
103
104
105
106
107
108
109
110
111
112
113
114
// @generated by uor-crate from uor-ontology — do not edit manually
//! UOR Foundation — typed Rust traits for the complete ontology.
//!
//! Version: 0.2.0
//!
//! This crate exports every ontology class as a trait, every property as a
//! method, and every named individual as a constant. Implementations (like
//! PRISM) import these traits and provide concrete types.
//!
//! # Primitives
//!
//! All traits are generic over [`Primitives`], a type family that lets
//! implementors choose their own concrete representations for XSD types.
//!
//! ```rust,ignore
//! struct MyImpl;
//! impl uor_foundation::Primitives for MyImpl {
//! type String = str;
//! type Integer = i64;
//! type NonNegativeInteger = u64;
//! type PositiveInteger = u64;
//! type Decimal = f64;
//! type Boolean = bool;
//! }
//! ```
//!
//! # Module Structure
//!
//! - [`kernel`] — Immutable foundation: addressing, schema, operations
//! - [`bridge`] — Kernel-computed, user-consumed: queries, resolution, partitions, proofs
//! - [`user`] — Runtime declarations: types, morphisms, state
//!
//! # Enforcement Layer
//!
//! The [`enforcement`] module provides concrete types (not generic over
//! `Primitives`) for declarative validation. These form a three-layer
//! pipeline:
//!
//! **Layer 1 — Opaque Witnesses.** [`enforcement::Datum`],
//! [`enforcement::Validated`], [`enforcement::Derivation`],
//! [`enforcement::FreeRank`]: sealed types with private fields that
//! prove a value passed through the reduction evaluator or the two-phase
//! minting boundary. Prism code consumes these but cannot fabricate them.
//!
//! **Layer 2 — Declarative Builders.** [`enforcement::CompileUnitBuilder`]
//! and 8 others collect the declarations required by each conformance
//! shape, then call `validate()` to get a `Validated<T>` or a
//! [`enforcement::ShapeViolation`] with machine-readable IRIs.
//!
//! **Layer 3 — Term AST.** [`enforcement::Term`] and
//! [`enforcement::TermArena`]: stack-resident, `#![no_std]`-safe
//! expression trees. Builders accept `Term` references (not closures),
//! keeping Prism declarations within the term language.
//!
//! # The `uor!` Macro
//!
//! The re-exported [`uor!`] macro parses EBNF surface syntax at compile
//! time and produces typed `Term` ASTs. Ground assertions (no free
//! variables) are evaluated at compile time using the foundation's
//! `const fn` ring arithmetic.
//!
//! ```rust,ignore
//! use uor_foundation::uor;
//!
//! // Type declaration with constraints:
//! let pixel = uor! { type Pixel { residue: 255; hamming: 8; } };
//!
//! // Operation composition (produces a TermArena):
//! let expr = uor! { add(mul(3, 5), 7) };
//!
//! // Ground assertion — checked at compile time:
//! uor! { assert add(1, 2) = 3; };
//! ```
//!
//! # Getting Started
//!
//! 1. Implement [`Primitives`] for your concrete type family.
//! 2. Use the [`enforcement`] builders to declare your types, effects,
//! and boundaries.
//! 3. Use the [`uor!`] macro for term-language expressions.
//! 4. The reduction evaluator validates and evaluates your declarations,
//! producing [`enforcement::Datum`] and [`enforcement::Derivation`]
//! witnesses.
pub use *;
pub use uor;
/// XSD primitive type family.
/// Implementors choose concrete representations for each XSD type.
/// PRISM might use `u64` for integers at Q0, `u128` at higher quantum
/// levels, or a bignum library. The foundation does not constrain this choice.