Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Higher-order unification

I'm working on a higher-order theorem prover, of which unification seems to be the most difficult subproblem.

If Huet's algorithm is still considered state-of-the-art, does anyone have any links to explanations of it that are written to be understood by a programmer rather than a mathematician?

Or even any examples of where it works and the usual first-order algorithm doesn't?

like image 223
rwallace Avatar asked Dec 20 '09 17:12

rwallace


People also ask

What is higher-order unification?

Unification is the process of finding an assignment to free variables in terms t and t , such that they are equal under the assignment. While this is a computable problem for formulas of first-order logic, in higher-order logics, it is known to be undecidable [2].

What is unification in knowledge based system?

Unification is a process of making two different logical atomic expressions identical by finding a substitution. Unification depends on the substitution process. It takes two literals as input and makes them identical using substitution.

What is the purpose of unification?

The goal of unification is to make two expression look like identical by using substitution. Unification can be used for type inference, order sorting, narrowing, e-unification, etc. for simple logics we use first-order unification and to unify typed lambda terms we use higher-order unification.

What is the purpose of unification in artificial intelligence?

In computer science and logic, unification is the algorithmic procedure used in solving equations involving symbolic expressions. In other words, by replacing certain sub-expression variables with other expressions, unification tries to identify two symbolic expressions.


2 Answers

State of the art — yes, so far as I know all algorithms more or less take the same shape as Huet's (I follow theory of logic programming, although my expertise is tangential) provided you need full higher-order matching: subproblems such as higher-order matching (unification where one term is closed), and Dale Miller's pattern calculus, are decidable.

Note that Huet's algorithm is the best in the following sense — it is like a semi-decision algorithm, in that it will find the unifiers if they exist, but it is not guaranteed to terminate if they do not. Since we know that higher-order unification (indeed, second-order unification) is undecidable, you can't do better than that.

Explanations: The first four chapters of Conal Elliott's PhD thesis, Extensions and Applications of Higher-Order Unification should fit the bill. That part weighs almost 80 pages, with some dense type theory, but its well motivated, and is the most readable account I've seen.

Examples: Huet's algorithm will come up with the goods for this example: [X(o), Y(succ(0))]; which of necessity will perplex a first-order unification algorithm.

like image 137
Charles Stewart Avatar answered Oct 11 '22 13:10

Charles Stewart


An example of higher-order unification (really second-order matching) is: f 3 == 3 + 3, where == is modulo alpha, beta, and eta-conversion (but not assigning any meaning to "+"). There are four solutions:

\ x -> x + x \ x -> x + 3 \ x -> 3 + x \ x -> 3 + 3 

In contrast, first-order unification/matching would give no solution.

HOU is very handy when used with HOAS (higher-order abstract syntax), to encode languages with variable binding while avoiding the complexity of variable capture etc.

My first exposure to the topic was the paper "Proving and Applying Program Transformations Expressed with Second Order Patterns" by Gerard Huet and Bernard Lang. As I recall, this paper was "written to be understood by a programmer". And once you understand second-order matching, HOU isn't much further to go. A key result of Huet's is that the flexible/flexible case (variables as head of a term, and the only case not appearing in matching) is always solvable.

like image 41
Conal Avatar answered Oct 11 '22 15:10

Conal