~ Office Supplies ~~ Buy Posters ~~ A-Z Products ~~ Website Advertising


Unification - Wikipedia

<<Up     Contents

Unification

The concept of unification is one of the main ideas behind Prolog. It represents the mechanism of binding the contents of variables and can be viewed as a kind of one-time assignment. In Prolog, this operation is denoted by symbol "=".

  1. An uninstantiated variable X (i.e. no previous unification were performed on it) can be unified with an uninstantiated variable (and effectively becomes its alias), an atom or a term.
  2. An atom can be unified only with the same atom.
  3. A term is unified with another term, if the heads and arities of the terms are identic and the parameters are unified (note that this is a recursive behaviour).

Due to its declarative nature, the order in a sequence of unifications doesn't play (usually) any role.

Examples of unification

A=A
Succeeds (tautology)
A=B, B=abc
Both A and B are unified with the atom abc
xyz=C, C=D
Unification is symmetric
abc=abc
Unification succeeds
abc=xyz
Fails to unify, atoms are different
f(A)=f(B)
A is unified with B
f(A)=g(B)
Fails, the heads of terms are different
f(A)=f(B,C)
Fails to unify, because terms have different arity
f(g(A))=f(B)
Unifies B with the term g(A)
f(g(A), A)=f(B, xyz)
Unifies A with the atom xyz and B with the term g(xyz)
A=f(A)
Infinite unification, A is unified with f(f(f(f(...)))).
A=abc, xyz=X, A=X
Fails to unify; effectively abc=xyz

wikipedia.org dumped 2003-03-17 with terodump




 
 
33 carats blue Tanzanite zoisite rough crystal specimen jewelry cabbing gemstone 6 grams lot parcel
 33 carats blue Tanzanite zoisite crystal specimen jewelry cabbing 6 grams lot parcel 
 
8 carat black OBSIDIAN gem stones Polished rectangle blocks Cabbing cab cabochon rough gemstones
 8 carat black OBSIDIAN Polished rectangle blocks Cabbing cab cabochon  
 
60 gr Arizona pink red yellow PETRIFIED WOOD Cab lapidary rough tumble polished cabbing gemstone lot
 60 gr Arizona pink red yellow PETRIFIED WOOD Cab lapidary tumble polished cabbing lot 
 
91 carats Red SUNSTONE Feldspar Tumbled Polished raw uncut rough jewelry gemstone 18 grams Pretty
 91 carats Red SUNSTONE Feldspar Tumbled Polished raw uncut jewelry 18 grams Pretty 
 
50 carats Mandarin Orange SPESSARTITES GARNETS gems tumble polished raw cab rough gemstones 10 grams
 50 carats Mandarin Orange SPESSARTITES GARNETS tumble polished raw cab 10 grams