Course / Lectures / Lecture 02 / Lab
Lab 02
A query is a proof.
A Datalog engine has no weights and no gradients. It has facts, rules, unification, and a fixpoint. Run it, step it, and read the derivation: every answer comes with the reason it is true.
The Datalog lab
Syntax: parent(alice, bob). · variables start uppercase: ancestor(X, Y) :- parent(X, Y). · negation: not graduated(X) · one statement per period.
Run the query.
Derivation
The proof tree appears here.
Fixpoint trace
Each round adds the facts that follow from the previous round.
All answers
Variable queries list every substitution.
What this shows — and what it does not
It shows the actual mechanism: parsing, unification, rule application, the least fixpoint, stratified negation, and a proof tree. It does not implement a full Datalog system: there are no function symbols, no aggregates, no indexing, and no magic sets. The point is to make the symbolic engine visible, not to replace clingo or Soufflé.
← Read the inference section · Back to Lecture 02 · Slides →