Show that the following language $L$ is regular by describing it using a regular expression. $$L = \{1^n w 1^n \mid n > 0 \text{ and }w ∈ \{0,1\}^*\} $$
My (apparently incorrect) answer:
Given $w ∈ \{0,1\}^*$ , we can rewrite $L$ as: $1^n(0\cup1)^*1^n\ for\ n ≥ 0$
However, since the language specifies that the number of leading and trailing $1$s must be the same - this language is not regular.
My justification:
- For every regular language, there is (by definition) a finite automaton that accepts that language
- The given language $L$ requires an equivalent count of leading and trailing $1$s
- Finite automata are not capable of maintaining a count.
Since no finite automata can accept the language $L$, $L$ is not regular.
Can anyone explain to me why this language is regular? I'm completely stumped. I can see that it could be pumped using the Pumping Lemma (thereby proving regularity), but my brain just refuses to recognize that an FSM could accept this language.