Theory of Computation - Week 5 Notes
Theory of Computation - Week 5 Notes
Announcements
- Assignment 1 Deadline: 30/03/2025 (Sunday) by 23:59
- Midterm Exam: 29/04/2025 (Week 8)
- Venue: MS202 STHG01 (Regular lecture venue)
- Time: 14:00 - 15:00
- Lecture Continues: 15:00 - 16:00
- Content Covered: References from Lectures 2 to 5 and Tutorials 1 to 4.
Weekly Topics Breakdown
- Week 1: Background knowledge revision (logic, sets, proof techniques)
- Week 2: Languages, strings, hierarchies, computation, closure properties
- Week 3: Finite State Machines - non-determinism vs. determinism
- Week 4: Regular languages - expressions and grammars
- Week 5: Non-regular languages - pumping lemma, closure properties
- Week 6: Context-free languages - grammars, parse trees
- Week 7: Pushdown automata
- Week 8: Non context-free languages - pumping lemma and decidability, closure properties
- Week 9: Decidable languages - Turing Machines
- Week 10: Church-Turing thesis and the unsolvability of the Halting Problem
- Week 11: Decidable, semi-decidable, and undecidable languages (and proofs)
- Week 12: Review of the hierarchy, safety-critical systems
- Week 13: Extra revision (if needed)
Key Concepts from Last Week (Week 4)
Regular Expressions (REs): Define patterns for regular languages.
- For every RE, there exists an equivalent Finite State Machine (FSM).
A language is regular if it can be defined with a regular expression.
A regular grammar G is defined as a quadruple (V, Σ, R, S).
- Where:
- V = variables
- Σ = terminal symbols
- R = production rules
- S = start symbol
For any Deterministic Finite State Machine (DFSM) M, there exists an algorithm
fsmtoregexthat constructs a regular expression recognizing L(M).For any grammar G, an algorithm
grammartofsmcan construct an FSM that accepts L(G).The class of languages defined by regular grammars, regular expressions, and FSMs is precisely the regular languages.
Week 5 Lecture Outline
- Non-Regular Languages: Exploring the pumping lemma and closure properties.
- Number of Regular and Non-Regular Languages.
- How to Prove a Language L is Regular or Non-Regular.
- Closure Properties of Regular Languages:
- Union
- Concatenation
- Kleene star
- Complement
- Intersection
- Difference
- Reverse
- Letter substitution
Key Theorems and Proofs
Theorem: There is a countably infinite number of regular languages.
- Proof:
- Upper Bound: We can lexicographically enumerate all syntactically legal DFSMs or regular expressions.
- There are countably infinite DFSMs, therefore countably infinite regular languages.
- Lower Bound: Regular sets like {a}, {aa}, {aaa}, etc. show countable infinity as well.
Theorem: Every finite language is regular.
- Proof: Finite languages defined by regular expressions like
s1 ∪ s2 ∪ ... ∪ snare regular.
- Proof: Finite languages defined by regular expressions like
Showing That L is Regular: Options include:
- Show L is finite.
- Exhibit an FSM for L.
- Exhibit a regular expression for L.
- Show that the number of equivalence classes of
≈Lis finite. - Exhibit a regular grammar for L.
- Exploit closure theorems.
Closure Properties of Regular Languages
- Union: If L1, L2 are regular, then L1 ∪ L2 is regular.
- Concatenation: If L1, L2 are regular, then L = L1L2 is regular.
- Kleene Star: If L1 is regular, then L1* is regular.
- Complement: If L is regular, then ¬L is regular.
- Intersection: If L1, L2 are regular, then L1 ∩ L2 is regular.
- Difference: L1 - L2 = L1 ∩ ¬L2 is regular.
- Reverse: The reverse of a regular language is regular.
- Letter Substitution: If a letter substitution function where each letter is mapped to a string, then the resulting language from the substitution is regular if the original is.
The Pumping Lemma
- If a language L is regular, then there exists a pumping length
ksuch that any stringwin L with length ≥ k can be divided intoxyzwhere:|xy| ≤ k|y| > 0xy^iz ∈ Lfor alli ≥ 0(pumping property).
- To use the pumping lemma in proof, one must demonstrate a long string that cannot satisfy the pumping conditions, indicating that L is not regular.
Example of Non-Regular Language
- Language L = {a^nb^n: n ≥ 0} must satisfy the conditions of the Pumping Theorem.
- Choosing
w = a^k b^kshows that for any possible division ofwintoxyz, one of the pumped results will not belong to L.
Final Notes
- The Pumping Theorem is crucial in proving that certain languages are not regular through contradiction.
- Effective strategies for using the theorem include narrowing the choice of
wappropriately and considering all cases forysubstitution.