0

I am trying to prove that every finite language is regular. I have come up with a proof that every language with a finite number of finite length strings is regular (shown at the bottom of this post), but now I am looking to prove the claim for languages with a finite number of finite or infinte length strings.

If I can show that any language containing a single string is regular, then the claim follows from the closure of regular languages under set union. It is easy to show that any language containing a single string of finite length is regular using the fact that individual characters are regular combined with the closure of regular languages under concatenation. But how do I do this for a infinite length string?

It appears that I cannot simply use closure under concatenation because this is defined as a finite closure. I am under the impression that if $\cdot$ is some operation on the elements of set $S$, and $S$ is closed in the sense that $x\cdot y\in S$ for any $x,y\in S$, the principal of mathematical induction says that $x_1\cdot x_2\cdot...\cdot x_n\in S$ for $x_i\in S$ and any $n\in\mathbb{N}$, but combining a countably infinite number of elements in $S$ using $\cdot$ is not necessarily closed because $\infty\notin\mathbb{N}$. Is this true?

If so, how else could one prove that a language containing a single infinite string is regular?

My original proof for finite strings is shown below (not really important for question, so don't read it if you don't want to):

Let $\Sigma=\{1,...,n\}$. Consider the language $L$ such that $|L|<\infty$. We can enumerate $L=\{w_1,...,w_m\}$. Construct the NFA $X=(\Sigma, Q, q_0,\delta,F)$. If $\varepsilon\in L$, then include an epsilon transition from $q_0$ into accept state $q_\varepsilon\in F$. Now, for each nonempty $w_i=x_1x_2...x_k\in L$, define the state $q_{i,1}$ such that $q_{i.1}\in\delta(q_0,x_1)$. Then, define the sequence of states $q_{i,2},q_{i,3},...,q_{i,k}$ where $q_{i,j}$ transitions into the state $q_{i,j+1}$ given input character $x_{j+1}$ for $j\in[k-1]$, and where $q_{i,j}$ implicitly rejects any other character. Then, letting $q_{i,k}\in F$, we see that the sequence of states $q_0,q_{i,2},q_{i,3},...,q_{i,k}$ accepts the string $w_i$. Since we have defined such a branch $q_0,q_{i,2},q_{i,3},...,q_{i,k}$ for all $i\in[m]$, every $w_i\in L$ is accepted by $X$. Furthermore, Each branch $q_0,q_{i,2},q_{i,3},...,q_{i,k}$ does not accept any string $w$ that is not equal to $w_i\in L$, so it follows that every string $w\notin L$ will be rejected by $X$. Thus, $X$ decides $L$, which proves that $L$ is regular.

LYB
  • 13
  • What does it mean for a set of infinitely long strings to be a rengular language? – Sassatelli Giulio Jan 27 '23 at 23:52
  • @SassatelliGiulio a language is regular if there is a DFA (or NFA) that accepts strings in that language and rejects strings otherwise. – LYB Jan 28 '23 at 00:18
  • 2
    How does that work for infinite strings? – Sassatelli Giulio Jan 28 '23 at 00:27
  • @SassatelliGiulio I guess that's a good point. Formally, a string is accepted if there's a sequence of states that start at $q_0$ and map sequentially by the transition function to an end state in the set of accepted states. This definition only really makes sense for finite strings (as we assume an "end state" exists). Does that mean DFA's can only decide languages with finite string lengths? I was under the impression that the set of strings (in a unary alphabet) that have even length form a regular language (which one can construct a DFA for quite easily). Is this not true? – LYB Jan 30 '23 at 03:59
  • @SassatelliGiulio, on second thought what I said is not a counterexample because infinity has no parity. So then running infinitely long strings through DFA's is undefined as there is no "last character" for which we can end up in an final accept or reject state, correct? – LYB Jan 30 '23 at 04:06

0 Answers0