Notes

REFERENCE SHEET

P, NP & completeness

Ask what can be computed efficiently after establishing that it can be computed at all.

Before this Turing machines, deciders & recognizers, Asymptotics & recurrences, Boolean logic, circuits & satisfiability

A ≤ₚ B and B ∈ P ⇒ A ∈ P

Definitions

01

P

Decision languages decidable by a deterministic Turing machine in time polynomial in the encoded input length.

02

NP

Decision languages with polynomial-length certificates whose validity can be checked by a deterministic polynomial-time verifier. Equivalently, nondeterministic polynomial time.

03

NP-hard and NP-complete

B is NP-hard if every language in NP polynomial-time many-one reduces to B. It is NP-complete if it is also in NP.

Key theorems

01

Basic containment

P⊆NP: a verifier can ignore the certificate and run the polynomial-time decider.

02

Cook–Levin theorem

Boolean satisfiability is NP-complete. In particular, polynomial-time SAT would imply P=NP.

03

Completeness transfer

To prove B NP-complete, prove B∈NP and reduce a known NP-complete language A to B with a polynomial-time membership-preserving transformation.

Notable applications

01

Optimization strategy

NP-hardness motivates approximation, parameterized algorithms, special cases, or exact exponential methods rather than a promised general polynomial-time solution.

02

Verification vs discovery

A proposed solution may be quick to check even when no efficient general discovery algorithm is known.

Work it out

Try before revealing

01 / Verify

For CLIQUE, the input is a graph and k. Describe a certificate and verifier for a yes-instance.

Hint

List the proposed vertices and check all pairs.

Solution

The certificate lists k distinct vertices. Check membership, distinctness, and the existence of all k(k−1)/2 edges. This is polynomial in the graph encoding length (reject immediately if k exceeds the vertex count).

02 / Reduce

Reduce CLIQUE to INDEPENDENT SET.

Hint

Complement the graph while keeping k.

Solution

Map (G,k) to (the complement graph of G,k). A set of k vertices has every pair joined in G exactly when it has no pair joined in the complement. Constructing the complement takes polynomial time.

Connect the ideas

Reductions & undecidabilityDynamic programming & greedy choice

Go deeper

Further reading and full-length treatments: