explain_gap
Given a predicate and key, identifies why a Datalog fact is missing by showing the rule, satisfiable premises, and the unmet premise — either a missing fact to add or a blocking fact to remove.
Instructions
Explain why a derived (Datalog) fact does NOT hold — the why-not dual of explain_fact.
Returns the rule whose gap it characterizes, the body premises that WERE satisfiable (with the head bound), and the first premise no binding satisfies:
a MISSING positive premise → the gap closes by ADDING such a fact (verify with sim_datalog)
a PRESENT negated premise → the gap closes by REMOVING the blocking fact
Default program is the bundled depends.dl, so the common use is explaining a missing MODULE→MODULE dependency:
"Why does module A NOT depend on B?" → explain_gap(predicate="depends", key=["", ""])
A "no gap" result means the fact actually IS derivable (use explain_fact), or no rule head matches the key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| predicate | Yes | The derived predicate of the missing fact (e.g. "depends"). | |
| key | Yes | The missing fact's ground key tuple as wire-string terms (node ids as decimal). | |
| source | No | Optional Datalog program (derive engine); empty/omitted ⇒ the bundled depends.dl. |