Logic for Computer Scientists/Propositional Logic/Horn clauses
From Wikibooks, the open-content textbooks collection
Contents |
[edit] Horn clauses
In this subsection we introduce a special class of formulae which are of particular interest for logic programming. Furthermore it turns out that these formulae admit an efficient test for satisfiability.
[edit] Definition 9
A formula is a Horn formula if it is in CNF and every disjunction contains at most one positive literal. Horn clauses are clauses, which contain at most one positive literal.


where true is a tautology and false is an unsatisfiable formula.
In clause form this can be written as

and in the context of logic programming this is written as:

}
For Horn formula there is an efficient algorithm to test satisfiability of a formula F :
|
[edit] Theorem 6
The above algorithm is correct and stops after n steps, where n is the number of atoms in the formula.
As an immediate consequence we see, that a Horn formula is satisfiable if there is no subformula of the form
.
Horn formulae admit unique least models, i.e.
is a unique least model for F if for every model
and for every atom B in F holds: if
then
. Note, that this unique least model property does not hold for non Horn formulae: as an example take
which is obviously non Horn.
is a least model and
as well, hence we have two least models.
[edit] Problems
[edit] Problem 20 (Propositional)
Let F be a propositional logical formulae and S a subset atomic formula occurring in F. Let TS(F) be the formula which results from F by replacing all occurrences of an atomic formulae
by
. Example:
. Prove or disprove: There exists an S for
or
, so that TS(F) is equivalent to a Horn formula H (i.e.
).

[edit] Problem 21 (Propositional)
Apply the marking algorithm to the following formula F.
Which is a least model?


[edit] Problem 22 (Propositional)
Decide which one of the indicated CNFs are Horn formulae and transform then into a conjunction of implications:






label every occurrence of
is a subformula and
are all labeled and
iff 




