pub enum GrammarState {
Admissible,
Boundary(ReasonCode),
Violation,
}Expand description
The DSFB grammar state — the typed intermediate representation.
This is what operators see instead of a scalar alarm count. The typed state encodes both the severity and the structural character of the observed residual trajectory.
Variants§
Admissible
Residual within envelope, drift inward or bounded. Nominal operation.
Boundary(ReasonCode)
Residual approaching envelope boundary with sustained outward drift or recurrent grazing. Early-warning state.
Violation
Residual has exited envelope. Structural fault state.
Implementations§
Source§impl GrammarState
impl GrammarState
Sourcepub fn requires_attention(&self) -> bool
pub fn requires_attention(&self) -> bool
Returns true if this state warrants any operator attention.
Sourcepub fn is_violation(&self) -> bool
pub fn is_violation(&self) -> bool
Returns true if this is a Violation state.
Sourcepub fn is_boundary(&self) -> bool
pub fn is_boundary(&self) -> bool
Returns true if this is a Boundary state.
Sourcepub fn severity_trust(&self) -> f32
pub fn severity_trust(&self) -> f32
Severity-based trust scalar T ∈ [0, 1].
Returns a deterministic, bounded trust weight that downstream stages
can use to down-weight grammar evidence that is already at
boundary or violation. This is the semiotics-engine trust_scalar_for()
severity dimension (de Beer 2026, §IV):
- Admissible → 1.0 (full trust: nominal region, no structural concern)
- Boundary → 0.5 (half trust: approach region, evidence partial)
- Violation → 0.0 (no trust: outside envelope, evidence suppressed)
Use geometry_trust() for a continuous, geometry-aware version.
Sourcepub fn geometry_trust(norm: f32, rho: f32, band_frac: f32) -> f32
pub fn geometry_trust(norm: f32, rho: f32, band_frac: f32) -> f32
Geometry-based grammar trust scalar T ∈ [0, 1].
Provides a continuous trust measure based on how far inside the admissibility envelope the current residual norm lies, within the boundary band. Derived from semiotics-engine eq. (trust_scalar_for):
margin = (ρ − ‖r‖) / ρ (normalised inward distance)
T = clamp(margin / band_frac, 0, 1)band_frac is the boundary band width as a fraction of ρ
(semiotics-engine default: 0.04 = 4 %).
§Semantics
- T = 1.0: residual deep inside envelope — full confidence
- T ≈ 0.5: residual halfway through the boundary band
- T = 0.0: residual at or outside the envelope boundary — suppressed
Independent of grammar state: can be used even when the FSM is in Admissible but the norm is close to ρ.
Sourcepub fn combined_trust(&self, norm: f32, rho: f32, band_frac: f32) -> f32
pub fn combined_trust(&self, norm: f32, rho: f32, band_frac: f32) -> f32
Combined grammar trust scalar: minimum of severity_trust and geometry_trust.
Takes the more conservative of the two trust dimensions. This is the recommended scalar for downstream weighting (e.g., DSA score blending, HRET combination).
Trait Implementations§
Source§impl Clone for GrammarState
impl Clone for GrammarState
Source§fn clone(&self) -> GrammarState
fn clone(&self) -> GrammarState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more