Week S2.4. Prenex Normal Form and Unification
Prenex Normal Form
Prenex Normal Form
A formula is in Prenex Normal Form (PNF) if it starts with 0 or more quantifiers followed by a quantifier free formula:
Where and is quantifier free.
In this case, is the (possibly empty) prefix. And is the matrix. Any first order formula can be translated into PNF.
Link to original
Examples:
But not:
Algorithm to PNF
Algorithm to Prenex Normal Form
Any first order formula can be converted into Prenex Normal Form by:
Link to original
- Eliminate all occurrences of and from the formula. Use equivalences from propositional logic:
- Move all negations inward, such that negations only appear in front of atoms. Use equivalences:
- Standardise the variables apart where necessary. Renaming variables in a formula such that distinct variables (not in the scope of the same quantifier) have distinct names.
- The PNF can now be obtained by moving all quantifiers to the front. Use logic equivalences ( not occurring, or already bound, in ): And other equivalences:
Example: Transforming to PNF
Transform the formula . Let’s start by performing steps 1 and 2:
Then apply step 3:
Finally, apply step 4:
First order Horn clauses
First order Horn clause
A clause in the matrix of a Prenex Normal Form formula is a first order Horn clause if:
Link to original
- the prefix consists only of universal quantifiers quantifying over all variables in the clause
- the clause consists of a finite disjunction of positive or negative atoms with no more than one positive atom
First order definite clause
A first order definite clause is a Horn clause with exactly one positive atom (and 0 or more negative atoms). It is of the form:
Where , are atoms, and are all the variables appearing in the atoms.
Link to original
First order definite rule
A first order definite clause can be represented as a first order definite rule:
And we can drop conjunctions for commands:
Link to original
To PNF to first order definite rules
Given some formula obtained by transforming to PNF. The matrix of will be positive or negated atoms joined by the and . In general, one must first transform the matrix of a PNF formula into first order conjunctive normal form in order to identify whether one can then represent it as first order definite rules.
Let be a PNF formula, If:
- a clause in the conjunctive normal form of the matrix of is of the form ()
- the prefix of contains universal quantifiers that quantify over every variable in
Then the clause is a definite clause and can be represented as a definite rule.
First order (predicate) definite clause programming
First order definite clause program
A first order definite clause program is a set of first order definite clauses, these can be represented as their equivalent definite rules.
Link to original
First order conjunctive query
Let be a program of first order definite rules. A conjunctive query to is a prenex normal form formula:
Where is a conjunction of positive atoms. Where are the variables in .
Link to original
Example: Resolution over first order definite rules
For example, given we have:
We can have a first order conjunctive query:
Just as with propositional logic, we expand selected query atoms by choosing a rule with a matching head. Then replace the atom in the query with the body of the rule.
Referring to the unification we learn about below:
Substitutions & Unification
Substitution
A substitution is a finite set where:
- are distinct variables (only variables can be substituted)
- are terms (variables, constants, or functional terms)
If we let be a substitution and a first order formula, then is the result of applying the substitution to .
Link to original
Unifier
If we let be a substitution and and be two first order formulas: Then unifies, or is a unifier for, and if .
Link to original
Example: From Slides
{
"url":"[10b_unification.pdf](https://git.is.horse/insert/university/obsidian-notes/-/raw/9d95afcbbdb7a4c77ca9f62b32e35c6f31e269e7/University/Year%201/Semester%201%20%26%202/4CCS1ELA%20Elementary%20Logic%20with%20Applications/Slides/10b_unification.pdf)",
"page":[6,7,8,9],
"scale":1.7
}Most general unifiers
Two formulas that unify might have different unifying substitutions:
- and are unified by , so we have that:
- and are unified by , so we have that: Here, makes unnecessary substitutions.
Most general unifier
is the most general unifier of and if and only if, for all other unifiers , there is some substitution such that .
Link to original