Regular Languages Among Given Options: A Formal Language Analysis

Regular Languages Among Given Options: A Formal Language Analysis

Verified Sources
Oct 1, 2026

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 Σ={0,1}\Sigma=\{0,1\} in these problems).

Footnotes

  1. Properties of Regular Languages - Notes on regular languages and closure concepts. ↩

  2. 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 1

If acceptance depends only on finite local properties (like parity), it is likely regular."

Use pumping lemma

Step 2

If the language requires unbounded global structure (like palindromes or prime lengths), pumping breaks it."

Use closure/special constructions

Step 3

If you can reduce a known non-regular language to one of the options via closure arguments, it is non-regular."

Conclude

Step 4

Exactly 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 wwrww^r (depends on the factorization; the required equality-of-unbounded halves gives non-regularity).
  • (iv) Regular: strings with an even number of 00’s.

We now justify each item rigorously.

(i) Strings whose length is a sequence of prime numbers

Key idea

Let Σ={0}\Sigma=\{0\} for a moment and consider the unary language

Lprime={0p∣p is prime}.L_{\text{prime}}=\{0^p \mid p \text{ is prime}\}.

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 LprimeL_{\text{prime}} is regular. Let pp be its pumping length. Choose a prime ℓ>p\ell>p and consider the string 0ℓ∈Lprime0^\ell\in L_{\text{prime}}. The pumping lemma guarantees a decomposition 0ℓ=xyz0^\ell=xyz where ∣xy∣≤p|xy|\le p and ∣y∣≥1|y|\ge 1 such that for all i≥0i\ge 0, the pumped string xyizxy^iz is still in the language.

However, pumping changes the length away from ℓ\ell (by adding/removing copies of yy), producing 0ℓ′0^{\ell'} where ℓ′\ell' is not prime for some ii—contradiction.2

So option (i) is not regular.

Keywords: pumping lemma unary language pumping length closure under intersection

Footnotes

  1. Proof: The language consisting of strings whose lengths are prime is not regular - Pumping-lemma style proof for prime-length unary language. ↩ ↩2

  2. Pumping lemma for regular languages - Statement of pumping lemma used for non-regularity proofs. ↩ ↩2 ↩3

(ii) Palindrome strings

Key idea

Let

PAL={w∈Σ∗∣w=wR}.PAL=\{w\in\Sigma^* \mid w=w^R\}.

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 ww 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 w=0n110nw=0^n 1 1 0^n (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 PALPAL.2

Thus option (ii) is not regular.

Keywords: palindrome language mirror constraint pumping-lemma proof finite automaton

Footnotes

  1. 4 Showing that a language is not regular - Pumping lemma example for palindromes. ↩ ↩2

  2. Pumping lemma for regular languages - Statement of pumping lemma used for non-regularity proofs. ↩ ↩2

(iii) Strings containing substring wwrww^r

Interpret the option as the set

Lwwr={x∈Σ∗∣∃w such that wwR occurs as a substring of x}.L_{ww^r}=\{x\in\Sigma^*\mid \exists w \text{ such that } ww^R \text{ occurs as a substring of } x\}.

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 ww 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 wwRww^R or yields strings where no such wwRww^R occurrence can be formed. Discussions and example analyses for languages built from wwRww^R-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 ww, it would become regular. But with unbounded ∣w∣|w|, the reversal-equality constraint is the obstacle.

Keywords: substring reversal factor $ww^R regularity obstruction

Footnotes

  1. Regular Languages; Pumping Lemma (and wwRww^R-type discussion) - Notes illustrating pumping lemma usage for languages involving reversal/equality constraints. ↩

  2. Pumping lemma for regular languages - Statement of pumping lemma used for non-regularity proofs. ↩

(iv) Strings with even number of 00’s

Key idea

This is a classic DFA-recognizable property: count parity of 00’s.

Let

Leven={x∈{0,1}∗∣#0(x) is even}.L_{\text{even}}=\{x\in\{0,1\}^*\mid \#0(x)\text{ is even}\}.

A DFA with two states suffices:

  • state qEq_E meaning “seen an even number of 00’s so far”
  • state qOq_O meaning “seen an odd number of 00’s so far”

On reading:

  • a 00: toggle between qEq_E and qOq_O
  • a 11: stay in the same state

This construction is standard and makes LevenL_{\text{even}} regular.

So option (iv) is regular.

Keywords: DFA construction parity automaton toggle transition regular language

Footnotes

  1. 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 ∣w∣|w|). Finite automata cannot, in general, enforce exact equality/reversal matches over unbounded regions.

Final classification

OptionLanguage descriptionRegular?Reason (core argument)
(i)lengths are prime numbersNoUnary prime-length language fails pumping lemma behavior2
(ii)palindromesNoPumping lemma breaks mirrored structure2
(iii)contains substring wwrww^rNo (general)Unbounded reversal-equality constraint cannot be maintained finitely2
(iv)even number of 00’sYesDFA with 2 states (parity tracking)

Footnotes

  1. 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

  3. 4 Showing that a language is not regular - Pumping lemma example for palindromes. ↩

  4. Regular Languages; Pumping Lemma (and wwRww^R-type discussion) - Notes illustrating pumping lemma usage for languages involving reversal/equality constraints. ↩

  5. 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

Question 1 of 4
Q1Single choice

Which of the following is regular?