Graph connections

Draft

Circuit-SAT

Decide whether some Boolean input assignment makes a circuit output 1, and see why one assignment is a checkable certificate.

concept intermediate complexityalgorithmsnp-hardnesssatisfiabilitycircuits

Hook problem: turn on the lamp

Imagine a Boolean control circuit. It has four input switches x1, x2, x3, and x4. Each switch is either 0 or 1. Gates such as AND, OR, and NOT combine those bits, and one output wire z controls a lamp.

The decision question is:

Is there any switch setting that makes z = 1?

A circuit asks whether some switch setting turns the lamp onInputs are switches, gates apply Boolean rules, wires carry bits forward, and z=1 means the output lamp turns on.
switch = input bit1 AND 0 = 01 OR 0 = 1NOT 0 = 1lamp on means output 1
x11x20x31x40NOTn1=1ANDg1=1ORg2=1ANDg3=1ANDg4=0ORz=11

This page uses the same fixture throughout:

n1 = NOT x2
g1 = x1 AND n1
g2 = x3 OR x4
g3 = g1 AND g2
g4 = x2 AND x4
z  = g3 OR g4

Assignment strings are positional: 1010 means x1=1, x2=0, x3=1, x4=0.

First naive idea: try every row

The most direct method is to list every assignment and evaluate the circuit on each row.

Naive search table

A four-input circuit has 16 well-formed rows. The grid shows selected rows from that table.

2^4 = 16
1010 -> z=1satisfying via g1 AND g2

x1=1 and x2=0 make g1=1; x3=1 makes g2=1.

One rejecting row is only evidence about that row, not the whole decision problem.

x11x20x31x40NOTn1=1ANDg1=1ORg2=1ANDg3=1ANDg4=0ORz=11

For four inputs, there are only 16 rows, so brute force feels manageable. But the table is not part of the certificate. It is the solver’s blind search space.

Fixture rows used throughoutMalformed examples are kept out of the exhaustive-search grid and shown in verifier/practice surfaces.
1010 -> z=1satisfying via g1 AND g2

x1=1 and x2=0 make g1=1; x3=1 makes g2=1.

0101 -> z=1satisfying via x2 AND x4

x2=1 and x4=1 make g4=1, so z=1.

0000 -> z=0rejecting row, not a No proof

This row fails, but other rows can still turn the circuit on.

Where it breaks: doubling pain

Every extra input doubles the number of rows:

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

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

Every extra input doubles the search table

Checking one row follows the circuit once; blind search may repeat that check for every row.

reason: search grows by doubling, checking one row follows the circuit once
Assignments16

all rows in the brute-force table

One certificate checkO(|C| + n)

validate bits, evaluate gates, read z

Fixture search16 checks for this fixture

same shape, larger input thought experiment

Doubling snapshots
n2^none-check label
416O(|C| + n)
8256O(|C| + n)
124,096O(|C| + n)
201,048,576O(|C| + n)
301,073,741,824O(|C| + n)

Core invention: one row can be a certificate

Now separate two jobs:

  • Search asks whether some satisfying row exists.
  • Verification receives one proposed row and checks it.

If someone hands us 1010, we do not search the table again. We validate that it has one bit per input, evaluate gates in order, and accept if z=1.

Existence search becomes one certificate checkThe problem asks whether some row exists. A certificate is one claimed witness row, not a shortcut for finding it.
0000000100100011010001010110011110001001101010111100110111101111
->
chosen certificate: 1010check only this row

If it makes z=1, the instance is Yes. If it fails, only this certificate failed.

The certificate is one claimed witness. It can prove a Yes answer when it works, but it is not a method for finding itself.

Verifier trace: check one proposed assignment

The verifier validates the certificate, evaluates gates in topological order, then reads z.

accept
1 / 8
validation passedassignment has one bit for each input

Stored values grow monotonically: each new gate value is added after its inputs are already known.

Stored values after this step
x1=1x2=0x3=1x4=0
x11x20x31x40NOTn1=?ANDg1=?ORg2=?ANDg3=?ANDg4=?ORz=??
Canonical trace order
stepworkstatus
validation passedassignment has one bit for each inputcurrent
n1: NOTx2=0 -> n1=1waiting
g1: ANDx1=1, n1=1 -> g1=1waiting
g2: ORx3=1, x4=0 -> g2=1waiting
g3: ANDg1=1, g2=1 -> g3=1waiting
g4: ANDx2=0, x4=0 -> g4=0waiting
z: ORg3=1, g4=0 -> z=1waiting
read final outputfinal output z is 1, so the verifier acceptswaiting

Formal Circuit-SAT definition

A Boolean circuit is a finite directed acyclic network of input bits, gates, and wires. A satisfying assignment is an assignment that makes the output gate equal 1.

Let $C$ be a Boolean circuit with $n$ input variables, let $a \in \{0,1\}^n$ be an assignment, and let $C(a)$ be the output under that assignment.

CCircuit-SATa{0,1}n such that C(a)=1.C \in \text{Circuit-SAT} \quad\Longleftrightarrow\quad \exists a \in \{0,1\}^n \text{ such that } C(a)=1.

In plain language: the circuit is satisfiable if at least one input setting turns the output on.

Formal decision languageAfter the concrete circuit, the symbol C means any Boolean circuit with n inputs and one output.
C

a finite directed acyclic Boolean circuit

a in {0,1}^n

one bit for each input

C(a) = 1

the output lamp turns on

Verifier implementation

The verifier’s contract is narrower than solving:

function verifyCircuitSat(C, certificate) {
  if (!hasOneBitPerInput(C, certificate)) return false;

  const values = readInputBits(C, certificate);
  for (const gate of gatesInTopologicalOrder(C)) {
    values[gate.id] = applyBooleanGate(gate, values);
  }
  return values[C.output] === 1;
}

For well-formed assignments:

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

Malformed strings such as 101 or 1020 are rejected before gate evaluation, so they are not treated as meaningful circuit runs.

Verifier implementation traceA concrete implementation stores input bits, then gate outputs, in the same order every time.
stepinputs readstored output
n1 = NOTx2=0n1=1
g1 = ANDx1=1, n1=1g1=1
g2 = ORx3=1, x4=0g2=1
g3 = ANDg1=1, g2=1g3=1
g4 = ANDx2=0, x4=0g4=0
z = ORg3=1, g4=0z=1
read zz=1accept

Gate-order invariant

The circuit is acyclic, so we can evaluate gates in a topological order:

validation -> n1 -> g1 -> g2 -> g3 -> g4 -> z -> read final output.

Invariant:

After each gate is evaluated, every stored value equals the Boolean value of that input or gate under the assignment.

Gate-order invariantWhen a gate is evaluated, every wire it reads has already been assigned its correct Boolean value.
n1x2 -> 1
g1x1 + n1 -> 1
g2x3 + x4 -> 1
g3g1 + g2 -> 1
g4x2 + x4 -> 0
zg3 + g4 -> 1

This is why a verifier can be simple. It never guesses a missing wire value; it only reads dependencies that have already been computed.

Complexity

The certificate has one bit per input:

a=n.|a| = n.

One verification pass validates the assignment, evaluates the gates, follows the wires, and reads the output:

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

Blind search may repeat that check for every assignment:

brute force search=O(2nC).\text{brute force search} = O(2^n \cdot |C|).
Cost stackFor this fixture, |C| counts 4 inputs, 6 gates, and 11 wires. The verifier touches each part once up to constant gate cost.
validate certificaten = 4

one bit per input

evaluate gates6 gates

topological order

follow wires11 wires

dependencies are already known

This proves Circuit-SAT in NP: a Yes instance has a polynomial-size certificate, and the verifier runs in polynomial time.

Claim boundary

Circuit-SAT has a second famous role: by the Cook-Levin theorem, it is NP-hard. This node only names that theorem and previews why Circuit-SAT becomes a source problem for later reductions.

The tiny fixture, the highlighted satisfying row, and the verifier trace do not prove NP-hardness. They prove only the membership side: certificates can be checked efficiently.

Claim boundary ledgerKeep membership and hardness separate.
claimtreatmentwhy
Circuit-SAT is in NPproved hereassignment length n; verifier runs in O(|C| + n)
Circuit-SAT is NP-hardnamed hereCook-Levin theorem preview; the proof is not expanded
the tiny fixture proves hardnessfalsethe fixture demonstrates checking, not universal reductions

Common confusions

Common confusions

Each repair keeps search, checking, and hardness claims separate.

`0000` outputs 0, so maybe the circuit is unsatisfiable.

Repair: A failed row rejects only that assignment. A No proof would need to rule out every row.

The fixture trace proves Circuit-SAT is NP-hard.

A verifier somehow finds the satisfying assignment.

A short or non-bit string can still be pushed through the gates.

Connections in the graph

p-vs-np gives the language of certificates and verifiers. np-hardness gives the idea that a known source problem can start later reduction chains.

Circuit-SAT is the first concrete source problem after the general definition. Later nodes can convert Circuit-SAT toward SAT-style formulas, but those nodes are not graph links until they exist.

Local graph positionThe existing graph stops at real nodes. Future SAT reductions are shown as faded preview context only.
P vs NP

certificates and verifiers

->NP-Hardness

source-problem role

->Circuit-SAT

first concrete source

->SAT

future conversion, not linked yet

Exercises

Practice the boundary

Classify rows, malformed certificates, and the proved-versus-named claim ledger.

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 gate first makes assignment 1010 promising?
  2. Why does 0000 not prove the whole circuit is unsatisfiable?
  3. Why should 101 stop before any gate evaluation?
  4. Which claim is proved here: Circuit-SAT in NP, Circuit-SAT is NP-hard, or both?

Graph connections : Circuit-SAT