B u s L o g i c:- prolog, code, chatter.

Purity: A Horn Clause Only library for Prolog

Up: Purity

Set Predicates

To use, import the following module

:- use_module(library(pset)).


pset_empty(Domain, Set).

Set is the empty set for Domain.


list_set(Domain, List, Set).

Set is a set of unique and sorted elements of List. List elements must all be in Domain.


set_list(Set, List).

List is the data for Set as a list.


subset(SubSet, Set, Truth).

Truth is true if all elements in SubSet are also in Set. Truth is false if any elements in SubSet are not in Set.


punion(Set1, Set2, ResultSet).

ResultSet is the union of Set1 and Set2.


pintersection(Set1, Set2, ResultSet).

ResultSet is the intersection of Set1 and Set2.

This means that all elements


pdifference(Set1, Set2, ResultSet).

ResultSet containst elements in Set1 that don't exist in Set2.