Unification Problem

A unification problem is a set of equations between terms containing variables.

A solution to , also called a unifier, is a substitution , such that when applied to every term in , for each equation , the terms and are syntactically identical.

Link to original

Most General Unifier

Most general unifier (semantics)

The most general unifier of is a unifier such that any other unifier is an instance of .

Link to original

Consider the unification problem and substitutions and .

Both substitutions make the terms and syntactically identical:

Hence they are both unifiers. However, is more general than because is an instance of . (apply the substitution after gives us ), but is not an instance of (we cannot get from ).

In this case, we can also say that is the most general unifier because no other unifier is more general than is.

Intuition

Substitutions applied to entire clauses allow them to resolve. Those that “commit” variables to specific terms (constants, function terms) prevent future substitutions from being able to act as unifiers.

Example of "committing" variables

We can unify the atoms and in the clauses: either by replacing by (or by ), or by replacing both and by some constant.

The first two substitutions would allow us to unify the resolvent (or with the clause , the former would not.

Replacing and by early commits the variable (or ) to the constant , generating the new clause and would not allow resolution of this clause with any atom involving anything other than . So we want to leave variables “free”, unless we need to bind them for unification to succeed.

Unification Algorithm

The unification algorithm finds the most general unifier for a unification problem if a solution exists, or otherwise fails, indicating there are no solutions. To find the mgu, the algorithm simplifies the set of equations using a set of transformation rules.

At each step, either a new set of equations is produced or a failure case arises. Algorithm terminates and outputs mgu when no rule may be applied.

The algorithm has:

  • an input of: a finite set of term equations
  • an output of: the mgu of those equations or failure

We follow the rules:

  1. this and the following rule also apply to constants
  2. this is called an occur-check for example if is a failure case this step is time-consuming and sometimes omitted

The unification algorithm applies the rules in a non-deterministic way until no further rules can be applied or a failure case arises. In the case of success, we can change each in the final set of equations to in order to obtain the mgu of the initial set of terms.

Unification Examples

  1. use rule (1) with the first equation:
  2. use rule (4) with the first equation:
  3. use rule (1) with the second equation:

Output:

  1. use rule (1) with the first equation:
  2. use rule (5) with the first equation:
  3. use rule (4) with the last equation:

Output:

  1. use rule (1) on 1:
  2. use rule (4) on 1:
  3. use rule (5) on 1:
  4. use rule (1) on 2:
  5. use rule (1) on 2:
  6. use rule (4) on 2:
  7. use rule (5) on 2:
  8. use rule (1) on 3:
  9. use rule (1) on 3:
  10. use rule (3) on 3:

Output: