📘 Lecture 23 — Mealy machines in terms of sequential circuit
📖 Overview: This lecture demonstrates how a Mealy machine can be implemented using a sequential circuit composed of logic gates and a delay (flip-flop) box. It explains the step-by-step process of determining state transitions and outputs based on the circuit’s logical relationships, providing a concrete example with a transition table and diagram.
🗂️ Topics Covered
The lecture covers the components of a sequential circuit (NAND, DELAY, OR, AND boxes), the definition of four states based on current at points A and B, the transition rules for new A, new B, and output, and the construction of a transition table and diagram for the Mealy machine. It also includes an example of running a string through the machine to determine the output sequence.
📝 Lecture Summary
Example
The lecture presents a sequential circuit containing four types of boxes:
- NAND box (NOT AND): Provides the complement of the Boolean AND output for the given input.
- DELAY box (Flip Flop box): Delays the transmission of the signal along the wire by one step (clock pulse).
- OR box: Provides the Boolean OR output for the given input.
- AND box: Provides the Boolean AND output for the given input.
Current in the wire is indicated by 1, and 0 indicates the absence of current.
There are two points A and B with respect to which the following four states of the machine are identified according to the presence and absence of current at these points:
- q₀ (A=0, B=0) ≡ (0,0)
- q₁ (A=0, B=1) ≡ (0,1)
- q₂ (A=1, B=0) ≡ (1,0)
- q₃ (A=1, B=1) ≡ (1,1)
The operation of the circuit is such that the machine changes its state after reading 0 or 1. The transitions are determined using the following relations:
- new B = old A
- new A = (input) NAND (old A AND old B)
- output = (input) OR (old B)
🔑 Definition — old A and old B: These indicate the presence or absence of current at A and B before inputting any letter. Similarly, new A and new B indicate the presence or absence of current after reading a certain letter.
At various discrete pulses of a time clock, input is received by the machine and the corresponding output string is generated.
📌 Example: The transition at state q₀ after reading the letter 0 can be determined as follows:
- new B = old A = 0
- new A = (input) NAND (old A AND old B) = 0 NAND (0 AND 0) = 0 NAND 0 = 1
- output = (input) OR (old B) = 0 OR 0 = 0
Thus, after reading 0 at q₀, new B is 0 and new A is 1, so the machine moves to state (1,0) ≡ q₂, and during this process its output character is 0.
The remaining actions of this sequential circuit are shown in the following transition table of the corresponding Mealy machine:
| Old State | Inputting 0 | Inputting 1 |
|---|---|---|
| State | Output | |
| q₀ ≡ (0,0) | (1,0) ≡ q₂ | 0 |
| q₁ ≡ (0,1) | (1,0) ≡ q₂ | 1 |
| q₂ ≡ (1,0) | (1,1) ≡ q₃ | 0 |
| q₃ ≡ (1,1) | (1,1) ≡ q₃ | 1 |
💡 Why this matters: The transition table directly maps the sequential circuit’s behavior into a formal Mealy machine representation, which is essential for designing and analyzing digital systems.
The corresponding transition diagram is derived from the table (as shown in the lecture text).
📌 Example: Running the string 01101110 on the machine starting from state q₀ yields the following output sequence:
| Input | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| States | q₀ | q₂ | q₃ | q₁ | q₂ | q₃ | q₁ | q₂ |
| Output | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
🔑 Definition — Note: It may be noted that if the string 00 is read at any state, it results in ending in state q₃.
Note
It is to be noted that in this sequential circuit, the delay box plays an important role in introducing four states of the machine.
⭐ Key Takeaways
The four states of the machine (q₀ through q₃) are defined by the current at points A and B, which represent the outputs of the logic gates in the sequential circuit. The transition rules (new B = old A, new A = input NAND (old A AND old B), output = input OR old B) determine state changes and output for each input. The delay box is crucial as it introduces memory, creating the four distinct states. The transition table and diagram provide a complete Mealy machine representation of this circuit. Running a test string through the machine demonstrates how input sequences produce specific output sequences.
🧠 Quick Revision Questions
- What are the four types of boxes used in the sequential circuit, and what is the function of each?
- How are the four states (q₀, q₁, q₂, q₃) defined in terms of points A and B?
- Write down the three relations used to determine new B, new A, and output for a given input.
- What happens to the machine’s state and output when reading 0 at state q₀?
- If the string 00 is read at any state, which state does the machine end in?
📘 Lecture 24 — Regular Languages, Complement, and Intersection
📖 Overview: This lecture explores properties of regular languages, focusing on the closure properties under union, concatenation, and Kleene star, as well as proving that the complement and intersection of regular languages are also regular. It provides constructive proofs using regular expressions and TGs (Kleene’s theorem), which are essential for understanding language operations in automata theory.
🗂️ Topics Covered
Regular languages and their closure under union, concatenation, and Kleene star are reviewed. The complement of a language is defined, and a theorem proving that the complement of a regular language is regular is presented with an example using FA construction. Finally, the theorem that the intersection of two regular languages is regular is proved using De Morgan’s law and the complement closure property.
📝 Lecture Summary
Regular languages
As discussed earlier, any language that can be expressed by a RE is said to be a regular language. So if L₁ and L₂ are regular languages, then L₁ + L₂, L₁L₂, and L₁* are also regular languages. This fact can be proved by the following two methods.
🔑 Definition — Regular Language: Any language that can be expressed by a Regular Expression (RE) is called a regular language.
By Regular Expressions As discussed earlier, if r₁, r₂ are regular expressions corresponding to the languages L₁ and L₂, then the languages L₁ + L₂, L₁L₂, and L₁* generated by r₁ + r₂, r₁r₂, and r₁* are also regular languages.
By TGs (Transition Graphs) If L₁ and L₂ are regular languages, then L₁ and L₂ can also be expressed by some REs and hence, using Kleene’s theorem, L₁ and L₂ can also be expressed by some TGs.
- If L₁ and L₂ are expressed by TG₁ and TG₂, then a TG accepting L₁ + L₂ can be constructed by adding a new start state with λ-transitions to the start states of TG₁ and TG₂.
- A TG accepting L₁L₂ can be constructed by connecting each final state of TG₁ to the start state of TG₂ via a λ-transition, then making the old final states of TG₁ non-final and keeping the final states of TG₂.
- A TG accepting L₁* can be constructed by adding a new start state that is also a final state, with a λ-transition to the old start state, and adding λ-transitions from each old final state back to the old start state.
📌 Example: Consider the following TGs:
- TG₁ accepts language L₁ (strings with even number of a’s and b’s)
- TG₂ accepts language L₂ (strings with odd length)
Following may be a TG accepting L₁ + L₂, where a new start state connects to both original start states. A TG accepting L₁L₂ connects final states of TG₁ to start of TG₂. A TG accepting L₂* adds a new initial/final state with loops.
Complement of a language
Let L be a language defined over an alphabet Σ. Then the language of strings, defined over Σ, not belonging to L, is called the complement of the language L, denoted by Lᶜ or L’.
🔑 Definition — Complement of a Language: For a language L defined over alphabet Σ, Lᶜ = {w ∈ Σ* | w ∉ L}.
Note: To describe the complement of a language, it is very important to describe the alphabet of that language over which the language is defined. For a certain language L, the complement of Lᶜ is the given language L, i.e., (Lᶜ)ᶜ = L.
Theorem If L is a regular language, then Lᶜ is also a regular language.
Proof: Since L is a regular language, by Kleene’s theorem, there exists an FA, say F, accepting the language L. Converting each of the final states of F to non-final states and old non-final states of F to final states, the FA thus obtained will reject every string belonging to L and will accept every string, defined over Σ, not belonging to L. This shows that the new FA accepts the language Lᶜ. Hence, using Kleene’s theorem, Lᶜ can be expressed by some RE. Thus Lᶜ is regular.
💡 Why this matters: This provides a constructive method to build an FA for the complement of any regular language simply by toggling final and non-final states.
📌 Example: Let L be the language over the alphabet Σ = {a, b} consisting of only two words: aba and abb. The FA accepting L may have states: start → 1, 2, 3 (accepting), etc. Converting final states to non-final states and old non-final states to final states, the FA accepting Lᶜ now accepts all strings over Σ except "aba" and "abb".
Intersection of two regular languages
Theorem Statement: If L₁ and L₂ are two regular languages, then L₁ ∩ L₂ is also regular.
Proof: Using De Morgan’s law for sets: (L₁ᶜ ∪ L₂ᶜ)ᶜ = (L₁ᶜ)ᶜ ∩ (L₂ᶜ)ᶜ = L₁ ∩ L₂
Since L₁ and L₂ are regular languages, so are L₁ᶜ and L₂ᶜ (by the complement theorem). L₁ᶜ and L₂ᶜ being regular implies that L₁ᶜ ∪ L₂ᶜ is also a regular language (by closure under union). Therefore, (L₁ᶜ ∪ L₂ᶜ)ᶜ = L₁ ∩ L₂, being the complement of a regular language, is regular.
💡 Why this matters: This elegantly shows that the intersection of two regular languages is regular without needing to construct a new FA directly — it relies on already proven closure properties (union and complement).
⭐ Key Takeaways
Regular languages are closed under union (L₁+L₂), concatenation (L₁L₂), and Kleene star (L₁*), provable via both regular expressions and TG constructions. The complement of a regular language is regular, constructible by swapping final and non-final states in its FA. Using De Morgan’s law, the intersection of two regular languages is also regular, as it can be expressed as the complement of the union of their complements. These closure properties are fundamental for proving other language properties and for designing automata for complex languages without constructing them from scratch. Always define the alphabet when working with complements, as the complement depends entirely on the alphabet over which the language is defined.
🧠 Quick Revision Questions
- What are the two methods by which it can be proved that L₁+L₂, L₁L₂, and L₁* are regular if L₁ and L₂ are regular?
- Explain the step-by-step construction of a TG that accepts the complement of a language accepted by a given FA.
- Using De Morgan’s law, prove that the intersection of two regular languages L₁ and L₂ is also regular.
- Why is it essential to specify the alphabet when describing the complement of a language?
- Given an FA for language L that accepts strings of even length over {a, b}, how would you construct an FA for Lᶜ?
📘 Lecture 25 — Theory of Automata
📖 Overview: This lecture proves that the intersection of two regular languages is also regular, using De-Morgan's law. It then provides detailed examples of constructing finite automata for the intersection of regular languages, and concludes by introducing the concept of nonregular languages with a proof using the pumping lemma concept.
🗂️ Topics Covered
The lecture covers the theorem for intersection of two regular languages with its proof using De-Morgan's law, a remark on the difficulty of finding regular expressions for intersection, an example of finding an FA for the intersection of two languages (words with double a's and words with even number of a's), a short method for constructing FA for intersection, and the introduction of nonregular languages with the example of the language {aⁿbⁿ : n=0,1,2,3,...}.
📝 Lecture Summary
Theorem
Statement: If L₁ and L₂ are two regular languages, then L₁ ∩ L₂ is also regular.
Proof: Using De-Morgan's law for sets: (L₁ᶜ ∪ L₂ᶜ)ᶜ = (L₁ᶜ)ᶜ ∩ (L₂ᶜ)ᶜ = L₁ ∩ L₂
Since L₁ and L₂ are regular languages, so are L₁ᶜ and L₂ᶜ. L₁ᶜ and L₂ᶜ being regular provide that L₁ᶜ ∪ L₂ᶜ is also regular language and so (L₁ᶜ ∪ L₂ᶜ)ᶜ = L₁ ∩ L₂, being complement of regular language is regular language.
Remark: If L₁ and L₂ are regular languages, then these can be expressed by the corresponding FAs. Finding regular expressions defining the language L₁ ∩ L₂ is not so easy and building corresponding FA is rather harder.
Example
Consider two regular languages L₁ and L₂, defined over the alphabet Σ = {a, b}, where:
- L₁ = language of words with double a's
- L₂ = language of words containing even number of a's
FA₁ accepting L₁ has states p- (start), q, and r+ (final), with transitions: on 'a' from p→q and q→r; on 'b' from p→p, q→p, r→r.
FA₂ accepting L₂ has states 1± (start and final) and 2, with transitions: on 'a' from 1→2 and 2→1; on 'b' from 1→1 and 2→2.
Their corresponding REs may be:
- r₁ = (a+b)aa(a+b)
- r₂ = (b+aba)
Now FAs accepting L₁ᶜ and L₂ᶜ are constructed by swapping final and non-final states. FA₁ᶜ has states p± (start and final), q+ (final), and r; FA₂ᶜ has states 1± and 2.
An FA accepting L₁ᶜ ∪ L₂ᶜ is constructed using the product method with states being pairs from the two FAs:
Old States | New States after reading a | New States after reading b z₁±≡(p,1) | (q,2)≡z₄ | (p,1)≡z₁ z₂+≡(p,2) | (q,1)≡z₃ | (p,2)≡z₂ z₃+≡(q,1) | (r,2)≡z₆ | (p,1)≡z₁ z₄+≡(q,2) | (r,1)≡z₅ | (p,2)≡z₂ z₅≡(r,1) | (r,2)≡z₆ | (r,1)≡z₅ z₆+≡(r,2) | (r,1)≡z₅ | (r,2)≡z₆
An FA that accepts the language (L₁ᶜ ∪ L₂ᶜ)ᶜ = L₁ ∩ L₂ has states z₁- (start), z₂, z₃, z₄, z₅+ (final), z₆, with transitions on a and b as defined in the table.
The regular expression defining the language L₁ ∩ L₂ can be obtained by converting and reducing the FA into a GTG. After eliminating states z₂ and z₆, then z₃ and z₄, and eliminating loops, the required RE is: (b+abbab) a (a+bbaaba) (b+aba)
💡 Why this matters: This demonstrates that while intersection of regular languages is regular, constructing the actual FA and RE can be complex and requires systematic elimination of states.
FA corresponding to intersection of two regular languages (short method)
Let FA₃ be an FA accepting L₁ ∩ L₂, then the initial state of FA₃ must correspond to the initial state of FA₁ and the initial state of FA₂. Since the language corresponding to L₁ ∩ L₂ is the intersection of corresponding languages L₁ and L₂, consists of the strings belonging to both L₁ and L₂, therefore a final state of FA₃ must correspond to a final state of FA₁ and FA₂.
Example: Using the same FAs as above, the short method produces:
Old States | New States after reading a | New States after reading b z₁-≡(p,1) | (q,2)≡z₄ | (p,1)≡z₁ z₂≡(p,2) | (q,1)≡z₃ | (p,2)≡z₂ z₃≡(q,1) | (r,2)≡z₆ | (p,1)≡z₁ z₄≡(q,2) | (r,1)≡z₅ | (p,2)≡z₂ z₅+≡(r,1) | (r,2)≡z₆ | (r,1)≡z₅ z₆≡(r,2) | (r,1)≡z₅ | (r,2)≡z₆
The final state z₅+ corresponds to (r,1), where r is final in FA₁ and 1 is final in FA₂.
Nonregular Languages
The language that cannot be expressed by any regular expression is called a nonregular language. The languages PALINDROME and PRIME are the examples of nonregular languages.
🔑 Definition — Nonregular Language: A language that cannot be expressed by any regular expression, and by Kleene's theorem, cannot be accepted by any FA or TG.
Example: Consider the language L = {Λ, ab, aabb, aaabbb, ...} i.e. {aⁿbⁿ : n=0,1,2,3,...}
To prove that this language is nonregular, assume contrary that L is a regular language. Then by Kleene's theorem it must be accepted by an FA, say, F. Since every FA has finite number of states, the language L (being infinite) accepted by F must have words of length more than the number of states. This shows that F must contain a circuit.
For the sake of convenience, suppose F has 10 states. Consider the word a⁹b⁹ from the language L. Due to the finite number of states, the path traced by this word must contain a circuit. Looping the circuit generated by states 3,4,6,5,3 with a-edges once more, F also accepts the word a⁹⁺⁴b⁹ = a¹³b⁹, while a¹³b⁹ is not a word in L. Because of this circuit, F also accepts the words a⁹(a⁴)ᵐb⁹, m = 1,2,3,...
Moreover, there is another circuit generated by states 9,10,9. Including the possibility of looping this circuit, F accepts the words a⁹(a⁴)ᵐb⁹(b²)ⁿ where m,n=0,1,2,3,... (m and n not being 0 simultaneously). This shows that F accepts words that are not belonging to L.
📐 Formula: {aⁿbⁿ : n=0,1,2,3,...} — The language of equal numbers of a's followed by equal numbers of b's.
💡 Why this matters: This proof technique (pigeonhole principle applied to finite automata) shows that any FA with finite states cannot distinguish between strings that must have equal numbers, thus proving L is nonregular.
⭐ Key Takeaways
The intersection of two regular languages is always regular, proven using De-Morgan's law and the fact that regular languages are closed under complement and union. While the theorem guarantees regularity, constructing the actual FA and regular expression for the intersection is complex and involves the product construction method. The key insight is that the final states of the intersection FA must correspond to pairs where BOTH original FAs have final states. Nonregular languages like {aⁿbⁿ} cannot be accepted by any FA because any finite automaton with a limited number of states must contain circuits that allow it to accept strings with unequal numbers of a's and b's. The pumping lemma concept demonstrates that infinite regular languages must have repeating patterns (circuits), and languages requiring exact counting cannot be regular.
🧠 Quick Revision Questions
- How does De-Morgan's law help prove that the intersection of two regular languages is regular?
- In the example of L₁ (double a's) and L₂ (even number of a's), what is the final regular expression for L₁ ∩ L₂?
- In the short method for constructing FA for intersection, what condition determines whether a state (p,q) is a final state?
- Why does the existence of a circuit in an FA accepting {aⁿbⁿ} lead to a contradiction?
- What are the two circuits found in the FA that supposedly accepts {a⁹b⁹}, and what extra strings do they allow?
📘 Lecture 26 — Example of nonregular language, pumping lemma version I, proof, examples
📖 Overview: This lecture proves that the language {aⁿbⁿ} is nonregular using the pumping lemma. It formally states and proves the pumping lemma version I, which provides a necessary condition for infinite regular languages, and demonstrates its application through multiple examples including PALINDROME, revealing its limitations.
🗂️ Topics Covered
The lecture begins with a detailed example proving {aⁿbⁿ} is nonregular using the concept of finite state machine circuits. It then formally introduces the Pumping Lemma (version I) with its statement and proof. This is followed by worked examples applying the lemma to a 5-state FA and to {aⁿbⁿ} directly. The lecture also discusses the nonregularity of EQUAL language via closure properties and concludes with remarks on the pumping lemma's limitations, particularly regarding PALINDROME.
📝 Lecture Summary
Example
Consider the language L = {Λ, ab, aabb, aaabbb, ...} i.e. {aⁿ bⁿ : n=0,1,2,3,...}. Suppose it is required to prove that this language is nonregular. Let, contrary, L be a regular language then by Kleene's theorem it must be accepted by an FA, say, F. Since every FA has finite number of states then the language L (being infinite) accepted by F must have words of length more than the number of states. Which shows that, F must contain a circuit.
For the sake of convenience suppose that F has 10 states. Consider the word a⁹ b⁹ from the language L. But, looping the circuit generated by the states 3,4,6,5,3 with a-edges once more, F also accepts the word a⁹⁺⁴ b⁹, while a¹³b⁹ is not a word in L. Moreover, there is another circuit generated by the states 9,10,9. Including the possibility of looping this circuit, F accepts the words a⁹(a⁴)ᵐ b⁹(b²)ⁿ where m,n=0,1,2,3,... (m and n not being 0 simultaneously). Which shows that F accepts words that are not belonging to L. Similarly for finding FAs accepting other words from L, they will also accept the words which do not belong to L. Thus there is no FA which accepts the language L, which shows, by Kleene's theorem, that the language L can't be expressed by any regular expression.
💡 Why this matters: This example demonstrates that any FA accepting an infinite regular language must contain a circuit, and looping that circuit inevitably generates words outside the target language if the language is nonregular.
Pumping Lemma
Statement: Let L be any infinite regular language (that has infinite many words), defined over an alphabet Σ then there exist three strings x, y and z belonging to Σ* (where y is not the null string) such that all the strings of the form xyⁿz for n=1,2,3,... are the words in L.
Proof: If L is a regular language, then according to Kleene's theorem, there exists an FA, say, F that accepts this language. Now F, by definition, must have finite no of states while the language has infinitely many words, which shows that there is no restriction on the length of words in L, because if there were such restriction then the language would have finite many words.
Let w be a word in the language L, so that the length of word is greater than the number of states in F. In this case the path generated by the word w, is such that it cannot visit a new state for each letter i.e. there is a circuit in this path. The word w, in this case, may be divided into three parts:
- x: The substring which generates the path from initial state to the state which is revisited first while reading the word w. x can be a null string.
- y: The substring which generates the circuit starting from the state which was lead by x. y cannot be null string.
- z: The substring which is the remaining part of the word after y. This part may be null string as the word may end after y or z part may itself be a circuit.
Thus the word may be written as w = xyz where x,y and z are the strings, also y can't be a null string. Now this is obvious that, looping the circuit successively, the words xyyz, xyyyz, xyyyz,... will also be accepted by this FA i.e. xyⁿz, n=1,2,3,... will be words in L.
🔑 Definition — Pumping Lemma: For any infinite regular language L over alphabet Σ, there exist strings x, y, z ∈ Σ* with y ≠ Λ such that xyⁿz ∈ L for all n = 1, 2, 3, ...
🔑 Definition — Pumping: The process of looping a circuit in an FA to generate infinitely many words, effectively "pumping" the substring y to create new words of the form xyⁿz.
Example
Consider the following 5 states FA, say, F which accepts an infinite language. Let the word w = bbbababa, belonging to the language L, so that the length of word is greater than 6 (the number of states in F). In this case the path generated by this word is such that it cannot visit a new state for each letter i.e. there is a circuit in this path.
The state 2 is such that it is revisited first while reading the word w. So the word w can be decomposed, according to pumping lemma, as w = xyz = (b)(bba)(baba). If y-part of w is continuously pumped, the resulting strings will be accepted by F and hence will be words in the language accepted by F. Thus, by pumping lemma, the language accepted by F is regular.
📌 Example: w = bbbababa decomposed as x = b, y = bba, z = baba. Pumping y gives: b(bba)ⁿ(baba) for n = 1, 2, 3,... all accepted by F.
Remark: If the pumping lemma is applied directly on the language L = {aⁿ bⁿ : n=0,1,2,3,...}, it can be observed that for the word w = (aaa)(aaaabbbb)(bbb) where x = aaa, y = aaaabbbb and z = bbb. xyyz will contain as many number of a's as there are b's but this string will not belong to L because the substring ab can occur at the most once in the words of L, while the string xyyz contains the substring ab twice. On the other hand if y-part consisting of only a's or b's, then xyyz will contain number of a's different from number of b's. This shows that pumping lemma does not hold and hence the language is not regular.
Example
Consider the language EQUAL, of strings, defined over Σ={a,b}, with number of a's equal to number of b's, i.e. EQUAL = {Λ, ab, aabb, abab, baba, abba,...}. From the definition of EQUAL, it is clear that {aⁿ bⁿ} = a* b* ∩ EQUAL. Obviously a* b* defines a regular language while {aⁿ bⁿ} has been proved nonregular. Using the theorem that intersection of two regular languages is regular, it can be proved that the EQUAL is not regular. Because if it is considered regular then the language {aⁿ bⁿ} will, being intersection of regular languages, be regular language, which is impossible.
🔑 Definition — EQUAL: The language of strings over {a,b} with an equal number of a's and b's.
Remarks
In the previous examples, languages are proved to be regular or nonregular using pumping lemma. In fact to prove a certain language to be regular, it is not needed to use the full force of pumping lemma i.e. for a word with length greater than the number of states of the machine, decomposing the word into xyz and for a language to be regular it is sufficient that xyyz is in L. The condition that xyⁿz is in L for n>2, provides that the language is infinite.
Consider the language PALINDROME and a word w = aba belonging to PALINDROME. Decomposing w = xyz where x=a, y=b, z=a. It can be observed that the strings of the form xyⁿz for n=1,2,3,..., belong to PALINDROME. Which shows that the pumping lemma holds for the language PALINDROME (which is nonregular language). To overcome this drawback of pumping lemma, a revised version of pumping lemma is to be introduced.
💡 Why this matters: The PALINDROME example reveals a crucial limitation of pumping lemma version I — it provides a necessary condition for regularity but not a sufficient one. Some nonregular languages can still satisfy the lemma, requiring a stronger version for proof of nonregularity.
⭐ Key Takeaways
The pumping lemma version I states that for any infinite regular language L, there exist strings x, y (non-null), and z such that all strings xyⁿz for n ≥ 1 are in L. This lemma is proven by noting that any FA accepting an infinite language must have a circuit due to finite states, and the word can be decomposed into x (path to first revisited state), y (the circuit), and z (remainder). The language {aⁿbⁿ} is proved nonregular because any decomposition either produces strings with mismatched counts of a's and b's or with multiple occurrences of "ab", which are not in the language. EQUAL is also proved nonregular using closure under intersection with regular language ab. The pumping lemma has a limitation: nonregular languages like PALINDROME can satisfy it, motivating the need for a revised version.
🧠 Quick Revision Questions
- State the pumping lemma version I for infinite regular languages.
- Why must any FA accepting an infinite language contain a circuit?
- Using the pumping lemma, explain why {aⁿbⁿ} is not regular.
- How can the nonregularity of EQUAL be proved using closure properties?
- Why is PALINDROME considered a counterexample to the sufficiency of pumping lemma version I?
📘 Lecture 27 — Theory of Automata
📖 Overview: This lecture presents Pumping Lemma version II, a stronger version of the pumping lemma used to prove that certain languages are not regular. It also introduces the Myhill Nerode theorem, which provides a necessary and sufficient condition for a language to be regular based on the number of equivalence classes it generates over Σ*.
🗂️ Topics Covered
Pumping lemma version II statement and proof with examples including PALINDROME and PRIME languages, the concept of strings belonging to the same class in an FA, and the Myhill Nerode theorem with examples showing how regular languages generate a finite number of partition classes.
📝 Lecture Summary
Pumping Lemma version II
Statement — Let L be an infinite language accepted by a finite automaton with N states. Then for all words w in L that have length more than N, there are strings x, y, and z (y being non-null string) and length(x) + length(y) ≤ N such that w = xyz and all strings of the form xyⁿz are in L for n = 1, 2, 3, ...
The proof follows from the pigeonhole principle applied to the states visited while reading the first N characters of w. Since the FA has only N states, some state must repeat within the first N+1 steps, allowing us to identify the loop (y).
🔑 Definition — Pumping Lemma version II: A stronger version requiring that the pumping segment (xy) be within the first N characters of the word, where N is the number of states in the FA.
📌 Example — Consider the language PALINDROME, which is infinite. Suppose it is accepted by an FA with 78 states. Take the word w = a⁸⁵ba⁸⁵. Decompose w as xyz where y is non-null and length(x) + length(y) ≤ 78. This means xy consists only of a's (since the first 78 characters are a's). Then xyyz = a^(85+|y|)ba⁸⁵, which has more a's on the left than on the right. This string is NOT in PALINDROME because the first and last characters would be a, but the count imbalance breaks the palindrome property. Thus PALINDROME does not satisfy pumping lemma version II, proving PALINDROME is non-regular.
📌 Example — Consider the language PRIME = {a^p : p is prime}, defined over Σ = {a}. Assume PRIME is regular and accepted by an FA with 345 states. Choose w = a³⁴⁷ (347 is prime, length > 345). By pumping lemma, xyⁿz ∈ PRIME for n = 1, 2, 3, ... Let y = a^m where 1 ≤ m ≤ 345 (since length(x)+length(y) ≤ 345). Consider n = 348: xy³⁴⁸z = a³⁴⁷(a^m)³⁴⁷ = a^(347m + 347) = a^(347(m+1)). The exponent 347(m+1) is not prime for m = 1, 2, ..., 345 because 347(m+1) = 347 × (m+1), always having at least factors 347 and (m+1). When m+1 = 1 (m=0, but m≥1) or the product equals 347×1=347, but m+1≥2, so it's composite. Hence xy³⁴⁸z ∉ PRIME. Therefore PRIME is not regular.
💡 Why this matters: Version II is more restrictive than version I — the condition length(x)+length(y) ≤ N ensures the loop occurs early in the word, making it harder for non-regular languages to accidentally satisfy the lemma.
Strings belonging to same class
Consider a regular language L, defined over an alphabet Σ. If two strings x and y, defined over Σ, are run over an FA accepting L, then x and y are said to belong to the same class if they end in the same state, no matter whether that state is final or not.
🔑 Definition — Same class (w.r.t. an FA): Two strings belong to the same class if they lead the FA to the same state from the start state.
🔑 Note: This concept is equivalent to indistinguishability w.r.t. L. Strings x and y are in the same class if for all strings z, either both xz and yz belong to L or neither xz nor yz belongs to L.
Myhill Nerode theorem
Statement — For a language L defined over an alphabet Σ, L partitions Σ* into distinct classes (equivalence classes under the indistinguishability relation).
- If L is regular, then L generates a finite number of classes.
- If L generates a finite number of classes, then L is regular.
The proof follows from the fact that each class corresponds to a state in the minimal DFA for L.
📌 Example — Consider L = {strings over Σ={a,b} ending in a}. L partitions Σ* into two classes:
- C₁ = set of all strings ending in a (final state)
- C₂ = set of all strings not ending in a (non-final state)
Since there are finitely many (2) classes, L is regular. The FA accepting L has two states:
- C₂ (start, non-final) — on input a goes to C₁, on input b stays in C₂
- C₁ (final) — on input a stays in C₁, on input b goes to C₂
📌 Example — Consider L = {strings over Σ={a,b} containing double "aa"}. L partitions Σ* into three classes:
- C₁ = set of all strings without "aa" but ending in a
- C₂ = set of {Λ} and all strings without "aa" but ending in b
- C₃ = set of all strings containing "aa"
Since there are finitely many (3) classes, L is regular. The FA accepting L:
- C₂ (start, non-final) — on input a goes to C₁, on input b stays in C₂
- C₁ (non-final) — on input a goes to C₃ (found "aa"), on input b goes back to C₂
- C₃ (final) — on any input (a or b) stays in C₃
💡 Why this matters: The Myhill Nerode theorem gives both a necessary and sufficient condition for regularity, unlike the pumping lemma which only gives a necessary condition. If you can show infinitely many classes, the language is definitively non-regular.
⭐ Key Takeaways
The pumping lemma version II requires that the pumping segment xy be within the first N characters (where N is the number of states), making it more powerful than version I for proving non-regularity. Languages like PALINDROME and PRIME fail version II, confirming their non-regularity. The Myhill Nerode theorem establishes that a language is regular if and only if it partitions Σ* into a finite number of equivalence classes under the indistinguishability relation. These classes correspond directly to the states of the minimal DFA accepting the language. This theorem is the most definitive test for regularity, as it provides both necessary and sufficient conditions.
🧠 Quick Revision Questions
- What is the difference between Pumping Lemma version I and version II regarding the length constraint?
- Why does the word a⁸⁵ba⁸⁵ in the PALINDROME example fail the pumping lemma version II when decomposed within the first 78 characters?
- In the PRIME example, why does the exponent 347(m+1) not remain prime for any m = 1, 2, ..., 345?
- According to the Myhill Nerode theorem, how many equivalence classes does the language L = {strings ending in "ab"} over Σ={a,b} generate? Construct the corresponding FA.
- What is the relationship between "strings belonging to the same class" (w.r.t. an FA) and "indistinguishable strings w.r.t. L"?