Introduction
1.1 Why Theory Matters
The theory of computation provides the mathematical foundations for computer science. It answers Fundamental questions: What can be computed? What cannot? How efficiently? These answers guide the Design of algorithms, programming languages, compilers, and hardware.
1.2 Alphabets, Strings, and Languages
An alphabet is a finite, non-empty set of symbols (e.g., ).
A string (or word) over is a finite sequence of symbols from . The empty string Is denoted .
Notation:
- : The set of all strings over (including ).
- : The set of all non-empty strings over .
- : The length of string . .
- : The reversal of .
- : Strings of length over .
A language over is any subset of . The empty language is (distinct from Which contains one string).
Operations on languages:
- Union: .
- Intersection: .
- Concatenation: .
- Kleene star: .
- Complement: .
1.3 Examples of Formal Languages
Formal languages arise throughout computer science. Here are representative examples Organised by complexity class.
Finite languages (always regular):
- — the set of Boolean literals.
- — all binary strings of length at most 3.
Regular languages (decidable by finite automata):
- .
- .
- .
Context-free but not regular:
- — matching counts of two symbols.
- — even-length palindromes.
- — equal numbers of
aS andbS.
Decidable but not context-free:
- .
- .
Undecidable (Turing-recognisable):
- — the acceptance problem.
- \mathrm{HALT_}{\mathrm{TM} = \{\langle M, w \rangle : M \mathrm{ halts} on w\}}.
Not even Turing-recognisable:
- — the complement of the acceptance problem.
This hierarchy illustrates the central theme of the course: as we move to more expressive language Classes, the corresponding machines become more powerful, but certain properties (decidability, Closure under complement) may be lost.
1.4 Countability and Cardinality
An important foundational observation is that the set of all languages over is uncountable, while the set of all Turing machines (and hence the set of all decidable Languages) is countable.
Theorem 1.1. The set of all languages over a non-empty alphabet is uncountable.
Proof. The set is countable (enumerate strings by length, then lexicographically). The set of all languages is Which is uncountable by Cantor”s theorem (since for any set ).
Theorem 1.2. The set of all Turing machines is countable.
Proof. Each TM has a finite description (its states, alphabet, and transition function). Encode This as a string over a finite alphabet. The set of all finite strings is countable.
Corollary 1.3. There exist languages that are not Turing-recognisable (in fact, uncountably Many such languages).
This follows because there are uncountably many languages but only countably many TMs. The set Of Turing-recognisable languages is a countable subset of the uncountable set of all languages.
Cantor’s diagonalisation. The classic …/1-number-and-algebra/3*proof-and-logic of Theorem 1.1 uses diagonalisation: assume the Set of all languages is countable, list them as And construct a language that differs from each on the -th string. Then is not in the list — contradiction. This technique reappears in the …/1-number-and-algebra/3_proof-and-logic of undecidability of (Section 5.2).