CSC 392 · Automata Theory, Computability and Formal Languages
Our notes
2 min readAlphabets and strings
- An alphabet Σ is a finite set of symbols: {0, 1}, {a, b}, the ASCII characters.
- A string is a finite sequence of symbols: 0110, abba.
- The empty string ε has length 0.
- |w| is the length: |abba| = 4.
- Σ* is the set of all strings over Σ (including ε); Σ⁺ excludes ε.
Operations on strings
- Concatenation: x = ab, y = ba, xy = abba.
- Power: a³ = aaa; w⁰ = ε.
- Reverse: (abc)ᴿ = cba. A palindrome equals its reverse (abba, racecar).
- Prefix, suffix, substring: of abc the prefixes are ε, a, ab, abc.
Languages
A language is any set of strings over an alphabet:
- L₁ = {ε, a, aa, aaa, ...} (all strings of a's) = {aⁿ : n ≥ 0}.
- L₂ = {strings over {0, 1} with an even number of 1s}.
- L₃ = {aⁿbⁿ : n ≥ 0} = {ε, ab, aabb, ...}.
- The set of all valid Pascal programs is a (very large) language over the ASCII alphabet.
Operations on languages
- Union L ∪ M, intersection L ∩ M, complement Σ* − L.
- Concatenation: LM = {xy : x in L, y in M}. If L = {a, b} and M = {c, dd}, LM = {ac, add, bc, bdd}.
- Kleene star: L* = all concatenations of zero or more strings from L. {ab}* = {ε, ab, abab, ...}.
Counting strings
Over an alphabet of k symbols there are kⁿ strings of length n. Over {0, 1}: 2³ = 8 strings of length 3, and 1 + 2 + 4 + 8 = 15 strings of length at most 3.
Problems as languages
A yes/no problem becomes a language: "is this number prime?" is the language {binary strings of primes}. Asking whether a machine can recognise that language is asking whether it can solve the problem. This is how the theory turns questions about computation into questions about languages.
Proof methods used in this course
Induction (on string length), contradiction (the pumping lemma, the halting problem) and construction (build an automaton to show a language is regular).
Exams usually ask
- Define alphabet, string, empty string, language and Kleene star.
- Perform concatenation, reversal and star on given strings and languages.
- Count strings of a given length.
Common mistake
Confusing the empty string ε with the empty language ∅. {ε} contains one string (of length 0); ∅ contains no strings at all.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
No reading links here yet
Our team adds free books, videos and practice for each topic, and opens every link before it goes up.