pub struct SlgArena { /* private fields */ }Implementations§
Source§impl SlgArena
impl SlgArena
pub fn new() -> Self
Sourcepub fn register_rule(&mut self, rule: &Rule<'_>)
pub fn register_rule(&mut self, rule: &Rule<'_>)
Registers a logical implication rule into the Webizen VM
Sourcepub fn stage_rule(&mut self, rule: &Rule<'_>) -> u64
pub fn stage_rule(&mut self, rule: &Rule<'_>) -> u64
Stage a parsed rule for later activation via NativeRegisterRule.
Returns the rule id (object_reg value) used to activate it.
Sourcepub fn activate_staged_rule(&mut self, rule_id: u64) -> bool
pub fn activate_staged_rule(&mut self, rule_id: u64) -> bool
Activate a staged rule by id into the live rule registry.
pub fn rule_count(&self) -> usize
pub fn staged_rule_count(&self) -> usize
Sourcepub fn collect_active_quins(&self, out: &mut [NQuin]) -> usize
pub fn collect_active_quins(&self, out: &mut [NQuin]) -> usize
Collect recently written Quins with valid ECC parity (bounded scan, zero heap).
Sourcepub fn fire_registered_rules(&mut self, contract_hash: u64) -> usize
pub fn fire_registered_rules(&mut self, contract_hash: u64) -> usize
Compile registered N3 rules to norms + bytecode and execute on Core 1 (cold path).
Sourcepub fn fire_guard_rules(&mut self) -> usize
pub fn fire_guard_rules(&mut self) -> usize
Forward-chaining grounding pass for variable (non-ground) N3 guard rules.
fire_registered_rules handles ground deontic rules via
compile_n3_rule_to_norm. This is its complement: for every registered rule
whose premise contains variables, it performs a conjunctive backtracking join
of the premise triples against the facts currently live in the arena, and for
each satisfying binding instantiates and asserts the (variable-substituted)
conclusion triples back into the arena. Returns the number of conclusion
triples newly asserted.
Worked example — agency.n3 G1:
{ ?c a values:CorporatePerson ; values:claims ?r .
?r a values:Right ; values:heldBy values:NaturalPerson }
=> { ?c values:flag values:PersonhoodCategoryError } .Given facts that a corporate person claims a natural-person right, the guard
asserts (?c, values:flag, values:PersonhoodCategoryError) — the personhood
category error (a Deny) — observable via Self::has_quin.
Cold path: bounded stack buffers, no hot-path heap growth. Hashing is uniform
q_hash over IRIs/variables/literals (matching n3_compiler::triple_to_quin),
so grounding matches facts ingested through the standard triple path.
Forward chaining asserts the conclusion of any satisfied premise. Defeasible
override of a deontic norm (e.g. a marked corporate overlay defeating a
prohibition) is handled in the deontic-norm lane via the q42:unless
defeater path (evaluate_deontic_contract), not here — the agency.n3 guards
(G1/G1’) are strict => rules.
Sourcepub fn has_quin(&self, subject: u64, predicate: u64, object: u64) -> bool
pub fn has_quin(&self, subject: u64, predicate: u64, object: u64) -> bool
True when a fact (subject, predicate, object) is live in the arena with
valid ECC parity. Used to observe forward-chained guard conclusions.
Sourcepub fn check_table(
&self,
subject: u64,
predicate: u64,
object: u64,
) -> Option<NQuin>
pub fn check_table( &self, subject: u64, predicate: u64, object: u64, ) -> Option<NQuin>
Checks the SLG Arena for a previously proven sub-goal.
Sourcepub fn write_table(&mut self, result: NQuin)
pub fn write_table(&mut self, result: NQuin)
Writes a proven sub-goal into the SLG Arena. If the slot is occupied (hash collision) or we hit the boundary, it acts as a FIFO ring-buffer and strictly overwrites the oldest cache entries.
Auto Trait Implementations§
impl Freeze for SlgArena
impl RefUnwindSafe for SlgArena
impl Send for SlgArena
impl Sync for SlgArena
impl Unpin for SlgArena
impl UnsafeUnpin for SlgArena
impl UnwindSafe for SlgArena
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
§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> 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>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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