In logic and computer science, the Boolean satisfiability problem (sometimes called propositional satisfiability problem and abbreviated SATISFIABILITY, SAT or BSAT) is the problem of determining if there exists an interpretation that satisfies a given Boolean formula. In other words, it asks whether the variables of a given Boolean formula can be consistently replaced by the values TRUE or FALSE in such a way that the formula evaluates to TRUE. If this is the case, the formula is called satisfiable. On the other hand, if no such assignment exists, the function expressed by the formula is FALSE for all possible variable assignments and the formula is unsatisfiable. For example, the formula "a AND NOT b" is satisfiable because one can find the values a = TRUE and b = FALSE, which make (a AND NOT b) = TRUE. In contrast, "a AND NOT a" is unsatisfiable.
SAT is the first problem that was proven to be NPcomplete; see Cook–Levin theorem. This means that all problems in the complexity class NP, which includes a wide range of natural decision and optimization problems, are at most as difficult to solve as SAT. There is no known algorithm that efficiently solves each SAT problem, and it is generally believed that no such algorithm exists; yet this belief has not been proven mathematically, and resolving the question of whether SAT has a polynomialtime algorithm is equivalent to the P versus NP problem, which is a famous open problem in the theory of computing.
Nevertheless, as of 2007, heuristic SATalgorithms are able to solve problem instances involving tens of thousands of variables and formulas consisting of millions of symbols,^{[1]} which is sufficient for many practical SAT problems from, e.g., artificial intelligence, circuit design,^{[2]} and automatic theorem proving.
A propositional logic formula, also called Boolean expression, is built from variables, operators AND (conjunction, also denoted by ∧), OR (disjunction, ∨), NOT (negation, ¬), and parentheses. A formula is said to be satisfiable if it can be made TRUE by assigning appropriate logical values (i.e. TRUE, FALSE) to its variables. The Boolean satisfiability problem (SAT) is, given a formula, to check whether it is satisfiable. This decision problem is of central importance in many areas of computer science, including theoretical computer science, complexity theory,^{[3]}^{[4]} algorithmics, cryptography^{[5]}^{[6]} and artificial intelligence.^{[7]}^{[additional citation(s) needed]}
A literal is either a variable (in which case it is called a positive literal) or the negation of a variable (called a negative literal). A clause is a disjunction of literals (or a single literal). A clause is called a Horn clause if it contains at most one positive literal. A formula is in conjunctive normal form (CNF) if it is a conjunction of clauses (or a single clause). For example, x_{1} is a positive literal, ¬x_{2} is a negative literal, x_{1} ∨ ¬x_{2} is a clause. The formula (x_{1} ∨ ¬x_{2}) ∧ (¬x_{1} ∨ x_{2} ∨ x_{3}) ∧ ¬x_{1} is in conjunctive normal form; its first and third clauses are Horn clauses, but its second clause is not. The formula is satisfiable, by choosing x_{1} = FALSE, x_{2} = FALSE, and x_{3} arbitrarily, since (FALSE ∨ ¬FALSE) ∧ (¬FALSE ∨ FALSE ∨ x_{3}) ∧ ¬FALSE evaluates to (FALSE ∨ TRUE) ∧ (TRUE ∨ FALSE ∨ x_{3}) ∧ TRUE, and in turn to TRUE ∧ TRUE ∧ TRUE (i.e. to TRUE). In contrast, the CNF formula a ∧ ¬a, consisting of two clauses of one literal, is unsatisfiable, since for a=TRUE or a=FALSE it evaluates to TRUE ∧ ¬TRUE (i.e., FALSE) or FALSE ∧ ¬FALSE (i.e., again FALSE), respectively.
For some versions of the SAT problem, it is useful to define the notion of a generalized conjunctive normal form formula, viz. as a conjunction of arbitrarily many generalized clauses, the latter being of the form R(l_{1},...,l_{n}) for some Boolean function R and (ordinary) literals l_{i}. Different sets of allowed boolean functions lead to different problem versions. As an example, R(¬x,a,b) is a generalized clause, and R(¬x,a,b) ∧ R(b,y,c) ∧ R(c,d,¬z) is a generalized conjunctive normal form. This formula is used below, with R being the ternary operator that is TRUE just when exactly one of its arguments is.
Using the laws of Boolean algebra, every propositional logic formula can be transformed into an equivalent conjunctive normal form, which may, however, be exponentially longer. For example, transforming the formula (x_{1}∧y_{1}) ∨ (x_{2}∧y_{2}) ∨ ... ∨ (x_{n}∧y_{n}) into conjunctive normal form yields
while the former is a disjunction of n conjunctions of 2 variables, the latter consists of 2^{n} clauses of n variables.
However, with use of the Tseytin transformation, we may find an equisatisfiable conjunctive normal form formula with length linear in the size of the original propositional logic formula.
SAT was the first known NPcomplete problem, as proved by Stephen Cook at the University of Toronto in 1971^{[8]} and independently by Leonid Levin at the National Academy of Sciences in 1973.^{[9]} Until that time, the concept of an NPcomplete problem did not even exist. The proof shows how every decision problem in the complexity class NP can be reduced to the SAT problem for CNF^{[note 1]} formulas, sometimes called CNFSAT. A useful property of Cook's reduction is that it preserves the number of accepting answers. For example, deciding whether a given graph has a 3coloring is another problem in NP; if a graph has 17 valid 3colorings, the SAT formula produced by the Cook–Levin reduction will have 17 satisfying assignments.
NPcompleteness only refers to the runtime of the worst case instances. Many of the instances that occur in practical applications can be solved much more quickly. See Algorithms for solving SAT below.
Like the satisfiability problem for arbitrary formulas, determining the satisfiability of a formula in conjunctive normal form where each clause is limited to at most three literals is NPcomplete also; this problem is called 3SAT, 3CNFSAT, or 3satisfiability. To reduce the unrestricted SAT problem to 3SAT, transform each clause l_{1} ∨ ⋯ ∨ l_{n} to a conjunction of n  2 clauses
where x_{2}, ⋯ , x_{n − 2} are fresh variables not occurring elsewhere. Although the two formulas are not logically equivalent, they are equisatisfiable. The formula resulting from transforming all clauses is at most 3 times as long as its original, i.e. the length growth is polynomial.^{[10]}
3SAT is one of Karp's 21 NPcomplete problems, and it is used as a starting point for proving that other problems are also NPhard.^{[note 2]} This is done by polynomialtime reduction from 3SAT to the other problem. An example of a problem where this method has been used is the clique problem: given a CNF formula consisting of c clauses, the corresponding graph consists of a vertex for each literal, and an edge between each two noncontradicting^{[note 3]} literals from different clauses, cf. picture. The graph has a cclique if and only if the formula is satisfiable.^{[11]}
There is a simple randomized algorithm due to Schöning (1999) that runs in time (4/3)^{n} where n is the number of variables in the 3SAT proposition, and succeeds with high probability to correctly decide 3SAT.^{[12]}
The exponential time hypothesis asserts that no algorithm can solve 3SAT (or indeed kSAT for any ) in exp(o(n)) time (i.e., fundamentally faster than exponential in n).
Selman, Mitchell, and Levesque (1996) give empirical data on the difficulty of randomly generated 3SAT formulas, depending on their size parameters. Difficulty is measured in number recursive calls made by a DPLL algorithm.^{[13]}
3satisfiability can be generalized to ksatisfiability (kSAT, also kCNFSAT), when formulas in CNF are considered with each clause containing up to k literals.^{[citation needed]} However, since for any k ≥ 3, this problem can neither be easier than 3SAT nor harder than SAT, and the latter two are NPcomplete, so must be kSAT.
Some authors restrict kSAT to CNF formulas with exactly k literals.^{[citation needed]} This doesn't lead to a different complexity class either, as each clause l_{1} ∨ ⋯ ∨ l_{j} with j < k literals can be padded with fixed dummy variables to l_{1} ∨ ⋯ ∨ l_{j} ∨ d_{j+1} ∨ ⋯ ∨ d_{k}. After padding all clauses, 2^{k}1 extra clauses^{[note 4]} have to be appended to ensure that only d_{1} = ⋯ = d_{k}=FALSE can lead to a satisfying assignment. Since k doesn't depend on the formula length, the extra clauses lead to a constant increase in length. For the same reason, it does not matter whether duplicate literals are allowed in clauses, as in ¬x ∨ ¬y ∨ ¬y.
Conjunctive normal form (in particular with 3 literals per clause) is often considered the canonical representation for SAT formulas. As shown above, the general SAT problem reduces to 3SAT, the problem of determining satisfiability for formulas in this form.
SAT is trivial if the formulas are restricted to those in disjunctive normal form, that is, they are a disjunction of conjunctions of literals. Such a formula is indeed satisfiable if and only if at least one of its conjunctions is satisfiable, and a conjunction is satisfiable if and only if it does not contain both x and NOT x for some variable x. This can be checked in linear time. Furthermore, if they are restricted to being in full disjunctive normal form, in which every variable appears exactly once in every conjunction, they can be checked in constant time (each conjunction represents one satisfying assignment). But it can take exponential time and space to convert a general SAT problem to disjunctive normal form; for an example exchange "∧" and "∨" in the above exponential blowup example for conjunctive normal forms.
A variant of the 3satisfiability problem is the oneinthree 3SAT (also known variously as 1in3SAT and exactly1 3SAT). Given a conjunctive normal form with three literals per clause, the problem is to determine whether there exists a truth assignment to the variables so that each clause has exactly one TRUE literal (and thus exactly two FALSE literals). In contrast, ordinary 3SAT requires that every clause has at least one TRUE literal. Formally, a oneinthree 3SAT problem is given as a generalized conjunctive normal form with all generalized clauses using a ternary operator R that is TRUE just if exactly one of its arguments is. When all literals of a oneinthree 3SAT formula are positive, the satisfiability problem is called oneinthree positive 3SAT.
Oneinthree 3SAT, together with its positive case, is listed as NPcomplete problem "LO4" in the standard reference, Computers and Intractability: A Guide to the Theory of NPCompleteness by Michael R. Garey and David S. Johnson. Oneinthree 3SAT was proved to be NPcomplete by Thomas Jerome Schaefer as a special case of Schaefer's dichotomy theorem, which asserts that any problem generalizing Boolean satisfiability in a certain way is either in the class P or is NPcomplete.^{[14]}
Schaefer gives a construction allowing an easy polynomialtime reduction from 3SAT to oneinthree 3SAT. Let "(x or y or z)" be a clause in a 3CNF formula. Add six fresh boolean variables a, b, c, d, e, and f, to be used to simulate this clause and no other. Then the formula R(x,a,d) ∧ R(y,b,d) ∧ R(a,b,e) ∧ R(c,d,f) ∧ R(z,c,FALSE) is satisfiable by some setting of the fresh variables if and only if at least one of x, y, or z is TRUE, see picture (left). Thus any 3SAT instance with m clauses and n variables may be converted into an equisatisfiable oneinthree 3SAT instance with 5m clauses and n+6m variables.^{[15]} Another reduction involves only four fresh variables and three clauses: R(¬x,a,b) ∧ R(b,y,c) ∧ R(c,d,¬z), see picture (right).
Another variant is the notallequal 3satisfiability problem (also called NAE3SAT). Given a conjunctive normal form with three literals per clause, the problem is to determine if an assignment to the variables exists such that in no clause all three literals have the same truth value. This problem is NPcomplete, too, even if no negation symbols are admitted, by Schaefer's dichotomy theorem.^{[14]}
A 3SAT formula is Linear SAT (LSAT) if each clause (viewed as a set of literals) intersects at most one other clause, and, moreover, if two clauses intersect, then they have exactly one literal in common. An LSAT formula can be depicted as a set of disjoint semiclosed intervals on a line. Deciding whether an LSAT formula is satisfiable or not is NPcomplete.^{[16]}
SAT is easier if the number of literals in a clause is limited to at most 2, in which case the problem is called 2SAT. This problem can be solved in polynomial time, and in fact is complete for the complexity class NL. If additionally all OR operations in literals are changed to XOR operations, the result is called exclusiveor 2satisfiability, which is a problem complete for the complexity class SL = L.
The problem of deciding the satisfiability of a given conjunction of Horn clauses is called Hornsatisfiability, or HORNSAT. It can be solved in polynomial time by a single step of the Unit propagation algorithm, which produces the single minimal model of the set of Horn clauses (w.r.t. the set of literals assigned to TRUE). Hornsatisfiability is Pcomplete. It can be seen as P's version of the Boolean satisfiability problem. Also, deciding the truth of quantified Horn formulas can be done in polynomial time. ^{[17]}
Horn clauses are of interest because they are able to express implication of one variable from a set of other variables. Indeed, one such clause ¬x_{1} ∨ ... ∨ ¬x_{n} ∨ y can be rewritten as x_{1} ∧ ... ∧ x_{n} → y, that is, if x_{1},...,x_{n} are all TRUE, then y needs to be TRUE as well.
A generalization of the class of Horn formulae is that of renameableHorn formulae, which is the set of formulae that can be placed in Horn form by replacing some variables with their respective negation. For example, (x_{1} ∨ ¬x_{2}) ∧ (¬x_{1} ∨ x_{2} ∨ x_{3}) ∧ ¬x_{1} is not a Horn formula, but can be renamed to the Horn formula (x_{1} ∨ ¬x_{2}) ∧ (¬x_{1} ∨ x_{2} ∨ ¬y_{3}) ∧ ¬x_{1} by introducing y_{3} as negation of x_{3}. In contrast, no renaming of (x_{1} ∨ ¬x_{2} ∨ ¬x_{3}) ∧ (¬x_{1} ∨ x_{2} ∨ x_{3}) ∧ ¬x_{1} leads to a Horn formula. Checking the existence of such a replacement can be done in linear time; therefore, the satisfiability of such formulae is in P as it can be solved by first performing this replacement and then checking the satisfiability of the resulting Horn formula.
Solving an XORSAT example by Gaussian elimination  

 
 
 
 
 
 

Another special case is the class of problems where each clause contains XOR (i.e. exclusive or) rather than (plain) OR operators.^{[note 5]} This is in P, since an XORSAT formula can also be viewed as a system of linear equations mod 2, and can be solved in cubic time by Gaussian elimination;^{[18]} see the box for an example. This recast is based on the kinship between Boolean algebras and Boolean rings, and the fact that arithmetic modulo two forms a finite field. Since a XOR b XOR c evaluates to TRUE if and only if exactly 1 or 3 members of {a,b,c} are TRUE, each solution of the 1in3SAT problem for a given CNF formula is also a solution of the XOR3SAT problem, and in turn each solution of XOR3SAT is a solution of 3SAT, cf. picture. As a consequence, for each CNF formula, it is possible to solve the XOR3SAT problem defined by the formula, and based on the result infer either that the 3SAT problem is solvable or that the 1in3SAT problem is unsolvable.
Provided that the complexity classes P and NP are not equal, neither 2, nor Horn, nor XORsatisfiability is NPcomplete, unlike SAT.
The restrictions above (CNF, 2CNF, 3CNF, Horn, XORSAT) bound the considered formulae to be conjunctions of subformulae; each restriction states a specific form for all subformulae: for example, only binary clauses can be subformulae in 2CNF.
Schaefer's dichotomy theorem states that, for any restriction to Boolean functions that can be used to form these subformulae, the corresponding satisfiability problem is in P or NPcomplete. The membership in P of the satisfiability of 2CNF, Horn, and XORSAT formulae are special cases of this theorem.^{[14]}
The following table summarizes some common variants of SAT.
Code  Name  Restrictions  Requirements  Class 

3SAT  3satisfiability  Each clause contains 3 literals.  At least one literal must be true.  NPC 
2SAT  2satisfiability  Each clause contains 2 literals.  At least one literal must be true.  P 
1in3SAT  Exactly1 3SAT  Each clause contains 3 literals.  Exactly one literal must be true.  NPC 
1in3SAT+  Exactly1 Positive 3SAT  Each clause contains 3 positive literals.  Exactly one literal must be true.  NPC 
NAE3SAT  Notallequal 3satisfiability  Each clause contains 3 literals.  Either one or two literals must be true.  NPC 
NAE3SAT+  Notallequal positive 3SAT  Each clause contains 3 positive literals.  Either one or two literals must be true.  NPC 
PLSAT  Planar SAT  The incidence graph (clausevariable graph) is planar.  At least one literal must be true.  NPC 
L3SAT  Linear 3SAT  Each clause intersects at most one other clause, and the intersection is exactly one literal.  At least one literal must be true.  NPC 
HORNSAT  Horn satisfiability  Horn clauses (at most one positive literal).  At least one literal must be true.  P 
XORSAT  Xor satisfiability  Each clause contains XOR operations rather than OR.  The XOR of all literals must be true.  P 
An extension that has gained significant popularity since 2003 is satisfiability modulo theories (SMT) that can enrich CNF formulas with linear constraints, arrays, alldifferent constraints, uninterpreted functions,^{[19]} etc. Such extensions typically remain NPcomplete, but very efficient solvers are now available that can handle many such kinds of constraints.
The satisfiability problem becomes more difficult if both "for all" (∀) and "there exists" (∃) quantifiers are allowed to bind the Boolean variables. An example of such an expression would be ∀x ∀y ∃z (x ∨ y ∨ z) ∧ (¬x ∨ ¬y ∨ ¬z); it is valid, since for all values of x and y, an appropriate value of z can be found, viz. z=TRUE if both x and y are FALSE, and z=FALSE else. SAT itself (tacitly) uses only ∃ quantifiers. If only ∀ quantifiers are allowed instead, the socalled tautology problem is obtained, which is coNPcomplete. If both quantifiers are allowed, the problem is called the quantified Boolean formula problem (QBF), which can be shown to be PSPACEcomplete. It is widely believed that PSPACEcomplete problems are strictly harder than any problem in NP, although this has not yet been proved. Using highly parallel P systems, QBFSAT problems can be solved in linear time.^{[20]}
Ordinary SAT asks if there is at least one variable assignment that makes the formula true. A variety of variants deal with the number of such assignments:
Other generalizations include satisfiability for first and secondorder logic, constraint satisfaction problems, 01 integer programming.
While SAT is a decision problem, the search problem of finding a satisfying assignment reduces to SAT. That is, each algorithm which correctly answers if an instance of SAT is solvable can be used to find a satisfying assignment. First, the question is asked on the given formula Φ. If the answer is "no", the formula is unsatisfiable. Otherwise, the question is asked on the partly instantiated formula Φ{x_{1}=TRUE}, i.e. Φ with the first variable x_{1} replaced by TRUE, and simplified accordingly. If the answer is "yes", then x_{1}=TRUE, otherwise x_{1}=FALSE. Values of other variables can be found subsequently in the same way. In total, n+1 runs of the algorithm are required, where n is the number of distinct variables in Φ.
This property is used in several theorems in complexity theory:
Since the SAT problem is NPcomplete, only algorithms with exponential worstcase complexity are known for it. In spite of this, efficient and scalable algorithms for SAT were developed during the 2000s and have contributed to dramatic advances in our ability to automatically solve problem instances involving tens of thousands of variables and millions of constraints (i.e. clauses).^{[1]} Examples of such problems in electronic design automation (EDA) include formal equivalence checking, model checking, formal verification of pipelined microprocessors,^{[19]} automatic test pattern generation, routing of FPGAs,^{[26]} planning, and scheduling problems, and so on. A SATsolving engine is also considered to be an essential component in the electronic design automation toolbox.
Major techniques used by modern SAT solvers include the Davis–Putnam–Logemann–Loveland algorithm (or DPLL), conflictdriven clause learning (CDCL), and stochastic local search algorithms such as WalkSAT. Almost all SAT solvers include timeouts, so they will terminate in reasonable time even if they cannot find a solution. Different SAT solvers will find different instances easy or hard, and some excel at proving unsatisfiability, and others at finding solutions.
SAT solvers are developed and compared in SATsolving contests.^{[27]} Modern SAT solvers are also having significant impact on the fields of software verification, constraint solving in artificial intelligence, and operations research, among others.
Wikimedia Commons has media related to Boolean satisfiability problem. 
modern SAT solvers can often handle problems with millions of constraints and hundreds of thousands of variables.
Additional references by date of publication:
This article includes material from a column in the ACM SIGDA enewsletter by Prof. Karem Sakallah
Original text is available here