FAQ Database Discussion Community


Prolog and List Unification

prolog,unification
I'm trying to further my understanding of Prolog, and how it handles unification. In this case, how it handles unification with lists. This is my knowledgebase; member(X, [X|_]). member(X, [_|T]):- member(X, T). If I'm understanding the process correctly. If member(X, [X|_]) is not true, then it moves into the recursive...

prolog single quote (') unification

prolog,unification
I'm trying to unify variable X with '*' (including the quote marks, for a total of 3-symbol string) What I'm doing is a simple X='*'., but that results in X having the value *. If I go for X=''*''., the result is X=''*''. I'm confused, how can I achieve the...

How is Prolog matching “X = father(X)”?

prolog,unification
In Prolog I entered following query to check if they match: ?- father(X) = X. Prolog responded with this: X = father(X). But in the book it is written that Prolog should respond like this: X = father(father(father(father(father(father(...)))))))))). Why is this happening?...

Unification with STO detection

algorithm,prolog,unification,iso-prolog
In ISO Prolog unification is defined only for those cases that are NSTO (not subject to occurs-check). The idea behind is to cover those cases of unifications that are mostly used in programs and that are actually supported by all Prolog systems. More specifically, ISO/IEC 13211-1:1995 reads: 7.3.3 Subject to...

Is it possible to get the infinite kind error in Haskell 98?

haskell,functional-programming,ocaml,type-inference,unification
I am implementing a kind system for a new functional programming language and I am currently writing the function to unify two kinds. There are four cases two consider: +---------+---------+-------------------------------------------------------+ | k1 | k2 | action | +=========+=========+=======================================================+ | var | var | k1 := k2 ^ k2 := k1...