The SAT problem
The SAT problem (Boolean satisfiability problem) asks whether a formula made of true/false variables joined by AND, OR and NOT can be made true by some assignment of values. It was the first problem proved NP-complete, by Stephen Cook in 1971 and independently by Leonid Levin, whose paper appeared in 1973. No polynomial-time algorithm for SAT is known, yet modern SAT solvers routinely handle industrial formulas with millions of clauses.
SAT sits at the center of the P vs NP question: a provably polynomial-time algorithm for it would show P = NP. As of today that has not happened; see the current status of P vs NP.
What the SAT problem asks
A Boolean variable takes the value true or false. A literal is a variable or its negation, such as x1 or NOT x1. A clause is an OR of literals. A formula in conjunctive normal form (CNF) is an AND of clauses, and SAT is usually stated for CNF formulas.
Here is a small one with three variables and three clauses:
(x1 OR NOT x2) AND (x2 OR x3) AND (NOT x1 OR NOT x3)
The formula is satisfiable if at least one assignment makes every clause true. Try x1 = true. The third clause then needs x3 = false. With x3 false, the second clause needs x2 = true. Check the first clause: x1 is true, so it holds. The assignment x1 = true, x2 = true, x3 = false satisfies the formula, so the answer is "yes".
Checking an assignment is fast: you read each clause once. Finding one is the hard part, because n variables give 2^n possible assignments. That split, fast to verify and apparently slow to find, is exactly what the class NP captures. If those terms are new, P vs NP explained covers them from the start.
The same formula in DIMACS CNF
SAT solvers read a plain-text format from the DIMACS challenge in the early 1990s. Variables are numbered from 1, a minus sign means NOT, each clause ends with 0, and the p cnf line gives the number of variables and clauses.
c (x1 OR NOT x2) AND (x2 OR x3) AND (NOT x1 OR NOT x3)
p cnf 3 3
1 -2 0
2 3 0
-1 -3 0
Feed this to any standard solver and it will report the formula satisfiable and print a model such as 1 2 -3, meaning x1 and x2 true, x3 false.
The Cook-Levin theorem: why SAT was first
A problem is NP-complete if it is in NP and every problem in NP reduces to it in polynomial time. A reduction is a fast translation: it turns any instance of problem A into an instance of problem B with the same yes/no answer.
In his 1971 STOC paper, "The complexity of theorem-proving procedures", Cook showed that SAT has this property. The core idea: any nondeterministic machine that checks a certificate in polynomial time can be described by a polynomial-size Boolean formula. The formula's variables encode the machine's tape, head position and state at every step, and its clauses force each step to follow the machine's rules. The formula is satisfiable exactly when some certificate makes the machine accept.
Leonid Levin reached an equivalent result in the Soviet Union, framed in terms of search problems. His paper, translated as "Universal search problems" or "Universal sequential search problems", appeared in 1973. Because the two discoveries were independent, the result is now called the Cook-Levin theorem.
The theorem gave the field a starting point. In 1972 Richard Karp used reductions from SAT to show that 21 well-known combinatorial problems are NP-complete, including clique, Hamiltonian circuit and 3-SAT. Today thousands of problems are known to be NP-complete, and most proofs trace back to SAT. For how NP-complete differs from NP-hard, see NP-complete vs NP-hard.
2-SAT is in P, 3-SAT is NP-complete
Restricting the clause length changes everything.
| Variant | Clause length | Complexity |
|---|---|---|
| 2-SAT | at most 2 literals | In P, solvable in linear time |
| 3-SAT | at most 3 literals | NP-complete |
| SAT (CNF) | any length | NP-complete |
For 2-SAT, each clause (a OR b) is equivalent to two implications: if NOT a then b, and if NOT b then a. Put all of these into a directed "implication graph". Aspvall, Plass and Tarjan showed in 1979 that the formula is unsatisfiable exactly when some variable and its negation lie in the same strongly connected component, which can be checked in linear time.
3-SAT has no such shortcut. Any CNF clause with more than three literals can be split into three-literal clauses with fresh helper variables, without changing satisfiability and with only polynomial growth. So 3-SAT is as hard as general SAT, and it is the version most textbook reductions start from. A polynomial-time algorithm for 3-SAT would prove P = NP.
How SAT solvers work: DPLL and CDCL
The classic algorithm is DPLL, named after Davis, Putnam, Logemann and Loveland, whose papers date from 1960 and 1962. It is a backtracking search with two key rules:
- Unit propagation: if a clause has only one unassigned literal left and all others are false, that literal must be true.
- Pure literal elimination: if a variable appears only positively (or only negatively), set it to satisfy all its clauses.
DPLL picks a variable, guesses a value, propagates, and backtracks one level when it hits a conflict.
Modern solvers use conflict-driven clause learning (CDCL), developed in the GRASP solver by Marques-Silva and Sakallah in the mid-1990s and made much faster by the Chaff solver in 2001. When CDCL hits a conflict, it analyzes why, adds a new "learned" clause that rules out that cause, and jumps back several levels at once (non-chronological backtracking). Combined with good variable-selection heuristics, restarts and efficient data structures, this lets solvers prune enormous parts of the search space.
Where SAT solvers are used
Because so many problems reduce to SAT, a fast general solver becomes a general tool. Common uses:
- Hardware verification. Bounded model checking, introduced by Biere and colleagues in 1999, encodes "can this circuit reach a bad state within k steps?" as a SAT formula. It was adopted widely in industry for finding bugs.
- Software verification. The same idea extends to programs, for example in the CBMC bounded model checker for C.
- Planning. Kautz and Selman's 1992 "Planning as satisfiability" encodes a planning problem with a fixed number of steps as a formula; a satisfying assignment is a plan.
- Scheduling and configuration. Timetables, resource assignments and package dependency problems are often expressed as SAT or as close relatives that use SAT solvers internally.
Why this does not contradict NP-completeness
NP-completeness is a worst-case statement. It says no known algorithm solves every SAT instance in polynomial time. It says nothing about the instances that engineers actually generate, which tend to have structure: local constraints, modular circuits, many variables that become fixed once a few key decisions are made. CDCL is very good at finding and exploiting that structure.
The worst case is still real. When a CDCL solver proves a formula unsatisfiable, its run implicitly builds a resolution proof. In 1985 Armin Haken proved that formulas encoding the pigeonhole principle (n+1 pigeons cannot fit in n holes, one per hole) need resolution proofs of exponential size. So every CDCL solver takes exponential time on those formulas, no matter how clever its heuristics. Small, hard formulas of this kind are easy to write down.
Practical success also does not count as evidence either way on P vs NP. A solver that is fast on industrial inputs is not a polynomial-time algorithm for SAT, and a family of hard formulas for one proof system does not show P ≠ NP. Both questions remain open, and SAT remains the canonical NP-complete problem at the center of them.
Questions
What is the SAT problem in simple terms?
You get a formula built from true/false variables with AND, OR and NOT. The question is whether some assignment of true and false to the variables makes the whole formula true.
What does the Cook-Levin theorem say?
It says the Boolean satisfiability problem is NP-complete: SAT is in NP, and every problem in NP can be reduced to SAT in polynomial time. Stephen Cook proved it in 1971 and Leonid Levin found an equivalent result independently, published in 1973.
Why is 2-SAT easy but 3-SAT hard?
2-SAT can be solved in linear time by building an implication graph and checking its strongly connected components. 3-SAT is NP-complete, so no polynomial-time algorithm for it is known, and finding one would prove P = NP.
If SAT is NP-complete, how do SAT solvers handle millions of variables?
NP-completeness is a statement about the worst case. Industrial formulas have structure that clause-learning solvers exploit, while specific formula families, such as pigeonhole formulas, still force these solvers to take exponential time.
Would a fast SAT solver prove P = NP?
Only if it provably runs in polynomial time on every input. Solvers that are fast on the instances people care about do not settle the question.
Sources
- Stephen A. Cook, The complexity of theorem-proving procedures, STOC 1971
- Cook-Levin theorem (Wikipedia), including Levin's 1973 paper
- Computational Complexity blog, The Levin translation (2024)
- Richard M. Karp, Reducibility among combinatorial problems (1972)
- Karp's 21 NP-complete problems (Wikipedia)
- Aspvall, Plass and Tarjan, A linear-time algorithm for testing the truth of certain quantified Boolean formulas, IPL 1979
- DIMACS, Satisfiability suggested format (1993)
- DPLL algorithm (Wikipedia)
- Conflict-driven clause learning (Wikipedia)
- Marques-Silva, Lynce and Malik, Conflict-Driven Clause Learning SAT Solvers, Handbook of Satisfiability
- Biere et al., Bounded Model Checking (JKU project page)
- Kautz and Selman, Planning as Satisfiability, ECAI 1992 (BibBase entry)
- Proof complexity (Wikipedia), including Haken's 1985 pigeonhole lower bound for resolution
- Mikša and Nordström, Long proofs of (seemingly) simple formulas, on CDCL and resolution
Get one email the day P vs NP changes status.
Get the alert