Theory of Computation · Basics: Alphabets, Strings and Languages
Definition of Computation and Modeling Machines
Overview
Theory of Computation (TOC) studies computation by building a mathematical model of a computer or machine and then analyzing what that model can and cannot do.
The subject is built bottom-up from the most basic object, the symbol, which is collected into an alphabet on which all later objects (strings, languages) are defined.
Key concepts
- Theory of Computation (TOC): T = Theory, O = of, C = Computation; the subject is "the theory of computation".
- Computation: any task that can be performed by a calculator or a computer.
- Goal of the subject: to mathematically model a computer (or any machine in general), and then study the theory about that model — its capabilities, the problems it can solve, and its limitations.
- Symbol: the basic building block of TOC. A symbol can be any letter (like a, b, ...) or anything at all — even a picture can be a symbol.
- Alphabet: a collection of symbols, generally represented by (sigma); is also called the alphabet. An alphabet can have any number of symbols in it.
- Predefined alphabet: once the alphabet is defined, all strings are based on this predefined set.
How it works
- Start from the idea of computation: any task a calculator or computer can do.
- To study computation rigorously, build a mathematical model of a machine, then ask what its capabilities are, what problems it can solve, and what its limitations are.
- Build the model from the bottom up: the most basic object is the symbol (any letter or mark).
- Collect symbols into a set — this set is the alphabet . Everything studied afterwards (strings, languages) is defined relative to this fixed, predefined alphabet.
- The alphabet may contain any number of symbols; the choice of alphabet is free.
Formulas
- — example alphabet: the set whose elements are the symbols and ; all strings are then based on this predefined set.
Revision summary
- Computation = any task performable by a calculator or computer.
- TOC = mathematical modeling of a computer/machine plus the study of its capabilities, solvable problems, and limitations.
- Hierarchy of basics: symbol → alphabet () → strings, built over the alphabet.
- A symbol is the basic building block; it can be any letter or even a picture.
- An alphabet is a collection of symbols and can contain any number of symbols.
- All strings are defined with respect to a predefined alphabet.
Previous-year exam insights
- An alphabet is a finite, non-empty set of symbols; the empty set is not a valid alphabet, and the alphabet of a language is fixed once the language is defined.
- A string is a finite sequence of symbols from the alphabet; the empty string is denoted ε (or λ), has length 0, and is a string over every alphabet.
- The length of a string w is written |w|; the number of occurrences of a symbol a in w is written #a(w) or na(w), and the sum of these counts over all symbols of the alphabet equals |w|.
- Σ* is the set of all finite strings over Σ (including ε) and is countably infinite; Σ+ = Σ* − {ε}. For an alphabet of size k, the number of strings of length exactly n is , and the number of strings of length at most n is + … + .
- A language over Σ is any subset of Σ*; it may be finite or infinite, and the empty language ∅ and {ε} are different languages (∅ has no strings, {ε} has one string of length 0).
- Standard string operations to memorise: concatenation (|xy| = |x| + |y|, εw = wε = w), reversal , and prefix/suffix/substring relations;
a string is a prefix or suffix of itself, and ε is a prefix and suffix of every string.