Ann: SWI-Prolog 8.1.9

Dear SWI-Prolog user,

I’m happy to announce SWI-Prolog 8.1.9. A lot of stuff happened,
although not much that is important to the causual Prolog user … yet.
I hope the new functionality will open new application areas.


  • A new more general, documented and faster API to listen to
    events in the Prolog core. This allows for listening to
    dynamic database updates (assert,retract,erase, retractall)
    which was needed for incremental tabling, but surely has
    other applications such as simplifying the API of
    library(consistency). See prolog_listen/2,3.

  • Keri modified fatal error handling such that (Windows)
    service managers pick up fatal events in Prolog services
    easier. Also adds ?- halt(abort) to trigger fatal errors
    from inside Prolog.

  • Some fixes to xpce (gui tracer issue, old pre-SWI-7 minor
    compatibility issue).

Tabling stuff:

  • Fixed several crashes in the tabling implementation as well
    as errors in fetching the residual program.

  • Added incremental tabling. This declares a number of tabled
    predicates to depend on each other and some dynamic predicates.
    Modifying the dynamic predicates automatically invalidates the
    affected tables that are (lazily) recomputed on subsequent
    access. Dynamic updates preserve the well founded semantics.
    Unlike XSB, update view consistency is not yet implemented,
    i.e. answers being generated on backtracking should not be
    affected by subsequent database modifications. This is true
    for SWI-Prolog, but not yet preserved for incremental tabling.

    Again, Theresa Swift, David Warren should be acknowledged for
    their support, as well as Benjamin Grossof and Kyndi for making
    this possible.

  • A lot more has been added to the XSB dialect emulation libraries.
    These libraries are now mostly populated to be able to reuse
    tests from the XSB suite unmodified.

    Enjoy — Jan

SWI-Prolog Changelog since version 8.1.8

  • DOC: Included reference to XSB incremental tabling paper.

  • XSB: Started emulation of the module error_handler.

  • ENHANCED: Simplify early if an unconditional answer arrives.

  • TEST: Added incremental WFS test

  • ADDED: WFS updates for incremental tabling.

  • DOC: more complete description of incremental tabling.

  • FIXED: Allow module qualification in specification of table/1.

  • ADDED: abolish_nonincremental_tables/0,1.

  • XSB: added incr_invalidate_calls/1 and incr_table_update/0

  • XSB: More of the increval module emulation.

  • TEST: Start migrating XSB incremental tests

  • XSB: pass incremental for :- table.

  • XSB: Support incremental tabling predicate emulaton.

  • FIXED: library(prolog_colour): table (...) as ....

  • DEBUG: Allow runtime disabling of early completion when compiled
    for debugging.

  • ADDED: abstract(0) property and partial implementation to get dynamic
    predicates into the IDG.

  • ADDED: dynamic/2 to set additional properties on dynamic predicates.

  • MODIFIED: Deleted the possibility of :- dynamic(p/1, q/1). This
    was once added due to misinterpretation of the ISO standard.

  • ADDED: predicate property incremental for tabled predicates (no-op).

  • XSB: Fixed PLDoc comments

  • ADDED: library(prolog_trace) for printing access to predicates.

  • MODIFIED: Removed trace/1,2 from the core. Will be re-added as
    library based on wrap_predicate/4 in subsequent commits.

  • FIXED: Breakpoint handling using new hook interface.

  • TEST: Added new event handling tests

  • ADDED: prolog_listen/2,3 and prolog_unlisten/2 to register hooks into
    the Prolog engine that allow trapping certain events. This replaces
    and generalises the undocumented prolog_event_hook/1 hook used by
    the debugger. A notable new feature is to track changes to (dynamic)

  • CLEANUP: Move event interface into new files pl-event.[ch], preparing
    for further generalisation.

  • XSB: Allow get_call/3 and get_calls/3 to work for answer subsumption.

  • ADDED: table/1: allow for answer subsumption using
    lattice(name(_,_,_)) for compatibility with XSB.

  • TEST: Added several XSB tests from the table_tests test set.

  • XSB: Include library(tables) by default.

  • TEST: Fixed results for pred_abolish_dag.P

  • TEST: Correct pred_abolish_cycle.P test

  • TEST: Completed import of XSB table_tests/abolish* tests

  • XSB: abolish_table_pred/1 must remove all tables, also if the head
    is partially instantiated.

  • FIXED: table/1: Allow specifying arity-0 predicates with just their
    name (as it is interpreted as a special case for answer subsumption).

  • TEST: Partial copy of the XSB table_tests test set.

  • ENHANCED: allow for abolishing answer tries that are active (on a
    choice point) and/or have mutual dependencies due to undefined answers.

  • MAINTENANCE: Provide ninja/make etags target

  • XSB: added gc_tables/1.

  • FIXED: Make toplevel behave correctly if the tables underlying a WFS
    residual program have been deleted by the goal.

  • FIXED: abolish_table_subgoals/1 to deal with imported predicates.

  • XSB: Make get_residual/2 work on imported predicates.

  • XSB: added gc_tables/1.

  • XSB: Added abolish_table_call/1 to library(tables)

  • ADDED: abolish_module_tables/1.

  • XSB: Ignore index/3 as a directive (what does this do?)

  • XSB: Started emulation of library(consult).

  • TEST: Added tests for recent memory errors.

  • FIXED: Reset the argument stack on failure during trie unification.
    Lead to a crash in GC on a stack overflow during unification.

  • FIXED: Stack allocation for pushing the table return template.

  • FIXED: Skip over a deleted node while backtracking over a trie.

  • DOC: halt(abort)

  • MODIFIED: halt/1 accepts ‘abort’ arg to terminate Prolog via
    abort(). Fatal+system errors now terminate Prolog using abort()
    instead of exit().

  • DOC: call_residual_program/2 LaTeX error.

  • ENHANCED: Better representation for answer term return terms. By
    using the variable labeling of the node for the answer trie in the
    variant trie we do not need to store the return term explicitly and
    we can avoid several general unifications.

  • FIXED: sandbox declaration to allow tabling.

Package xpce

  • FIXED: GUI tracer: do not interpret key bindings for the debugger if
    the editor is in a sub-mode (e.g., searching).

  • FIXED: translation of [] into an empty vector/chain.

  • MODIFIED: Use new SWI-Prolog even API instead of prolog_event_hook/1.