1

I don't want to create a duplicate question of How to prove a language is regular?, I only want to know what is a good and simple way to explain why a language like

$\qquad \displaystyle L = \{w \in \{a,b,c\}^* \mid w = ua \text{ and } |u| \equiv 2 \pmod 3 \}$.

is regular.

jannnik
  • 85
  • 1
  • 6

1 Answers1

1

The easiest way is by giving a regular expression for $L$: $$ L = (a+b+c)^2((a+b+c)^3)^*a. $$ Here $(a+b+c)^2$ is a shorthand for $(a+b+c)(a+b+c)$, and $(a+b+c)^3$ is a shorthand for $(a+b+c)(a+b+c)(a+b+c)$.

Other ways described in the comments:

  1. Give a DFA (6 states) or an NFA (4 states) for $L$.
  2. Decompose $L = L' a$ and give a DFA (3 states) or an NFA (3 states) for $L'$.
Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514