sarvesh.
P vs NP: Small Circuits

P vs NP: Small Circuits · Circuits for tables

What one NOT gate can save

Mark three cells in distinct rows and columns, leaving at least one spare row and column. Ask a circuit to accept every cell except the three marks. A glance suggests a shortcut. Detect the three exceptions, then reverse the answer. How much does that last operation buy?

Build the six-gate circuit

Use three AND gates to detect the three marked pairs. Two ORs combine those answers and one NOT flips the result. That is a six-gate circuit for any table with at least four rows and four columns. The lower bound also allows gate reuse and rules out every five-gate alternative.

Remove the NOT gate

If the circuit can only use AND and OR, accepting all except the three cells costs exactly R + C + 1 on an R-by-C table. Accepting just the three marked cells instead costs five. On a six-by-six table the respective minima are thirteen, six and five. An earlier construction already reached the positive upper bound on square tables. The proofs establish optimality and extend the result to rectangles.

Mark more exceptions

For s disjoint marked pairs, with s ≥ 2 and a spare row and column, the marked set costs exactly 2s − 1 positive gates. Detecting its complement with negation allowed costs exactly 2s. The positive-only R + C + 1 result above is specific to three exceptions.

Proof and verification

Lean-checked exact costs under each gate set.