1
$\begingroup$

This was given as a challenge problem during one of my lectures

Given any alphabet $\Sigma$, the language $L$ over $\Sigma^*$ described by $\{x: \text{any symbol of }x\text{ differs from the previous symbol}\}$ is regular.

How do I prove that this is true or false? The way I thought about it was that x could be any "symbol" and therefore the language could contain an infinite number of some "symbols", and since it is infinite it is therefore not regular, is this correct?

  • 0
    Here, "symbol" means an element of the "alphabet" $\Sigma$, and $\Sigma$ is usually assumed to be finite.2017-02-17
  • 0
    Regular languages can be very infinite, e.g. $L = \{0,1\}^\ast$, so the last argument makes no sense2017-02-18

2 Answers 2

2

Can you think about a DFA accepting this language? Hint: there are only finitely many subsets $A$ of the alphabet $\Sigma$, try to use these as states in a machine for the symbols we have already "seen".

2

Hint. You probably know that the complement of a regular language is regular. Therefore it suffices to establish that the complement $L^c$ of your language is regular. Now $L^c$ is the set of words containing two equal consecutive letters. Can you find a regular expression for $L^c$?