deepseek/deepseek-chat-v3.1

Exercise 4: Really regular

Let Σ:={0,...,9}\Sigma:=\{\mathtt{0},...,\mathtt{9}\}. For words u,vΣu,v\in\Sigma^* we denote by (u.v)10:=(u)10+10v(v)10(u\mathtt{.}v)_{10}:=(u)_{10}+10^{-|v|}\cdot(v)_{10} the value of a decimal fraction, so for example (1.75)10=74(\mathtt{1.75})_{10}=\tfrac{7}{4}.

Let γR\gamma\in\mathbb{R}, 0γ<10\le\gamma<1 and define Lγ:={wΣ:(0.w)10γ}L_\gamma:=\{w\in\Sigma^*:(\texttt{0.}w)_{10}\le\gamma\}.

Subproblem a (5.0/5.0P)

Which of the following properties are sufficient conditions for LγL_\gamma to be regular? Choose all that apply. For the last option you selected, prove that it is indeed a sufficient condition. You do not need to prove that the options you have not selected are not sufficient.
xx is a decimal fractionxx is rationalxx is algebraicxx is computable
Since γ\gamma is rational and 0γ<10 \le \gamma < 1, it has a decimal expansion that is eventually periodic. Let the pre-period have length mm and the period have length pp, so the expansion is 0.d1d2dm(dm+1dm+p)ω0.d_1 d_2 \dots d_m (d_{m+1} \dots d_{m+p})^\omega.

We construct a DFA M=(Q,Σ,δ,q0,F)M = (Q, \Sigma, \delta, q_0, F) where:
- Q={q0,q1,,qm,r1,,rp,l,g}Q = \{q_0, q_1, \dots, q_m, r_1, \dots, r_p, l, g\} where:
  - q0q_0 is the start state, representing no digits read.
  - qiq_i for 1im1 \le i \le m represents that the first ii digits match exactly the first ii digits of γ\gamma.
  - rjr_j for 1jp1 \le j \le p represents the periodic part, phase jj.
  - ll represents that the prefix read is strictly less than the corresponding prefix of γ\gamma.
  - gg represents that the prefix is strictly greater, and is a dead state.
- Σ={0,,9}\Sigma = \{\mathtt{0}, \dots, \mathtt{9}\}.
- The transition function δ\delta is defined as follows:
  - From q0q_0 (start state), upon reading digit dd:
    - If d<d1d < d_1, go to ll.
    - If d=d1d = d_1, go to q1q_1.
    - If d>d1d > d_1, go to gg.
  - From qiq_i for 1i<m1 \le i < m, upon reading digit dd:
    - If d<di+1d < d_{i+1}, go to ll.
    - If d=di+1d = d_{i+1}, go to qi+1q_{i+1}.
    - If d>di+1d > d_{i+1}, go to gg.
  - From qmq_m, upon reading digit dd:
    - If d<dm+1d < d_{m+1} (first digit of period), go to ll.
    - If d=dm+1d = d_{m+1}, go to r1r_1.
    - If d>dm+1d > d_{m+1}, go to gg.
  - From rjr_j for 1jp1 \le j \le p, upon reading digit dd:
    - If d<dm+jd < d_{m+j} (or pjp_j), go to ll.
    - If d=dm+jd = d_{m+j}, go to rj+1r_{j+1} if j<pj < p, or to r1r_1 if j=pj = p.
    - If d>dm+jd > d_{m+j}, go to gg.
  - From ll, upon reading any digit, remain in ll.
  - From gg, upon reading any digit, remain in gg.
- The accepting states F=Q{g}F = Q \setminus \{g\}, since:
  - If the automaton is in ll, the prefix is strictly less than γ\gamma's prefix, so 0.w<γ0.w < \gamma.
  - If in qiq_i or rjr_j, the prefix matches so far, and since γ\gamma may have infinite expansion or finite, but in all cases 0.wγ0.w \le \gamma for finite ww.
  - The start state q0q_0 accepts the empty string ϵ\epsilon since (0.ϵ)10=0γ(0.\epsilon)_{10} = 0 \le \gamma.

This DFA has finitely many states and recognizes LγL_\gamma, so LγL_\gamma is regular.

Subproblem b (/5.0P)

Which of the following properties are necessary conditions for LγL_\gamma to be regular? Choose all that apply. For the first option you selected, prove that it is indeed a necessary condition. You do not need to prove that the options you have not selected are not necessary
xx is a decimal fractionxx is rationalxx is algebraicxx is computable
Assume that Lγ L_\gamma  is regular. Then there exists a DFA M=(Q,Σ,δ,q0,F) M = (Q, \Sigma, \delta, q_0, F)  with finitely many states that recognizes Lγ L_\gamma .

Let s=d1d2d3 s = d_1 d_2 d_3 \dots  be the decimal expansion of γ \gamma . For each nN n \in \mathbb{N} , the prefix sn=d1d2dn s_n = d_1 d_2 \dots d_n  is in Lγ L_\gamma  because (0.sn)10γ (0.s_n)_{10} \leq \gamma .

Consider the sequence of states q0,q1,q2, q_0, q_1, q_2, \dots  where q0 q_0  is the start state, and qk=δ(q0,sk) q_k = \delta(q_0, s_k)  for k1 k \geq 1 . Since Q Q  is finite, by the pigeonhole principle, there exist indices m<n m < n  such that qm=qn q_m = q_n .

Let u=s1s2sm u = s_1 s_2 \dots s_m  and v=sm+1sm+2sn v = s_{m+1} s_{m+2} \dots s_n , so v=nm>0 |v| = n - m > 0 . Since qm=qn q_m = q_n , it follows that δ(q0,u)=δ(q0,uv) \delta(q_0, u) = \delta(q_0, u v) .

Now, consider the infinite suffix w w  such that γ=(0.uvw)10 \gamma = (0.u v w)_{10} . Since γ \gamma  is irrational (for contradiction), its decimal expansion is not eventually periodic. Therefore, there exists a finite string x x  such that:
- (0.ux)10>γ (0.u x)_{10} > \gamma , so uxLγ u x \notin L_\gamma , and thus M M  does not accept ux u x .
- But (0.uvx)10<γ (0.u v x)_{10} < \gamma  (since v v  is part of the prefix and x x  can be chosen appropriately; for example, if x x  is a prefix of w w , then (0.uvx)10γ (0.u v x)_{10} \leq \gamma , but since γ \gamma  is irrational, we can find x x  where (0.uvx)10<γ (0.u v x)_{10} < \gamma  and (0.ux)10>γ (0.u x)_{10} > \gamma  by exploiting the difference in length between u u  and uv u v ).

However, since δ(q0,u)=δ(q0,uv) \delta(q_0, u) = \delta(q_0, u v) , the state after reading u u  and after reading uv u v  is the same. Therefore, for any string y y , M M  accepts uy u y  if and only if M M  accepts uvy u v y . In particular, for y=x y = x , M M  accepts ux u x  if and only if M M  accepts uvx u v x .

But from above, (0.ux)10>γ (0.u x)_{10} > \gamma  implies uxLγ u x \notin L_\gamma , so M M  does not accept ux u x , and thus does not accept uvx u v x . However, (0.uvx)10<γ (0.u v x)_{10} < \gamma  implies uvxLγ u v x \in L_\gamma , so M M  should accept uvx u v x . This is a contradiction.

Therefore, the assumption that γ \gamma  is irrational must be false. Hence, γ \gamma  is rational.

google/gemini-2.5-pro

Exercise 4: Really regular

Let Σ:={0,...,9}\Sigma:=\{\mathtt{0},...,\mathtt{9}\}. For words u,vΣu,v\in\Sigma^* we denote by (u.v)10:=(u)10+10v(v)10(u\mathtt{.}v)_{10}:=(u)_{10}+10^{-|v|}\cdot(v)_{10} the value of a decimal fraction, so for example (1.75)10=74(\mathtt{1.75})_{10}=\tfrac{7}{4}.

Let γR\gamma\in\mathbb{R}, 0γ<10\le\gamma<1 and define Lγ:={wΣ:(0.w)10γ}L_\gamma:=\{w\in\Sigma^*:(\texttt{0.}w)_{10}\le\gamma\}.

Subproblem a (/5.0P)

Which of the following properties are sufficient conditions for LγL_\gamma to be regular? Choose all that apply. For the last option you selected, prove that it is indeed a sufficient condition. You do not need to prove that the options you have not selected are not sufficient.
xx is a decimal fractionxx is rationalxx is algebraicxx is computable
The last option selected is that "xx is rational" is a sufficient condition for LγL_\gamma to be regular. We will now prove this.

Proof that if γ\gamma is rational, then LγL_\gamma is regular.

Let γ[0,1)\gamma \in [0, 1) be a rational number. We want to show that the language Lγ={wΣ(0.w)10γ}L_\gamma = \{w \in \Sigma^* \mid (\mathtt{0.}w)_{10} \le \gamma\} is regular.

1. Reformulating the language condition

A word w=w1w2wkΣkw = w_1w_2\dots w_k \in \Sigma^k is in LγL_\gamma if and only if its value as a decimal fraction is less than or equal to γ\gamma.
(0.w)10γ(\mathtt{0.}w)_{10} \le \gamma
This is equivalent to:
(w)1010kγ    (w)1010kγ\frac{(w)_{10}}{10^k} \le \gamma \iff (w)_{10} \le 10^k \gamma
Since (w)10(w)_{10} is an integer, this inequality is equivalent to:
(w)1010kγ(w)_{10} \le \lfloor 10^k \gamma \rfloor
Let d=0.d1d2d3d = 0.d_1d_2d_3\dots be the standard decimal expansion of γ\gamma, which is the unique expansion that does not end in an infinite sequence of 9s. Then, for any k1k \ge 1, the integer part of 10kγ10^k \gamma is given by the first kk digits of this expansion:
10kγ=(d1d2dk)10\lfloor 10^k \gamma \rfloor = (d_1d_2\dots d_k)_{10}
Thus, the condition for wΣkw \in \Sigma^k to be in LγL_\gamma becomes:
(w)10(d1d2dk)10(w)_{10} \le (d_1d_2\dots d_k)_{10}
This inequality between two kk-digit numbers is equivalent to the lexicographical comparison of the corresponding strings ww and d1d2dkd_1d_2\dots d_k. That is:
wlexd1d2dkw \le_{lex} d_1d_2\dots d_k
For the empty word ϵ\epsilon, (0.ϵ)10=0γ(\mathtt{0.}\epsilon)_{10}=0 \le \gamma, so ϵLγ\epsilon \in L_\gamma. Our definition needs to include this case, which corresponds to k=0k=0.

So, the language LγL_\gamma can be expressed as:
Lγ={wΣwlexd1d2dw}L_\gamma = \{w \in \Sigma^* \mid w \le_{lex} d_1d_2\dots d_{|w|}\}
where d1d2dwd_1d_2\dots d_{|w|} is the prefix of length w|w| of the decimal expansion of γ\gamma.

2. Constructing a DFA for LγL_\gamma

Since γ\gamma is a rational number, its decimal expansion d=d1d2d3d=d_1d_2d_3\dots is eventually periodic. This means there exist integers N0N \ge 0 (the length of the pre-period) and P1P \ge 1 (the length of the period) such that for all i>Ni > N, di=di+Pd_i = d_{i+P}.

We can construct a Deterministic Finite Automaton (DFA) MM that recognizes LγL_\gamma. The DFA processes an input word ww from left to right, comparing it with the corresponding prefix of dd. The states of the DFA will keep track of whether the prefix of ww read so far is lexicographically smaller than, equal to, or greater than the corresponding prefix of dd.

The set of states QQ includes:
*   States p0,p1,,pN+P1p_0, p_1, \dots, p_{N+P-1} to track matching prefixes of dd. The automaton is in state pip_i after having read a prefix of ww that is equal to d1did_1\dots d_i. State p0p_0 is the start state, corresponding to the empty prefix.
*   An accepting sink state p<p_{<}, reached when a prefix of ww is found to be lexicographically smaller than the corresponding prefix of dd.
*   A non-accepting sink state (trap state) p>p_{>}, reached when a prefix of ww is found to be lexicographically greater than the corresponding prefix of dd.

The DFA components are M=(Q,Σ,δ,p0,F)M = (Q, \Sigma, \delta, p_0, F):
*   States: Q={p0,p1,,pN+P1,p<,p>}Q = \{p_0, p_1, \dots, p_{N+P-1}, p_{<}, p_{>}\}. The finiteness of this set is guaranteed by the eventual periodicity of dd.
*   Alphabet: Σ={0,,9}\Sigma = \{\mathtt{0}, \dots, \mathtt{9}\}.
*   Start State: p0p_0.
*   Final States: F=Q{p>}={p0,p1,,pN+P1,p<}F = Q \setminus \{p_{>}\} = \{p_0, p_1, \dots, p_{N+P-1}, p_{<}\}. A word ww belongs to LγL_\gamma if and only if it is not lexicographically greater than d1dwd_1\dots d_{|w|}. Thus, any state that does not represent this "greater than" condition is an accepting state.
*   Transition Function δ\delta:
    The transitions from the "equal track" states pip_i are defined by comparing the input symbol with the next expected digit from the expansion of γ\gamma.
    
    For i{0,,N+P2}i \in \{0, \dots, N+P-2\}: for any digit cΣc \in \Sigma,
    δ(pi,c)={pi+1if c=di+1p<if c<di+1p>if c>di+1 \delta(p_i, c) = \begin{cases} p_{i+1} & \text{if } c = d_{i+1} \\ p_{<} & \text{if } c < d_{i+1} \\ p_{>} & \text{if } c > d_{i+1} \end{cases} 
    The transitions from pN+P1p_{N+P-1} loop back into the periodic part of the state machine. The next digit to match is dN+Pd_{N+P}, and after that it's dN+P+1=dN+1d_{N+P+1}=d_{N+1}. The state corresponding to having matched up to dN+P1d_{N+P-1} and then matching dN+Pd_{N+P} should be followed by a state that tries to match dN+1d_{N+1}. This is handled by identifying states pip_i and pi+Pp_{i+P} for i>Ni>N. A simpler way to view the transitions is that from state pN+P1p_{N+P-1}, a match on dN+Pd_{N+P} should lead to a state that will then match dN+1d_{N+1}. This state is pNp_N, since after matching d1dNd_1\dots d_N, the next digit to match is dN+1d_{N+1}. A more formal definition using state indices:
    δ(pN+P1,c)={pNif c=dN+P and N=0,P=1pN+P (identified with pN)?No. \delta(p_{N+P-1}, c) = \begin{cases} p_{N} & \text{if } c = d_{N+P} \text{ and } N=0, P=1 \\ p_{N+P} \text{ (identified with } p_N\text{)} ? No. \end{cases}
    Let's refine the states. Q={p0,,pN+P1,pS,pG}Q = \{p_0, \dots, p_{N+P-1}, p_S, p_G\}.
    δ(pi,c)\delta(p_i,c) for i<N+P1i<N+P-1: pi+1p_{i+1} on c=di+1c=d_{i+1}, pSp_S on c<di+1c<d_{i+1}, pGp_G on c>di+1c>d_{i+1}.
    For the last state in the chain, pN+P1p_{N+P-1}, the next digit is dN+Pd_{N+P}, and because N+P>NN+P > N, dN+P=d(N1+1)+P1d_{N+P}=d_{(N-1+1)+P-1} \dots. Let's use the property dk=dk+Pd_{k}=d_{k+P} for k>Nk > N.
    The next digit after did_i is di+1d_{i+1}.
    The state pip_i has matched d1did_1\dots d_i. It expects di+1d_{i+1}.
    The state pN+P1p_{N+P-1} expects dN+Pd_{N+P}. A match on dN+Pd_{N+P} means the prefix is d1dN+Pd_1\dots d_{N+P}. The next expected digit is dN+P+1=dN+1d_{N+P+1}=d_{N+1}. So the next state should be one that prepares for matching dN+1d_{N+1}. This corresponds to a state that represents the prefix d1dNd_1\dots d_N if followed by a periodic part. The state pNp_N does exactly this.
    Thus, from pN+P1p_{N+P-1} on input c=dN+Pc=d_{N+P}, we transition to state pNp_{N}.
    δ(pN+P1,c)={pNif c=dN+Pp<if c<dN+Pp>if c>dN+P \delta(p_{N+P-1}, c) = \begin{cases} p_N & \text{if } c = d_{N+P} \\ p_{<} & \text{if } c < d_{N+P} \\ p_{>} & \text{if } c > d_{N+P} \end{cases} 
    For the sink states: for any digit cΣc \in \Sigma,
    δ(p<,c)=p<andδ(p>,c)=p> \delta(p_{<}, c) = p_{<} \quad \text{and} \quad \delta(p_{>}, c) = p_{>} 

3. Conclusion

The constructed automaton MM is a DFA with a finite number of states because the decimal expansion of the rational number γ\gamma is eventually periodic. This DFA accepts exactly the words ww such that wlexw \le_{lex} the prefix of dd of length w|w|, which is precisely the language LγL_\gamma. Therefore, if γ\gamma is rational, LγL_\gamma is a regular language.

Subproblem b (/5.0P)

Which of the following properties are necessary conditions for LγL_\gamma to be regular? Choose all that apply. For the first option you selected, prove that it is indeed a necessary condition. You do not need to prove that the options you have not selected are not necessary
xx is a decimal fractionxx is rationalxx is algebraicxx is computable
The first option selected is that "γ\gamma is rational" is a necessary condition for LγL_\gamma to be regular. We will now prove this.

Proof that if LγL_\gamma is regular, then γ\gamma must be rational.

We will prove the contrapositive: if γ\gamma is irrational, then LγL_\gamma is not regular. We will use the Myhill-Nerode theorem, which states that a language is regular if and only if its Myhill-Nerode equivalence relation has a finite number of equivalence classes.

1. The Myhill-Nerode equivalence relation for LγL_\gamma

The language is Lγ={wΣ(0.w)10γ}L_\gamma = \{w \in \Sigma^* \mid (\mathtt{0.}w)_{10} \le \gamma\}. The Myhill-Nerode equivalence relation Lγ\equiv_{L_\gamma} for this language is defined for two words u,vΣu, v \in \Sigma^* as:
uLγv    (zΣ,uzLγ    vzLγ)u \equiv_{L_\gamma} v \iff (\forall z \in \Sigma^*, uz \in L_\gamma \iff vz \in L_\gamma)

Let's analyze the condition wLγw \in L_\gamma. Let w=k|w| = k.
(0.w)10=(w)1010k(\mathtt{0.}w)_{10} = (w)_{10} \cdot 10^{-k}.
The condition uzLγuz \in L_\gamma can be written as (0.uz)10γ(\mathtt{0.}uz)_{10} \le \gamma.
Let u=ku|u|=k_u and z=kz|z|=k_z. Then uz=ku+kz|uz| = k_u+k_z.
(0.uz)10=(u)1010ku+(z)1010(ku+kz)=(0.u)10+(0.z)1010ku(\mathtt{0.}uz)_{10} = (u)_{10} \cdot 10^{-k_u} + (z)_{10} \cdot 10^{-(k_u+k_z)} = (\mathtt{0.}u)_{10} + (\mathtt{0.}z)_{10} \cdot 10^{-k_u}.
So, uzLγ    (0.u)10+(0.z)1010kuγuz \in L_\gamma \iff (\mathtt{0.}u)_{10} + (\mathtt{0.}z)_{10} \cdot 10^{-k_u} \le \gamma.
This is equivalent to:
(0.z)1010ku(γ(0.u)10)(\mathtt{0.}z)_{10} \le 10^{k_u}(\gamma - (\mathtt{0.}u)_{10})
Similarly, for a word vv with v=kv|v|=k_v:
vzLγ    (0.z)1010kv(γ(0.v)10)vz \in L_\gamma \iff (\mathtt{0.}z)_{10} \le 10^{k_v}(\gamma - (\mathtt{0.}v)_{10})

For uLγvu \equiv_{L_\gamma} v to hold, the conditions on (0.z)10(\mathtt{0.}z)_{10} must be equivalent for all zΣz \in \Sigma^*. The set of values {(0.z)10zΣ}\{(\mathtt{0.}z)_{10} \mid z \in \Sigma^*\} is the set of non-negative terminating decimal fractions, which is a dense subset of R0\mathbb{R}_{\ge 0}. If for any A,BRA, B \in \mathbb{R}, we have (x{(0.z)10},xA    xB)(\forall x \in \{(\mathtt{0.}z)_{10}\}, x \le A \iff x \le B), then due to the denseness, we must have A=BA=B.
Therefore, uLγvu \equiv_{L_\gamma} v if and only if:
10u(γ(0.u)10)=10v(γ(0.v)10)10^{|u|}(\gamma - (\mathtt{0.}u)_{10}) = 10^{|v|}(\gamma - (\mathtt{0.}v)_{10})
Let's define a function f(w)=10w(γ(0.w)10)f(w) = 10^{|w|}(\gamma - (\mathtt{0.}w)_{10}). Two words u,vu,v are equivalent if and only if f(u)=f(v)f(u) = f(v). The number of equivalence classes is the size of the image of ff. For LγL_\gamma to be regular, this set of values must be finite.

2. Showing an infinite number of equivalence classes for irrational γ\gamma

Let γ\gamma be an irrational number in [0,1)[0, 1). Let its unique (non-terminating) decimal expansion be γ=0.d1d2d3\gamma = 0.d_1d_2d_3\dots.
Consider the sequence of words wn=d1d2dnw_n = d_1d_2\dots d_n for n=1,2,3,n = 1, 2, 3, \dots. These are the prefixes of the decimal expansion of γ\gamma.
Let's compute the value of f(wn)f(w_n):
f(wn)=10n(γ(0.d1dn)10)f(w_n) = 10^n(\gamma - (\mathtt{0.}d_1\dots d_n)_{10})
We have (0.d1dn)10=i=1ndi10i(\mathtt{0.}d_1\dots d_n)_{10} = \sum_{i=1}^n d_i 10^{-i}.
Also, γ=i=1di10i=i=1ndi10i+i=n+1di10i\gamma = \sum_{i=1}^\infty d_i 10^{-i} = \sum_{i=1}^n d_i 10^{-i} + \sum_{i=n+1}^\infty d_i 10^{-i}.
So, γ(0.d1dn)10=i=n+1di10i=10nj=1dn+j10j=10n(0.dn+1dn+2)10\gamma - (\mathtt{0.}d_1\dots d_n)_{10} = \sum_{i=n+1}^\infty d_i 10^{-i} = 10^{-n} \sum_{j=1}^\infty d_{n+j} 10^{-j} = 10^{-n} \cdot (0.d_{n+1}d_{n+2}\dots)_{10}.
Therefore,
f(wn)=10n(10n(0.dn+1dn+2)10)=(0.dn+1dn+2)10f(w_n) = 10^n \cdot (10^{-n} \cdot (0.d_{n+1}d_{n+2}\dots)_{10}) = (0.d_{n+1}d_{n+2}\dots)_{10}
This is the value of the "tail" of the decimal expansion of γ\gamma starting after the nn-th digit.

For LγL_\gamma to be regular, the set {f(wn)nN}\{f(w_n) \mid n \in \mathbb{N}\} must be finite. This means there must exist two distinct integers n<mn < m such that f(wn)=f(wm)f(w_n) = f(w_m).
This implies:
(0.dn+1dn+2)10=(0.dm+1dm+2)10(0.d_{n+1}d_{n+2}\dots)_{10} = (0.d_{m+1}d_{m+2}\dots)_{10}
This means the sequence of digits of the decimal expansion of γ\gamma must be the same from the (n+1)(n+1)-th position as from the (m+1)(m+1)-th position. In other words, for all k1k \ge 1, dn+k=dm+kd_{n+k} = d_{m+k}. This shows that the decimal expansion of γ\gamma is eventually periodic (with a pre-period of length nn and a period of length mnm-n).

A real number has an eventually periodic decimal expansion if and only if it is rational.
So, if the set of values {f(wn)}\{f(w_n)\} is finite, γ\gamma must be rational.

Since we assumed γ\gamma is irrational, its decimal expansion is not eventually periodic. Therefore, all the tails (0.dn+1dn+2)10(0.d_{n+1}d_{n+2}\dots)_{10} are distinct for all n0n \ge 0. This means all values f(wn)f(w_n) are distinct.
The infinite sequence of words w1,w2,w3,w_1, w_2, w_3, \dots thus produces an infinite sequence of distinct values f(w1),f(w2),f(w3),f(w_1), f(w_2), f(w_3), \dots. This implies that each wnw_n belongs to a different Myhill-Nerode equivalence class.

3. Conclusion

If γ\gamma is irrational, there are infinitely many Myhill-Nerode equivalence classes for LγL_\gamma. By the Myhill-Nerode theorem, this implies that LγL_\gamma is not a regular language.
Therefore, for LγL_\gamma to be regular, it is a necessary condition that γ\gamma be a rational number.

openai/gpt-5

Exercise 4: Really regular

Let Σ:={0,...,9}\Sigma:=\{\mathtt{0},...,\mathtt{9}\}. For words u,vΣu,v\in\Sigma^* we denote by (u.v)10:=(u)10+10v(v)10(u\mathtt{.}v)_{10}:=(u)_{10}+10^{-|v|}\cdot(v)_{10} the value of a decimal fraction, so for example (1.75)10=74(\mathtt{1.75})_{10}=\tfrac{7}{4}.

Let γR\gamma\in\mathbb{R}, 0γ<10\le\gamma<1 and define Lγ:={wΣ:(0.w)10γ}L_\gamma:=\{w\in\Sigma^*:(\texttt{0.}w)_{10}\le\gamma\}.

Subproblem a (/5.0P)

Which of the following properties are sufficient conditions for LγL_\gamma to be regular? Choose all that apply. For the last option you selected, prove that it is indeed a sufficient condition. You do not need to prove that the options you have not selected are not sufficient.
xx is a decimal fractionxx is rationalxx is algebraicxx is computable
We prove: if γ is rational, then L_γ is regular.

Fix the (unique) decimal expansion of γ that is not eventually 9, so γ = 0.b₁…b_N (c₁…c_p)^ω for some N ≥ 0, p ≥ 1, with digits b_i, c_j ∈ {0,…,9} and the period (c₁…c_p) not equal to 9…9.

Construction of a DFA recognizing L_γ:
- States:
  * “equal” states that remember the position in γ’s digit stream:
    - eq(1), …, eq(N) for the preperiod,
    - eq(N,0), …, eq(N,p−1) for the periodic phase (index modulo p),
  * an absorbing accepting state LESS,
  * an absorbing rejecting state GREATER.
- Start state: eq(1) (or eq(N,0) if N=0).
- Accepting states: LESS and all eq(·).
- Transitions on reading a digit d:
  * From LESS: stay in LESS on any d.
  * From GREATER: stay in GREATER on any d.
  * From eq(i), 1 ≤ i ≤ N: compare d with b_i:
    - if d < b_i, go to LESS;
    - if d > b_i, go to GREATER;
    - if d = b_i, go to eq(i+1) (with eq(N+1) understood as eq(N,0)).
  * From eq(N,k), 0 ≤ k ≤ p−1: let expected digit be c_{k+1} (with indices modulo p):
    - if d < c_{k+1}, go to LESS;
    - if d > c_{k+1}, go to GREATER;
    - if d = c_{k+1}, go to eq(N,(k+1) mod p).

Correctness:
- If the first position where the input’s digit differs from γ’s digit is k and the input digit there is smaller, then any continuation yields a value ≤ γ. Indeed, the maximum tail the input can add is ∑_{i>k} 9/10^i = 1/10^k, so 0.w ≤ ∑_{i<k} b_i/10^i + (b_k−1)/10^k + 1/10^k = ∑_{i≤k} b_i/10^i ≤ γ.
- If at that first differing position the input digit is larger, then 0.w ≥ ∑_{i≤k} b_i/10^i + 1/10^k > γ, where the strict inequality holds because we chose γ’s expansion not eventually 9, so its tail beyond k is strictly less than 1/10^k.
- If no difference occurs within the length of the input, then the input equals a prefix of γ’s digits, hence its value is ≤ γ.

The DFA exactly implements these three cases with finitely many states (only N+p index-tracking “equal” states plus two sinks). Therefore L_γ is regular.

Subproblem b (/5.0P)

Which of the following properties are necessary conditions for LγL_\gamma to be regular? Choose all that apply. For the first option you selected, prove that it is indeed a necessary condition. You do not need to prove that the options you have not selected are not necessary
xx is a decimal fractionxx is rationalxx is algebraicxx is computable
We prove: if L_γ is regular, then γ is rational.

Fix the unique decimal expansion of γ that is not eventually 9:
γ = 0.a₁a₂a₃… with a_i ∈ {0,…,9}.
For a prefix p = a₁…a_k of this expansion, write suf(p) = a_{k+1}a_{k+2}… for the infinite tail.

Claim. If p is a prefix of γ’s digits, then for every finite word x,
(0.px)_{10} ≤ γ  iff  x ≤_lex suf(p).
Justification: comparing (0.px) to γ reduces to the first position where x and suf(p) differ; the choice of the non-9 expansion guarantees strict separation when the first differing digit is larger.

Assume L_γ is recognized by a DFA M. Let q_k be the state reached after reading the prefix a₁…a_k. Since M has finitely many states, there exist i<j with q_i = q_j. Then for all x ∈ Σ*,
a₁…a_i x ∈ L_γ  iff  a₁…a_j x ∈ L_γ.
By the claim, this means for all x,
x ≤_lex suf(a₁…a_i)  iff  x ≤_lex suf(a₁…a_j).
The set {x : x ≤_lex β} determines the infinite word β uniquely when the expansion is not eventually 9; hence suf(a₁…a_i) = suf(a₁…a_j). Therefore the digit sequence a₁a₂… is ultimately periodic with period p = j−i, so γ has an ultimately periodic decimal expansion and is rational.

Consequences. Since rational numbers are algebraic and computable, options 3 and 4 are also necessary.