Finding Tractable Formulas in NNF E. Altamirano and G. Escalada-Imaz Arti cial Intelligence Research Institute (IIIA) Spanish Scienti c Research Council (CSIC) Campus UAB, s/n 08193 Bellaterra, Barcelona (Spain) fealtamir,
[email protected]
Abstract Many applications in Computer Science require to represent knowledge and to reason with non normal form formulas. However, most of the advances in tractable reasoning are applied only to CNF formulas. In this paper, we extend tractability to several classes of non normal formulas which are of high practical interest. Thus, we rst de ne three non normal Horn-like classes of formulas 1 ^ 2 ^ ^ n where each i is ? + constituted by a disjunction of two optional terms i = i _ i : the rst one is in Negation Normal Form (NNF) composed exclusively with negative literals and the second one is a conjunction of positive propositions. These formulas codify the same problems that the Horn formulas but with signi cantly, even exponentially, less propositional symbols. Second, we de ne sound and refutational complete inference rule sets for each class. Our third contribution consists in the design of a sound, complete and strictly linear running time algorithm for each class. As a result, the time required by our linear algorithms running on the de ned non normal Horn-like formulas can be exponentially less than that required by the existing linear Horn-SAT algorithms. F
F
:::
F
F
F
NNF
C
1 Introduction In some practical applications of Computer Science, the well-known Normal Forms CNF and DNF do not provide a natural framework to represent knowledge and to reason. In fact, performing inferences eciently with formulas whose forms are non restricted to the classical ones is a matter of major interest in many practical applications inside very heterogeneous areas such as Expert Systems, Deductive Data Bases, Hardware Design, Automated Software Veri cation, Symbolic Optimisation, Logic Programming, Automated Theorem Proving, Petri Nets, Truth Maintenance Systems, etc. However, most of the existing ecient proof methods are designed to work with CNF formulas. So, it is a common practice to translate knowledge representations from general forms to CNF's [10, 36]. This transformation was originally proposed in 1970 by Tseitin [39] who published the rst algorithm, later [25] included the case for rst-order logic, [30] covered the cases for modal and intuitionistic logics, nally, Hahnle [22] investigated the problem of translating arbitrary nitely valued logics to short CNF signed formulas.
The translation procedure is in polynomial time if auxiliary propositions are allowed in the CNF formula but it takes exponential time otherwise. Thus, the principle of transforming a WFF in a CNF formula and then applying a CNFbased inference method has two important drawbacks [23]. First, translations procedures take several computational steps and easily can create an exponential growth of symbols even before inference procedures are applied. Second, there exist some ecient transformations methods based on substitutions of sub-formulas by literals preserving only the satis ability relation but no other relations of practical interest, e.g. the logical equivalence relation. In addition, interesting structures as Horn-like, that could exist in the original formulas can be lost in the transformed formula [38].
1.1 Our NNF tractability contribution In spite of the large number of potential applications, few attention has been devoted to non-clausal reasoning. Thus, we present new results related to this eld and more precisely to tractability with formulas in Negation Normal Form (NNF). In this paper, we identify NNF formulas F1 ^ F2 ^ : : : ^ Fn having a Horn-like structure. Each Fi is a disjunction of two optional terms, i.e. Fi = NNFi? _ Ci+ : the rst one is a NNF formula with only negated propositions, noted NNF ? , and the second one is a conjunction of non-negated atomic propositions, noted C +. The three classes of formulas we are proposing vary according to the expressiveness allowed to the NNF ? term from the simplest one, where the NNF ? is a disjunction of negative literals (clause form), noted D? , the second, where the NNF ? is a disjunction of conjunctions of negative literals, i.e. C1? _ : : : _ Ck? or DNF ? and the third class, with the NNF ? being a conjunction of disjunctions of negative literals, i.e. D1? ^ : : : ^ Dk? or CNF ? . The three classes of formulas can arise from an original non-clausal representation of the problem. These formulas are compact representations of Horn formulas given that they require less symbols than Horn formulas to codify identical problems; this reduction can be in an exponential rate. Afterwards, we de ne sound and refutational complete inference rule sets for each class of formulas. Finally, we detail algorithms in pseudo-code with suitable data structures to resolve SAT-problems expressed in this kind of speci ed formulas. These algorithms are formally analysed and showed to be sound, refutational complete and a strictly linear running time. They are extensions of the pure Horn algorithms such as [14, 29, 21]. Although one could think that an alternative way to solve Horn problems would be to transform the Horn formulas to our class of factorised Horn formulas and then, to apply the algorithms exposed here, rstly the cost of the transformations should be analysed, which is beyond the scope of this paper. Thus, we stress the fact that the proposed algorithms are more appropriate for many real problems that require a non canonical representation.
Conversely, one possibility to solve non-clausal Horn-like problems consists in introducing arti cial literals for transforming original problems in pure Horn problems and then applying Horn algorithms. But as mentioned previously, the logical equivalence property is lost and also, the cost of the transformations is not warranted to be done in strictly linear time. This paper is structured as follows. In the next section we brie y review the research about tractable reasoning and related issues. In section three we de ne the class of non normal formulas which is our rst extension of the class of Horn formulas. In sections four and ve we deal with and ! classes which include as a particular case the class. For each of the mentioned classes, we specify a sound and complete set of inference rules and a strictly linear algorithm is detailed.
2 Related Work Next, we revise the main works published concerning tractable reasoning. Thus, we review successively the existing results with CNF and NNF formulas.
2.1 CNF Tractability The propositional satis ability (CNF-SAT) problem is fundamental at the core in Computer Science. It was the rst NP-complete problem found [12]. Since then, a rather big eort has been done do determine some CNF-SAT islands of tractability with signi cant repercussions in applications. The most important classes that can be resolved in deterministic polynomial time are: 2-CNF, for which linear algorithms were designed in [5, 19, 17], and Horn-SAT, that admits also linear algorithms as showed in [26, 14, 29, 21, 34, 20]. Several variants of the Horn-SAT problem have been also found out to be solvable in polynomial time: renamable Horn [4, 28], extended Horn [11], CC-balanced [13], SLUR [35] and q-Horn [9, 8]. The Horn-SAT problem is polynomially solvable since the work of Karp [27]. After that, Henschen and Wos [24] showed that if a Horn formula is unsatis able, then, there exists a refutation proof employing unit propagation only. Jones and Laaser [26] showed that a direct implementation of this principle leads to an algorithm of quadratic complexity. Later, Dowling and Gallier [14] presented two linear algorithms to resolve the Horn-SAT problem: one with a forward chaining strategy and the second one based on backward chaining. In [34] and [20] it is proved that the backward algorithm is incomplete and not linear respectively. In [29, 21, 15, 2] were proposed dierent linear versions, all of them based on a forward chaining strategy. A linear and complete algorithm with backward chaining strategy is described in [20].
2.2 NNF tractability Several methods have been developed to infer with formulas in NNF. This is the case of Matings [3], Matrix Connection [6, 7], Dissolution [31, 32], and TAS [1]. These methods give a step forward to show that deduction could be performed on formulas in non-clausal form avoiding thus, the transformation to normal forms. However, no studies relative to NNF tractability employing one of these methods have been carried out. To our knowledge, the rst published results concerning non-clausal tractability comes from [16, 15, 18] where a strictly linear forward chaining algorithm to test for the satis ability of certain NNF formulas subclass is detailed. Such a class embeds the Horn case as a particular case. In [20] a linear backward algorithm is given for the same NNF subclass of formulas. New results concerning NNF tractability are reported in [33] where a method called Restricted Fact Propagation is presented which is a quadratic, incomplete non-clausal inference procedure. More recently, in [37, 38] a signi cant advance in NNF tractability has been accomplished. The author de ne a class of formulas by extending the Horn formulas to the eld of NNF. Such extension relies on the concept of polarity. A method to make inferences and potentially to detect refutational formulas is designed. In [37], a SLD-resolution variant with the property of being refutationally complete is showed but its computational complexity is not studied. In [38] a method for propositional NNF Horn-like formulas is described and it is stated that the method is sound, incomplete and linear. However, concerning the last issue, no algorithm is speci ed, indeed the steps of the method are described as dierent propagations of some truth values in a sparse tree. Then, although it seems that the number of inferences of the proposed method is linear, it is not proved the resulting complexity (w.r.t. the number of computer instructions) of a linear number of truth value propagations on the employed sparse trees. A preliminary version of the contain of our current article has been presented in [2].
3 -formulas The -formulas are a direct extension of the Horn formulas in the sense that a Horn clause (disjunction of negative literals and at most one positive literal) is extended to include one conjunction of positive propositions instead of a positive proposition. The -formulas, permit us to represent a real problem with many less symbols, whereas keeping the good computational properties of Horn-like structure formulas
3.1 Syntax and Semantics Firstly, we recall the required de nitions of classical logic before introducing the rst non normal class of formulas, denoted -formulas.
De nition 1. A literal L is either an atomic proposition p 2 P, noted L+ or its negation :p, noted L?. De nition 2. A classical clause is a nite disjunction of literals: (L1 _ : : : _ Lk ). A unit clause (L) includes only one literal. We denote the empty clause by 2.
De nition 3. A Horn clause is a classical clause with at most one positive literal. A Horn formula is a conjunction of Horn clauses. Notation From now on, D stands for a disjunction of literals (L1 _ : : : _ Lk ) and C denotes a conjunction of literals (L1 ^ : : : ^ Lk ). D+ and C + (D? and C ? ) include only positive (negative) literals.
De nition 4. A CNF formula is a conjunction of disjunctions of literals (D1 ^ : : : ^ Dm ) and DNF is a disjunction of conjunction of literals (C1 _ : : : _ Cm ). Also, CNF + and DNF + (CNF ? and DNF ? ) includes only positive (negative) literals.
De nition 5. A clause C is a disjunction of two optional terms C = D? _
C + : D? is a negative disjunction and C + is a positive conjunction. Clauses with only the D? (C + ) term are said negative (positive) clauses. Remark. A clause C = D? _ C + is a Horn clause if C + = (p).
De nition 6. A -formula is a nite conjunction of clauses C . An interpretation I assigns to each formula one value in the set f0; 1g.
De nition 7. An interpretation I satis es: { A literal p (:p) i I (p) = 1 (I (p) = 0). { A disjunction D = L1 _ : : : _ Lk , i I (Li) = 1, for at least one Li. { A conjunction C = L1 ^ : : : ^ Lk , i I (Li) = 1 for every Li. { A clause C = D? _ C + , i I (D?) = 1 or I (C +) = 1. { A -formula if I satis es all clauses C of the formula. An interpretation I is a model of a -formula if satis es the formula. We say that is satis able if it has at least one model, otherwise, it is unsatis able.
3.2 Inference rules In this section we introduce the two required inference rules to process formulas: The Variable Truth Assignment (VTA) and the And Elimination (AE) and we show that both together form a sound and complete logical calculi. Henceforth, and 2 represent respectively any -formula and any -formula containing the empty clause 2.
De nition 8. Variable Truth Assignment (VTA).
It consists in assigning true to a variable p. More speci cally, if (p) 2 then VTA derives a formula 0 obtained from by removing (p) and the occurrences of :p.
De nition 9. And Elimination (AE)
Inference rule AE derives from a positive conjunction clause (p1 ^ : : : ^ pi ^ : : : ^
pn ), the unit clauses (p1 ); : : : ; (pi ); : : : ; (pn ).
De nition 10. Clause Proof
A refutation of a formula , is a succession of formulas < 1 ; 2 ; : : : ; n > such that 1 = ; n = 2 and for each 1 i n ? 1, either i+1 = TV A(i ) or i+1 = AE (i ). Example 1. Let us = f(p1 ); (p3 ); (:p1 _ (p2 ^ p4 )); (:p2 _:p3 _ (p1 ^ p5 )); (:p2 _ :p5 )g = f(p1 ); (p3 ); C1 ; C2 ; C3 g. The inference chaining to get a formula with the
empty clause is as follows: f(p1 ); (p3 ); (:p1 _ (p2 ^ p4 )); C2 ; C3 g `TV A f(p3); (p2 ^ p4 ); C2 ; C3 g `AE f(p3 ); (p2 ); (p4 ); (:p2 _ :p3 _ (p1 ^ p5 )); C3 g `TV A f(p2); (p4 ); (:p2 _ (p1 ^ p5 )); C3 g `TV A f(p4); (p1 ^ p5 ); (:p5 )g `AE f(p4 ); (p1 ); (p5 ); (:p5 )g `TV A f(p4); (p1 ); 2g = 2
Theorem 1. Soundness `V TA+AE 0 ) j= 0 . The proofs of the soundness of each rule are trivial and the proof of the theorem follows straightforwardly from those proofs.
Theorem 2. Completeness If is unsatis able then `V TA+AE 2 . The proof is by induction on the length of , i.e. the number of occurrences of literals in . The following theorem extends completeness to atomic clauses.
Theorem 3. Completeness j= (L) ) `V TA+AE (L). 3.3 Algorithm Description Initially, if has no positive unit clauses then it is satis able because all the clauses have at least one negative literal. So, assume that (p) 2 . Thus is satis able i :fp 1g is satis able. In other words is satis able if the formula 0 resulting of removing (p) from and the occurrences of :p is satis able. This operation is performed for each positive unit clause in . Now, observe that some clauses in the initial formula can become positive because of the removals of negative literals. Also due to these removals, a pure negative clause can become empty. Thus, at this stage, three situations can arise:
1. An empty clause is produced. The algorithm ends by determining that the original formula is unsatis able. 2. No positive clauses have emerged. The algorithm ends by determining that the formula is satis able. 3. A positive clause is produced. Then, the algorithm applies the And-Elimination rule and adds new unit clauses to the formula. Thus, a new iteration of the described operations above are carried out with these new unit clauses. We begin the description of the algorithm by a very simple version in order to help the reader to understand it. Afterwards, we shall advance progressively towards the de nitive version which is more elaborated but it warrants a strictly linear worst case complexity.
(VTA p): It applies the VTA rule returning the formula 0 resulting of removing from the clause (p) and the occurrences of :p and possibly, adding some conjunctions C + among which could be the empty clause 2.
(AE C +): It applies the And-Elimination rule returning the formula 0
resulting of removing C + from and adding the unit clauses (p) for each conjunct p in C + .
Notation. We note + the set of positive clauses in which can be empty. VTA-AE-Propagation() If + = fg then return(sat) If 2 2 then return(unsat) If (p) 2 then return(VTA-AE-Propagation (VTA (p))) If C + 2 then return(VTA-AE-Propagation (AE C + )) End
Theorem 4. The previous algorithm returns sat i the input formula is sat-
is able.
Theorem 5. The maximal number of recursions is at most in O(size()). The previous algorithm is correct but not very ecient. Its eciency is similar to that of the method proposed in [37, 38] and [33]. Although the number of recursions is bounded by O(n), the complexity of each line is clearly not constant and so, the algorithm's complexity measured in computer instructions number is not linear. One can check that searching for the clauses including some occurrence of :p without a suitable data structure has O(size()) computational cost. Hence, the real complexity of the algorithms in number of computer instructions is at least in O(n2 ). To improve this complexity, we shall use the following data structures: Neg(p): Set of pointers to the C clauses in which include :p. Neg:Counter(C ): it is a counter of the remaining negative literals :p 2 C such that the corresponding propositions p have not been derived yet.
With this data structures, the procedure VTA rstly obtains by means of Neg(p) the clauses C containing :p. Then, instead of removing physically :p in each C , the counter Neg.Counter(C ) is decremented. Thus, although no information of which negative literals have been removed from C is maintained, the necessary information of how many negative literals there still left in C is furnished by Neg.Counter(C ) at each moment of the inference process. If this counter is set to 0 means that a positive conjunctive clause C + , maybe empty, has been deduced from the initial clause C . With the described data structure, the procedure VTA is the following.
VTA ( (p)) Remove (p) from for 8C 2 Neg(p) do: Decrement Neg.Counter(C ) if Neg.Counter(C ) = 0 then do:
Add C + to Return() Now, remark that a same proposition p can be deduced in more than one conjunction C + , and then the counter Neg.counter(C ) such that pointer(C ) 2 Neg(p) could be decremented more than once. To disallow these multiple decrements, we use a boolean variable as follows: V al(p) = 1 i p has already been derived from . So, the truth propagation of variable p is allowed only when the ag V al(p) is 0, and once the propagation has been performed, the
ag is set to 1 disallowing further propagations. Also, a list C + of non-negated propositions in C is required. Thus, the procedure AE becomes:
AE ( C + ) Remove C + from 8p 2 C + do: if V al(p) = 0 then do:
Add (p) to V al(p) 1 Return() Following with the improvements of the algorithm, we remark that to know whether 2 2 takes a computational cost in O(j j). But this cost can be reduced if each time that a positive conjunction C + is going to be added to is tested whether C + = 2 or not. In the armative case, the algorithm stops the process and it returns 'unsatis able'. A last point consists in avoiding the search throughout the complete formula of (1) the unit clauses and (2) the positive conjunction. For this purpose, (1) we store unit clauses in a stack and (2) we will call the procedure AE each time that a C + conjunction is going to be added to . In order to get a more ecient algorithm we shall apply iteratively, instead of recursively, the VTA and the AE inference rules. Thus the de nitive algorithm is the following:
while Stack 6= ; do: p pop(Stack) fPROCEDURE VTAg for 8C 2 Neg(p) do: Decrement Neg:Counter(C ) if Neg:Counter(C ) = 0 then do: if C + = fg return 'Unsatis able' 8p 2 C + do: fPROCEDURE AEg if V al(p) = 0 then do: push(p; Stack) V al(p) 1
return 'Satis able'
The initialisation of the data structures is carried out in the following procedure: Stack ;; for 8p 2 Prop() do: Val(p) 0, Neg(p) fg; for 8C 2 do: If C=fg then return('unsatis able') Else C = f:p1 ; : : : ; :pk ; C + g do: If k 6= 0 do: Neg:Counter(C ) k for 1 i k do: Add C to Neg(pi) Else for 8p 2 C + do: if V al(p) = 0 then do: V al(p) 1, push(p; Stack) Theorem 6. Correctness. The previous algorithm is correct: it returns unsatis able i is unsatis able. Theorem 7. Complexity. The last algorithm is strictly in O(size()).
Proof.
(1) It is trivial to check that the initialisation of the data structures takes at most O(size()). The following two statements derive straightforwardly from the construction design of the algorithm: (2) Each VTA procedure is done at most once for each proposition. (3) Each AE procedure is executed at most once for each positive conjunction. (4) By (2), the total number of operations in the VTA procedure is
O(
X j Neg:Counter(C) j) O(size()) p2
X j C+ j) O(size())
(5) By (3), the total number of operations in the AE procedure is limited to
O(
C 2
(6) By (1), (4) and (5), the algorithm is in O(size()).
4 -formulas The -formulas include -formulas as a particular case. The -formulas require exponentially less symbols than -formulas to represent the same logical problem. De nition 11. A ?clause?C , is a disjunction of two optional terms C = DNF ? _ C + = C1 _ C2 _ : : : _ Cn? _ C + . Two particular cases are noted: clauses with only negative (positive) literals are called negatives (positives). De nition 12. A -formula is a nite conjunction of clauses C . Interpretations, models and other semantic concepts are easily de ned from the previous class of -formulas and the de nition of the -language here above. As before, and 2 stand for respectively any -formula and any -formula containing the empty clause 2.
De nition 13. Variable Truth Assignment VTA2
If (p) 2 then VTA2 obtains the formula 0 resulting of removing from , the unit clause (p) and the conjunctions (:p ^ :p1 ^ : : : ^ :pk ). Theorem 8. Soundness VTA2 is sound, namely `V TA2 0 ) j= 0. Theorem 9. Completeness If is unsatis able then `V TA2+AE 2 . The proofs of both theorems are immediate from the same proofs for the -formulas and the de nition above of the -formulas language. Example 2. Let the following unsatis able formula: = f(p1 ); (p3 ); (:p1 ^:p2 ) _ (:p3 ^:p4 )_(p5 ^p6 ); (:p5 ^:p6 )_(p7 ^p8 ); (:p7 ^:p9 )g = f(p1 ); (p3 ); C1 ; C2 ; C3 g
A proof sequence of the unsatis ability of is: f(p1 ); (p3 ); (:p1 ^ :p2 ) _ (:p3 ^ :p4 ) _ (p5 ^ p6 ); C2 ; C3 g `V TA2 f(p3); (:p3 ^ :p4 ) _ (p5 ^ p6 ); C2 ; C3 g `V TA2 f(p5 ^ p6 ); C2 ; C3 g `AE f(p5 ); (p6 ); (:p5 ^ :p6 ) _ (p7 ^ p8 ); C3 g `V TA2 f(p6); (p7 ^ p8 ); (:p7 ^ :p9 )g `AE f(p6 ); (p7 ); (p8 ); (:p7 ^ :p9 )g `V TA2 f(p6); (p8 ); 2g = 2 Algorithm's principle The principle of the VTA2-AE-deduction algorithm is
similar to that of the rst VTA-AE-deduction algorithm, namely the rules VTA2 and AE are applied until giving rise to one of the two following situations: (1) the empty clause is derived (the original formula is unsatis able), or (2) no more new clauses are derived (the original formula is satis able).
Data structures The data? structures vary slightly. (1) Now a Flag First(Ci ) is associated with each conjunction Ci? in the term DNF ? = C1? _ C2? _ : : : _ Cn? of a clause C = DNF ? _ C + . This is due to
the fact that Neg:counter(C ) now counts the number of negative conjunctions (and not atomic literals) Ci? in DNF ? not falsi ed by the propositions p already deduced. These conjunctions Ci? are falsi ed as soon as one of the propositions in the conjunction is derived. But, notice that further deductions of the same negative conjunction must not provoke decrements of the counter. Indeed, only one decrement for each conjunction can be enabled. Otherwise, the following error could be committed. Assume that C = DNF ? _ C + and DNF ? = C1? _ C2? _ : : : Ci? _ : : : _ Cn? . In order to have DNF ? falsi ed at least one proposition pi in each conjunction Ci? must be deduced. However notice that n propositions deduced, not distributed in the n conjunctions, do not falsify DNF ?. To ensure that the counter is decremented only once per each negative conjunction, we require a ag First(Ci? ) which indicates whether any proposition whose negation is in Ci? has been already derived. Thus, the meaning of the aforementioned ag is First(Ci? ) = F i no proposition in Ci? has been deduced. Once the rst proposition is deduced First(Ci? ) is set to T. (2) Another small modi cation is related to the Neg(p) data structure. Neg(p) must point to the conjunctions Ci? = (:p^:p1 ^: : :^:pk ) containing :p (instead of pointing to the :p occurrences themselves). Thus, Neg(p) is a list of couples (Ci? ; C ) of pointers to each Ci? containing :p and to the clause C containing Ci? . Algorithm The algorithm for -formulas is supported on the same structure that the algorithm for the -formulas. As AE inference works well for both types of formulas no modi cation of the AE-Deduction is required. Thus, only VTA procedure is modi ed as follows:
VTA2 ( (p)) Remove (p) from for 8(C ?; C ) 2 Neg(p) do: if First(C ? ) = F then do:
Decrement Neg:Counter(C ) First(C ? ) T if Neg:Counter(C ) = 0 then do: if C + = 2 return Unsatis able Else C + = (p1 ^ p2 : : : ^ pn ) Begin PROCEDURE AE with C + The algorithm VTA2-AE-Deduction is obtained from the VTA-AE-Deduction by replacing in it the VTA procedure by the new VTA2 procedure de ned here above. Theorem 10. Algorithm Correctness VTA2-AE-Deduction() returns Unsatis able i is unsatis able. Theorem 11. algorithm Complexity VTA2-AE-Deduction() is strictly in O(size()). Proofs of both theorems follow from the corresponding theorems for -formulas and the slight dierences between -formulas and -formulas.
5 !?formulas Like -formulas, !-formulas includes Horn and -formulas as particular cases.
De nition 14. A clause C ! is a disjunction of two optional terms C ! = CNF ?_
C + : CNF ? is a conjunctive normal form with only negative literals and C + is a positive conjunction. A !-formula is a nite conjunction of clauses of kind C ! . Notation !-formulas are denoted by !. Any !-formula containing the empty clause will be noted !2 . De nition 15. Variable Truth Assignment VTA3 If (p) 2 ! then VTA3 derives a new formula !0 resulting of removing from ! the unit clause (p), the ? ) and all the occurrences of :p. conjunctions (:p ^ D2? ^ : : : ^ Dm Interpretation, Model, other semantic concepts and clause proof de nition are extended from the -formulas case without diculty.
Example 3. Let the unsatis able formula ! = f(p1 ); (p2 ); (((:p1 _ :p2 ) ^ (:p3 _ :p4 )) _ (p5 ^ p6 )); ((:p5 _ :p6 ) _ (p7 ^ p8 )); (:p8 )g = f(p1); (p2 ); C1 ; C2 ; C3 g
A proof sequence of the unsatis ability of ! is:
f(p1 ); (p2 ); (((:p1 _ :p2 ) ^ (:p3 _ :p4 )) _ (p5 ^ p6 )); C2 ; C3 g `V TA3 f(p2); ((:p2 ^ (:p3 _ :p4 )) _ (p5 ^ p6 )); C2 ; C3 g `V TA3 f(p5 ^ p6 )); C2 ; C3 g `AE f(p5 ); (p6 ); ((:p5 _ :p6 ) _ (p7 ^ p8 )); C3 g `V TA3 f(p6); (:p6 _ (p7 ^ p8 )); C3 g `V TA3 f(p7 ^ p8 ); (:p8 )g `AE f(p7 ); (p8 ); (:p8 )g `V TA3 f(p7); 2g = !2 Theorem 12. Soundness ! `V TA3 !0 ) ! j= !0. Theorem 13. Completeness Let ! being an unsatis able formula; then ! `V TA3+AE !2 . The proofs of both theorems are analogous to the same proofs for the !formulas. The principle of the iterative algorithm for !-formulas is similar to the precedent ones. It applies the inference rules while unit clauses (p) are deduced. This process runs until the empty clause is deduced, or no more positive clauses are derived. The data structures for these new classes of formulas require only one modi cation which is related to the employed counter. Given that the CNF ? term of each clause C ! is a nite conjunction of disjunctions of negative literals, i.e. CNF ? = (D1? ^ D2? ^ : : : ^ Dm? ) we need one counter Neg:Counter(Di? ) of
negative literals for each disjunction Di? . All the other data structures de ned for the -formulas are kept for the current algorithm. In order to design an algorithm to test the satis ability of !-formulas we need to modify only the procedure VTA associated with the VTA inference rule. This procedure is very similar to the previous one. Now, instead of having one counter for each clause, we use so many counters as negative disjunctions D? exist in a clause C ! . If one of these counters is set to 0 means that the CNF ? has been falsi ed. Thus, the new VTA3 procedure is as follows. VTA3 (! (p)) Remove (p) from ! for 8(D?; C ! ) 2 Neg(p) do: Decrement Neg:Counter(D? ) if Neg:Counter(D?) = 0 then do: if C + 2 C ! is C + = 2 then return 'Unsatis able' Else C + = (p1 ^ p2 ^ : : : ^ pn ) Begin procedure AE with C + The algorithm VTA3-AE-Deduction for the !-formulas is obtained by replacing the VTA procedure in the algorithm for the -formulas with this new VTA3 procedure. Theorem 14. Correctness. The algorithm VTA3-AE-Deduction(!) returns unsatis able i ! is unsatis able. Theorem 15. Complexity. VTA3-AE-Deduction is strictly in O(size(!)). The Proofs of both theorems are similar to the previous 10 and 11 theorems for the -formulas language.
6 Conclusions On the theoretical side, our contribution described here aims at pushing further the frontiers of non clausal tractability. Thus, we rstly have de ned three classes of formulas in Negation Normal Form having a Horn-like shape. Secondly, we have established a set of inference rules which are sound and refutationally complete for each one of the three classes. In third place, we have designed strictly linear algorithms to solve the satis ability problem in each class of formulas. On the practical side, as the formulas keep a Horn-like structure, they are of relevant interest in such applications as for instance those based in Rule Based Systems. Indeed, the rules and the questions of many real applications require to represent and to reason with a richer language than the Horn formulas language. In this sense, the proposed formulas absorb the Horn language as a particular case. In addition, the proposed formulas represent logically equivalent pure Horn problems but with exponentially less symbols. Hence, as the described algorithms runs in linear time on these classes, the gain of time can be of an exponential order with respect to the known linear algorithms running on the Horn formulas.
Acknowledgements. We are grateful to the anonymous referees for their helpful comments. This research was developed under a bilateral collaboration framework between the IIIA-CSIC and the CINVESTAV-IPN and was partially nanced by the CSIC, the CONACyT and the Universidad Autonoma de Guerrero (Mexico).
References 1. Aguilera, G., de Guzman, I.P., Ojeda, M.: Increasing the eciency of automated theorem proving. Journal of Applied Non-classical Logics, 5:1 (1995) 9{29 2. Altamirano, E., Escalada-Imaz G.: Ecient algorithms for several factorized Horn theories (in Spanish). 2nd Congress Catala d'Intel.ligencia Arti cial, Girona, Spain (1999) 31{38 3. Andrews, P.B.: Theorem proving via general matings. Journal of Association Computing Machinery, 28 (1981) 4. Aspvall, B.: Recognising disguised NR(1) instances of the satis ability problem. Journal of Algorithms, 1 (1980) 97{103 5. Aspvall B., Plass M.F., Tarjan R.E.: A linear-time algorithm for testing the truth of certain quanti ed Boolean formulas. Information Processing Letters, 8:3 (1979) 121{132 6. Bibel, W.: Automated theorem proving. Fiedr, Vieweg and Sohn. (1982) 7. Bibel W.: Mating in matrices. Communications of the ACM, 26:11 (1983) 8. Boros E., Crama Y., Hammer P.L., Saks M.: A complexity index for satis ability problems SIAM Journal on Computing, 23 (1994) 45{49 9. Boros E., Hammer P.L., Sun X.: Recognition of q-Horn formulae in linear time. Discrete Applied Mathematics, 55 (1994) 1{13 10. Boy de la Tour, T.: Minimising the number of clauses by renaming. In: CADE-10, (1990) 558{572 11. Chandru V., Hooker, J.N.: Extended Horn sets in propositional logic. Journal of ACM, 38 (1991) 205{221 12. Cook S.A.: The complexity of theorem-proving procedures. Third ACM Symposium on theory of Computing, (1971) 151{158 13. Conforti M., Cornuejols G., Kapoor A., Vuskovic K., Rao M.R.: Balanced matrices. In: J.R. Birge and K.G. Murty, Mathematical Programming: State of the Art, (1994) 14. Dowling W.F., Gallier J.H.: Linear-time algorithms for testing the satis ability of propositional Horn formulae. Journal of Logic Programming, 3 (1984) 267{284 15. Escalada-Imaz G.: Optimisation d'algorithmes d'inference monotone en logique des propositions et du premier ordre. Universite Paul Sabatier, Toulouse, France (1989) 16. Escalada-Imaz G.: Linear forward inferences engines for a class of rule systems (in French). Laboratoire D'Automatique et Analyse des Systemes, Toulouse, France, (1989) LAAS-89172 17. Escalada-Imaz G.: A quadratic algorithm and a linear algorithm for 2-CNF (in French). Laboratoire D'Automatique et Analyse des Systemes, Toulouse, France, (1989) LAAS-89378 18. Escalada-Imaz G., Martnez-Enrquez A.M.: Forward chaining inference engines of optimal complexity for several classes of rule based systems (in Spanish). Informatica y Automatica, 27:3 (1994) 23{30
19. Even S., Itai A., Shamir A.: On the complexity of timetable and multicommodity
ow problems. SIAM J. of Computing, 5 (1976) 691{703 20. Ghallab M., Escalada-Imaz, G.: A linear control algorithm for a class of rule-based systems. Journal of Logic Programming, 11 (1991) 117{132 21. Gallo, G., Urbani, G.: Algorithms for testing the satis ability of propositional formulae. Journal of Logic Programming, 7 (1989) 45{61 22. Hahnle, R.: Short conjunctive normal forms in nitely-valued logics. Journal of Logic and Computation, 4:6 (1994) 905{927 23. Hahnle R., Murray N.V., Rosenthal, E.: Completeness for linear regular negation normal form inference systems. In: Proceedings ISMIS'97, (1997) 24. Henschen L., Wos L.: Unit refutations and Horn sets. Journal of the Association for Computing Machinery, 21:4 (1974) 590{605 25. Henschen L., Lusk E., Overbeek R., Smith B.T., Vero R., Winker S., Wos L.: Challenge problem 1. SIGART Newsletter, 72 (1980) 30{31 26. Jones N., Laaser W.: Complete problems for deterministic polynomial time. Theoretical Computer Science, 3 (1977) 105{117 27. Karp R.M.: Reducibility among combinatorial problems. In: Miller, R. E., Thatcher, J. W. (eds): Complexity of Computer Computations. Plenum Press. N.Y. (1972) 85{103 28. Lewis H.R.: Renaming a set of clauses as a Horn set. Journal of the ACM, 25 (1978) 134{135 29. Minoux, M.: LTUR: A simpli ed linear-time unit resolution algorithm for Horn formulae and computer implementation. Information Processing Letters, 29 (1988) 1{12 30. Mints, G.: Gentzen-type systems and resolution rules, part 1: Propositional logic. In: Proc. COLOG-88, Tallin. Lecture Notes in Computer Science, 417. Springer, (1990) 198{231 31. Murray N.V., Rosenthal, E.: Dissolution: making paths vanish. Journal of the ACM, 3 (1993) 504{535 32. Ramesh, A.G.: Some applications of non-Clausal deduction. Department of Computer Science, State University of new York at Albany, (1995) 33. Roy, R., Chowdhury, Dalal: Model theoretic semantics and tractable algorithm for CNF-BCP, In: Proc. of the AAAI-97, (1997) 227{232 34. Scutella M.G.: A note on Dowling and Gallier's top-down algorithm for propositional Horn satis ability. Journal of Logic Programming, 8 (1990) 265{273 35. Schlipf J.S., Annextein F., Franco J., Swaminathan, R.P.: On nding solutions for extended Horn formulas. Information Processing Letters, 54 (1995) 133{137 36. Socher, R.: Optimising the clausal normal form transformation. Journal of Automated Reasoning, 7 (1991) 325{336 37. Stachniak, Z.: Non-clausal reasoning with propositional de nite theories. In: International Conference on Arti cial Intelligence and Symbolic Computation. Lecture Notes in Computer Science, 1476. Springer Verlag, (1998) 296{307 38. Stachniak, Z.: Polarity guided tractable reasoning. In: International American Association on Arti cial Intelligence, AAAI-99 (1999) 751{758 39. Tseitin, G.: On the complexity of proofs in propositional logics. In: Siekmann, J., Wrightson, G. (eds.): Automation of Reasoning 2: Classical Papers on Computational Logic, Springer, (1983) 466{483