use crate::enums::GroundingPhase;
use crate::enums::SessionBoundaryType;
use crate::HostTypes;
pub trait Context<H: HostTypes> {
type Binding: Binding<H>;
fn binding(&self) -> &[Self::Binding];
fn capacity(&self) -> u64;
fn content_address(&self) -> &H::HostString;
fn witt_length(&self) -> u64;
fn grounding_degree(&self) -> H::Decimal;
fn context_temperature(&self) -> H::Decimal;
fn is_grounded(&self) -> bool;
fn grounding_phase(&self) -> GroundingPhase;
fn residual_free_count(&self) -> u64;
}
pub trait Binding<H: HostTypes> {
type Element: crate::kernel::address::Element<H>;
fn address(&self) -> &Self::Element;
type Datum: crate::kernel::schema::Datum<H>;
fn content(&self) -> &Self::Datum;
type TypeDefinition: crate::user::type_::TypeDefinition<H>;
fn bound_type(&self) -> &[Self::TypeDefinition];
fn timestamp(&self) -> &H::WitnessBytes;
}
pub trait Frame<H: HostTypes> {
type Binding: Binding<H>;
fn active_bindings(&self) -> &[Self::Binding];
type Context: Context<H>;
fn context(&self) -> &Self::Context;
type Constraint: crate::user::type_::Constraint<H>;
fn constraint(&self) -> &Self::Constraint;
}
pub trait Transition<H: HostTypes> {
type Context: Context<H>;
fn from(&self) -> &Self::Context;
fn to(&self) -> &Self::Context;
type Binding: Binding<H>;
fn added_bindings(&self) -> &[Self::Binding];
fn removed_bindings(&self) -> &[Self::Binding];
type ComputationTrace: crate::bridge::trace::ComputationTrace<H>;
fn trace(&self) -> &Self::ComputationTrace;
type TopologicalDelta: crate::user::morphism::TopologicalDelta<H>;
fn topological_snapshot(&self) -> &Self::TopologicalDelta;
}
pub trait Session<H: HostTypes> {
type Context: Context<H>;
fn session_bindings(&self) -> &Self::Context;
fn session_queries(&self) -> u64;
}
pub trait BindingAccumulator<H: HostTypes> {
type FreeRank: crate::bridge::partition::FreeRank<H>;
fn aggregate_site_deficit(&self) -> &Self::FreeRank;
type Binding: Binding<H>;
fn accumulated_bindings(&self) -> &[Self::Binding];
}
pub trait SessionBoundary<H: HostTypes> {
fn boundary_reason(&self) -> &H::HostString;
fn boundary_type(&self) -> SessionBoundaryType;
type Context: Context<H>;
fn prior_context(&self) -> &Self::Context;
fn fresh_context(&self) -> &Self::Context;
}
pub trait GroundedContext<H: HostTypes>: Context<H> {
type Triad: crate::kernel::schema::Triad<H>;
fn grounded_triad(&self) -> &Self::Triad;
}
pub trait GroundingWitness<H: HostTypes> {
type Binding: Binding<H>;
fn witness_binding(&self) -> &[Self::Binding];
fn witness_step(&self) -> u64;
}
pub trait DomainGroundingRecord<H: HostTypes> {
type GroundedContext: GroundedContext<H>;
fn grounded_context(&self) -> &Self::GroundedContext;
type TypeDefinition: crate::user::type_::TypeDefinition<H>;
fn grounded_domain(&self) -> &Self::TypeDefinition;
fn domain_free_count(&self) -> u64;
}
pub trait SharedContext<H: HostTypes>: Context<H> {
type ContextLease: ContextLease<H>;
fn lease_set(&self) -> &[Self::ContextLease];
}
pub trait ContextLease<H: HostTypes> {
type FreeRank: crate::bridge::partition::FreeRank<H>;
fn leased_sites(&self) -> &Self::FreeRank;
type Session: Session<H>;
fn lease_holder(&self) -> &Self::Session;
fn linear_site(&self) -> u64;
fn lease_scope(&self) -> &H::HostString;
}
pub trait SessionComposition<H: HostTypes> {
type Session: Session<H>;
fn composed_from(&self) -> &[Self::Session];
fn composition_compatible(&self) -> bool;
type Context: Context<H>;
fn composition_result(&self) -> &Self::Context;
fn tower_consistency_verified(&self) -> bool;
}
pub mod explicit_reset {}
pub mod convergence_boundary {}
pub mod contradiction_boundary {}
pub mod open {}
pub mod partial_grounding {}
pub mod full_grounding {}
pub mod ground_state {
#[allow(clippy::approx_constant)]
pub const CONTEXT_TEMPERATURE: f64 = 0.0;
#[allow(clippy::approx_constant)]
pub const GROUNDING_DEGREE: f64 = 1.0;
pub const GROUNDING_PHASE: &str = "https://uor.foundation/state/FullGrounding";
pub const IS_GROUNDED: bool = true;
pub const RESIDUAL_FREE_COUNT: i64 = 0;
}