Draft
Boolean Satisfiability (SAT)
Decide whether some truth assignment makes a Boolean formula true, and separate searching for an assignment from checking one.
Hook problem: make the rule true
Imagine an alarm controlled by a written rule rather than by a circuit diagram. Four switches x1, x2, x3, and x4 can each be 0 or 1. The rule is a Boolean formula:
phi = (x1 AND NOT x2 AND (x3 OR x4)) OR (x2 AND x4)
The decision question is:
Is there any switch setting that makes
phievaluate to true?
Assignment strings are positional in the order x1 x2 x3 x4. For example, 1010 means x1=1, x2=0, x3=1, and x4=0.
a named Boolean switch
a variable or its negation
a smaller expression inside phi
rules that combine truth values
First naive idea: try every row
The most direct method is to build the truth table and test rows one by one.
Four variables give 16 well-formed rows. The grid shows representative rows from that table.
x1=1, x2=0, and x3=1 make the three-part left side true.
One rejecting row is only evidence about that row, not an unsatisfiability proof.
For this four-variable fixture there are only 16 rows, so brute force feels harmless. But the table is the search space, not the certificate.
x1=1, x2=0, and x3=1 make the three-part left side true.
x2=1 and x4=1 make the right side true, so the root OR is true.
This assignment fails, but 1010 and 0101 show the formula is still satisfiable.
Where it breaks: doubling pain
Every new variable doubles the number of possible assignments:
One false row, such as 0000, proves only that 0000 fails. It does not prove that no satisfying assignment exists.
Checking one certificate evaluates phi once; blind search may evaluate one row after another.
all rows in the brute-force table
validate bits, evaluate formula tree, read root
same doubling shape for larger formulas
| n | 2^n | one-check label |
|---|---|---|
| 4 | 16 | O(|phi| + n) |
| 8 | 256 | O(|phi| + n) |
| 12 | 4,096 | O(|phi| + n) |
| 20 | 1,048,576 | O(|phi| + n) |
| 30 | 1,073,741,824 | O(|phi| + n) |
Core invention: one assignment can be a certificate
Now separate two jobs:
- Search asks whether some satisfying assignment exists.
- Verification receives one proposed assignment and checks it.
If someone hands us 1010, we do not need to rebuild the whole table. We validate that the string has one bit per variable, evaluate the formula tree, and accept if the root is true.
If phi becomes true, the instance is Yes. If this row fails, only this certificate failed.
The certificate is one claimed witness for a Yes instance. It can prove a Yes answer when it works, but it is not a method for finding itself.
The verifier validates the certificate, evaluates formula occurrences bottom up, then reads the root.
Stored values grow monotonically: each parent is stored only after its children are known.
| step | work | status |
|---|---|---|
| validation passed | assignment has exactly one bit for each formula variable | current |
| x1-left: VAR | x1: x1=1 -> 1 | waiting |
| x2-left: VAR | x2: x2=0 -> 0 | waiting |
| not-x2-left: NOT | NOT x2: x2-left=0 -> 1 | waiting |
| x3-left: VAR | x3: x3=1 -> 1 | waiting |
| x4-left: VAR | x4: x4=0 -> 0 | waiting |
| or-x3-x4: OR | x3 OR x4: x3-left=1, x4-left=0 -> 1 | waiting |
| and-left: AND | x1 AND NOT x2 AND (x3 OR x4): x1-left=1, not-x2-left=1, or-x3-x4=1 -> 1 | waiting |
| x2-right: VAR | x2: x2=0 -> 0 | waiting |
| x4-right: VAR | x4: x4=0 -> 0 | waiting |
| and-right: AND | x2 AND x4: x2-right=0, x4-right=0 -> 0 | waiting |
| or-root: OR | (x1 AND NOT x2 AND (x3 OR x4)) OR (x2 AND x4): and-left=1, and-right=0 -> 1 | waiting |
| read root result | the root formula is true, so the verifier accepts this certificate | waiting |
Formal SAT definition
A Boolean formula is built from variables, literals, and operators such as AND, OR, and NOT. A satisfying assignment is an assignment that makes the whole formula true.
Let $\varphi$ be a Boolean formula over variables $x_1,\dots,x_n$. Let $a \in \{0,1\}^n$ be one assignment, and let $\varphi(a)$ be the truth value of the formula under that assignment.
In plain language: the formula is satisfiable if at least one truth setting makes the whole expression true.
a Boolean formula made from variables and operators
one bit for each variable
the whole expression evaluates to true
Verifier implementation
The verifier’s contract is narrower than solving:
function verifySat(phi, certificate) {
if (!hasOneBitPerVariable(phi, certificate)) return false;
const assignment = readAssignmentBits(phi, certificate);
const rootValue = evaluateFormulaTree(phi.root, assignment);
return rootValue === true;
}
For well-formed assignments:
Malformed strings such as 101 or 1020 are rejected before formula evaluation, so they are not treated as meaningful false rows.
| node | inputs read | stored output |
|---|---|---|
| x1-left | x1=1 | x1 = 1 |
| x2-left | x2=0 | x2 = 0 |
| not-x2-left | x2-left=0 | NOT x2 = 1 |
| x3-left | x3=1 | x3 = 1 |
| x4-left | x4=0 | x4 = 0 |
| or-x3-x4 | x3-left=1, x4-left=0 | x3 OR x4 = 1 |
| and-left | x1-left=1, not-x2-left=1, or-x3-x4=1 | x1 AND NOT x2 AND (x3 OR x4) = 1 |
| x2-right | x2=0 | x2 = 0 |
| x4-right | x4=0 | x4 = 0 |
| and-right | x2-right=0, x4-right=0 | x2 AND x4 = 0 |
| or-root | and-left=1, and-right=0 | (x1 AND NOT x2 AND (x3 OR x4)) OR (x2 AND x4) = 1 |
| read root | root=1 | accept |
Subformula invariant
The evaluator walks the expression tree bottom up:
validation -> x1-left -> x2-left -> not-x2-left -> x3-left -> x4-left -> or-x3-x4 -> and-left -> x2-right -> x4-right -> and-right -> or-root -> final.
Invariant:
After each subformula is evaluated, every stored value equals that subformula’s truth value under the current assignment.
This is why checking is straightforward. The verifier never guesses a parent value; it computes children first, then applies the parent operator.
Complexity
The certificate has one bit per variable:
For the fixture, formula size counts variable occurrences and operator nodes. With the n-ary AND and OR convention used here, |\varphi| = 11: six variable occurrences plus five operator nodes.
One verification pass validates the assignment, evaluates the formula tree once, and reads the root:
Blind search may repeat a formula check for every assignment:
one bit per variable
six variable occurrences plus five operator nodes
may repeat the formula pass for every assignment
This proves SAT in NP: a Yes instance has a certificate with one bit per variable, and the verifier runs in polynomial time in the formula size.
Claim boundary
SAT is also famous because it is NP-complete, but this page does not prove hardness or completeness. The proof path needs reductions, normal forms such as CNF and 3SAT, and more machinery than this node should carry.
The tiny fixture, the satisfying row 1010, and the verifier trace prove only the membership side: proposed assignments can be checked efficiently.
| claim | treatment | why |
|---|---|---|
| SAT is in NP | proved here | assignment length n; verifier runs in O(|phi| + n) |
| SAT is NP-hard or NP-complete | named as later context | the proof needs reductions, not one fixture trace |
| SAT already means CNF or 3SAT | future nodes | this page uses arbitrary parenthesized formulas |
Common confusions
Each repair keeps failed rows, malformed rows, verifiers, and future reductions separate.
`0000` makes phi false, so maybe phi is unsatisfiable.
Repair: A failed row rejects only that assignment. Unsatisfiable means every well-formed row fails.
A verifier somehow finds the satisfying assignment.
SAT must already mean a clause list in CNF.
A short or non-bit string can still be evaluated as false.
| x1 | psi | why |
|---|---|---|
| 0 | false | x1 is false, so the left literal fails. |
| 1 | false | NOT x1 is false, so the right literal fails. |
Connections in the graph
p-vs-np gives the language of certificates and verifiers. circuit-sat asks the same assignment-search question for gate circuits. SAT is the formula-shaped sibling: the object is now a Boolean expression tree.
Later nodes can explain how circuits become formulas or constraints, why CNF matters, and how 3SAT fits reduction proofs. Those are future nodes, not hidden prerequisites for this page.
certificates and verifiers
same assignment question on circuits
formula version, implemented node
later normal-form nodes
Exercises
Classify satisfying, rejecting, malformed, and proved-versus-future claims.
Choose an answer to check this item.
Choose an answer to check this item.
Choose an answer to check this item.
Choose an answer to check this item.
Choose an answer to check this item.
- Which subformula first makes assignment
1010promising? - Why does
0000not prove thatphiis unsatisfiable? - Why should
101stop before any formula-tree evaluation? - Which claim is proved here:
SAT in NP,SAT is NP-hard, or both?
Graph connections : Boolean Satisfiability (SAT)