[semantic-reasoning] Safe lowering and reasoning semantics for negation, defaults, exceptions, uncertainty, time, causality, and constraints #404
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#404
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
Goal
Define the trusted reasoning/lowering layer that turns validated semantic IR into queryable Prolog semantics without treating arbitrary generated terms as executable code.
Required semantics
Implement safe handling for at least:
Hard distinction
Unknown/open vocabulary remains data interpreted by generic semantic predicates. Only trusted closed constructors/adapters may lower to executable/queryable Prolog predicates or constraint calls.
Negation / unknown
Do not use ordinary Prolog failure as a universal semantic
false.The layer must distinguish:
and preserve source scope/provenance.
Defaults / exceptions
Provide explicit representation and evaluation policy for natural-language defaults such as:
The implementation may use priorities/specificity/defeasible records, but behavior must be deterministic, inspectable and provenance-preserving. Do not silently encode default reasoning as raw clause order.
Conflicts
Contradictory assertions/rules may coexist. Query outcomes need to expose conflict rather than arbitrary winner selection unless an explicit trusted resolution policy applies.
Temporal reasoning
Support reusable trusted predicates over explicit time/interval data:
Unresolved relative time remains unresolved rather than being invented.
Constraint lowering
Validated safe quantitative forms should lower to trusted CLP facilities where appropriate:
Unknown expressions remain symbolic rather than evaluated through arbitrary Prolog.
Explanation
Every derived result should be able to return a proof/evidence structure identifying:
MACHINE-SPIRIT #400A epistemic foundation: support graph + explicit profiles
Depth 3A found that
truth,support, andacceptancemust be separate layers.The canonical reasoning boundary should consume an Epistemic Support Graph (ESG) built over #392 propositions/assertions/contexts/justifications:
Base support state should be representable independently of final acceptance:
This Belnap-like support summary is not itself the universal consequence relation.
Candidate profile family established by #400A:
Do not silently choose a profile from predicate name or Prolog clause order.
Conceptual query result direction:
Hard invariants added by #400A:
A source correction that explicitly asserts the opposite may add negative support, but mere withdrawal must not manufacture it.
Defaults must be explicit semantic objects with conditions, conclusion, exceptions, priority/specificity metadata, scope and provenance. Exact default-priority/reinstatement semantics remain intentionally open for #400B; do not freeze them as raw clause ordering.
Implementation direction: canonical ESG inputs are immutable; current support/warrant indexes are rebuildable derived state. Premise/lifecycle/context changes invalidate only dependent justifications/profile views. For SWI-compatible bounded default fragments, tabled Well-Founded Semantics via
tnot/1is a strong candidate implementation primitive because it provides a unique partial result and residual undefined conditions; it must not conflate explicit negation with negation-as-failure.Acceptance
call/1.Non-goals
Refs #388 #392 #56 #93 #397 #400.
MACHINE-SPIRIT #398D handoff — compile semantic reasoning into explicit deductive plans
Depth-1 KR research now requires #394 to expose a backend-neutral deductive plan compilation boundary rather than treating
semantic_lower/3as a direct IR→Prolog-clause transform.Recommended conceptual split:
A plan should record at least:
Required evaluation-strategy semantics
For admitted fragments, support strategy selection equivalent to:
Do not use an LLM to choose among strategies when deterministic query/profile/theory metadata suffices.
Outcome semantics
Execution status must not collapse into logical truth:
Timeout/resource exhaustion is never semantic false.
Freshness and explanation
Derived tables/materializations are rebuildable caches keyed to semantic/theory generations. Changes to assertions, theory mappings, bridges, rules or lifecycle status invalidate only dependent derived state where backend capability permits it.
Successful material conclusions/action-relevant evidence should be able to carry a replayable derivation receipt referencing plan fingerprint, rules, premises, theory edges, solver receipts and semantic generation.
This is architecture input only; exact default/negation/paraconsistent semantics remain owned by #394/#400 rather than being accidentally defined by the execution backend. Full design and sources are preserved in #398D.
MACHINE-SPIRIT #400B canonical handoff — typed defeat/dependence semantics
Depth 3B adversarially stress-tested #400A and refined the reasoning contract. Strong additions for this issue:
undefined, stable-model plurality/no-model, argumentation undecided);skeptically_warranted,credulously_warranted,rejected,undefined,undecided,profile_inconsistent) and evaluation completeness (complete,bounded_partial,resource_limited,solver_error,unsupported_query_class);Preferred refined substrate is
ESG + Typed Defeat/Dependence Graph -> explicit profile translator -> profile-specific semantics -> warrant receipt.Full research, alternatives, primary sources, 24 adversarial fixtures and unresolved questions are preserved on #400 in the
Depth 3 / #400Bcomment. Do not freeze one universal priority/default semantics before #400C/#400D.MACHINE-SPIRIT #400C handoff — Epistemic Federation Fabric
Depth 3C requires cross-theory epistemics to preserve local semantics rather than flattening all contexts into one non-monotonic logic.
Add a trusted Epistemic Federation Fabric (EFF) above local ESG/profile evaluation:
Required bridge/export semantics:
evidence_only,skeptical_warrant_as_support,credulous_candidate,attributed_acceptance,revision_input,argument_import, andinert_reference;undefined,conflicted,no_model,resource_limited, andunsupportedremain distinct;noncomposable, never synthetic negation;federated_evidence,federated_skeptical,federated_credulous,federated_argumentation, optional boundedmcs_equilibrium, managed revision, etc.);exact_preserving,sound_but_incomplete,lossy_declared,status_only,noncomposable, orunknown_compatibility.Classic Brewka/Eiter heterogeneous Multi-Context Systems are the main formal precedent; Machine Spirit deliberately keeps global equilibrium as an optional bounded profile rather than ambient memory semantics because a no-equilibrium context must not globally disable unrelated memory.
Cross-theory warrant must expose participating theories/profile versions, bridge closure/versions, local outcome vector, mapping/identity assumptions, source-dependence components, imports/loss, semantic acceptance and evaluation completeness.
Security invariant remains unchanged: semantic/epistemic import never transfers host capability/authority.
MACHINE-SPIRIT #400D canonical handoff — demand-driven interface-factored epistemic execution
Depth 3D completes the execution contract for ESG + Typed Defeat/Dependence + EFF.
Add an explicit Epistemic Query Plan (EQP) layer above the existing deductive-plan/runtime boundary. EQP is data executed by the one canonical runtime/scheduler; it is not a second scheduler.
Required execution semantics:
Project interfaces, not full local worlds
Federation must normally reason over bridge-visible projected interface states. If multiple local WFS/ASP/argumentation states differ internally but export the same status-bearing interface for the selected query, they may be quotiented for federation. Do not enumerate a Cartesian product of full local models merely to discover identical exports.
Projected summaries must remain keyed by theory/profile/evidence frontier/context/interface/identity/dependence/bridge generations and retain a local receipt. Quotienting is federation-query-specific and must not erase local distinctions.
SCC-specific evaluators
undefinedand residual conditions;noncomposableSCC: return a diagnostic/partial result rather than inventing common semantics.Incremental invalidation
Derived dependency indexes must track evidence/lifecycle -> local summaries -> bridge applications -> SCC results -> downstream query caches. Identity, dependence, mapping, closure-contract, bridge and profile version changes invalidate only consumers. If local recomputation produces the same projected interface digest, invalidation stops at that boundary.
Local backends may use SWI/XSB-style incremental tabling, multi-shot ASP/overgrounding, semi-naive Datalog, or profile-specific incremental machinery; do not fake one universal incremental algorithm.
Factorized alternatives
When alternatives genuinely cross a cyclic federation, use a shared AND/OR + guard/nogood/link graph (engine-neutral FECG) or a backend-specific compact representation. BDD/ZDD/d-DNNF/tree-decomposition techniques are optional optimizations, not canonical semantics. Plan cost should expose SCC size, bridge-interface width/treewidth/separators, projected state count, solver calls and hard CPU/memory/work ceilings.
Hard outcome/replay invariants
For the same canonical evidence/context/profile/bridge versions and budgets:
where equality is semantic/receipt-normalized and nondeterministic backend internals are not mistaken for source truth.
All compiled-semantic #400 conformance fixtures must execute with zero provider/LLM calls. Solver exhaustion never triggers implicit LLM fallback.
Full D research, sources, alternatives, complexity analysis and 22 adversarial fixtures are preserved on #400.
MACHINE-SPIRIT #402C boundary — CLFM below epistemic federation
Depth 5C does not add a second truth/warrant layer. CLFM provides #394/#400 with status-bearing durable observations:
#394/EFF still decides epistemic support/warrant under the selected profile. Thus:
Source-dependence accounting must collapse replica/mirror/multi-TS observation paths back to the underlying assertion origin where appropriate. Full CLFM design and fixtures: #402C.
#405C CONCORDAT-MS handoff
Cross-domain epistemic composition must preserve local theory/profile semantics rather than importing remote conclusions as ambient truth.
Hard rules:
Bridge support/status/justification with an explicit target-local appraisal/profile step. Global MCS/equilibrium reasoning remains a named bounded profile, not the default union of all memories. Missing bridge semantics, private provenance, no equilibrium, multiple equilibria and exhausted search stay typed outcomes.
Canonical detail + fixtures C8-C13: #405C.