Lecture 6: Unification and Lifting
Laura Kovács
First-Order Logic: Exercises
Which of the following statements are true?
- First-order logic is an extension of propositional logic.
- First-order logic is NP-complete.
- In first-order logic you can use quantifiers over sets.
- First-order logic is decidable.
- One can axiomatise naturals in first-order logic.
- Having proofs is good.
Substitution
- A substitution is a mapping from variables to terms such that the set is finite.
- This set is the domain of .
- Notation: , where are pairwise different variables, denotes the substitution with
- Applying a substitution to an expression means replacing each by simultaneously; we denote the result by .
- Substitutions are functions, so we can compose them. We write (rather than ), and we always have .
Example
Consider the expression and the substitution .
What is ?
Substitution Composition
Suppose we have two substitutions
How can we compute their composition ?
The substitution is obtained from
by deleting
- all such that ;
- all such that .
The remaining bindings constitute .
Example
Let
What is ?
Instances and Ground Instances
An instance of an expression (term, atom, literal, or clause) is obtained by applying a substitution to .
- Some instances of the term are , , , and .
- The term is not an instance of .
- A ground instance is an instance that contains no variables.
Herbrand's Theorem
For a set of clauses , let denote the set of ground instances of clauses in .
Theorem. Let be a signature with at least one constant symbol and let be a set of universal clauses over . The following are equivalent:
- is unsatisfiable.
- is unsatisfiable.
By compactness of first-order logic, this is equivalent to:
- There exists a finite unsatisfiable set of ground instances of clauses in .
Thus the theorem reduces checking unsatisfiability of arbitrary clause sets to checking unsatisfiability of sets of ground clauses, even though can be infinite.
Lifting
Lifting is a technique for proving completeness theorems:
- Prove completeness of the inference system for sets of ground clauses.
- Lift the proof to the non-ground case.
Lifting Example
Consider the non-ground clauses and . When the signature contains function symbols, both clauses have infinitely many ground instances:
We can resolve ground instances iff and , yielding inferences such as
but there are infinitely many such inferences.
Lifting Idea
Represent an infinite number of ground inferences of the form:
with a single non-ground inference:
Is this always possible?Yes!
For the inference
the substitution solves the “equation” , so the lifted inference represents all its ground instances.
Lifting Lemma for (Robinson 1965)
Idea. Represent infinitely many ground inferences by a single non-ground inference.
For binary resolution with selection:
- Work with non-ground clauses.
- Generalize the notion of “same” ground atoms to unifiability of non-ground atoms.
- Compute most general unifiers (mgu) only.
Lifting Lemma. Let and be clauses that share no variables. If a ground binary resolution inference
exists, then there is a substitution such that a non-ground inference
and .
Similar lifting lemmas exist for each inference of and of the superposition system .
What Should We Lift?
- The ordering .
- The selection function .
- The calculus .
Most importantly, lifting requires solving equations between terms and between atoms, which we do using most general unifiers.
Unifier
A unifier of expressions and is a substitution with .
Equivalently, it is a solution of the “equation” . For systems of equations , a substitution that satisfies all equations simultaneously is a simultaneous unifier.
Most General Unifiers
A solution to a set of equations is most general if, for every other solution , there exists a substitution with . In a similar way, we can define a most general unifier.
Consider the terms and . Two unifiers are
Both substitutions make the terms equal, but only is an mgu; is obtained from it by instantiating with .
Unification Algorithm
Let be a set of equations. An isolated equation in is any equation in such that has exactly one occurrence in .
Input. A finite set of equations (here denote terms, constants, function symbols, and a variable).
Output. A solution to or failure.
- While there exists a non-isolated equation :
- Consider the pair .
- remove this equation from .
-
- if occurs in , halt with failure;
- otherwise, replace every other occurrence of in by .
- replace this equation by and proceed as in .
- halt with failure.
- halt with failure.
- halt with failure.
- with halt with failure.
- replace this equation by the set .
- Consider the pair .
- Once and every equation in it is isolated, return the substitution .
Examples
Try running the algorithm on:
Properties
Theorem. Suppose we run the algorithm on .
- If and are unifiable, the algorithm terminates and outputs a most general unifier of and .
- If and are not unifiable, the algorithm terminates with failure.
We often write for a most general unifier and for a most general solution of the equation set .
Exercise
Consider the trivial systems of equations and .
- What is the set of all solutions?
- What is the set of most general solutions?
Revisiting the Ingredients of Lifting
- Lift the ordering .
- Lift the selection function .
- Lift the calculus (thanks to the lifting lemmas).
Most importantly, lifting works because we use most general unifiers.