This is the final state of the document as it was used for the resolutions in Edinburgh. In the meantime many systems adopted accordingly. This document is superseded by DTC2.In 13211-1:1995 built-in predicates (8) are provided automatically by a standard-conforming processor. This document provides an overview of the current practice of built-in predicates that are not part of 13211-1 but are compliant (5.1) due to:
5.5.9 Built-in predicates
A processor may support one or more additional built-in
predicates (8) as an implementation specific feature.
Implementors interested in standardization who wish to see their system listed in this table are asked to provide a table in HTML with the complete first row and one row for their system. Please consider only additional built-in predicates if you believe that they should be part of the Prolog core.
In all known Prolog processors, there is no distiction between control constructs (7.8) and built-in predicates (8) w.r.t. predicate_property/2.
bip : built-in predicate lib : library - must be loaded explicitly pdp : pre-defined predicate - either autoloaded or pre-defined otherwise. alt : alternate name or very close alternate definition - : this built-in is not present empty : this field is unknown, please help to remove the unknowns!
core | core | pllib | B | IF | SICStus | YAP | SWI | ECLiPSe | GNU | |
Functor | 2008-11-17 | 2009-07-17 | 7B | 7.3 | 5.3 | 3.12 | 6.0 | 5.7 | 6.0 | 1.3 |
compare/3 | 8.4.2 | 8.4.2 | bip | bip | bip | bip | bip | bip | bip | bip |
sort/2 | 8.18.4 | 8.18.4 | any | bip | bip | bip | bip | bip | bip | bip |
keysort/2 | 8.18.5 | 8.18.5 | any | bip | - | bip | bip | bip | bip | bip |
ground/1 | 8.3.10 | 8.3.10 | bip | bip | bip | bip | bip | bip | bip | |
call/2-8 | 8.15.4 | 8.15.4 | bip | bip | ... | 4 | bip | bip | lib | bip |
false/0 | pdp | - | bip | bip | pdp | bip | new | |||
callable/1 | 8.3.9 | 8.3.9 | pdp | - | bip | bip | bip | bip | bip | |
subsumes_term/2 | bip | - | alt | alt | alt | alt | new | |||
alt | lib | lib | bip | lib | ||||||
alt | 4 | alt | alt | alt | ||||||
bip | alt | alt | alt | alt | ||||||
acyclic_term/1 | alt | 8.3.11 | new | alt | lib | lib | bip | bip | new | |
8.3.11 | alt | - | alt | alt | alt | alt | alt | - | ||
8.3.12 | alt | - | bip | alt | alt | alt | alt | - | ||
term_variables/2,3 | bip | lib | bip | bip | lib | new | ||||
retractall/1 | 8.9.5 | 8.9.5 | bip | - | bip | bip | bip | bip | bip | |
numbervars/3 | 8.5.5 | 8.5.5 | bip | - | bip | bip | bip | lib | bip | |
subsumes/2 | 8.2.4 | 8.2.4 | alt | - | lib | lib | bip | lib | - | |
forall/2 | 8.10.4 | 8.10.4 | pdp | - | - | bip | bip | lib | new | |
setup_call_cleanup/3 | 7.8.11 | new | - | alt | bip | bip | lib | - | ||
call_cleanup/2 | 8.15.5 | bip | - | bip | bip | bip | alt | - | ||
(?=)/2 | ? | bip | - | bip | - | bip | lib | - | ||
between/3 | bip | - | - | - | lib | bip | lib | - | ||
is_list/1 | ? | bip | - | lib | bip | bip | bip | - | ||
variant/2 | bip | lib | lib | alt | bip | |||||
(=@=)/ 2 | alt | alt | bip | alt | ||||||
between/4 | ? | - | - | - | - | - | bip | - | ||
(>=<)/2 | bip | - | - | - | - | - | - | - | ||
arity/2 | - | - | - | - | - | bip | - | |||
length/2 | 8.18.2 | lib | any | bip | - | bip | bip | bip | bip | bip |
append/3 | 8.18.1 | lib | any | bip | bip | lib | lib | pdp | bip | bip |
member/2 | 8.18.3 | lib | any | bip | bip | lib | lib | pdp | bip | bip |
8.2.4.1 DescriptionThe last sentence should go reformulated into subclause 8.2.4 (precedent: 8.10.2 bagof/3).
subsumes(General, Specific)
is true iff there is a substitution θ, including the empty substitution, such thatthe term General is instantiated. Generalθ = Specific = Specificθ . This predicate provides a one-way unification.
subsumes(General, Specific) :- subsumes_chk(General, Specific), General = Specific.
subsumes_term(General, Specific)
is true iff there is a
substitution θ such
that
General
θ andSpecific
θ are identical, and
Specific
θ andSpecific
are identical.
Procedurally, subsumes_term(General, Specific)
simply succeeds or fails accordingly. There is no side effect or
unification.
subsumes_term(@term, @term)
subsumes_term(a, a). Succeeds. subsumes_term(f(X,Y), f(Z,Z)). Succeeds. subsumes_term(f(Z,Z), f(X,Y)). Fails. subsumes_term(g(X), g(f(X))). Fails. subsumes_term(X, f(X)). Fails. subsumes_term(X, Y), subsumes_term(Y, f(X)). Succeeds.
NOTES
1subsumes_term/2
is not transitive. The last two examples above illustrate this.
2 A related built-in predicatesubsumes/2
is implemented in many existing processors. In addition to testing for one-sided unifiability, it binds the first argument to become the second. In many situations this binding leads to erroneous programs. The following definition is deprecated and is mentioned here only for backwards compatibility.subsumes(General, Specific) :- subsumes_term(General, Specific), General = Specific.
sort(Xs, Sorted) :- setof(X, member(X,Xs), Sorted). sort([], []).Is
sort(@list, ?list)
a good mode? After all
?- sort([A],[a]). A = a.
mykeysort(KV_s, Sorted) :- bagof(K-V, Vs^ ( setof(K-Vs, bagof(V, member(K-V,KV_s), Vs), KVs_s), member(K-Vs, KVs_s), member(V, Vs) ), Sorted). mykeysort([], []).Is
keysort(@list, ?list)
a good mode? After
variant_halfcorrect(A, B) :- subsumes_term(A, B), subsumes_term(B, A).The more costly version would them be:
variant_correct(A, B) :- copy_term(A, AC), subsumes_term(AC, B), subsumes_term(B, AC).