1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
:- protocol(setp).
:- info([
version is 1.0,
author is 'Paulo Moura',
date is 2000/7/24,
comment is 'Set protocol.']).
:- public(delete/3).
:- mode(delete(+set, @term, ?set), one).
:- info(delete/3,
[comment is 'Deletes an element from a set returning the set of remaining elements.',
argnames is ['Set', 'Element', 'Remaining']]).
:- public(disjoint/2).
:- mode(disjoint(+set, +set), zero_or_one).
:- info(disjoint/2, [
comment is 'True if the two sets have no element in common.',
argnames is ['Set1', 'Set2']]).
:- public(equal/2).
:- mode(equal(+set, +set), zero_or_one).
:- info(equal/2, [
comment is 'True if the two sets are equal.',
argnames is ['Set1', 'Set2']]).
:- public(empty/1).
:- mode(empty(+set), zero_or_one).
:- info(empty/1, [
comment is 'True if the set is empty.',
argnames is ['Set']]).
:- public(insert/3).
:- mode(insert(+set, +term, ?set), one).
:- info(insert/3, [
comment is 'Inserts an element in a set, returning the resulting set.',
argnames is ['In', 'Element', 'Out']]).
:- public(insert_all/3).
:- mode(insert_all(+list, +set, ?set), one).
:- info(insert_all/3, [
comment is 'Inserts a list of elemnts in a set, returning the resulting set.',
argnames is ['List', 'In', 'Out']]).
:- public(intersect/2).
:- mode(intersect(+set, +set), zero_or_one).
:- info(intersect/2, [
comment is 'True if the two sets have at least one element in common.',
argnames is ['Set1', 'Set2']]).
:- public(intersection/3).
:- mode(intersection(+set, +set, ?set), zero_or_one).
:- info(intersection/3, [
comment is 'Returns the intersection of Set1 and Set2.',
argnames is ['Set1', 'Set2', 'Intersection']]).
:- public(length/2).
:- mode(length(+set, ?integer), zero_or_one).
:- info(length/2,
[comment is 'Number of set elements.',
argnames is ['Set', 'Length']]).
:- public(member/2).
:- mode(member(+term, +set), zero_or_one).
:- mode(member(-term, +set), zero_or_more).
:- info(member/2,
[comment is 'Element is a member of set Set.',
argnames is ['Element', 'Set']]).
:- public(powerset/2).
:- mode(powerset(+set, -list), one).
:- info(powerset/2,
[comment is 'Returns the power set of a set, represented as a list of sets.',
argnames is ['Set', 'Powerset']]).
:- public(select/3).
:- mode(select(?term, +set, ?set), zero_or_more).
:- info(select/3,
[comment is 'Selects an element from a set, returning the set of remaining elements.',
argnames is ['Element', 'Set', 'Remaining']]).
:- public(subset/2).
:- mode(subset(+set, +set), zero_or_one).
:- info(subset/2, [
comment is 'True if Subset is a subset of Set.',
argnames is ['Subset', 'Set']]).
:- public(subtract/3).
:- mode(subtract(+set, +set, ?set), zero_or_one).
:- info(subtract/3, [
comment is 'True when Difference contains all and only the elements of Set1 which are not also in Set2.',
argnames is ['Set1', 'Set2', 'Difference']]).
:- public(symdiff/3).
:- mode(symdiff(+set, +set, ?set), zero_or_one).
:- info(symdiff/3, [
comment is 'True if Difference is the symmetric difference of Set1 and Set2.',
argnames is ['Set1', 'Set2', 'Difference']]).
:- public(union/3).
:- mode(union(+set, +set, ?set), zero_or_one).
:- info(union/3, [
comment is 'True if Union is the union of Set1 and Set2.',
argnames is ['Set1', 'Set2', 'Union']]).
:- end_protocol.
|