Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "subsumes"

Title:Relational term subsumption. subsumes/2 is intended as a relational drop-in replacement for the anyway deprecated terms:subsumes/2.
Rating:Not rated. Create the first rating!
Latest version:0.6
SHA1 sum:cfee9114fb6856cf12dcb87329e8a2cabc194f16
Author:Geoffrey Churchill <geoffrey.a.churchill@gmail.com>
Home page:https://github.com/GeoffChurch/subsumes

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.6cfee9114fb6856cf12dcb87329e8a2cabc194f162https://github.com/GeoffChurch/subsumes/archive/0.6.zip
0.58eb6eced4dac71406604bb8cde5976500ced8c9212https://github.com/GeoffChurch/subsumes/archive/0.5.zip
0.4efeea89afc38587b16cdd87449dec0b06e05a3e314http://github.com/GeoffChurch/subsumes/archive/0.4.zip
https://github.com/GeoffChurch/subsumes/archive/0.4.zip
0.32e41eaa49814bbe221a62a5ced2f74f82a204fe53http://github.com/GeoffChurch/subsumes/archive/0.3.zip
0.2f5567af6e724be63e03ddd593b3277fbafa143116http://github.com/GeoffChurch/subsumes/archive/0.2.zip
0.178785bce9c2facfa548294493277ac02b69400772http://github.com/GeoffChurch/subsumes/archive/0.1.zip

subsumes

Relational term subsumption for SWI-Prolog

  • subsumes/2 is intended as a relational drop-in replacement for the anyway deprecated terms:subsumes/2. It can handle cyclic data, as well as cases where cyclic data would be induced.
    ?- f(X, Y) subsumes G.
    G = f(_A, _B),
    X subsumes _A,
    Y subsumes _B.
    
    ?- f(X) subsumes Y, Y subsumes X. % Example with induced cyclic data.
    X = Y, Y = f(Y).
    
    ?- X subsumes Y, X = g(_).
    X = g(_A),
    Y = g(_B),
    _A subsumes _B.
  • subsumes_chk(+General, +Specific) — holds if General can already be guaranteed to permanently subsume Specific (corresponding subterms are == or General's subsumes Specific's by subsumptive links or by being permavar). If ever true, it will remain true, but if false, it may become true later as subsumptive links are added that guarantee permanent subsumption.
  • is_permavar(+V) — holds if V's nonvar lower bounds (LBs) antiunify to a var, which guarantees that it can never be unified with a nonvar. You can make your own permavars with e.g. subsumes(V, apples), subsumes(V, oranges).
  • compact_lbs(+V) — compacts V's LBs, forgetting the originals in some cases, but otherwise a functionally invisible optimization. This is only useful for programs that would be bottlenecked by the sheer size of LB lists. See the unit tests in [test/subsumes.plt](test/subsumes.plt) for more examples.

Installation in SWI-Prolog

?- pack_install(subsumes).

Testing

Run from the project root:

swipl -p library=prolog -g "expand_file_name('test/*.plt', Files), load_files(Files), run_tests" -t halt

(Note to self) To publish a new version:

  1. update pack.pl
  2. do GitHub release with new tag matching the pack.pl version
  3. execute:
    swipl -g "make_directory(temp), pack_install(subsumes, [url('https://github.com/GeoffChurch/subsumes/archive/0.5.zip'), pack_directory(temp), interactive(false)]), delete_directory_and_contents(temp)" -t halt

Contents of pack "subsumes"

Pack contains 6 files holding a total of 10.9K bytes.