Unification is a substitution process . I saw that this is called a “two way match”.
In Prolog, in other logical programming languages and in languages directly based on rewrite logic ( Maude , Elan , etc.), this is the mechanism by which free (logical) variables are associated with terms / values. In Concurrent Prolog, these variables are interpreted as communication channels.
IMO, the best way to understand this with some examples from mathematics (unification was / is the basic key mechanism, for example, in the context of automated research by theoretical theorists, AI sub-field, other use in type inference algorithms ). The following examples are taken from the context of a computer algebra system (CAS) :
First example:
Q * + , * - +, :
X * (Y + Z) = (X * Y) + (X * Z) |1|
( - ).
, :
a * (1 + b) |2|
we ( ) , | 2 |, (lhs) of | 1 | () ( , mgu):
{X/a, Y/1, Z/b} |3|
, | 3 | (rhs) | 1 |, , :
(a * 1) + (a * b)
, . .
:
:
log(X,Y) + log(X,Z) => log(X,Y*Z) |4|
:
log(e,(x+1)) + log(e,(x-1)) = k |5|
(lhs of | 5 | lhs of | 4 |), mgu:
{X/e, Y/(x+1), Z/(x-1)} |6|
, X x - . : X Y, , (x + 1) (x-1), .
mgu, | 6 |, rhs of | 4 | | 5 |; :
log(e,(x+1)*(x-1)) = k |7|
..
(, , .)