Skip to content

tiny-datalog 0.6.0

Latest

Choose a tag to compare

@andrewgoodchild andrewgoodchild released this 15 Oct 10:38

Comparisons, integrity constraints, warnings, time, and agent memory.

  • Comparisons < <= > >= = !=. They check values but never compute them: both sides must be bound, and there is still no +. Numbers compare as numbers and strings as text, so ISO dates compare as dates. Every engine supports them, as do incremental maintenance, semirings and --models. prolog.py and the chase refuse them, and containment skips rules that use them.
  • Integrity constraints :- body.: after evaluation, every match is printed as a counterexample and the exit status is 3. In Python, engine.violations() returns the matches, and IncrementalEngine checks its updated state the same way.
  • Warnings on stderr for legal programs that are probably wrong:
    • a predicate nothing defines, with the nearest name ("did you mean suspended?");
    • a predicate with no base case;
    • comparisons that can never all hold.
  • --assume: a what-if run with facts added, or removed with fact~..
  • Value safety: strings containing line breaks, control characters, invisible or direction-changing characters, or both kinds of quote, are refused, in program text and in facts= from Python.
  • Two new lessons:
    • 23, Time: dated statements and supersession, intervals and overlap, and when a fact held versus when it was recorded.
    • 24, Agent memory: a language model writes only the statements it was told, tagged with their source. Rules derive the beliefs, contradictions become questions to the user, and --explain traces each belief back to its source.
  • Lesson 17 gains sections on integrity constraints and on mistakes that are still legal Datalog. An Agent Skill (skills/tiny-datalog/SKILL.md) is included, and the other lessons were updated to match.

Behaviour changes:

  • :- q(X). used to be a parse error and is now a constraint.
  • String values refuse tabs, newlines and other invisible characters.
  • violations() doesn't report _ variables, matching query().

362 tests.