pub enum Term {
Show 21 variants
Literal {
value: TermValue,
level: WittLevel,
},
Variable {
name_index: u32,
},
Application {
operator: PrimitiveOp,
args: TermList,
},
Lift {
operand_index: u32,
target: WittLevel,
},
Project {
operand_index: u32,
target: WittLevel,
},
Match {
scrutinee_index: u32,
arms: TermList,
},
Recurse {
measure_index: u32,
base_index: u32,
step_index: u32,
},
Unfold {
seed_index: u32,
step_index: u32,
},
Try {
body_index: u32,
handler_index: u32,
},
AxisInvocation {
axis_index: u32,
kernel_id: u32,
input_index: u32,
},
ProjectField {
source_index: u32,
byte_offset: u32,
byte_length: u32,
},
FirstAdmit {
domain_size_index: u32,
predicate_index: u32,
},
Nerve {
value_index: u32,
},
ChainComplex {
simplicial_index: u32,
},
HomologyGroups {
chain_index: u32,
},
Betti {
homology_index: u32,
},
CochainComplex {
chain_index: u32,
},
CohomologyGroups {
cochain_index: u32,
},
PostnikovTower {
simplicial_index: u32,
},
HomotopyGroups {
postnikov_index: u32,
},
KInvariants {
homotopy_index: u32,
},
}Expand description
Concrete AST node for the UOR term language.
Mirrors the EBNF grammar productions. All child references are
indices into a TermArena, keeping the AST stack-resident and
#![no_std]-safe.
§Examples
use uor_foundation::enforcement::{Term, TermList};
use uor_foundation::{WittLevel, PrimitiveOp};
// Literal: an integer value tagged with a Witt level.
let lit = uor_foundation::pipeline::literal_u64(42, WittLevel::W8);
// Application: an operation applied to arguments.
// `args` is a TermList { start, len } pointing into a TermArena.
let app = Term::Application {
operator: PrimitiveOp::Mul,
args: TermList { start: 0, len: 2 },
};
// Lift: canonical injection from a lower to a higher Witt level.
let lift = Term::Lift { operand_index: 0, target: WittLevel::new(32) };
// Project: canonical surjection from a higher to a lower level.
let proj = Term::Project { operand_index: 0, target: WittLevel::W8 };Variants§
Literal
Integer literal with Witt level annotation. Per ADR-051 the value
carrier is a TermValue byte sequence whose length matches the declared
level’s byte width. Use uor_foundation::pipeline::literal_u64(value, level)
to construct a literal from a u64 value (the narrow form).
Fields
Variable
Variable reference by name index.
Application
Operation application: operator applied to arguments.
Fields
operator: PrimitiveOpThe primitive operation to apply.
Lift
Lift: canonical injection W_n to W_m (n < m, lossless).
Fields
Project
Project: canonical surjection W_m to W_n (m > n, lossy).
Fields
Match
Match expression with pattern-result pairs.
Fields
Recurse
Bounded recursion with descent measure.
Fields
Unfold
Stream construction via unfold.
Try
Try expression with failure recovery.
AxisInvocation
Substitution-axis-realized verb projection (wiki ADR-029 + ADR-030).
Delegates evaluation to the application’s AxisTuple substitution-axis
impl: the catamorphism evaluates the input subtree, dispatches the
axis at axis_index to the kernel identified by kernel_id, and
emits the kernel’s output as the result. Emitted by
prism_model! from the closure-body form hash(input) (ADR-026 G19,
which lowers to AxisInvocation against the application’s HashAxis).
Fields
ProjectField
Field-access projection over a partition_product input (wiki
ADR-033 G20). The catamorphism’s fold-rule evaluates source
and slices [byte_offset .. byte_offset + byte_length] from
the resulting bytes. Emitted by prism_model! and verb!
from the closure-body forms <expr>.<index> and
<expr>.<field_name> (named-field access requires the
partition_product! declaration to use the named-field form).
Coproduct field-access is rejected at macro-expansion time.
Fields
FirstAdmit
Bounded search with structural early termination (wiki ADR-034).
The catamorphism iterates idx from 0 up to (but excluding) the
evaluated domain_size; for each iteration it evaluates
predicate with FIRST_ADMIT_IDX_NAME_INDEX bound to idx.
On the first non-zero predicate result the fold emits the
coproduct value (0x01, idx_bytes) and terminates iteration; if
no idx admits, the fold emits (0x00, idx-width zero bytes).
Emitted by prism_model! and verb! from the closure-body
form first_admit(<DomainTy>, |idx| <pred>) (ADR-026 G16; the
lowering target shifted from Term::Recurse to Term::FirstAdmit
per ADR-034’s structural-search commitment).
Fields
Nerve
ψ_1 (wiki ADR-035): nerve construction — Constraints → SimplicialComplex.
Lowered from the closure-body form nerve(<value_expr>) (G21).
Resolver-bound: consults the ResolverTuple’s NerveResolver per ADR-036.
Fields
ChainComplex
ψ_2 (wiki ADR-035): chain functor — SimplicialComplex → ChainComplex.
Lowered from chain_complex(<simplicial_expr>) (G22).
Resolver-bound: ChainComplexResolver per ADR-036.
HomologyGroups
ψ_3 (wiki ADR-035): homology functor — ChainComplex → HomologyGroups.
H_k(C) = ker(∂_k) / im(∂_{k+1}).
Lowered from homology_groups(<chain_expr>) (G23).
Resolver-bound: HomologyGroupResolver per ADR-036.
Betti
ψ_4 (wiki ADR-035): Betti-number extraction — HomologyGroups → BettiNumbers.
Pure computation on resolved homology groups; no resolver consultation.
Lowered from betti(<homology_expr>) (G24).
CochainComplex
ψ_5 (wiki ADR-035): dualization functor — ChainComplex → CochainComplex.
C^k = Hom(C_k, R).
Lowered from cochain_complex(<chain_expr>) (G25).
Resolver-bound: CochainComplexResolver per ADR-036.
CohomologyGroups
ψ_6 (wiki ADR-035): cohomology functor — CochainComplex → CohomologyGroups.
H^k(C) = ker(δ^k) / im(δ^{k-1}).
Lowered from cohomology_groups(<cochain_expr>) (G26).
Resolver-bound: CohomologyGroupResolver per ADR-036.
PostnikovTower
ψ_7 (wiki ADR-035): Kan-completion + Postnikov truncation —
SimplicialComplex → PostnikovTower. The PostnikovResolver performs
the Kan-completion internally; verb authors do not need to construct
KanComplex values explicitly.
Lowered from postnikov_tower(<simplicial_expr>) (G27).
Resolver-bound: PostnikovResolver per ADR-036.
HomotopyGroups
ψ_8 (wiki ADR-035): homotopy extraction — PostnikovTower → HomotopyGroups.
π_k from each truncation stage.
Lowered from homotopy_groups(<postnikov_expr>) (G28).
Resolver-bound: HomotopyGroupResolver per ADR-036.
KInvariants
ψ_9 (wiki ADR-035): k-invariant computation — HomotopyGroups → KInvariants.
κ_k classifying the Postnikov tower.
Lowered from k_invariants(<homotopy_expr>) (G29).
Resolver-bound: KInvariantResolver per ADR-036.