[semantic-compiler] Multi-pass semantic induction: discourse, coreference, events, rules, procedures, constraints, and cross-sentence linking #405
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#405
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
Depends on: #392
Research: #397 #399
Goal
Implement the semantic frontend that maps arbitrary prose into candidate instances of the general semantic IR without flattening meaning, discourse commitment, attribution, scope, or pragmatic status into isolated triples/facts.
The compiler must be usable for heterogeneous sources including LLM logs, Wikipedia/encyclopedic prose, news, manuals, scientific papers, chats, issue/PR histories, policies and arbitrary text.
Architecture: evidence-anchored Semantic Compilation Lattice (SCL)
The old conceptual linear checklist remains useful for coverage, but it is not the execution model. Coreference, scope, attribution, event structure, procedure/rule interpretation, temporal attachment and pragmatic phenomena constrain one another.
Use an ephemeral/versioned Semantic Compilation Lattice (SCL) between immutable source text and #392 candidate IR:
No analyzer/model view is authoritative by itself. SCL/SCC are compiler-local evidence/interpretation state, not another durable world model.
SCL conceptual records
Observations may include syntax/dependencies, SRL/frames, AMR/UCCA-style structure, DRS/MRS-style discourse/scope, quote/speaker boundaries, timestamps, source-format structure, numeric/unit parses, and bounded model-proposed hypotheses.
Observations are evidence, not truth.
Packed ambiguity
Preserve material alternatives for at least:
Do not enumerate a Cartesian product. Use shared packed structure + compatibility constraints. Budget exhaustion may leave ambiguity unresolved; it must not silently choose one.
Explicit discourse workspace
Large-document compilation carries symbolic discourse state rather than only overlapping text windows.
Conceptual state includes:
For LLM logs, exact envelope metadata such as role, provider/model, message/tool-call IDs, timestamps and request/reply linkage is deterministic input and must not be re-inferred by a model.
Induction / interpretation classes
Every material compiler output distinguishes at least:
pragmatic_candidate,induced_rule, andcompiler_repairmust never masquerade as source-explicit knowledge. A historical successful troubleshooting episode may support aninduced_rule; it does not itself prove a universal procedure.MACHINE-SPIRIT #399B: Semantic Commitment Calculus (SCC)
#399B found that induction-class labels alone are too flat. The compiler must model who is committed to what, in which context, with which linguistic force, projectivity/opacity, defeasibility and derivation license.
Add compiler-local records equivalent to:
Candidate linguistic-force distinctions include:
Candidate projectivity/opacity distinctions include:
Candidate defeasibility distinctions include:
Exact enums may be tightened fixture-first. Do not collapse these dimensions into one confidence score.
Presupposition
A presupposition trigger creates a content hypothesis plus a resolution obligation. Resolution may bind existing discourse content, accommodate locally/above, remain unresolved, or be filtered/cancelled by context. Triggered content is never automatically a global assertion.
Alice stopped smokingmay license prior-smoking content, but that content remainspresupposed, notsource_explicit asserted.Conversational implicature
Implicature is an optional licensed, cancellable pragmatic transformation.
Some services passedmay support anot allcandidate, butIn fact, all passedcancels it without contradicting the asserted content. Pragmatic candidates cannot silently become ordinary world assertions.Ellipsis
Reconstructed content retains ellipsis site, antecedent candidate and reconstruction transform. The source span is not rewritten to pretend reconstructed wording occurred literally.
Intensionality / attitudes
Belief, desire, report, plan and modal content lives in explicit attitude/modal contexts. No automatic extensional substitution or upward leakage into actual-world assertions. Preserve de-re/de-dicto alternatives when material.
Indexicals
Resolve
I/you/here/now/today/...from explicit utterance/source context where available. Structured logs provide deterministic speaker/time/session anchors. Missing anchors remain unresolved; never default them to ingestion time/operator/current process.Direct / indirect / mixed quotation
Separate:
Indirect report does not imply verbatim wording. Mixed quotation may require metalinguistic/form semantics and cannot be flattened to ordinary embedded content.
Genericity / habituality
Generic and habitual language must not silently lower to exceptionless universal rules/events.
Preserve semantic forms equivalent to:
A reasoning profile may later interpret generics as defaults. That is not a compiler truth.
Metonymy
Preserve surface referent separately from a contextual coerced/intended participant. Do not turn
The White House denied Pinto a global identity merge between building/institution/spokesperson, and never use metonymic coercion to rebind security principals.Temporal discourse
Distinguish explicit temporal relations from tense/aspect constraints, temporal anaphora, discourse-derived likely sequence and mere textual order. Constraint propagation may leave partial/underspecified order. Text order alone is not sufficient evidence for
before/2.Discourse relation != world relation
Relations such as explanation/elaboration/contrast/narration connect discourse units. Any conversion into causal or other world relations requires a separate typed transform with explicit semantic-strength evidence.
Export contract
Reconciliation decides not only accepted/rejected, but an export class:
Conceptual API:
Every exported material #392 record needs an auditable receipt to source/SCL/SCC evidence showing what licensed the export.
Three independent provenance/epistemic axes
Preserve independently:
Parser/model confidence concerns interpretation confidence, not world truth confidence.
LLM role
Use LLMs as bounded semantic inducer/reconciler for open-domain concepts, discourse repair, implicit procedure/rule structure, ellipsis/metonymy/pragmatic candidates and alternative ranking.
Prefer:
not whole-document direct truth generation.
Grammar/schema constraints guarantee structure only; they do not guarantee semantic faithfulness.
Deterministic source-first extraction
Adapters expose exact source structure before model analysis:
A model must not be asked to rediscover deterministic metadata already present in the source.
Dedicated rule/procedure lane
Explicitly induce/validate:
and rule distinctions such as
if,only if,iff,unless, generic/habitual, default/exception, requirement/recommendation/permission.Scaling requirements
Worst-case scope/reference/pragmatic ambiguity is combinatorial. The correct failure mode is bounded unresolved alternatives, not heuristic silent collapse.
Safety / authority invariants
admins can restart servicesdoes not grant restart authority;Language interpretation is never an authority bridge.
Acceptance
Non-goals
Refs #388 #392 #394 #395 #397 #399.
MACHINE-SPIRIT #399C canonical compiler delta — Semantic Interoperability Fabric
Depth 2C found that SCL/SCC still need an explicit interoperability layer. Add compiler-local support for:
Hard requirements:
The full research, alternatives, sources and conformance cases are in #399's C comment. This should be incorporated into the fixture-first implementation design of #393 rather than implemented as arbitrary pairwise Prolog conversion clauses.
MACHINE-SPIRIT #399D canonical execution handoff — Semantic Build Graph (SBG)
Depth 2D makes the
#393scaling section normative rather than aspirational.Adopt a compiler-local Semantic Build Graph: typed stage actions with exact input/dependency fingerprints, immutable/content-addressable artifacts, dynamically recorded discourse dependencies, explicit determinism classes, and demanded incremental recomputation.
Required stage semantics
Conceptual contracts:
Exact names follow repository conventions.
Hard invariants:
pure_deterministic, versioned deterministic external work, retained/recorded nondeterministic work and volatile external work;Runtime boundary
The SBG is work-plan/dependency data, not a second scheduler. Execute through existing Prolog-RLM async/Futures/cancellation/concurrency/runtime machinery where available; direct library callers may execute synchronously. Preserve #376's one-runtime/one-authority boundary.
Discourse frontier
Cross-segment processing should pass a bounded symbolic semantic frontier (referents/events/context frames/open obligations + dependency digests), not all prior text. An edit invalidates only observed dependency closure; late resolution creates explicit back-dependencies.
Full research, candidate alternatives, sources, adversarial review and D1-D13 fixtures are in #399 subpass D.
MACHINE-SPIRIT #404A handoff — induction output remains candidate knowledge
The semantic compiler's existing
induced_ruledistinction now feeds EPOCH explicitly:induced_ruleor model-generated lesson must never be exported as source-explicit truth or trusted control policy merely because schema validation succeeds. Preserve source/SCL/SCC evidence plus induction mechanism/version so #404 can distinguish language interpretation evidence from later empirical/VERIFY learning evidence.Ref #404A EPOCH.