Graph connections

Draft

Boolean Satisfiability (SAT)

Decide whether some truth assignment makes a Boolean formula true, and separate searching for an assignment from checking one.

concept intermediate complexityalgorithmsnp-hardnesssatisfiabilitylogic

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 phi evaluate to true?

A formula asks whether some switch setting makes the whole rule trueThe root OR means either the left sub-rule or the right sub-rule can satisfy the alarm.
x1=1x2=0x3=1x4=0left sub-rule: x1 AND NOT x2 AND (x3 OR x4)right sub-rule: x2 AND x4final lamp: true
root ORroot=1left AND1right AND0x11NOT x21x2=0x3 OR x41x3=1x4=0x20x40

Assignment strings are positional in the order x1 x2 x3 x4. For example, 1010 means x1=1, x2=0, x3=1, and x4=0.

Pieces of the same formulaThe vocabulary points into phi instead of introducing a second example.
variable: x1

a named Boolean switch

literal: NOT x2

a variable or its negation

subformula: (x3 OR x4)

a smaller expression inside phi

operator: AND / OR / NOT

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.

Naive truth-table search

Four variables give 16 well-formed rows. The grid shows representative rows from that table.

2^4 = 16
1010 -> phi=1satisfying via left side

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.

root ORroot=1left AND1right AND0x11NOT x21x2=0x3 OR x41x3=1x4=0x20x40

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.

Fixture rows used throughoutMalformed examples are kept out of the truth table and shown in verifier/practice surfaces.
1010 -> phi=1satisfying via left side

x1=1, x2=0, and x3=1 make the three-part left side true.

0101 -> phi=1satisfying via right side

x2=1 and x4=1 make the right side true, so the root OR is true.

0000 -> phi=0rejecting row, not an unsat proof

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:

number of assignments=2n.\text{number of assignments} = 2^n.

One false row, such as 0000, proves only that 0000 fails. It does not prove that no satisfying assignment exists.

Every new variable doubles the table

Checking one certificate evaluates phi once; blind search may evaluate one row after another.

reason: search doubles rows, checking one certificate evaluates the formula once
Assignments16

all rows in the brute-force table

One certificate checkO(|phi| + n)

validate bits, evaluate formula tree, read root

Fixture search16 formula checks for this fixture

same doubling shape for larger formulas

Doubling snapshots
n2^none-check label
416O(|phi| + n)
8256O(|phi| + n)
124,096O(|phi| + n)
201,048,576O(|phi| + n)
301,073,741,824O(|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.

Existence search becomes one certificate checkA certificate is evidence for a Yes instance, not a method for finding the evidence.
0000000100100011010001010110011110001001101010111100110111101111
->
chosen certificate: 1010check only this assignment

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.

Verifier trace: evaluate one proposed assignment

The verifier validates the certificate, evaluates formula occurrences bottom up, then reads the root.

accept
1 / 13
validation passedassignment has exactly one bit for each formula variable

Stored values grow monotonically: each parent is stored only after its children are known.

Stored subformula values after this step
none yet
root ORroot=?left AND?right AND?x1?NOT x2?x2=?x3 OR x4?x3=?x4=?x2?x4?
Canonical trace order
stepworkstatus
validation passedassignment has exactly one bit for each formula variablecurrent
x1-left: VARx1: x1=1 -> 1waiting
x2-left: VARx2: x2=0 -> 0waiting
not-x2-left: NOTNOT x2: x2-left=0 -> 1waiting
x3-left: VARx3: x3=1 -> 1waiting
x4-left: VARx4: x4=0 -> 0waiting
or-x3-x4: ORx3 OR x4: x3-left=1, x4-left=0 -> 1waiting
and-left: ANDx1 AND NOT x2 AND (x3 OR x4): x1-left=1, not-x2-left=1, or-x3-x4=1 -> 1waiting
x2-right: VARx2: x2=0 -> 0waiting
x4-right: VARx4: x4=0 -> 0waiting
and-right: ANDx2 AND x4: x2-right=0, x4-right=0 -> 0waiting
or-root: OR(x1 AND NOT x2 AND (x3 OR x4)) OR (x2 AND x4): and-left=1, and-right=0 -> 1waiting
read root resultthe root formula is true, so the verifier accepts this certificatewaiting

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.

φSATa{0,1}n such that φ(a)=1.\varphi \in \text{SAT} \quad\Longleftrightarrow\quad \exists a \in \{0,1\}^n \text{ such that } \varphi(a)=1.

In plain language: the formula is satisfiable if at least one truth setting makes the whole expression true.

Formal decision languageAfter the concrete formula, phi means any Boolean formula over n variables.
phi

a Boolean formula made from variables and operators

a in {0,1}^n

one bit for each variable

phi(a) = 1

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:

verify(φ,a)=1φ(a)=1.\text{verify}(\varphi,a)=1 \quad\Longleftrightarrow\quad \varphi(a)=1.

Malformed strings such as 101 or 1020 are rejected before formula evaluation, so they are not treated as meaningful false rows.

Verifier implementation traceA concrete implementation stores each subformula value in the same bottom-up order every time.
nodeinputs readstored output
x1-leftx1=1x1 = 1
x2-leftx2=0x2 = 0
not-x2-leftx2-left=0NOT x2 = 1
x3-leftx3=1x3 = 1
x4-leftx4=0x4 = 0
or-x3-x4x3-left=1, x4-left=0x3 OR x4 = 1
and-leftx1-left=1, not-x2-left=1, or-x3-x4=1x1 AND NOT x2 AND (x3 OR x4) = 1
x2-rightx2=0x2 = 0
x4-rightx4=0x4 = 0
and-rightx2-right=0, x4-right=0x2 AND x4 = 0
or-rootand-left=1, and-right=0(x1 AND NOT x2 AND (x3 OR x4)) OR (x2 AND x4) = 1
read rootroot=1accept

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.

Subformula invariantWhen a parent is evaluated, every child it reads already stores the correct truth value.
not-x2-leftx2-left -> 1
or-x3-x4x3-left + x4-left -> 1
and-leftx1-left + not-x2-left + or-x3-x4 -> 1
and-rightx2-right + x4-right -> 0
or-rootand-left + and-right -> 1

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:

a=n.|a| = n.

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:

one check=O(φ+n).\text{one check} = O(|\varphi| + n).

Blind search may repeat a formula check for every assignment:

brute force search=O(2nφ).\text{brute force search} = O(2^n \cdot |\varphi|).
Cost stackKeep n assignment bits separate from |phi| formula occurrences and operator nodes.
validate certificaten = 4

one bit per variable

evaluate formula|phi| = 11

six variable occurrences plus five operator nodes

blind search2^n rows

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 boundary ledgerMembership in NP is shown here; reduction proofs stay outside this node.
claimtreatmentwhy
SAT is in NPproved hereassignment length n; verifier runs in O(|phi| + n)
SAT is NP-hard or NP-completenamed as later contextthe proof needs reductions, not one fixture trace
SAT already means CNF or 3SATfuture nodesthis page uses arbitrary parenthesized formulas

Common confusions

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.

Tiny unsatisfiable contrastpsi = x1 AND NOT x1 is separate from the main satisfiable fixture phi.
x1psiwhy
0falsex1 is false, so the left literal fails.
1falseNOT 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.

Local graph positionOnly existing nodes are graph links; future normal forms are faded context.
P vs NP

certificates and verifiers

->Circuit-SAT

same assignment question on circuits

->Boolean Satisfiability (SAT)

formula version, implemented node

->CNF / 3SAT

later normal-form nodes

Exercises

Practice the boundary

Classify satisfying, rejecting, malformed, and proved-versus-future claims.

What should the verifier do with certificate 1010?

Choose an answer to check this item.

What does 0000 prove?

Choose an answer to check this item.

How should 101 be handled?

Choose an answer to check this item.

What is wrong with 1020?

Choose an answer to check this item.

Which claim is actually proved on this page?

Choose an answer to check this item.

  1. Which subformula first makes assignment 1010 promising?
  2. Why does 0000 not prove that phi is unsatisfiable?
  3. Why should 101 stop before any formula-tree evaluation?
  4. Which claim is proved here: SAT in NP, SAT is NP-hard, or both?

Graph connections : Boolean Satisfiability (SAT)