Expand description
N3Logic → SHACL → Sentinel Bytecode compiler (CogAI symbolic layer).
The LLM emits N3 assertions on the cold path; this module validates them against
compiled SHACL shapes from crate::modalities::logic::shacl and lowers surviving rules to
SlgOpcode sequences for the Core-1 Webizen VM. Hot-path execution uses only
fixed caller-supplied buffers.
Structs§
Enums§
Constants§
Functions§
- compile_
formula - Compile a formula into the fixed 8-triple
CompiledFormulabuffer; triples beyond the cap are silently truncated. - compile_
rule_ to_ opcodes - Lower one N3 rule into Sentinel opcodes (reuses SHACL terminal semantics).
- compile_
rule_ to_ quin - Emit a compiled rule as
NQuin(s): deontic-lowerable rules produce a single norm quin viacompile_n3_rule_to_norm; other rules fall back to one fact quin per formula head triple.QuinBufferFullwhenoutcan’t hold the result. - compile_
rule_ to_ zero_ heap - Compile an entire parsed N3 rule (id, arrow type, weight, premise,
conclusion) into the zero-heap
CompiledRuleform. - compile_
rules_ with_ shacl_ gate - SHACL-gated batch compile: validate each rule, then emit opcodes into a fixed buffer.
- compile_
term - Hash-lower a parsed N3
Termto aCompiledTerm, preserving the variable/literal/URI distinction. Variables hash their name; an unhashable non-variable falls back toq_hash("?"). - compile_
triple - Compile a parsed triple — each of subject/predicate/object lowered
via
compile_term. - default_
observation_ shape - Build a default health-observation SHACL gate for LLM-emitted N3 (cold path helper).
- execute_
compiled_ program - Execute compiled opcodes inside the 42 MB
SlgArenawithout heap growth in the eval loop. - triple_
to_ quin - Pack a compiled triple into an
NQuinundercontext, computing the XOR-fold parity. Never fails at present — theResultpreserves the signature for future checks. - validate_
rule_ against_ shapes - Returns true when every conclusion triple property path matches a compiled SHACL shape.