Renamable Horn
Renamable Horn
HARRY R. LEWIS
Harvard Umversity, Cambrtdge, Massachusetts
ABSTRACT An efflcment algorithm is given for determining whether a set of clauses can be transformed into
a Horn set by a predicate renaming
KEYWORDS AND eHRASES theorem proving, Horn set
CR CATEGORIES: 5 21, 5 25
In [2] Henschen and Wos show that Horn sets of clauses are particularly amenabl e to
certain mechanical theorem-proving methods, such as unit refutation. They point out
that a quick check reveals whether a set S of clauses is a Horn set, and that "with very
little additional effort one can exami ne all of the predicate renammgs in search of one
which would map S into a Horn set." But if S contains n distinct predicates, the second
process requires time O(2n), since there are 2 n possible renamings. In this not e we
present a more sophisticated met hod for det ermi ni ng whether a given set of clauses can
be transformed into a Horn set, which requires only time O(mnZ), where n Is the
number of predicates and m is the number of clauses. The method also produces the
desired transformation, if one exists.
We consider just the propositional calculus. The renamJng problem for a set of first-
order clauses reduces immediately to that for a set of propositional clauses by dropping
the arguments from atomic formulas and treating each predicate as a propositional
variable.
A hteral L is negative if it is ~p for some propositional variable p, otherwise positive
0. e. if it is just a propositional variable); the complement L of L is ~p if L i sp and l sp
if L is ~p. A clause is a set of literals. I f A is a set of propositional variables and S is a
set of clauses, then ra(S) lS the result of replacing in S each literal whose propositional
variable is in A by its compl ement ; rA(S) Is a renaming of S. The set S of clauses is Horn
if each clause in S contains at most one positive literal; if some renami ng of S is Horn,
then S is renamable-Horn.
A set S of clauses is satisfiable if and only if there is a model for S, i.e. a set M of
literals not containing any pair of compl ement ary literals and having nonempt y intersec-
tion with each clause in S
Let S be a set of clauses, say S = {Ct . . . . . Cm}, where each C, = {L,~ . . . . , L,4 }. Then
define S* to be the set of clauses
m
U U {{Lu, L,k}}.
t= 1 1-<J<k~l~
THEOREM. S is renamable-Horn i f and only i f S* ts satisfiable.
PROOF. First suppose that S is renamabl e-Horn, and let A be a set of propositional
variables such that rA(S) is Horn. Let M be the set of literals consisting of all the
propositional variables in A and the compl ement s of all the propositional variables
Aut hor ' s address Ai ken Comput at i on Labor at or y, Har var d Uni versi t y, Cambr i dge, MA 02138
Journal of the Assoclauon for Computing Machinery, Vol 25, No 1, January 1978 pp 134-135
Renaming a Set of Clauses as a Horn Set 135
occurring in S but not in A We claim that M is a model for S*. Consi der any clause
{L0, L~k} of S* (1 --< i <- m, 1 --< j ~ k -< l~). If L,j and L~k are bot h positive t hen rA must
compl ement at least one, since bot h occur in the same clause of S; thus ei t her L o E A
or L~k @ A. If bot h Lu and L~k are negative then rA must leave at least one clause
uncompl ement ed, smce otherwise rA(S) would have a clause with two positive literals,
Ltj and L~k; thus ei t her Lu ~ A or L,k ~ A and again ei t her Lo E A or L~k ~ A.
Finally, if one (say L~j) is positive and the ot her (say L~k) is negat i ve, then ra must
compl ement L 0 tfrA compl ement s L~k; otherwise rA(S) woul d have a clause with the two
positive literals L o and L,k. Thus L~ E A if L,k ~ A, so L,j E M if I-,~k E M, and agam
ei t her Lo ~ M or L,k E M.
Now suppose that S* is satisfiable; let M be any model for S* and let A be the set of
positive literals in M. Then r~(S) is Horn. If, say, rA({C~}) had two positive hterals,
deri ved from L~j and L,k (1 --< t --< m, 1 --< ] < k -< n), then nei t her Lo nor L~k coul d be a
member of M; but {L0, L~k} ~ S*. []
Clearly the set of clauses S* can be const ruct ed in time O(mn2). Such a set, having
only two literals per clause, can easily be checked for satisfiability in t i me O(n 2) using,
for instance, resol ut i on. (This was first poi nt ed out by Cook [1].) In testing for
satisfmbility a model is const ruct ed if one exists. This model can then be used to
rename the proposi t i onal variables in S as descri bed in the proof of the Theor em, the
process requi ri ng time O(mn 2) at worst. Thus if S can be t ransformed into a Horn set, it
will be, and the whole procedure t akes time O(mn 2) as cl ai med.
ACKNOWLEDGMENT. I am grateful to the referees for their suggestions.
REFERENCES
1 COOK, S A The compl exi t y of t heor em- pr ovi ng pr ocedur es Pr oc Thi r d Annual ACM Syrup on
Theor y of Compt ng, 1971, pp 151- 158
2 HENSCHEN, L, AND WOS, L Umt r ef ut at i ons and Hor n sets J. ACM 21, 4 ( Oct 1974) , 590- 605
RECEIVED JULY 1975, REVISED JUNE 1977
Journal of the Association for Computing Machinery, Vol 25, No 1, January 1978