Struct KernelProgram
pub struct KernelProgram { /* private fields */ }Description
A completely validated, immutable Semantic Kernel model.
This is the only model form accepted by the reference interpreter. It is
compiled from one Snapshot revision, owns the selected definitions,
and cannot observe later Graph Federation commits.
Implementations§
§impl KernelProgram
impl KernelProgram
pub fn compose_boundary_physical_junction(
&self,
connection: Id<Connection>,
) -> Result<BoundaryJunctionResidual, Diagnostic>
pub fn compose_boundary_physical_junction( &self, connection: Id<Connection>, ) -> Result<BoundaryJunctionResidual, Diagnostic>
Compose trace-continuity and outward-flux-balance roots for one validated boundary-physical Connection.
§Errors
Returns EQ0302 if connection is not a closed field-valued junction
in this immutable program.
§impl KernelProgram
impl KernelProgram
pub fn compose_scalar_physical_subsystem(
&self,
connection: Id<Connection>,
) -> Result<ComposedResidualSystem, Diagnostic>
pub fn compose_scalar_physical_subsystem( &self, connection: Id<Connection>, ) -> Result<ComposedResidualSystem, Diagnostic>
Compose the closed scalar physical subsystem containing connection.
The immutable result is canonical and is the only Phase 1 handoff to later interpreter or Operator-IR execution work.
§Errors
Returns EQ0302 when the selected Connection is not a validated scalar
physical junction in this program.
§impl KernelProgram
impl KernelProgram
pub fn typed_event_guard(
&self,
event: Id<Activation>,
) -> Result<TypedResidual<RawId>, Vec<Diagnostic>>
pub fn typed_event_guard( &self, event: Id<Activation>, ) -> Result<TypedResidual<RawId>, Vec<Diagnostic>>
Reconstruct the exact numeric scalar guard owned by an accepted Event.
This uses the same symbol environment and scalar activation contract as Model admission, retaining the guard’s physical dimension.
§Errors
Rejects an absent or non-Event Activation and preserves typing diagnostics.
§impl KernelProgram
impl KernelProgram
pub fn numerical_residuals(
&self,
relation: RawId,
) -> Result<ExprDag, Diagnostic>
pub fn numerical_residuals( &self, relation: RawId, ) -> Result<ExprDag, Diagnostic>
Derive numerical residuals while retaining original node indices and sharing. Discrete equations have no subtraction projection and must use typed execution.
§Errors
Rejects absent Relations, non-numerical equation sides, or failed typed projection.
§impl KernelProgram
impl KernelProgram
pub fn observable_output_support(
&self,
observable: Id<Observable>,
) -> Result<Option<&SpatialSupport<RawId>>, Diagnostic>
pub fn observable_output_support( &self, observable: Id<Observable>, ) -> Result<Option<&SpatialSupport<RawId>>, Diagnostic>
Exact declared output support; a lumped Observable has none.
§Errors
Rejects an Observable outside this admitted Model.
pub fn evaluate_observable_limits(
&self,
observable: Id<Observable>,
resolve: &mut dyn FnMut(SymbolRef) -> Option<ValueLiteral>,
) -> Result<Option<[DynQuantity; 2]>, Diagnostic>
pub fn evaluate_observable_limits( &self, observable: Id<Observable>, resolve: &mut dyn FnMut(SymbolRef) -> Option<ValueLiteral>, ) -> Result<Option<[DynQuantity; 2]>, Diagnostic>
Evaluate explicit lower/upper mathematical limits using the canonical expression evaluator. This selects only the limit roots; it neither samples the density nor performs quadrature.
§Errors
Rejects foreign Observables, unavailable inputs, non-finite arithmetic and wrong limit units.
pub fn evaluate_finite_observable(
&self,
observable: Id<Observable>,
resolve: &mut dyn FnMut(SymbolRef) -> Option<ValueLiteral>,
) -> Result<ValueLiteral, Diagnostic>
pub fn evaluate_finite_observable( &self, observable: Id<Observable>, resolve: &mut dyn FnMut(SymbolRef) -> Option<ValueLiteral>, ) -> Result<ValueLiteral, Diagnostic>
Evaluate the retained expression of one finite Observable in this exact Model. Symbol values come from the caller’s admitted numerical context; this performs no spatial quadrature or solver acceptance.
§Errors
Rejects foreign Observables, spatial reductions, unavailable symbols, invalid arithmetic and a result that differs from the declared Observable type.
pub fn evaluate_observable_with_points(
&self,
observable: Id<Observable>,
point: Option<&EvaluationPoint>,
resolve: &mut impl FnMut(EvaluationInput, Option<&EvaluationPoint>) -> Result<ValueLiteral, Diagnostic>,
) -> Result<ValueLiteral, Diagnostic>
pub fn evaluate_observable_with_points( &self, observable: Id<Observable>, point: Option<&EvaluationPoint>, resolve: &mut impl FnMut(EvaluationInput, Option<&EvaluationPoint>) -> Result<ValueLiteral, Diagnostic>, ) -> Result<ValueLiteral, Diagnostic>
Evaluate an Observable with exact point contexts for spatial reconstruction. A supported output requires a point on precisely that output support. Arithmetic and conditional demand remain with the canonical evaluator. The callback supplies admitted Field and Parameter values for this evaluation, including probability weights; it must not advance state or infer a representation.
§Errors
Rejects foreign Observables, reductions, invalid coordinates/sides and callback failures.
pub fn evaluate_observable_integrands_with_points(
&self,
observable: Id<Observable>,
point: &EvaluationPoint,
remaining_work: &Cell<usize>,
resolve: &mut impl FnMut(EvaluationInput, Option<&EvaluationPoint>) -> Result<ValueLiteral, Diagnostic>,
) -> Result<Vec<ValueLiteral>, Diagnostic>
pub fn evaluate_observable_integrands_with_points( &self, observable: Id<Observable>, point: &EvaluationPoint, remaining_work: &Cell<usize>, resolve: &mut impl FnMut(EvaluationInput, Option<&EvaluationPoint>) -> Result<ValueLiteral, Diagnostic>, ) -> Result<Vec<ValueLiteral>, Diagnostic>
Evaluate the ordered integrands of a reduction at its exact input point.
Probability moments bind their random variables to the declared continuous
law. This does not draw samples, choose quadrature or evaluate the moment.
remaining_work is shared across quadrature points and recursive input
resolution. The canonical evaluator charges each expression context before
evaluation, including coordinate rebinding and random-variable dependencies.
§Errors
Rejects foreign identities or points, non-integral reductions, unavailable inputs, exhausted shared work and roots differing from their admitted types.
pub fn typed_observable(
&self,
observable: Id<Observable>,
) -> Result<TypedResidual<RawId>, Vec<Diagnostic>>
pub fn typed_observable( &self, observable: Id<Observable>, ) -> Result<TypedResidual<RawId>, Vec<Diagnostic>>
Infer an Observable’s retained expression in this exact Model.
§Errors
Rejects foreign identities or incompatible expression/measure types.
§impl KernelProgram
impl KernelProgram
pub fn evaluate_relation_operands(
&self,
relation: Id<Relation>,
fields: &[(Id<Field>, ValueLiteral)],
parameters: &[(Id<Parameter>, ValueLiteral)],
observables: &[(Id<Observable>, ValueLiteral)],
) -> Result<Vec<ValueLiteral>, Diagnostic>
pub fn evaluate_relation_operands( &self, relation: Id<Relation>, fields: &[(Id<Field>, ValueLiteral)], parameters: &[(Id<Parameter>, ValueLiteral)], observables: &[(Id<Observable>, ValueLiteral)], ) -> Result<Vec<ValueLiteral>, Diagnostic>
Evaluate original ordered Relation operands at exact typed numerical candidates. Unselected Parameters retain their immutable Model values. This evaluates mathematical values; it does not enforce constraints or interpret solver success.
§Errors
Rejects foreign Relations, Fields, Parameters or Observables, duplicate coordinates, wrong candidate types, spatial Observable outputs and unsupported symbols. Observable values are supplied by the numerical realization; this performs no quadrature. Canonical evaluation failures retain the original Relation/expression path.
§impl KernelProgram
impl KernelProgram
pub fn from_snapshot(
snapshot: &Snapshot,
model: OntologyId<Model>,
) -> Result<KernelProgram, Vec<Diagnostic>>
pub fn from_snapshot( snapshot: &Snapshot, model: OntologyId<Model>, ) -> Result<KernelProgram, Vec<Diagnostic>>
Select a ModelView from an immutable snapshot and validate all
cross-node invariants required for execution.
Validation is diagnostic-accumulating: independent faults are returned together in deterministic graph order.
§Errors
Returns diagnostics when the view is absent, its semantic topology is not closed, a symbol is unresolved, dimensions conflict, activation or clock wiring is ambiguous, or a connection contract is invalid.
pub fn from_snapshot_with_geometry(
snapshot: &Snapshot,
model: OntologyId<Model>,
geometry: &[&CanonicalGeometryV1],
) -> Result<KernelProgram, Vec<Diagnostic>>
pub fn from_snapshot_with_geometry( snapshot: &Snapshot, model: OntologyId<Model>, geometry: &[&CanonicalGeometryV1], ) -> Result<KernelProgram, Vec<Diagnostic>>
Select and validate a Model together with its exact closed canonical geometry bundle.
Artifact order is irrelevant. Every distinct geometry digest named by the Model must be supplied exactly once, and no unreferenced artifact is accepted. The returned program retains only internally derived spatial support facts, never artifact bytes or borrowed references.
§Errors
Returns diagnostics for the ordinary model invariants, an inexact artifact bundle, invalid entity-set selections, or unsupported geometry use.
§impl KernelProgram
impl KernelProgram
pub const fn revision(&self) -> Revision
pub const fn revision(&self) -> Revision
Graph Federation revision captured by this program.
pub const fn model(&self) -> OntologyId<Model>
pub const fn model(&self) -> OntologyId<Model>
Selected Standard Ontology ModelView identifier.
pub fn node(&self, id: RawId) -> Option<&KernelNode>
pub fn node(&self, id: RawId) -> Option<&KernelNode>
Look up a validated kernel definition.
pub fn value(&self, id: RawId) -> Option<DynQuantity>
pub fn value(&self, id: RawId) -> Option<DynQuantity>
Revision-local Parameter value.
This captures SetValue operations visible in the source snapshot;
it is intentionally separate from the immutable node definition.
pub fn typed_value(&self, id: RawId) -> Option<&ValueLiteral>
pub fn typed_value(&self, id: RawId) -> Option<&ValueLiteral>
Complete revision-local Parameter value, retaining every typed component.
pub fn nodes(&self) -> impl ExactSizeIterator
pub fn nodes(&self) -> impl ExactSizeIterator
Kernel definitions in deterministic (kind, ULID) order.
pub fn edges(&self) -> &[Edge]
pub fn edges(&self) -> &[Edge]
Validated internal model edges in deterministic order.
pub fn boundary(&self) -> &BTreeSet<RawId>
pub fn boundary(&self) -> &BTreeSet<RawId>
Model boundary Ports in deterministic order.
pub fn spatial_support(
&self,
domain: Id<Domain>,
) -> Option<&SpatialSupport<RawId>>
pub fn spatial_support( &self, domain: Id<Domain>, ) -> Option<&SpatialSupport<RawId>>
Exact admitted continuous support, including ordered dimensioned factors.
pub fn resolved_cartesian_bounds(
&self,
domain: Id<Domain>,
) -> Result<&[AxisBounds], Diagnostic>
pub fn resolved_cartesian_bounds( &self, domain: Id<Domain>, ) -> Result<&[AxisBounds], Diagnostic>
Resolve the accepted Cartesian bounds for one Domain.
This is the single metric projection of fixed and Parameter-backed coordinate recipes and exact admitted Geometry regions. Callers must not interpret raw sources independently.
§Errors
Returns EQ0302 when domain is absent or is not an accepted
Cartesian box.
pub fn typed_relation_residual(
&self,
relation: Id<Relation>,
) -> Result<TypedResidual<RawId>, Vec<Diagnostic>>
pub fn typed_relation_residual( &self, relation: Id<Relation>, ) -> Result<TypedResidual<RawId>, Vec<Diagnostic>>
Reconstruct the exact typed residual owned by one accepted Relation.
The returned proof is the only input accepted by componentwise Operator scalarization. Symbol types and spatial support are therefore derived from this immutable program rather than supplied as a parallel caller-owned shape array.
§Errors
Returns deterministic diagnostics when relation is absent or is not
a Relation in this accepted program. Re-inference failures indicate a
violated internal invariant and retain the original expression path.
pub fn symbol_type(&self, symbol: SymbolRef) -> Option<ExpressionType<RawId>>
pub fn symbol_type(&self, symbol: SymbolRef) -> Option<ExpressionType<RawId>>
Complete mathematical type and declared support of an exact Model symbol.
Returns None for a foreign identity or an invalid symbol role.
Trait Implementations§
§impl Clone for KernelProgram
impl Clone for KernelProgram
§impl Debug for KernelProgram
impl Debug for KernelProgram
§impl PartialEq for KernelProgram
impl PartialEq for KernelProgram
§fn eq(&self, other: &KernelProgram) -> bool
fn eq(&self, other: &KernelProgram) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for KernelProgram
Auto Trait Implementations§
impl Freeze for KernelProgram
impl RefUnwindSafe for KernelProgram
impl Send for KernelProgram
impl Sync for KernelProgram
impl Unpin for KernelProgram
impl UnsafeUnpin for KernelProgram
impl UnwindSafe for KernelProgram
Blanket Implementations§
Source§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Source§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
§fn approx(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
§impl<T> ConvUtil for T
impl<T> ConvUtil for T
§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
§fn into_as<Dst>(self) -> Dstwhere
Self: Sized + Into<Dst>,
fn into_as<Dst>(self) -> Dstwhere
Self: Sized + Into<Dst>,
§fn try_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + TryInto<Dst>,
fn try_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + TryInto<Dst>,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
Source§impl<T> From<T> for T
impl<T> From<T> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where
F: FnOnce(&Self) -> bool,
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where
F: FnOnce(&Self) -> bool,
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Same for T
impl<T> Same for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.