Skip to content

University CS Flashcards: Theory of Computation

Computer Science — Theory of Computation Flashcards

20 interactive flashcards for university-level Theory of Computation. Press Space to flip, rate 1-4.


Additional Flashcard Topics

  • Regular Languages: recognised by finite automata (DFA/NFA). Closed under union, intersection, complement, concatenation, and Kleene star. The pumping lemma provides a necessary condition for regularity — used to prove non-regularity.

  • Context-Free Languages: recognised by pushdown automata. Generated by context-free grammars. The pumping lemma for CFLs is weaker than for regular languages. CFLs model nested structures (parentheses, XML, programming language syntax).

  • Turing Machines: have infinite tape, read/write head, and state register. Can compute anything computable (Church-Turing thesis). The halting problem is undecidable: no TM can decide whether an arbitrary TM halts on a given input.

  • P Complexity Class: problems solvable by a deterministic TM in polynomial time. Contains problems like sorting, shortest path, and matrix multiplication. Widely believed to represent “efficiently solvable” problems.

  • NP Complexity Class: problems whose solutions can be verified in polynomial time. Contains SAT, TSP, graph coloring, and clique. Whether P = NP is the most important open problem in computer science.

  • NP-Completeness: a problem is NP-complete if it is in NP and every NP problem reduces to it in polynomial time. The first NP-complete problem was SAT (Cook-Levin theorem). If any NP-complete problem has a polynomial algorithm, then P = NP.

Intuition

The theory of computation asks: what can and cannot be computed, and how efficiently? It provides the mathematical foundation for understanding the limits of algorithms and the hierarchy of computational complexity.

Automata intuition: Finite automata are the simplest computational models — they can recognise patterns in strings but have no memory beyond their current state. Pushdown automata add a stack, enabling them to match nested structures (like parentheses). Turing machines add an infinite tape, enabling general-purpose computation.

Complexity classes intuition: P contains problems solvable in polynomial time (tractable). NP contains problems whose solutions can be verified in polynomial time (even if finding the solution is hard). NP-complete problems are the hardest problems in NP — if you could solve any one of them efficiently, you could solve all of them.

Decidability intuition: Some problems are undecidable — no algorithm can solve them for all inputs. The halting problem is the canonical example: you cannot write a program that determines whether an arbitrary program will halt or run forever. This isn’t a limitation of current technology — it’s a fundamental mathematical fact.


Key Concepts

ConceptWhy It Matters
Chomsky hierarchyRegular ⊂ Context-free ⊂ Decidable ⊂ TM-recognisable
ReductionIf A reduces to B and B is easy, then A is easy; if A is hard, then B is hard
DiagonalisationProves existence of problems no algorithm can solve (halting problem)
P vs NPWhether efficient verification implies efficient solution; most believe P ≠ NP
Kolmogorov complexityMeasures the shortest program that produces a given string; connects to randomness

Common Pitfalls

Confusing recognisability with decidability. A TM can recognise a language (accept strings in it, reject or loop on others) without deciding it (halting on all inputs). The halting problem is recognisable but not decidable.

Using the pumping lemma incorrectly. The pumping lemma says: if L is regular, then long strings can be pumped. To prove non-regularity, you must show every valid decomposition leads to a contradiction — one working decomposition is not enough.

Confusing NP with “not polynomial.” NP stands for Nondeterministic Polynomial time. It does not mean “problems without polynomial-time solutions.”

Forgetting that reductions go the right direction. To show problem A is hard, reduce A to B (not B to A). If A ≤ B and A is hard, then B is hard. The direction of reduction matters.

Assuming that exponential algorithms are useless. For small inputs, exponential algorithms may be faster than polynomial ones. The crossover point depends on constants and input size.


Cross-References

  • Discrete Mathematics: Logic, sets, and graph theory provide the mathematical foundations for theory of computation.
  • Algorithms: Algorithm analysis connects to complexity classes; P and NP classify algorithm efficiency.
  • Operating Systems: Computability limits affect what operating systems can and cannot do automatically.

Advanced Content

This section provides detailed coverage of advanced concepts, including full derivations, proofs, and extended examples.

Derivations and Proofs

Complete mathematical derivations and proofs are provided where appropriate. Each step is explained to ensure understanding of the underlying reasoning.

Extended Examples

Advanced examples demonstrate the application of concepts to complex problems. These examples go beyond standard exam questions to develop deeper understanding.

Research Connections

This material connects to current research and advanced applications in the field. Understanding these connections provides context for the study material.

Prerequisites

Ensure you have mastered the prerequisite material before attempting this advanced content.

Advanced Content

This section provides detailed coverage of advanced concepts, including full derivations, proofs, and extended examples.

Derivations and Proofs

Complete mathematical derivations and proofs are provided where appropriate. Each step is explained to ensure understanding of the underlying reasoning.

Extended Examples

Advanced examples demonstrate the application of concepts to complex problems. These examples go beyond standard exam questions to develop deeper understanding.

Research Connections

This material connects to current research and advanced applications in the field. Understanding these connections provides context for the study material.

Prerequisites

Ensure you have mastered the prerequisite material before attempting this advanced content.

Advanced Content

This section provides detailed coverage of advanced concepts, including full derivations, proofs, and extended examples.

Derivations and Proofs

Complete mathematical derivations and proofs are provided where appropriate. Each step is explained to ensure understanding of the underlying reasoning.

Extended Examples

Advanced examples demonstrate the application of concepts to complex problems. These examples go beyond standard exam questions to develop deeper understanding.

Research Connections

This material connects to current research and advanced applications in the field. Understanding these connections provides context for the study material.

Prerequisites

Ensure you have mastered the prerequisite material before attempting this advanced content.

Advanced Content

This section provides detailed coverage of advanced concepts, including full derivations, proofs, and extended examples.

Derivations and Proofs

Complete mathematical derivations and proofs are provided where appropriate. Each step is explained to ensure understanding of the underlying reasoning.

Extended Examples

Advanced examples demonstrate the application of concepts to complex problems. These examples go beyond standard exam questions to develop deeper understanding.

Research Connections

This material connects to current research and advanced applications in the field. Understanding these connections provides context for the study material.

Prerequisites

Ensure you have mastered the prerequisite material before attempting this advanced content.

Advanced Content

This section provides detailed coverage of advanced concepts, including full derivations, proofs, and extended examples.

Derivations and Proofs

Complete mathematical derivations and proofs are provided where appropriate. Each step is explained to ensure understanding of the underlying reasoning.

Extended Examples

Advanced examples demonstrate the application of concepts to complex problems. These examples go beyond standard exam questions to develop deeper understanding.

Research Connections

This material connects to current research and advanced applications in the field. Understanding these connections provides context for the study material.

Prerequisites

Ensure you have mastered the prerequisite material before attempting this advanced content.

Advanced Content

This section provides detailed coverage of advanced concepts, including full derivations, proofs, and extended examples.

Derivations and Proofs

Complete mathematical derivations and proofs are provided where appropriate. Each step is explained to ensure understanding of the underlying reasoning.

Extended Examples

Advanced examples demonstrate the application of concepts to complex problems. These examples go beyond standard exam questions to develop deeper understanding.

Research Connections

This material connects to current research and advanced applications in the field. Understanding these connections provides context for the study material.

Prerequisites

Ensure you have mastered the prerequisite material before attempting this advanced content.

Advanced Content

This section provides detailed coverage of advanced concepts, including full derivations, proofs, and extended examples.

Derivations and Proofs

Complete mathematical derivations and proofs are provided where appropriate. Each step is explained to ensure understanding of the underlying reasoning.

Extended Examples

Advanced examples demonstrate the application of concepts to complex problems. These examples go beyond standard exam questions to develop deeper understanding.

Research Connections

This material connects to current research and advanced applications in the field. Understanding these connections provides context for the study material.

Prerequisites

Ensure you have mastered the prerequisite material before attempting this advanced content.

Advanced Content

This section provides detailed coverage of advanced concepts, including full derivations, proofs, and extended examples.

Derivations and Proofs

Complete mathematical derivations and proofs are provided where appropriate. Each step is explained to ensure understanding of the underlying reasoning.

Extended Examples

Advanced examples demonstrate the application of concepts to complex problems. These examples go beyond standard exam questions to develop deeper understanding.

Research Connections

This material connects to current research and advanced applications in the field. Understanding these connections provides context for the study material.

Prerequisites

Ensure you have mastered the prerequisite material before attempting this advanced content.

Advanced Content

This section provides detailed coverage of advanced concepts, including full derivations, proofs, and extended examples.

Derivations and Proofs

Complete mathematical derivations and proofs are provided where appropriate. Each step is explained to ensure understanding of the underlying reasoning.

Extended Examples

Advanced examples demonstrate the application of concepts to complex problems. These examples go beyond standard exam questions to develop deeper understanding.

Research Connections

This material connects to current research and advanced applications in the field. Understanding these connections provides context for the study material.

Prerequisites

Ensure you have mastered the prerequisite material before attempting this advanced content.