Go to the previous, next section.
This package defines operations on terms for subsumption checking, "anti-unification", unification with occurs-check, testing acyclicity, and getting the variables.
To load the package, enter the query
| ?- use_module(library(terms)).
subsumes_chk(f(X), f(a)). true | ?- subsumes_chk(f(a), f(X)). no | ?- subsumes_chk(A-A, B-C). no | ?- subsumes_chk(A-B, C-C). true
| ?- term_subsumer(f(g(1,h(_))), f(g(_,h(1))), T). T = f(g(_B,h(_A))) | ?- term_subsumer(f(1+2,2+1), f(3+4,4+3), T). T = f(_A+_B,_B+_A)
The depth of a term is defined as follows: the (principal functor of) the term itself has depth 1, and an argument of a term with depth i has depth i+1.
Depth should be an integer >= -1. If Depth = -1, Term must be ground, and all subterms of Term are relevant in computing Hash. Otherwise, only the subterms up to depth Depth of Term are used in the computation.
Range should be an integer >= 1.
| ?- term_hash([a,b,_], 3, 4, H). H = 2 | ?- term_hash([a,b,_], 4, 4, H). true | ?- term_hash(f(a,f(b,f(_,[]))), 2, 4, H). H = 0
term_hash/4
is provided primarily as a tool for the construction
of sophisticated Prolog clause access schemes. Its intended use is to
generate hash values for terms that will be used with first argument
clause indexing, yielding compact and efficient multi-argument or deep
argument indexing.
Go to the previous, next section.