First-Order Unification and the Occurs Check

Solve term equations with substitutions and explain why a finite variable cannot denote a term that properly contains itself.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Decompose equal outer constructors
  2. A self-reference changes the allowed term model

Decompose equal outer constructors

Unify terms by taking equations between them. Equal function symbols of equal arity yield equations on corresponding arguments. Distinct rigid symbols conflict. An equation of the form \(x=t\), with \(x\) a variable absent from \(t\), allows substitution through the remaining equations. For \(f(x,g(y))=f(g(a),g(z))\), decomposition gives \(x=g(a)\) and \(y=z\). Additional choices for \(z\) are left unconstrained.

A self-reference changes the allowed term model

The equation \(x=f(x)\) has no finite-term solution. Whatever term replaces \(x\), applying \(f\) creates a strictly larger term. The occurs check rejects this equation before substitution. In usual first-order unification, the most general solution represents other solutions as further substitutions. Hindley–Milner inference solves related equations over type constructors. First-order proof search uses unification to connect clauses with compatible instances.[1][2]

References

  1. Benjamin C. Pierce et al., Software Foundations ↩
  2. Shriram Krishnamurthi, Programming Languages: Application and Interpretation ↩