uor-foundation 0.2.0

UOR Foundation — typed Rust traits for the complete ontology. Import and implement.
Documentation
// @generated by uor-crate from uor-ontology — do not edit manually

//! `monoidal/` namespace — Sequential composition of computations via monoidal product A ⊗ B..
//!
//! Space: Kernel

use crate::Primitives;

/// A ⊗ B: the sequential composition of two computations. Output of A feeds input of B.
pub trait MonoidalProduct<P: Primitives> {
    /// Associated type for `ComputationDatum`.
    type ComputationDatum: crate::user::morphism::ComputationDatum<P>;
    /// The left operand in the monoidal product A ⊗ B.
    fn left_operand(&self) -> &Self::ComputationDatum;
    /// The right operand in the monoidal product A ⊗ B.
    fn right_operand(&self) -> &Self::ComputationDatum;
    /// Associated type for `Datum`.
    type Datum: crate::kernel::schema::Datum<P>;
    /// The result datum of the composed computation A ⊗ B.
    fn composed_result(&self) -> &Self::Datum;
    /// σ(A⊗B) relationship: saturation of the sequential composition.
    fn saturation_value(&self) -> P::Decimal;
}

/// The identity computation I: passes input through unchanged. I ⊗ A ≅ A ≅ A ⊗ I.
pub trait MonoidalUnit<P: Primitives> {
    /// Associated type for `Certificate`.
    type Certificate: crate::bridge::cert::Certificate<P>;
    /// Certificate witnessing I ⊗ A ≅ A ≅ A ⊗ I.
    fn unit_witness_ref(&self) -> &Self::Certificate;
}

/// The witness that (A⊗B)⊗C ≅ A⊗(B⊗C). The associativity isomorphism.
pub trait MonoidalAssociator<P: Primitives> {
    /// Associated type for `MonoidalProduct`.
    type MonoidalProduct: MonoidalProduct<P>;
    /// The left-grouped product (A⊗B)⊗C.
    fn associator_left(&self) -> &Self::MonoidalProduct;
    /// The right-grouped product A⊗(B⊗C).
    fn associator_right(&self) -> &Self::MonoidalProduct;
    /// Associated type for `Certificate`.
    type Certificate: crate::bridge::cert::Certificate<P>;
    /// Certificate witnessing the associativity isomorphism (A⊗B)⊗C ≅ A⊗(B⊗C).
    fn associator_witness_ref(&self) -> &Self::Certificate;
}