use crate::enums::GroundingPhase;
use crate::enums::SessionBoundaryType;
use crate::Primitives;
pub trait Context<P: Primitives> {
type Binding: Binding<P>;
fn binding(&self) -> &[Self::Binding];
fn capacity(&self) -> P::PositiveInteger;
fn content_address(&self) -> &P::String;
fn witt_length(&self) -> P::PositiveInteger;
fn grounding_degree(&self) -> P::Decimal;
fn context_temperature(&self) -> P::Decimal;
fn is_grounded(&self) -> P::Boolean;
fn grounding_phase(&self) -> GroundingPhase;
fn residual_free_count(&self) -> P::NonNegativeInteger;
}
pub trait Binding<P: Primitives> {
type Element: crate::kernel::address::Element<P>;
fn address(&self) -> &Self::Element;
type Datum: crate::kernel::schema::Datum<P>;
fn content(&self) -> &Self::Datum;
type TypeDefinition: crate::user::type_::TypeDefinition<P>;
fn bound_type(&self) -> &[Self::TypeDefinition];
fn timestamp(&self) -> &P::String;
}
pub trait Frame<P: Primitives> {
type Binding: Binding<P>;
fn active_bindings(&self) -> &[Self::Binding];
type Context: Context<P>;
fn context(&self) -> &Self::Context;
type Constraint: crate::user::type_::Constraint<P>;
fn constraint(&self) -> &Self::Constraint;
}
pub trait Transition<P: Primitives> {
type Context: Context<P>;
fn from(&self) -> &Self::Context;
fn to(&self) -> &Self::Context;
type Binding: Binding<P>;
fn added_bindings(&self) -> &[Self::Binding];
fn removed_bindings(&self) -> &[Self::Binding];
type ComputationTrace: crate::bridge::trace::ComputationTrace<P>;
fn trace(&self) -> &Self::ComputationTrace;
type TopologicalDelta: crate::user::morphism::TopologicalDelta<P>;
fn topological_snapshot(&self) -> &Self::TopologicalDelta;
}
pub trait Session<P: Primitives> {
type Context: Context<P>;
fn session_bindings(&self) -> &Self::Context;
fn session_queries(&self) -> P::NonNegativeInteger;
}
pub trait BindingAccumulator<P: Primitives> {
type FreeRank: crate::bridge::partition::FreeRank<P>;
fn aggregate_site_deficit(&self) -> &Self::FreeRank;
type Binding: Binding<P>;
fn accumulated_bindings(&self) -> &[Self::Binding];
}
pub trait SessionBoundary<P: Primitives> {
fn boundary_reason(&self) -> &P::String;
fn boundary_type(&self) -> SessionBoundaryType;
type Context: Context<P>;
fn prior_context(&self) -> &Self::Context;
fn fresh_context(&self) -> &Self::Context;
}
pub trait GroundedContext<P: Primitives>: Context<P> {
type GroundingCertificate: crate::bridge::cert::GroundingCertificate<P>;
fn grounding_certificate(&self) -> &Self::GroundingCertificate;
}
pub trait GroundingWitness<P: Primitives> {
type Binding: Binding<P>;
fn witness_binding(&self) -> &[Self::Binding];
fn witness_step(&self) -> P::NonNegativeInteger;
}
pub trait DomainGroundingRecord<P: Primitives> {
type GroundedContext: GroundedContext<P>;
fn grounded_context(&self) -> &Self::GroundedContext;
type TypeDefinition: crate::user::type_::TypeDefinition<P>;
fn grounded_domain(&self) -> &Self::TypeDefinition;
fn domain_free_count(&self) -> P::NonNegativeInteger;
}
pub trait SharedContext<P: Primitives>: Context<P> {
type ContextLease: ContextLease<P>;
fn lease_set(&self) -> &[Self::ContextLease];
}
pub trait ContextLease<P: Primitives> {
type FreeRank: crate::bridge::partition::FreeRank<P>;
fn leased_sites(&self) -> &Self::FreeRank;
type Session: Session<P>;
fn lease_holder(&self) -> &Self::Session;
}
pub trait SessionComposition<P: Primitives> {
type Session: Session<P>;
fn composed_from(&self) -> &[Self::Session];
fn composition_compatible(&self) -> P::Boolean;
type Context: Context<P>;
fn composition_result(&self) -> &Self::Context;
fn tower_consistency_verified(&self) -> P::Boolean;
}
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 {
pub const CONTEXT_TEMPERATURE: &str = "0.0";
pub const GROUNDING_DEGREE: &str = "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;
}