 # Complexity of the CNF-satisfiability problem

This paper is devoted to the complexity of the Boolean satisfiability problem. We consider a version of this problem, where the Boolean formula is specified in the conjunctive normal form. We prove an unexpected result that the CNF-satisfiability problem can be solved by a deterministic Turing machine in polynomial time.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

The Boolean satisfiability problem is a classic combinatorial problem. Given a Boolean formula, this problem is to check whether it is satisfiable, i.e., to find such values of the variables, on which the formula takes on the true value. There are several special cases of the Boolean satisfiability problem in which the formulas are restricted to a particular structure. The CNF-satisfiability problem is a version of the Boolean satisfiability problem, where the Boolean formula is specified in the conjunctive normal form (CNF), i.e., a conjunction of clauses, where each clause is a disjunction of literals, and a literal is a variable or its negation.

Cook  and independently Levin  proved that the CNF-satisfiability problem is -complete. This proof shows how every decision problem in the complexity class can be reduced to the Boolean satisfiability problem for formulas in the conjunctive normal form. At the same time, for some restrictions such that 2-CNF-satisfiability or Horn-satisfiability, this problem can be solved in polynomial time or even in linear time [5, 4]. This also holds true for the evaluation problem of quantified Boolean formulas [1, 2]. All restrictions are generalized by Schaefer’s dichotomy theorem that states necessary and sufficient conditions under which the Boolean satisfiability problem for a given restriction to Boolean functions is in or -complete .

The aim of this paper is to prove that the CNF-satisfiability problem without restrictions to Boolean formulas is polynomial-time decidable also. We describe a simple polynomial-time algorithm that, for a given Boolean formula in CNF, stops and answers yes if the formula is satisfiable and no otherwise. Besides, if the formula is satisfiable, the algorithm returns its true assignment.

## 2 Preliminaries and results

Boolean formulas are built up from the signature , variables and parentheses in the usual way. We use letters , etc., to denote variables and literals, and capital letters , , , , etc., to denote propositional formulas.

A literal is a variable or its negation and denoted by , where and . We assume that . A clause is a disjunction of distinct literals. We identify clauses with sets of their literals. A Boolean formula is in the conjunctive normal form (CNF) if it is a conjunction of clauses. As an example, all of the following formulas are in CNF:

 x∨y,x∧y,(¯¯¯x∨y)∧¯¯¯z,(x∨¯¯¯y)∧(¯¯¯x∨y∨z)∧(¯¯¯x∨¯¯¯z).

Given a Boolean formula , an -assignment is a set of its literals that does not contain both a literal and its negation. We call an -assignment true if every clause of contains a literal from ; is called satisfiable if there is an -assignment. The CNF-satisfiability problem is the set of satisfiable Boolean formulas in CNF. Our main result is the following theorem.

###### Theorem 2.1.

There is an algorithm that, for a given Boolean formula in CNF, stops in time bounded by and answers yes together with a true -assignment if is satisfiable and no otherwise.

As a corollary, we have that , where is the class of sets of strings recognizable by a deterministic Turing machine in time bounded by a polynomial in the length of the input.

## 3 Proofs of statements

Given a Boolean formula in CNF, set of literals and literal . Let be the set of clauses of containing literals from , the set of literals such that and , and for all .

Define and , where is the number of symbols contained in . As an example, consider the following Boolean formula in CNF

 (x1∨¯¯¯¯¯x2∨¯¯¯¯¯x3)∧(x2∨x3∨¯¯¯¯¯x4)∧(¯¯¯¯¯x3∨x4)∧(¯¯¯¯¯x1∨¯¯¯¯¯x4)∧x4,

then and . It is not hard to check that , are computable in time bounded by and satisfy the following conditions:

 (1)u∈SF(z) ⟹ ¯¯¯u∉SF(z);(2)u≠z, [{u}]F⊆CF(z) ⟹ [{¯¯¯u}]F⊆CF(z);

for all literal of .

A literal is called redundant in if . We call reduced if it does not contain redundant literals. Denote by the Boolean formula in CNF obtained from by removing all clauses from . Prove auxiliary lemmas.

###### Lemma 3.1.

If is redundant, then is satisfiable iff is satisfiable.

###### Proof.

It is sufficient to prove that is satisfiable implies is satisfiable. Let is satisfiable and is a true -assignment. If , then are pairwise distinct by (1) and do not occur in by the definition of . Therefore, is a true -assignment and so is satisfiable. ∎

###### Lemma 3.2.

If is reduced, then is satisfiable iff does not contain clauses.

###### Proof.

By induction on the number of variables in . If , the statement holds. Let the induction assumption holds for all formula with less than variables, prove it for . Consider a variable of and let are the clauses of for some . Define a Boolean formula obtained from by removing all clauses and adding clauses for all and . Since is reduced, and so contains at least one clause.

First, prove that for all literal by induction on . If , then and so the statement holds. Let the statement holds for some and . By the definition, , and . Assume that . Then by (2). Consider a clause . If , then . Therefore, , which is impossible. Otherwise, for some , and so for all . Then either , or and so by (2), which is impossible. Therefore and so . Particularly, we have for all literal .

Next, assume that contains a redundant literal . Then and . Let . If , then . Therefore, , which is impossible. Otherwise, for some , and so for all . Then either , or and so by (2), which is impossible. Therefore, is reduced and by the induction assumption is not satisfiable.

Finally, if there is a true -assignment , then for all , either or contains a literal from . So, is a true -assignment, which is impossible. Thus, is not satisfiable. ∎

Now describe the following algorithm. Let . While contains a redundant literal , reduce to and extend by adding literals from . If is reduced, answers yes together with if does not contain clauses and no otherwise.

Note that for all redundant literal , every step can be performed in time bounded by , and the obtained set is an -assignment such that every removed clause of contains a literal from . Due to Lemmas 3.1 and 3.2, the algorithm stops in time bounded by and answers yes together with a true -assignment if is satisfiable and no otherwise. Theorem 2.1 is proved.

## References

•  Aspvall B., Plass M. F., Tarjan R. E. A linear-time algorithm for testing the truth of certain quantified boolean formulas // Information Processing Letters, 1979, vol. 8, no. 3, pp. 121-–123.
•  Buning H. K., Karpinski M., Flogel A. Resolution for Quantified Boolean Formulas // Information and Computation, 1995, vol. 117, no. 1, pp. 12-–18.
•  Cook S. A.

The complexity of theorem proving procedures // Proceedings of the third annual ACM symposium on Theory of computing, 1971, pp. 151–158.

•  Dowling W. F., Gallier J. H.

Linear-time algorithms for testing the satisfiability of propositional Horn formulae // Journal of Logic Programming, 1984, vol. 1, no. 3, pp. 267-–284.

•  Krom M. R. The Decision Problem for a Class of First-Order Formulas in Which all Disjunctions are Binary // Zeitschrift für Mathematische Logik und Grundlagen der Mathematik, 1967, vol. 13, pp. 15-–20.
•  Levin L. A. Universal search problems // Problems of Information Transmission, 1973, vol. 9, no. 3, pp. 115–116. (In Russian)
•  Schaefer T. J. The complexity of satisfiability problems // Proceedings of the 10th Annual ACM Symposium on Theory of Computing, 1978, pp. 216-–226.