uor-foundation 0.1.5

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

//! `parallel/` namespace — Independent computations over provably disjoint fiber budgets. Formalizes when execution order is irrelevant..
//!
//! Space: Kernel

use crate::Primitives;

/// A ∥ B: two computations with provably disjoint fiber targets. Execution order does not affect the result.
pub trait ParallelProduct<P: Primitives> {
    /// Associated type for `MonoidalProduct`.
    type MonoidalProduct: crate::kernel::monoidal::MonoidalProduct<P>;
    /// The left parallel component (itself a sequential computation).
    fn left_computation(&self) -> &Self::MonoidalProduct;
    /// The right parallel component.
    fn right_computation(&self) -> &Self::MonoidalProduct;
    /// Associated type for `DisjointnessCertificate`.
    type DisjointnessCertificate: DisjointnessCertificate<P>;
    /// The certificate proving fiber disjointness.
    fn disjointness_cert(&self) -> &Self::DisjointnessCertificate;
    /// True iff fiber targets have zero overlap (no SynchronizationPoints required).
    fn is_fully_disjoint(&self) -> P::Boolean;
    /// Declares whether this parallel product commutes with disjoint effects per FX_4.
    fn disjointness_commutation(&self) -> P::Boolean;
}

/// A kernel-produced certificate attesting that the fiber targets of two computations are disjoint.
pub trait DisjointnessCertificate<P: Primitives>: crate::bridge::cert::Certificate<P> {
    /// Associated type for `EffectTarget`.
    type EffectTarget: crate::kernel::effect::EffectTarget<P>;
    /// The fiber target of the left computation.
    fn cert_left_target(&self) -> &Self::EffectTarget;
    /// The fiber target of the right computation.
    fn cert_right_target(&self) -> &Self::EffectTarget;
}

/// A point where two parallel computations must agree on shared state before proceeding. Only applicable when parallelism is partial.
pub trait SynchronizationPoint<P: Primitives> {
    /// Associated type for `FiberCoordinate`.
    type FiberCoordinate: crate::bridge::partition::FiberCoordinate<P>;
    /// The shared fibers requiring synchronization.
    fn sync_fibers(&self) -> &[Self::FiberCoordinate];
}

/// A computation trace recording interleaved steps from two parallel computations. Valid iff every interleaving produces the same final context.
pub trait ParallelTrace<P: Primitives>: crate::bridge::trace::ComputationTrace<P> {}

/// A partition of the total fiber budget into disjoint subsets, one per parallel component. The sum of subset cardinalities equals the total fiber budget.
pub trait FiberPartitioning<P: Primitives> {
    /// Associated type for `EffectTarget`.
    type EffectTarget: crate::kernel::effect::EffectTarget<P>;
    /// The disjoint subsets composing the full fiber budget.
    fn partition_components(&self) -> &[Self::EffectTarget];
    /// Number of parallel components.
    fn component_count(&self) -> P::PositiveInteger;
}