There are satisfiability preserving transformations from 1st order logic to CNF, i.e., if a set of (1st order) formulae are satisfiable, then their CNF is satisfiable. Conversely, if the CNF of a set of formulae is unsatisfiable, then the formulae are unsatisfiable. This is then useful for showing logical consequence. Computationally, CNF is easier to work with, and is the form used by the resolution inference rule.
The starting point is a set of closed formulae.
The first operation is to simplify the formulae so that they contain only the ∀, ∃, &, | and ~ connectives. This is done by using known logical identities. The identities are easily verified using truth tables, to show that the original formula has the same value as the simplified formula for all possible interpretations of the component formulae, denoted by uppercase variable letters P and Q.
Simplify | |
---|---|
Formula | Rewrites to |
P <~> Q | (P | Q) & (~P | ~Q) |
P <=> Q | (P => Q) & (Q => P) |
P => Q | ~P | Q |
The second operation is to move negations in so that they apply to only atoms. This is done by using known logical identities (including De Morgan's laws), which are easily verified as above. After moving negations in the formulae are in literal normal form.
Move negations in | |
---|---|
Formula | Rewrites to |
~∀X P | ∃X ~P |
~∃X P | ∀X ~P |
~(P & Q) | (~P | ~Q) |
~(P | Q) | (~P & ~Q) |
~~P | P |
The third operation is to move quantifiers out so that each formula is in the scope of all the quantifiers in that formula. This is done by using known logical identities, which are easily verified as above. In these identities, if the variable X already exists in Q, it is renamed to a new variable name that does not exist in the formula. After moving quantifiers out the formulae are in prenex normal form.
Move quantifiers out | |
---|---|
Formula | Rewrites to |
∀X P & Q | ∀X (P & Q) |
∃X P & Q | ∃X (P & Q) |
Q & ∀X P | ∀X (Q & P) |
Q & ∃X P | ∃X (Q & P) |
∀X P | Q | ∀X (P | Q) |
∃X P | Q | ∃X (P | Q) |
Q | ∀X P | ∀X (Q | P) |
Q | ∃XP | ∃X (Q | P) |
The fourth operation is to Skolemize to remove existential quantifiers. This step replaces existentially quantified variables by Skolem functions and removes all quantifiers. The variables remaining after Skolemization are all implicitly universally quantified. Whereas the previous three operations maintain equivalence between the original and transformed formulae, Skolemization does not. However, Skolemization does maintain the satisfiability of the formulae, which is what is required for the overall goal of establishing logical consequence. After Skolemization the formulae are in Skolem normal form.
Skolemize | |
---|---|
Formula | Rewrites to |
Initially | Set γ = {} |
∀X P | P and set γ = γ ∪ {X} |
∃X P | P[X/x(γ)] where x is a new Skolem functor. |
The fifth operation is to distribute disjunctions so that the formulae are conjunctions of disjunctions. This is done by using known logical identities, which are easily verified as above. After distributing disjunctions the formulae are in conjunctive normal form.
Distribute disjunctions | |
---|---|
Formula | Rewrites to |
P | (Q & R) | (P | Q) & (P | R) |
(Q & R) | P | (Q | P) & (R | P) |
The last operation is to convert to Clause Normal Form. This is done by removing the conjunctions, to form a set of clauses.
Convert to CNF | |
---|---|
Formula | Rewrites to |
P1 & ... & Pn | {P1,...,Pn} |
Example |
---|
1st order formula ∀Y (∀X (taller(Y,X) | wise(X)) => wise(Y))
Simplify
Move negations in
Move quantifiers out
Skolemize
Distribute disjunctions
Convert to CNF |
Example |
---|
~taller(Y,x(Y)) | wise(Y) | ~wise(x(Y)) | taller(x(Y),Y)is written as taller(Y,x(Y)) & wise(x(Y)) => wise(Y) | taller(x(Y),Y)If the antecedent is empty it is set to TRUE, and if the consequent is empty it is set to FALSE. |
Horn clauses are clauses that have one or zero positive literals. Sets of Horn clauses are also called Horn.
Example |
---|
~taller(Y,x(Y)) | wise(Y) | ~wise(x(Y)) ~wise(geoff) | ~taller(Person,brother_of(jim))are Horn clauses. Written in Kowalski form, these Horn clauses are : taller(Y,x(Y)) & wise(x(Y)) => wise(Y) wise(geoff) & taller(Person,brother_of(jim)) => FALSE |
Non-Horn clauses are clauses that have two or more positive literals. Sets of clauses that contain one or more non-Horn clauses are also called non-Horn.
Example |
---|
~taller(Y,x(Y)) | ~wise(Y) | wise(x(Y)) | taller(x(Y),x(x(Y))) wise(X) | wise(brother_of(X))are non-Horn clauses. Written in Kowalski form, these non-Horn clauses are : taller(Y,x(Y)) & wise(Y) => wise(x(Y)) | taller(x(Y),x(x(Y))) TRUE => wise(X) | wise(brother_of(X)) |
In terms of ATP, the disjunction of positive literals in non-Horn clauses corresponds to a choice point in any goal directed search. This is a source of search. Thus, in general, Horn problems are easier than non-Horn problems.
Proof |
---|
|
Example |
Translating the formula
∀Y
(∀X ~taller(X,Y) => wise(Y))
|
( ? [Y] : ! [X] : ( element(X,Y) <=> element(X,X) ) => ~ ( ! [X1] : ? [Y1] : ! [Z] : ( element(Z,Y1) <=> ~ e1ement(Z,X1) ) ) )