Decidability

7 min read Last updated Wed Jun 10 2026 04:52:55 GMT+0000 (Coordinated Universal Time)

Whether a problem is solvable by an algorithm.

Decidable Problem

A problem is decidable iff a TM decider exists that halts with correct yes/no for every input.

A problem is undecidable iff no such TM exists.

Connected Graph Example

A={GG is a connected undirected graph}A = \{\langle G \rangle \mid G \text{ is a connected undirected graph}\}

TT marks the first node, then marks any node adjacent to a marked node. Accepts if all nodes are marked; rejects otherwise. Always halts. AA is decidable.

Why Undecidable Problems Exist

TMs can be encoded as strings. The set of all TMs is countable.

All languages over Σ\Sigma^* form the power set P(Σ)\mathcal{P}(\Sigma^*), which is uncountable and strictly larger than the set of TMs.

Since there are more languages than TMs, most languages have no TM that accepts them.

Cardinality

Cardinality measures the size of a set. 2 sets have equal cardinality iff a bijection exists between them.

  • Injective
    No 2 elements in XX map to the same element in YY.
  • Surjective
    Every yYy \in Y has a preimage in XX.
  • Bijective
    Both injective and surjective. Exact pairing between 2 sets.

Diagonalization

Technique for showing 2 sets have unequal cardinality by proving no bijection can exist.

Applied to R\mathbb{R}: assume a complete listing of all reals. Construct a number differing from the nn-th real at the nn-th decimal digit. That number is not in the listing. Contradiction. R\mathbb{R} is uncountable.

Applied to languages: any enumeration of TMs leaves languages unaccounted for. Some languages have no TM.

Language Hierarchy

Nested hierarchy (innermost \subset outermost):

Regular
  ⊂ Context-free
      ⊂ Decidable  (aka Recursive)
          ⊂ Turing-acceptable  (aka RE, Recursively Enumerable)
              ⊂ Universe of all languages
  • Decidable
    TM decider exists. Always halts with accept/reject.
  • Turing-acceptable
    TM acceptor exists. May loop forever on non-members.
  • Outside RE
    No TM accepts these languages at all.

Reduction

Reduction converts instances of one problem into instances of another. L1L2L_1 \leq L_2 (”L1L_1 reduces to L2L_2”) means L2L_2 is at least as hard as L1L_1.

L1L2L_1 \leq L_2 iff a Turing-computable f:Σ1Σ2f : \Sigma_1^* \to \Sigma_2^* exists such that:

xL1    f(x)L2x \in L_1 \iff f(x) \in L_2

ff converts any instance of L1L_1 into an equivalent instance of L2L_2.

Consequences:

  • L2L_2 decidable \Rightarrow L1L_1 decidable.
  • L1L_1 undecidable \Rightarrow L2L_2 undecidable.

To prove L2L_2 is undecidable: find a known undecidable L1L_1 and show L1L2L_1 \leq L_2.

Undecidable Problems

Self-Accepting Problem

Given TM TT, does TT accept its own encoding T\langle T \rangle?

Undecidable. Proved by diagonalization: assume a decider exists, construct a TM that contradicts it when run on its own encoding.

Accepts Problem

Given TM TT and string ww, does TT accept ww?

Undecidable. Direct simulation fails if TT loops forever on ww.

Proved by reducing Self-Accepting to Accepts: given any TM TT, construct TT' that ignores its input and runs TT on T\langle T \rangle. If Accepts were decidable, Self-Accepting would be too. Contradiction.

Halting Problem

Given TM TT and string ww, does TT halt on input ww?

Undecidable. Proof by contradiction:

  1. Assume a halting decider QQ exists. QQ takes any TM PP and input II, outputs YES if PP halts on II, NO otherwise.
  2. Construct SS. SS takes WW, passes (W,W)(W, W) to QQ:
    • QQ outputs YES \Rightarrow SS loops forever.
    • QQ outputs NO \Rightarrow SS halts with “OK”.
  3. Run SS on itself (W=SW = S):
    • QQ outputs YES (SS halts on SS) \Rightarrow SS loops. Contradiction.
    • QQ outputs NO (SS loops on SS) \Rightarrow SS halts. Contradiction.
  4. QQ cannot exist. \square

Post Correspondence Problem

Formulated by Emile Post in 1946.

A domino is a tile [tb]\left[\frac{t}{b}\right] with top string tt and bottom string bb.

A match is a sequence of dominos (repetition allowed) where concatenating tops equals concatenating bottoms.

Determining whether a match exists is undecidable.

Hilbert’s 10th Problem

Determine whether a polynomial has an integral root.

Posed in 1900 by David Hilbert. Shown undecidable in 1970 (Matiyasevich et al.).

Single-variable case: search x=0,1,1,2,2,x = 0, 1, -1, 2, -2, \ldots terminates within computable bounds. Decidable.

Multivariable case: no computable bound exists. Turing-acceptable but undecidable.

Other Undecidable Problems

For any programming language:

  • Whether a program loops forever on some input.
  • Whether a program ever produces output.
  • Whether a program halts on a specific input.

For formal languages:

  • Equivalence of 2 context-free grammars.
  • Emptiness of a context-sensitive language.
  • Membership of a string in a Type-0 language.

Intractable Problems

Decidable problems can still be practically unsolvable if no efficient algorithm exists.

A tractable problem has worst-case complexity O(nk)O(n^k) for fixed kk.

An intractable problem has no known polynomial algorithm. Best-known algorithms are exponential.

Class P

PP is the class of decision problems solvable by a deterministic algorithm in polynomial time.

Finding the answer is fast.

Class NP

NPNP is the class of decision problems whose solutions are verifiable in polynomial time by a deterministic algorithm.

Finding the answer may be slow. Checking a given answer is fast.

PNPP \subseteq NP. Every problem solvable fast is also verifiable fast. Whether P=NPP = NP is open.

Equivalently: solvable by a polynomially bounded nondeterministic algorithm with 3 phases:

  • Guessing
    Writes an arbitrary string ss into memory.
  • Verifying
    Deterministic check of input and ss. Returns true or false.
  • Output
    Outputs yes iff verifying returns true.

NP Problems

  • Clique
    Given G=(V,E)G = (V,E) and integer kk, does a clique of size kk exist?
  • Graph Coloring
    Given G=(V,E)G = (V,E) and integer kk, is GG kk-colorable?
  • Subset Sum
    Given set SS of positive integers and integer kk, does a subset RSR \subseteq S exist with R=k\sum R = k?
  • Satisfiability
    Given a Boolean formula, does a {0,1}\{0,1\} assignment exist that evaluates it to 1?
    • CNF: AND of clauses; each clause is OR of literals.
    • 3-CNF-SAT: satisfiability restricted to CNF with exactly 3 literals per clause.
  • Hamiltonian Path
    Does a graph contain a path visiting every vertex exactly once?
  • Traveling Salesperson
    Given a weighted complete graph and integer kk, does a Hamiltonian cycle with total weight k\leq k exist?

NP-Completeness

NP-complete problems are the hardest problems in NP. Every other NP problem reduces to them.

SS is NP-hard iff every RNPR \in NP is polynomially reducible to SS.

SS is NP-complete iff SNPS \in NP and SS is NP-hard.

If any NP-complete problem is in PP, then P=NPP = NP.

Examples: SAT, clique, graph coloring, Hamiltonian path, subset sum, TSP.

Polynomial-time Reduction

RPSR \leq_P S iff a polynomial-time computable transformation TT exists such that:

answer for R on x=yes    answer for S on T(x)=yes\text{answer for } R \text{ on } x = \text{yes} \iff \text{answer for } S \text{ on } T(x) = \text{yes}

SS is at least as hard as RR. If RPSR \leq_P S and SPS \in P, then RPR \in P.

Proving NP-Completeness

  1. Show SNPS \in NP: give a polynomial-time verifier.
  2. Select a known NP-complete problem RR.
  3. Show RPSR \leq_P S: construct a polynomial-time transformation.
  4. By transitivity, all NP problems reduce to SS.

Historical Results

Cook’s Theorem: SAT is NP-complete.

Karp’s reductions: decision versions of many optimization problems proved NP-complete via reductions from SAT.

Was this helpful?