[EPIC][library/tool] General semantic knowledge compiler: arbitrary natural language → extensible validated symbolic knowledge #410
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#410
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: #376
Downstream consumer: lost-rob0t/symbolic-memory
Integrates with: #377, #380, #381, #70, #93, #219
Mission
Implement a reusable general semantic knowledge compiler in
prolog-rlmthat transforms the meaning of arbitrary natural-language material into a safe, validated, extensible symbolic representation that Prolog can query and reason over.The target is deliberately broader than entity extraction, claim extraction, or
how-tocompilation:prolog-rlmowns the compiler, semantic IR, normalization and safe reasoning semantics. It does not own the long-term memory product or require a particular durable store.Design principle: universal kernel, extensible vocabulary
Do not attempt to freeze one giant ontology containing every domain concept.
Instead define:
This should make the compiler able to represent unfamiliar domains without redesigning the runtime while preventing arbitrary generated Prolog from becoming executable authority.
Knowledge classes the core MUST represent
The IR/kernel must be expressive enough to encode at least the following classes, including combinations of them.
1. Entities, identity and typing
Examples:
2. Taxonomic / definitional knowledge
Example:
3. Declarative facts and relations
Facts must retain scope, time and provenance where supplied rather than being treated as timeless universal truth by default.
4. General rules and implication
Support rule knowledge equivalent to:
including conjunction, disjunction/alternatives where safely represented, scoped variables, guards, exceptions and explicit assumptions.
Examples:
5. Procedures / skills / how-to knowledge
Represent:
Example:
must become usable procedural knowledge, not a bag of extracted nouns.
6. Events and state transitions
Represent:
This is required for logs, incident histories, conversations, operations and narratives.
7. Temporal knowledge
Represent:
Relative temporal language may remain unresolved/anchored when the source lacks an absolute reference.
8. Causal / diagnostic knowledge
Represent:
Do not collapse correlation, possibility and asserted causality into one predicate.
9. Constraints and mathematical/quantitative knowledge
Represent:
Lower suitable closed forms into CLP(FD), CLP(Q/R), or other trusted constraint facilities rather than asking an LLM to solve them repeatedly.
10. Spatial knowledge
Represent general spatial relations when present:
Domain-specific geometry is an extension, not a reason to redesign the kernel.
11. Normative / policy / deontic knowledge
Represent semantic statements such as:
Important: remembered/compiled normative knowledge is epistemic data. It does not itself grant runtime authority or become trusted host policy.
12. Goals, plans, intentions and preferences
Represent:
Keep
someone said/wants Xdistinct fromX is objectively true.13. Epistemic knowledge / claims / beliefs
Represent attribution explicitly:
This is essential for LLM logs and web research. The compiler must not flatten attributed claims into unqualified world facts.
14. Uncertainty, confidence and alternatives
Represent at least qualitative uncertainty:
Where a source supplies numeric probabilities/confidence, preserve them as data without pretending model confidence is calibrated truth.
15. Defaults, exceptions and defeasible knowledge
Natural language frequently means:
The IR must preserve this distinction from strict classical implication. Design an explicit safe default/exception representation rather than abusing negation-as-failure silently.
16. Negative knowledge
Represent explicit negation/denial separately from absence:
Missing knowledge must not automatically become false unless a declared closed-world scope says so.
17. Comparative / ranking knowledge
Represent:
including the basis/context for a comparison where present.
18. Social / organizational knowledge
Represent reusable concepts such as:
without baking one organization's ontology into core.
19. Technical/system knowledge
The generic representation must support system concepts such as:
Project/source-specific authoritative observations remain owned by #93/#380; this compiler can represent prose knowledge about systems.
20. Examples, cases and precedents
Represent examples/cases independently from universal rules:
This permits later case-based reasoning without mistaking one anecdote for a universal rule.
21. Hypotheses and counterfactuals
Represent:
Counterfactual/scenario knowledge must stay scoped and must not leak into asserted current-world facts.
22. Meta-knowledge
The KB must be able to state things about knowledge itself:
Meta-knowledge is essential, not decorative metadata.
Compositionality
A single passage may contain multiple kinds simultaneously.
Example:
contains:
The compiler must preserve that structure rather than force the passage into one record type.
Semantic IR requirements
The IR should provide a small set of composable constructors rather than one predicate per English sentence pattern.
Conceptual forms may include:
Exact representation is a design task. Prefer normalized ground IR with explicit IDs/references and a separate validated lowering layer over model-produced nested callable terms.
Open domain vocabulary
The compiler must support new domain concepts without core changes.
For example a biology source may introduce:
while a software source introduces:
These should be registered/represented as symbolic concepts/relations under the same kernel. Unknown domain predicates are data unless explicitly mapped to a trusted semantic extension.
Semantic compilation pipeline
Use multi-pass compilation where needed:
An LLM may implement one or more semantic frontend passes. Its output remains candidate data until validation.
Literal vs inferred semantics
Preserve a distinction between:
A generalized rule induced from examples should not masquerade as a rule explicitly stated by the source.
Context / discourse
Support knowledge that depends on discourse context:
Large documents must be compilable in bounded segments while preserving cross-segment entity/discourse links.
Compiler API direction
Provide semantics equivalent to:
Expose the same compiler through a normal capability-gated tool adapter.
The compiler result must be useful with no persistent database installed.
Safe lowering / execution boundary
No arbitrary model/source term may be handed to unrestricted
consult/1orcall/1.Separate:
A compiled procedure may contain
restart(service_x)as a symbolic action. It does not become executable unless a trusted host mapping explicitly binds that semantic action to an admitted capability.Only closed safe rule constructs are lowered into directly queryable executable Prolog. Other knowledge remains interpreted symbolic data operated on by trusted generic reasoning predicates.
Provenance
Every material semantic record must be able to retain:
Downstream stores may add lifecycle/history metadata but must not lose compiler provenance.
Contradiction and plurality
The compiler is not a truth oracle.
Given incompatible sources or ambiguous language, preserve multiple records plus conflict/alternative relationships. Do not force last-write-wins or choose whichever interpretation the model prefers.
Model usage
For arbitrary prose, an LLM may act as semantic parser/compiler frontend. Only actual provider calls are metered.
Prefer deterministic parsers/templates for structured inputs and deterministic normalization/logic after semantic parsing.
The long-term goal is that prose is semantically compiled once and repeated downstream reasoning is primarily Prolog/symbolic.
Child issue set
Create/implement focused children for:
Required cross-domain acceptance corpus
The test corpus must include materially different knowledge, not ten variants of software troubleshooting. At minimum include fixtures for:
For each fixture define expected semantic invariants, not necessarily one brittle exact serialization.
Semantic-loss evaluation
Add evaluation that asks whether material meaning disappeared during compilation.
Metrics/checks should cover at least:
Use deterministic fixture expectations plus optional model-assisted adversarial evaluation; deterministic acceptance remains authoritative.
North-star tests
General knowledge
Compile a heterogeneous multi-domain document set. Remove original prose from context. Ask symbolic queries that require chaining different knowledge classes. Prolog must recover the material semantics from the compiled representation.
Procedural knowledge
Feed several pages of operational prose once. Later ask
How do I recover X when Y occurs?with original prose absent. Prolog derives the applicable ordered procedure, branches, conditions and recovery path.Conflicting research
Compile two sources that disagree. Query what is known. The result identifies both attributed claims, supporting provenance, conflict and unresolved truth status rather than overwriting one source.
Non-goals
Refs #376 #377 #380 #381 #70 #93 #219 and downstream
lost-rob0t/symbolic-memorysemantic-memory epic.Downstream durable-memory consumers are now tracked in
lost-rob0t/symbolic-memory:Keep this issue compiler/library/tool-only. Do not move symbolic-memory namespace, retention, durable projection ledger, corpus backfill, or memory transport semantics into Prolog-RLM.
Machine Spirit #405A synthesis handoff
Depth 8A baseline synthesis (
#405) preserves this compiler boundary exactly. COVENANT-MS treats#388/#392-#396as the semantic/meaning side of a typed contract spine; it does not introduce a durable-memory dependency into Prolog-RLM.Baseline handoff from compiler to the rest of Machine Spirit must identify the exact source/version, semantic schema/profile, compiler run, package digest, export/license receipts, material ambiguity/gaps and provider usage. A validated package is still semantic candidate/represented knowledge, not world truth, host authority, VERIFY success or learned-policy admission.
The corresponding end-to-end conformance capsule begins with #395 meaning/commitment invariants and then follows the exact package into durable projection/retrieval/epistemics/procedure/VERIFY. Any later component must preserve compiler provenance and declared losses rather than reconstructing stronger semantics from a flattened view.
Refs #397 #405 #392-#396 and symbolic-memory#4/#5/#11.
Machine Spirit #405D executable-conformance handoff: Cycle-1 acceptance failed because the canonical #388/#392-#396
semantic_compilefamily is not yet present as executable evidence on currentmain. This is not a redesign of #388. The implementation gate now needs to produceMSD-SEM-*evidence capsules covering heterogeneous compile→source-free query, forbidden semantic overpromotion, canonical fingerprints, bounded ambiguity/resource behavior, from-scratch vs incremental equivalence, and provider-disabled deterministic lanes. Parent #397 now contains the proposed Cycle-2 ranking; do not treat issue design completion as Machine Spirit evidence.