Definition
A language is regular if it is recognized by:
- A DFA, or equivalently
- An NFA, or equivalently
- A regular expression
Closure Properties
Regular languages are closed under these operations:
Boolean Operations
| Operation | If regular | Result |
|---|---|---|
| Union | Regular | |
| Intersection | Regular | |
| Complement | Regular | |
| Difference | Regular |
Construction Methods
Union: NFA with -transitions to both machines.
Intersection: Product construction DFA. Accept if both components accept.
Complement: Swap accept and non-accept states in DFA. (Must be complete DFA — every state has transitions for all symbols.)
String Operations
| Operation | Result |
|---|---|
| Concatenation | Regular |
| Kleene star | Regular |
| Reversal | Regular |
| Homomorphism | Regular |
| Inverse homomorphism | Regular |
Pumping Lemma
Statement
If is regular, then there exists (pumping length) such that:
For any string with , we can write where:
- (y is non-empty)
- For all :
Using the Pumping Lemma
To prove is not regular:
- Assume is regular with pumping length
- Choose a string with
- For any valid division , show pumping fails
- Contradiction → is not regular
Example: is not regular
Proof:
- Assume is regular with pumping length
- Choose (clearly in )
- Any division with has for some
- Pump up: (unequal a's and b's)
- Contradiction! is not regular.
Common Non-Regular Languages
| Language | Why not regular |
|---|---|
| Can't count to match | |
| Can't remember first half | |
| Can't count squares | |
| Primes not periodic |
Myhill-Nerode Theorem
Distinguishability
Strings and are distinguishable by if:
Equivalence Relation
Define iff and are indistinguishable.
This is an equivalence relation with equivalence classes.
Theorem
is regular if and only if has finitely many equivalence classes.
Moreover, the number of classes equals the number of states in the minimal DFA.
Application: Proving Non-Regularity
Find infinitely many pairwise distinguishable strings.
Example: For :
- Strings are pairwise distinguishable
- and distinguished by (if )
- Infinitely many classes → not regular
Decision Problems
Decidable for Regular Languages
| Problem | Question | Complexity |
|---|---|---|
| Membership | Is ? | $O( |
| Emptiness | Is ? | $O( |
| Finiteness | Is finite? | $O( |
| Equivalence | Is ? | |
| Inclusion | Is ? | PSPACE-complete |
Emptiness Test
Check if any accept state is reachable from start state.
Equivalence Test
Minimize both DFAs and check isomorphism.
Regular vs. Non-Regular
Regular: Can be Recognized With
- Finite memory (constant)
- No stack
- No counting beyond a constant
Non-Regular: Requires
- Unbounded memory
- Counting
- Matching/balancing
- Remembering arbitrary patterns
Hierarchy
Regular languages are the simplest class in the Chomsky hierarchy.