Unit 4 of 4 · M.Sc IT Sem 4

Unit 4: Unsolvability and complexity

Theory of Computation notes · PTU syllabus (PGCA1927)

3 min read6 topics10 exam questions
On this page
  1. Unit summary
  2. Unsolvable problems
  3. The halting problem
  4. Post's correspondence problem
  5. Unsolvable problems for context-free languages
  6. Measuring and classifying complexity
  7. Tractable and intractable problems
  8. Key terms
  9. Quick revision
  10. Important questions

Unit summary

Some problems cannot be solved by any algorithm, and many solvable ones are too costly. This unit covers unsolvable problems, the halting problem, Post's correspondence problem, unsolvable problems for context-free languages, measuring and classifying complexity, and tractable and intractable problems.

After this unit you can

  • Prove the halting problem undecidable
  • Explain Post's correspondence problem and reductions
  • Identify undecidable problems about CFLs
  • Classify problems by complexity: P, NP, NP-complete

PTU syllabus topics

  • Unsolvable problems
  • the halting problem
  • Post correspondence problem
  • unsolvable problems for context-free languages
  • measuring and classifying complexity
  • tractable and intractable problems
ComparisonDecidability and complexity classes
Meaning
Example

Decidable

A TM always halts with yes or no

Is a string in a regular language?

Undecidable

No algorithm exists

Halting problem, Post correspondence

P

Solvable in polynomial time

Sorting, shortest path

NP-complete

Hardest problems in NP

SAT, travelling salesman (decision)

1

Topic 1

Unsolvable problems

  • A problem is decidable if some TM always halts with the correct yes or no answer; otherwise it is undecidable. Reduction: if A reduces to B and A is undecidable, then B is undecidable.
2

Topic 2

The halting problem

ProcessProof that halting is undecidable
  1. 1Assume a TM H decides whether M halts on w
  2. 2Build D: on input M, run H on (M, M); if H says "halts", loop forever; otherwise halt
  3. 3Run D on its own description
  4. 4If D halts, H said it does not halt; if D loops, H said it halts
  5. 5Contradiction — so H cannot exist
  • Rice's theorem: every non-trivial property of the language recognised by a TM is undecidable (e.g., "does M accept any string?").
3

Topic 3

Post's correspondence problem

  • PCP: given pairs of strings (x1, y1), …, (xn, yn), is there a sequence of indices i1 … ik with xi1 … xik = yi1 … yik? PCP is undecidable and is used to prove other problems undecidable.

Example

Pairs (a, ab), (bb, b): choose 1 then 2 → top "a" + "bb" = "abb", bottom "ab" + "b" = "abb" — a solution.

4

Topic 4

Unsolvable problems for context-free languages

Key termsUndecidable questions about CFGs
Ambiguity
Is a given CFG ambiguous?
Equivalence
Do two CFGs generate the same language?
Universality
Does a CFG generate all of Σ∗?
Intersection emptiness
Is the intersection of two CFLs empty?
Regularity
Is a CFL regular?
  • Decidable questions: emptiness, finiteness and membership of a CFL.
5

Topic 5

Measuring and classifying complexity

  • Time complexity of a TM: the maximum number of steps on inputs of length n; space complexity: the maximum tape cells used. Expressed with big-O notation.
ComparisonComplexity classes
Definition
Examples

P

Decidable in polynomial time by a deterministic TM

Sorting, shortest paths, primality testing

NP

Solutions verifiable in polynomial time (decidable by a non-deterministic TM in polynomial time)

SAT, Hamiltonian cycle, subset sum

NP-complete

In NP and every NP problem reduces to it in polynomial time

SAT (Cook–Levin), 3-SAT, vertex cover, travelling salesperson (decision)

NP-hard

At least as hard as NP-complete problems; need not be in NP

Optimisation TSP, halting problem

  • P versus NP is the central open question: if any NP-complete problem has a polynomial algorithm, then P = NP.
6

Topic 6

Tractable and intractable problems

  • Tractable: solvable in polynomial time — practical for large inputs. Intractable: no known polynomial algorithm (exponential growth) — e.g., 2ⁿ steps for n = 100 is beyond any computer.
  • Coping with intractability: approximation algorithms, heuristics and metaheuristics, special cases, randomised algorithms, and exact methods for small inputs (branch and bound).

Key terms

Undecidable problem
Problem with no algorithm that always halts with the answer
Halting problem
Deciding whether a program halts on an input
Reduction
Transforming one problem into another
NP-complete
Hardest problems in NP
Tractable problem
Problem solvable in polynomial time

Quick revision

  • Decidable vs undecidable; reductions; Rice's theorem.
  • Halting problem proof by diagonalisation.
  • PCP and its use.
  • Undecidable CFG questions: ambiguity, equivalence, universality.
  • Time and space complexity; P, NP, NP-complete, NP-hard; P vs NP; tractable vs intractable.

Important exam questions

Practice questions written to the PTU exam pattern for this unit's syllabus: short answers (Section A style) and long answers (Sections B and C style).

Short-answer questions

  1. Q1.What is an undecidable problem?
  2. Q2.State the halting problem.
  3. Q3.What is Post's correspondence problem?
  4. Q4.Name two undecidable problems about CFGs.
  5. Q5.Define the class NP.
  6. Q6.What does NP-complete mean?

Long-answer questions

  1. Q1.Prove that the halting problem is undecidable.
  2. Q2.Explain Post's correspondence problem with an example.
  3. Q3.Explain unsolvable problems for context-free languages.
  4. Q4.Explain P, NP, NP-complete and NP-hard problems.

Stuck on this unit?

Message SBS on WhatsApp for help with Theory of Computation, or to ask about studying M.Sc IT at Synetic.

WhatsApp us