[semantic-ir] General semantic knowledge algebra v1: domain-neutral kernel, typing, modality, provenance, and extensions #406
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/prolog-rlm#406
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent: #388
Goal
Design and implement the immutable/versioned general semantic knowledge algebra / IR v1 used by the semantic compiler.
The IR must represent materially different kinds of knowledge without requiring one bespoke schema per domain and without embedding arbitrary executable Prolog.
Architecture
Use a small closed semantic kernel plus open typed domain vocabulary.
Published IR versions are immutable. A semantic change creates a new version.
Kernel coverage
The v1 algebra must be able to represent and compose at least:
Semantic distinctions that MUST survive encoding
Ground IR
Prefer explicit IDs/references and normalized ground records over model-produced callable structures.
Conceptual shape only:
Exact API/records should follow repository conventions after fixture-driven design.
Extension mechanism
Allow domains to add typed concepts/relations as data without core changes.
Need a validated mechanism for:
Unknown domain vocabulary remains inert symbolic data. It must not become a host predicate merely because its name matches one.
Quantification / variables
Define safe representations for:
Avoid silently losing quantifiers such as
every,some,no,exactly one,at least,at most.Context and scope
Records must support explicit contextual scoping for:
Provenance fields
Every material semantic record must support linkage to:
Immutability and fingerprints
MACHINE-SPIRIT pass #398 research decision: proposition/assertion split + semantic profiles
Auto-Research #398 found that the kernel should not promise one universal reasoning semantics. The strongest precedent across RIF and OWL is a shared interchange/core vocabulary plus explicitly restricted dialects/profiles with different computational guarantees.
Adopt these additional v1 invariants:
represented,validated,queryable/entailed, andsafely_lowerable.restartordeleteremains data until a trusted host adapter separately maps it to a capability.Conceptual preferred layering:
This decision is based on Machine Spirit pass #398. The full research, alternatives and sources are preserved in that issue and must remain design input rather than being silently collapsed into this summary.
MACHINE-SPIRIT #398B depth decision: contextual theories + scoped witnesses + justifications
A second, deeper pass over #398 stress-tested the IR against the actual intended source classes: historical LLM logs, Wikipedia/encyclopedia revisions, news with attributed/conflicting claims, manuals/policies, scientific prose, heterogeneous ontology versions and hypothetical scenarios.
The result is that
proposition + assertion + profileis necessary but still insufficient. Adopt these further v1 requirements.1. Context and theory are first-class semantic objects
A source assertion must live in an explicit context/theory rather than an implicit global union.
Distinguish:
Use opaque context/theory IDs with normalized facets such as source, speaker, time, scenario, domain, jurisdiction or ontology version. Do not eagerly create a Cartesian product of context dimensions.
A
contextdescribes the semantic viewpoint/scope in which statements live. Atheoryidentifies an inference set: assertions/rules/vocabulary/profiles/imports considered together. They may correspond closely but are not identical.Conceptual forms:
2. Context/theory imports and bridge rules are explicit
Knowledge moves between source/microtheory/domain contexts only through explicit imports/bridges with provenance and status.
Conceptual form:
Bridge rules may promote/map knowledge, but compiler/model-generated bridge proposals are inert until admitted by the trusted semantic-policy boundary. A semantic bridge still does not grant host execution authority.
RDF named graphs may be used as an export/storage projection, but RDF dataset semantics do not provide the canonical context semantics required here.
3. Existential witnesses are distinct from globally identified entities
Text frequently contains existential knowledge:
Represent unknown witnesses explicitly and scope them to the originating formula/assertion/derivation.
Conceptual form:
Hard invariants:
Add an
existential_warded/equivalent candidate profile to the profile-design work; exact fragment selection follows implementation evaluation.4. Justification/derivation structure is first-class
The representation must preserve why a derived conclusion follows without conflating derivation state with immutable source truth.
Conceptual form:
Alternative derivations are separate hyperedges. This enables explanation, dependency tracking, corroboration, truth-maintenance experiments, provenance algebra and VERIFY/Review expert evidence.
Do not require every expanded proof tree to be durable. The justification schema/dependency model is canonical, while ordinary intermediate proof/materialization nodes may be rebuildable caches. Durable promoted conclusions/actions should retain replayable derivation receipts.
5. Preserve support and refutation independently
The ledger must retain enough polarity/evidence structure to compute an information state equivalent to:
This is an information summary inspired by four-valued/paraconsistent KR, not a decision that every profile uses one universal four-valued consequence relation. Pass #400 owns the exact non-monotonic/paraconsistent/default semantics.
6. Separate five provenance classes
Preserve distinct, linkable provenance for:
Do not flatten these into a single
confidenceor generic metadata blob.A provenance-semiring/annotation algebra may be supported by selected profiles, but probability, confidence, trust, cost and provenance are not assumed to share one arithmetic.
7. Canonical semantic state and derived/materialized state are different layers
Canonical append-only semantic data may include:
Rebuildable derived state includes ordinary:
Incremental tabling/materialized-view machinery is an implementation strategy, not canonical truth. The API must permit invalidation/rebuild/replay from durable semantics.
8. Profile capability contracts become explicit
A semantic profile should declare at least:
Expose capability levels equivalent to:
Never infer stronger operational guarantees merely because a semantic package is representable.
9. Validation schema is separate from inference semantics
The write-once IR/schema/signature layer validates the shape/type of semantic records. Validation does not by itself entail the data or select a reasoner. SHACL-style shape validation is a useful interoperability precedent, but semantic inference profiles remain separate.
10. Revised preferred architecture
This is now the canonical design direction to be attacked by #399-#405, not a claim that every downstream semantic decision is settled.
Acceptance
Non-goals
Refs #388 #376 #377 #93 #380 #397 #398 and downstream
lost-rob0t/symbolic-memory#4/#6.MACHINE-SPIRIT #398C/#398D canonical delta — theory composition + deductive plan plane
Depth-1 subpasses C/D add two implementation-significant requirements beyond #398A/B.
C: theory composition is typed, not generic
importsThe semantic IR/theory layer should support:
Recommended edge kinds/semantics include
include,reference,translate,bridge,conservative_extension,query_preserve,project, and cross-domain link relations. Exact names are design/implementation details, but one undifferentiatedimports/2is insufficient.A theory edge/mapping must retain provenance and status. Model/compiler-proposed mappings are inert until admitted for inference. Historical records remain tied to the original vocabulary/theory version.
This follows modular-KR evidence from E-connections / distributed DLs and conservative-extension/query-inseparability work: safe combination is contract- and application-dependent, not synonymous with set union.
D: add explicit three-plane separation
Canonical architecture must preserve:
Planes 2/3 are rebuildable and must never become semantic source-of-truth.
For admitted Horn/Datalog fragments, the design should support semi-naive materialization and query-demand transformation (e.g. Magic-Set-style planning) rather than either full closure or naive SLD as the only strategy. Tabled/incremental evaluation is another backend strategy; CLP/CHR-style profiles remain trusted solver profiles rather than arbitrary model-generated programs.
Additional v1 acceptance implications
false/unknownremains distinct fromunsupportedorresource_exhaustedexecution outcome.Full research, alternatives, sources and adversarial fixtures are preserved in #398 subpasses C/D and parent #397.
MACHINE-SPIRIT #400C bridge-layer clarification
Depth 3C confirms that the existing semantic
sem_bridgeconcept must not imply epistemic warrant transfer.Keep two layers distinct:
A semantically exact proposition mapping can still be epistemically noncomposable because source and destination use incompatible negation/default/model/priority semantics. Conversely, a recipient may retain another theory's acceptance as attributed meta-knowledge without admitting the mapped proposition as a premise.
#400C therefore recommends that
sem_bridgemay reference an epistemic interoperability-contract ID, but the semantic IR itself must not manufacture or assume that contract. This preserves the #398 rule that representation/mapping != local entailment/lowering/warrant.Machine Spirit #401A procedural-IR handoff
Depth 4A recommends refining the existing general
procedure/step/event/causalcoverage with a procedural semantic profile that preserves these distinctions without creating arbitrary executable Prolog:Conceptual forms from the research include
sem_task,sem_method,sem_task_network,sem_operator,sem_control_rule,sem_case, and a diagnostic-problem object reusing the existing causal/hypothesis/provenance kernel.Hard IR distinction:
sem_operatorpredicted effects are planning expectations, not observations.sem_caseis episodic evidence, not a universal rule. A semantic action/capability requirement remains inert until the trusted host mapping + ordinary authority/effect boundary admits execution.Exact constructor normalization should follow fixture-driven #392 implementation rather than expanding the kernel mechanically. Full rationale and A1-A20 fixtures are on #401; #401B must attack contingent/open-world/temporal procedural semantics before Depth 4 is considered settled.
Machine Spirit #401B procedural-profile refinement
Depth 4B requires the procedural semantic profile to preserve more than
procedure + steps + pre/postconditions.Required representable inert semantics:
Unknown/refuted/conflicted guard states come from explicit epistemic profiles; raw Prolog NAF must not become universal procedural falsehood. Semantic actions and branches remain inert and cannot self-bind to host capabilities. Full rationale/sources/fixtures: #401 Depth-4B.
Machine Spirit #401C handoff — procedural interoperability IR
Depth 4C now requires the procedural IR to keep five distinct objects rather than flattening them into one generic
procedure:Hard boundary:
Native HTN/HDDL, Golog/ConGolog, Behavior Tree, BPMN/workflow and PDDL2.1 semantics may share bridge-visible interfaces, but unsupported sensing,
RUNNING, interrupt, compensation, temporal/resource, fairness or guarantee semantics must yield explicit loss/noncomposable state rather than disappear. Host bindings are trusted adapter/configuration facts and cannot be manufactured by semantic names. See #401 Depth-4C full PIFF/PSC research and C1-C28 fixtures. #401D will define executable/scaling details.MACHINE-SPIRIT #402C handoff — federation metadata remains inert semantic data
Depth 5C (
#402C, CLFM) adds cross-ledger composition requirements but does not move physical federation into Prolog-RLM.Where #392 represents persistent/federated references, preserve typed/versioned distinctions for logical ledger identity, authority domain, remote event/statement identity, per-ledger frontier/checkpoint, causal-edge evidence, federation-link/mapping generation, integrity/admission/redaction/replay status, and replica-vs-independent-source classification.
Hard semantic boundary:
Unknown remote schemas/extensions remain inert/opaque where necessary. symbolic-memory owns durable federation links/frontiers/import history; #392 owns only the safe semantic representation/bridge vocabulary needed by consumers. Full design: #402C.
MACHINE-SPIRIT #404A handoff — learning meta-semantics
EPOCH requires the semantic algebra to preserve learning status/provenance without confusing induced knowledge with source assertion.
Representable semantic/meta distinctions must support the equivalent of:
A learned payload may reuse ordinary
sem_rule/ procedure / policy constructors, but its origin and lifecycle are separate meta-knowledge: learner/version, hypothesis/operationality profile, source experiences, assumptions, positives/negatives/counterexamples, evaluation cuts/fixtures and promotion policy/version. This does not make promotion itself a semantic entailment rule and never creates a host binding/capability.Ref #404A EPOCH.
Machine Spirit #404C handoff — portable learned objects are meta-knowledge, not portable truth
PACT-EPOCH adds a versioned Learning Artifact Contract (LAC) / attestation layer above the semantic kernel. The IR/meta-knowledge surface should be able to represent a learned object's kind, payload ref, learner contract, applicability assumptions, source environment, evidence-use roles, source promotion attestation, drift/calibration scope and transfer provenance without converting any of those into an unqualified world assertion.
Hard boundary:
Unknown/foreign learner predicates remain inert data. Cross-domain bridge logic may preserve/weaken/invalidate a guarantee but may not strengthen it without target evidence. Full design/fixtures are in #404C.
#405C CONCORDAT-MS handoff
Depth 8C confirms #392's existing context/profile/bridge model and adds one hard interoperability constraint for downstream implementation/conformance:
Semantic bridges should remain source/target-profile-qualified and expose a preservation class (
preserved|translated|weakened|conditional|unknown|noncomposable) plus exact mapping/version provenance. A strong bridge may claim satisfaction/consequence preservation only when its declared formal/fixture contract establishes it; otherwise retain loss/unknown.Foreign identity mappings remain semantic hypotheses and never substitute for authenticated host principal/resource binding.
Canonical research: #405C issue comment. #405D must turn the relevant bridge classes into executable conformance ownership.