Ann: SWI-Prolog 8.1.13

Dear SWI-Prolog user,

SWI-Prolog 8.1.13 is ready for download. Most of the work is again on
tabling (and is likely to be so for some time). Highlights:

  • Semweb fixes by Leonid Mokrushin. Thanks!

  • #! script argument processing fixed. Reported by Chris Mungall.

  • Tabling

    • Error in trie term enumeration that could miss terms, leading
      to semantic errors.
    • Two fixes to incrental tabling update management.
    • Fix wrapping predicates for foreign predicates. Allows tabling
      foreign precicates!
    • Update tabling if :- table directives are modified or removed
      from a source file. Removing removes the tabling and tables.
    • Added support for the :- table directive to listing/0-2.
    • Proof of concept for incremental shared tables, i.e. incremental
      tabling with tables that are shared between threads.
    • Avoid C-stack overflow on deeply nested tabling components.
    • Provide Prolog flags table_shared and table_incremental to set
      defaults for tabling options.
    • Despite discussion here, finally decided to support e.g.
      :- dynamic p/1 as incremental.. The incompatibility with XSB
      was too confusing. dynamic/2 remains an alternative syntax.
    • PceEmacs: added xsb mode for .P files with basic support for
      XSB syntax such as :- import p/1 from x.

    Enjoy — Jan

SWI-Prolog Changelog since version 8.1.12

  • ADDED: Code of Conduct page

  • ADDED: Prolog flags table_shared and table_incremental to set
    defaults for tabling options.

  • FIXED: library(prolog_xref): avoid looping on a module declaration
    with a variable export list.

  • FIXED: Use an atomic decision between re-evaluation and using the
    valid compiled clause.

  • TEST: Test shared IDG falsecount propagation.

  • ENHANCED: Allow waiting for a table from another thread to be aborted
    by a thread signal (including call_with_time_limit/2).

  • FIXED: if a no change is propagated to a shared table, release it.

  • CLEANUP: library(prolog_colour) dealing with highlighting declarations.

  • DOC: read/1: fixed and explain its role more clearly as this is a
    likely entry point for new users to read from a file or the user.

  • ADDED: Deal with as(,) for declarations in cross referencer and
    highlighting

  • ADDED: Support the XSB syntax :- dynamic p/1 as incremental.. The
    incompatibility makes writing code that runs on both too complicated.

  • CLEANUP: better structure for setting predicate properties.

  • ADDED: predicate_property/2: tabled option without flags to enumerate
    all tabled predicates without duplicates.

  • FIXED: Resolved abolishing tables with incremental tabling. This
    removes the notion of a nested tabling environment for re-evaluation.q

  • FIXED: Issue#499: free_component() (freeing a table component) to
    avoid C-recursion and thus a possible crash if the component stack
    is deeply nested.

  • DOC: with_output_to/2 encoding issues.

  • MODIFIED: Do not allow switching encoding to an Sopenmem() stream.

  • ADDED: predicate_property/2: provide access to table options
    through the tabled(Flag) property. Currently supports shared and
    incremental in addition to the mode (variant or subsumptive).

  • FIXED: An SCC can contain a mixture of re-evaluated and normal
    answer tries. Remove the check for such hybrid SCCs and document
    why they can occur.

  • FIXED: initialization of local and shared table space limit

  • FIXED: Do not discard merged tables.

  • TEST: Disabled shared tests if threads are disabled.

  • TEST: verify deadlock handling while re-evaluating a shared table.

  • FIXED: node/value count properties on tries if the trie is reset
    rather than destroyed.

  • FIXED: ‘$tbl_table_status’/4 if return skeleton is instantiated.

  • ENHANCED: Allow prolog_colour:goal_colours/2 to overrule builtin
    definitions.

  • ADDED: prolog_colourise_stream/4, providing an operators(+Ops) option.

  • ADDED: is_most_general_term/1. Compatibility with XSB

  • FIXED: Highlighting for qualified table declarations.

  • ADDED: trie_property/2, compiled_size(Bytes).

  • FIXED: wrap_predicate/4 for foreign predicate could cause data
    corruption if GC is triggered while executing the wrapper clause.
    This prevented table/1 for foreign predicates.

  • FIXED: Issue#498: crash in term_singletons/2 if second argument
    is instantiated.

  • FIXED: Delayed events on clauses could crash because the clause could
    be subject to clause garbage collection.

  • FIXED: Remove tabling if directive is removed from the source file.

  • ADDED: Partial support to include table directives in
    listing/0,1,2. Renamed wrapper to reuse normal hiding conventions
    for code.

  • ADDED: detect removal of table/1 directives during reconsult and call
    untable/1 to remove the tabling for these predicates. Not yet working.

  • MODIFIED: Do not use reconsult delay for predicate attributes set for
    predicates that are defined in another module. This fixes a problem
    where a file that contains a cross-module directive wipes the clauses
    of the referenced predicate on a reconsult. Not really sure about
    this. Possibly we need to keep track of locations of declarations
    such that we can manage changes to declarations more robustly.

  • FIXED: update for multiple incremental tables depending on the same
    dynamic predicate.

  • FIXED: re-evaluation of mutually dependent incremental dynamic goals.

  • FIXED: trie_gen/2,3 if a variable in the trie is matched against a
    compound term may miss answers.

  • FIXED: A #! script should pass all arguments to the application.
    Chris Mungall.

Package semweb

  • FIXED: incorrect temporary stream encoding in rdf_save/2

  • FIXED: to accept strings in save_attribute_value/3 to allow proper
    xsd:dateTime serialization

Package xpce

  • XSB: initial XSB colour mode.

  • ADDED: Deal with dedicated operators on Prolog sub-modes

  • ADDED: xsb mode for editing files in XSB syntax, triggered by the
    .P extension.

3 Likes

That was needed. I see a few of those type questions at StackOverflow each time a new semester starts at the university level.

1 Like

This is a great advantage, to be able to table foreign predicates!!
Does XSB have this? Maybe SWI-Prolog is starting to surpass (in some areas) XSB with regards to the feature set :slight_smile:

1 Like

XSB says:

| ?- table atom_concat/3.
++Error[XSB/Runtime/P]: [Permission (Operation) table on static_code: atom_concat/3]  in table/1

More importantly, you get the same if you load a file defining some predicate and then try to get it tabled. Fundamentally this is of course not so interesting: put the table directive with the predicate in the file and wrap the foreign predicate.

From a usability point of view we were happy to be able to play around by switching tabling on and off to see what is happening in a program with a lot of data loaded (and thus long startup time). This lead to the tentative conclusion that what needs to be tabled for optimal performance and minimal memory usage is not very trivial. The tools that should tell us are the profiler and to be written support tools to explain what is tabled. Some are in my personal Prolog library. In due time these should be moved to the system.

The new stuff wrt XSB will notably be in concurrent tabling :slight_smile:

1 Like