A unifier is a predicate substitution applied on two different predicates to make them syntactically the same (i.e. have the same symbols). This is also the same as making two formulae logically equivalent. Unification is required in resolution in predicate logic.
Definition
Unifier
Let and be two predicate formulae. Then, a unifier, is a predicate substitution such that:
If such a exists, then and are said to be unifiable. Here means syntactically the same (having the exact same symbols in the exact same order)
Most General Unifier
Most General Unifier (MGU)
A most general unifier (MGU) is the ‘simplest’ unifier. It is a predicate substitution that satisfies:
- is a unifier
- Every other unifier, can be expressed as a composition of with some other unifier :
The MGU is unique except in cases of variants (#todo )
#tosee Is there any way to prove that a substitution is a mgu?
Examples
A lot of these examples rely on convention for naming terms, so see that first!
-
and are unifiable with .
- is actually the most general unifier
-
and have two MGUs : and
- is not a MGU because it can be expressed as a composition: or
Non-examples
- and are not unifiable, because predicate substitution only applies to variables, not constants.
Uses
- Compilers use unification to obtain the type signature of functions in coding