Regular Languages Among Given Options: A Formal Language Analysis
We are asked which of the following languages is regular. Recall that a language is regular if it is recognized by some DFA/NFA (equivalently, if it satisfies the structural constraints of finite automata). For non-regularity, we typically use the pumping lemma for regular languages, which says every regular language must have a “pumping length” that can be exploited to generate new strings that still stay in the language.
We assume the input alphabet includes at least one symbol (typically in these problems).
Footnotes
-
Properties of Regular Languages - Notes on regular languages and closure concepts. ↩
-
Pumping lemma for regular languages - Statement of pumping lemma used for non-regularity proofs. ↩
How the decision is made (Regular vs Non-Regular)
Try to build a DFA
Step 1If acceptance depends only on finite local properties (like parity), it is likely regular."
Use pumping lemma
Step 2If the language requires unbounded global structure (like palindromes or prime lengths), pumping breaks it."
Use closure/special constructions
Step 3If you can reduce a known non-regular language to one of the options via closure arguments, it is non-regular."
Conclude
Step 4Exactly which options are regular is determined by the above tests."
Quick answer
- (i) Not regular: length is a prime number.
- (ii) Not regular: palindromes.
- (iii) Not regular (in general): strings containing substring (depends on the factorization; the required equality-of-unbounded halves gives non-regularity).
- (iv) Regular: strings with an even number of ’s.
We now justify each item rigorously.
(i) Strings whose length is a sequence of prime numbers
Key idea
Let for a moment and consider the unary language
If the original language “strings whose lengths are prime” were regular, then this unary subset would also be regular (by standard reasoning using intersection with a regular set; regular languages are closed under intersection).
But the unary language of prime lengths is a known non-regular language; one can prove it via the pumping lemma for regular languages.2
Pumping-lemma sketch (why prime lengths fail)
Assume is regular. Let be its pumping length. Choose a prime and consider the string . The pumping lemma guarantees a decomposition where and such that for all , the pumped string is still in the language.
However, pumping changes the length away from (by adding/removing copies of ), producing where is not prime for some —contradiction.2
So option (i) is not regular.
Keywords: pumping lemma unary language pumping length closure under intersection
Footnotes
-
Proof: The language consisting of strings whose lengths are prime is not regular - Pumping-lemma style proof for prime-length unary language. ↩ ↩2
-
Pumping lemma for regular languages - Statement of pumping lemma used for non-regularity proofs. ↩ ↩2 ↩3
(ii) Palindrome strings
Key idea
Let
The palindrome condition requires the automaton to “match” the first half with the second half in reverse order, which cannot be done with finite memory for unbounded lengths.
A standard pumping lemma proof picks a long palindrome with a large enough “middle” that any allowed pumping changes one side but not the corresponding mirrored side, so the result is no longer a palindrome.2
For example, in many pumping-lemma constructions one chooses (or similar) and pumps within the prefix region; the pumped string preserves the pumped prefix length but breaks equality with the suffix, contradicting membership in .2
Thus option (ii) is not regular.
Keywords: palindrome language mirror constraint pumping-lemma proof finite automaton
Footnotes
-
4 Showing that a language is not regular - Pumping lemma example for palindromes. ↩ ↩2
-
Pumping lemma for regular languages - Statement of pumping lemma used for non-regularity proofs. ↩ ↩2
(iii) Strings containing substring
Interpret the option as the set
Key idea
The substring requirement contains an exact reversal match between two unbounded parts. Even though it is “local” (a substring), the existence of some still requires equality between a segment and its reverse. This “self-similarity under reversal” generally prevents regularity.
A common proof strategy for such languages is to assume regularity and then apply the pumping lemma: pumping a part of a long witness string either breaks the required equality structure inside the occurrence of or yields strings where no such occurrence can be formed. Discussions and example analyses for languages built from -type patterns are typically handled via pumping lemma style contradictions.2
Therefore, option (iii) is not regular (in general).
Note: If the problem were restricted to a fixed size of , it would become regular. But with unbounded , the reversal-equality constraint is the obstacle.
Keywords: substring reversal factor $ww^R regularity obstruction
Footnotes
-
Regular Languages; Pumping Lemma (and -type discussion) - Notes illustrating pumping lemma usage for languages involving reversal/equality constraints. ↩
-
Pumping lemma for regular languages - Statement of pumping lemma used for non-regularity proofs. ↩
(iv) Strings with even number of ’s
Key idea
This is a classic DFA-recognizable property: count parity of ’s.
Let
A DFA with two states suffices:
- state meaning “seen an even number of ’s so far”
- state meaning “seen an odd number of ’s so far”
On reading:
- a : toggle between and
- a : stay in the same state
This construction is standard and makes regular.
So option (iv) is regular.
Keywords: DFA construction parity automaton toggle transition regular language
Footnotes
-
DFA machines accepting odd number of 0's or even number of 1's (parity DFA) - Example construction for parity of symbol counts. ↩
Why parity is easy, but prime-length/palindrome-like constraints are hard
Regular languages can track only finitely many equivalence classes of prefixes. Parity uses 2 classes. Palindromes and prime-length constraints require unbounded comparison of distant positions or the ability to test infinitely many specific lengths.
"Don’t confuse “some substring exists” with “finite pattern”
Even if the target property is phrased using “there exists a substring,” the substring can be arbitrarily long (unbounded ). Finite automata cannot, in general, enforce exact equality/reversal matches over unbounded regions.
Final classification
| Option | Language description | Regular? | Reason (core argument) |
|---|---|---|---|
| (i) | lengths are prime numbers | No | Unary prime-length language fails pumping lemma behavior2 |
| (ii) | palindromes | No | Pumping lemma breaks mirrored structure2 |
| (iii) | contains substring | No (general) | Unbounded reversal-equality constraint cannot be maintained finitely2 |
| (iv) | even number of ’s | Yes | DFA with 2 states (parity tracking) |
Footnotes
-
Proof: The language consisting of strings whose lengths are prime is not regular - Pumping-lemma style proof for prime-length unary language. ↩
-
Pumping lemma for regular languages - Statement of pumping lemma used for non-regularity proofs. ↩ ↩2 ↩3
-
4 Showing that a language is not regular - Pumping lemma example for palindromes. ↩
-
Regular Languages; Pumping Lemma (and -type discussion) - Notes illustrating pumping lemma usage for languages involving reversal/equality constraints. ↩
-
DFA machines accepting odd number of 0's or even number of 1's (parity DFA) - Example construction for parity of symbol counts. ↩
Knowledge Check
Which of the following is regular?