2.1 Regular Expressions
A regular expression is a formula of a special kind. Regular expressions provide
a notation for regular languages. We can declare them in BNF (Backus-Naur
form).
We define the class of regular expressions over an alphabet Σ recursively as
follows.
- Any element of Σ standing by itself is a regular expression;
- If A is a regular expressions, so is A*;
- If A and B are regular expressions, so is AB;
- If A and B are regular expressions, so is A|B.
For example, for any character a, a* is a regular expression.
The idea then is that regular expressions built up in this way from characters
in an alphabet Σ will somehow point to regular languages ⊆ Σ* . Now we are
going to recall the L() notation, where L(ℳ) is the
language recognised by ℳ, and overload it to notate a way of getting languages
from regular expressions. We do this by recursion using the clauses above.
- If a is a character from Σ (and thus by clause 1, a regular expression) then
L(a) = {a}.
- L(A|B) = L(A) ∪ L(B).
- L(AB) = L(A)L(B). This looks a bit cryptic, but actually makes perfect
sense. L(A) and L(B) are languages. If K1 and K2 are languages, you already
know what K1K2 from before, so you know what L(A)L(B) is!
L(A*) is the set L(A) ∪ L(AA) ∪ L(AAA) . . . = ⋃n∊ ℕ An. An is naturally
AAAA . . . A (n times).
Next: 2.1.1 More about bombs
Back: 2 Operations on machines and languages