A Complete Unification Algorithm for Associative-Commutative Functions

Mark E. Stickel

Abstract

Stickel presents a complete unification algorithm for functions that are both associative and commutative (AC). By mapping symbolic expressions to systems of linear Diophantine equations, the algorithm finds all possible ways to make two terms equivalent without falling into infinite loops or requiring manual "widening" hacks.

Introduction

In automated theorem proving, unification is the process of finding substitutions for variables that make two different logical expressions identical. Standard syntactic unification (Robinson’s algorithm) fails to account for mathematical properties like commutativity ($x + y = y + x$) or associativity ($(x + y) + z = x + (y + z)$).

Before Stickel's work, researchers either added explicit axioms for these properties—which caused the search space to explode—or used incomplete algorithms that might miss valid solutions. Stickel’s goal was to build these mathematical properties directly into the unification engine, ensuring the computer finds every possible way to match two terms while guaranteeing termination.

The Stickel Algorithm

The "Stickel Algorithm" shifts the problem from symbolic logic to linear algebra through several key steps:

  1. Flattening: AC functions are represented as having an arbitrary number of arguments. Instead of $f(a, f(b, c))$, it uses $f(a, b, c)$.
  2. Generalization: Complex sub-terms or constants are replaced with temporary variables to be solved for later.
  3. Diophantine Equations: Terms are translated into linear equations where coefficients represent the multiplicity of variables. For example, unifying $f(x, x, y)$ with $f(z, z, z)$ becomes the equation $2x + 1y = 3z$.
  4. Solving for Basis Solutions: The algorithm finds all minimal non-negative integer solutions to these equations. This step is critical for ensuring the finite nature of the solution set.
Table of minimal non-negative integer solutions for a linear Diophantine equation.
  1. Generating Unifiers: It forms combinations of these basis solutions. Because variables in logic cannot be "empty," the algorithm filters for combinations where every original variable is assigned at least one term.
  2. Recursive Unification: Finally, it reconciles the temporary variables with the original constants or sub-terms using standard unification.

Key Insights and Results

The most profound insight is that AC-matching is essentially a counting problem. By leveraging the theory of linear Diophantine equations, Stickel proved that a finite "basis" of solutions exists, ensuring the algorithm doesn't need to guess new variables indefinitely.

Key results include:

  • Termination: Unlike previous attempts at associative unification, Stickel proved that for AC functions, a finite set of "most general unifiers" always exists and can be found in finite time.
  • Soundness and Completeness: The paper provides a formal proof that the algorithm only returns valid unifiers and never misses one.
  • Efficiency: While computationally expensive due to the combinatorial nature of combining solutions, it was significantly more efficient than the axiomatic approach used in earlier systems like QA4 or QLISP.

Limitations and Future Work

The algorithm faces a combinatorial explosion; even simple examples can generate dozens of unifiers (e.g., unifying $f(xxya)$ and $f(bbz)$ results in 69 distinct unifiers). Additionally, it does not solve for functions that are only associative, as those can have an infinite number of unifiers. Future work focuses on finding tighter bounds for Diophantine solutions to improve practical performance.

Summary updated

BibTeX
@inproceedings{stickel1975complete,
  author = {Mark E. Stickel},
  title = {{A Complete Unification Algorithm for Associative-Commutative Functions}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {1975},
}
Figure