<p>This language is in $ \mathsf{SL}^=_\mathbb{Q} $, the class of co-exclusive rational stochastic language (<a href="http://arxiv.org/abs/0902.2081" rel="nofollow">YS10</a>). (More details were added below as Appendix 1!)</p>

<p>A language L is in $ \mathsf{SL}^=_\mathbb{Q} $ if there exists a probabilistic finite automaton (PFA) $P$ defined with only rational numbers such that every member is accepted by $P$ with probability $ 1 \over 2 $ and every non-member is accepted by $P$ with probability different than $ 1 \over 2 $.</p>

<p>$ \mathsf{SL}^=_\mathbb{Q} $ is also exactly characterized by</p>

<ul>
<li>realtime universal quantum finite automata (you can think as the "complement" of realtime nondeterministic quantum automata (<a href="http://arxiv.org/abs/0902.2081" rel="nofollow">YS10</a>)),</li>
<li>realtime deterministic blind vector automata (<a href="http://arxiv.org/abs/1303.6129" rel="nofollow">SYS13</a>), and</li>
<li>realtime (negative) one-sided bounded-error affine automata (<a href="http://arxiv.org/abs/1602.05432" rel="nofollow">VY16</a>),
where all machines are defined with rational numbers.</li>
</ul>

<hr>

<p>Your language can also be recognized by realtime universal one-counter automaton and realtime private alternating finite automaton (<a href="http://arxiv.org/abs/1407.0334" rel="nofollow">DHRSY</a>), deterministic set automata (<a href="https://dlt2014.sciencesconf.org/conference/dlt2014/pages/Session_1_Malcher.pdf" rel="nofollow">KMW</a>), and one-way deterministic 2-head finite automata.</p>

<p>Currently these are the ones that I could remember! </p>

<hr>

<p><strong>Appendix 1:</strong> More details on $ \mathsf{SL^=_\mathbb{Q}} $. Here I use another model, which is simpler than PFA to program in our case.</p>

<p>An $n$-state Turakainen finite automaton (TuFA) $ T $ is a 5 tuple $$ T = (S,\Sigma,\{A_\sigma \mid \sigma \in \Sigma\},v_0,f), $$
where</p>

<ul>
<li>$ S = \{s_1,\ldots,s_n\}$ is the set of states,</li>
<li>$ \Sigma $ is the input alphabet,</li>
<li>$ A_\sigma \in \mathbb{Q}^{n \times n} $ is the transition matrix for symbol $ \sigma \in \Sigma $,</li>
<li>$  v_0  $ is the initial state, and</li>
<li>$ f $ is the final vector.</li>
</ul>

<p>For a given input $ w \in \Sigma^* $, the accepting value of $ T $ on $ w $ is given by 
$$  f_T(w) = f A_{w_{|w|}} \cdots A_{w_2} A_{w_1} v_0, $$ 
where $ w_i $ is the $i$-th symbol of $ w $. (Remark that $ f_T(w) \in \mathbb{Q} $.) In the other words, $ T $ starts its computation in $ v_0 $ and then read $ w $ from the left to the right symbol by symbol and for each symbol it applies the corresponding transition matrix. At the end, it takes inner product of the final state with the final vector and it gives the accepting value (it can also be seen as a weighted sum of the entries in the final state).</p>

<p>There exists a TuFA $ T $ that defines the language $ L = \{ w \in \Sigma^* \mid f_T(w) = 0 \} $ if and only if $ L \in \mathsf{SL^=} $.</p>

<p>By using a TuFA, you can encode a binary string. Let $ w \in \{0,1\}^* $ be a given binary string and $ e(w) = 1w $ be its encoding.</p>

<p>The initial state is $ ( 1 ,1 ) $. For symbols 0 and 1, it applies the transition matrices
$$ A_0 = \left( \begin{array}{cc} 1 &amp; 0 \\ 2 &amp; 0 \end{array} \right) \mbox{ and } A_1 = \left( \begin{array}{cc} 1 &amp; 0 \\ 2 &amp; 1 \end{array} \right), $$ respectively. </p>

<p>After reading $ w $, the new state vector is $ (1,e(w)) $. Then, if it reads symbol 0, then the new state becomes $ (1,2e(w)) = (1,e(w0)) $; and, if it reads symbol 1, then the new state becomes $ (1,2e(w)+1) = (1,e(w1)) $.</p>

<p>The language $ \mathtt{TWIN} = \{ w \# w \mid w \in \{0,1\}^* \} $ is in $ \mathsf{SL^=} $. We can design a TuFA using the above encoding. Let $ w_1 \# w_2 $ be the given input. Otherwise, set the accepting value to a nonzero value. Encode $ w_1 $ and $ w_2 $ in the values of two states and then set the accepting value to $ e(w_1) - e(w_2) $. Thus, $ f_T(w_1 \# w_2) = 0 $ if and only if $ w_1 = w_2 $.</p>

<p>If we tensor $ T $ with itself, then we can also set the accepting value to $ (e(w_1) - e(w_2))^2 $. In fact, one can easily play with different combinations.</p>

<p>Let $ \mathtt{COPIES} = \{ (w\#)^k \mid w \in \{0,1\}^*, k \geq 1 \} $. We design a TuFA $T$ for $ \mathtt{COPIES} $. It is trivial to detect $ k=1 $. Let $ w_1 \# w_2 \# \cdots \# w_k \# $ be the given input for some $ k &gt;1 $. Encode $ w_1 $ into the value of a state and keep it until end of the computation. Also reserve the value of a state for the accepting values, which is zero at the beginning. After reading $ w_i $ ($ 2 \leq k \leq k $), add $ (e(w_1)-e(w_i))^2 $ to the accepting value. The accepting value ends with 0 for any member and with some positive integers for any non-member. More precisely, 
$$ f_T(w_1 \# w_2 \# \cdots \# w_k) = \sum_{i = 2}^k (e(w_1)-e(w_i))^2 $$.</p>

<p>Therefore, $ \mathtt{COPIES} $ is in $ \mathsf{SL^=} $.</p>

CC BY-SA 3.0
2016-10-03T22:01:52.293Z
thanks for your answer. But I have to admit that, except for the 2 head finite automata, I don't understand how the other models can be used to accept the language of the question. Would you be kind to add some comment on what do the $SL^=_Q$ machine does to accept the language?
verifying
CC BY-SA 3.0
2016-10-06T16:24:01.197Z
I added some explanations for $ \mathsf{SL_\mathbb{Q}^=} $. I hope it would be sufficient to follow the missing details.
Abuzer Yakaryilmaz
CC BY-SA 3.0
2016-09-21T11:18:01.663Z
2016-10-06T16:21:54.340Z
2016-10-06T16:21:54.340Z
Abuzer Yakaryilmaz
<p>Just to refine Abuzer's answer, the language can also be recognized by a
<strong>Stateless 2-head 1-way DFA</strong> which is usually defined in this way [Ibarra et al., On stateless multihead automata: hierarchies and the emptiness problem (2010)]:</p>

<p>For an input string $w \in \Sigma$, machines work on a tape containing $\text{^} w \$$ and
start with all heads on the left end marker. At every step of the computation,
the symbols $a_1,..., a_k$ currently scanned by all $k$ heads are considered, any
corresponding transition $a_1,...,a_k \to d_1,...,d_k \in \delta, a_i \in \Sigma \cup \{\text{^}, \$\}$ is chosen, and each $i$-th heads is moved according to $d_i \in \{ Stay, Right \}$. If no such transition exists, the automaton rejects. If any of the heads falls off the tape, the automaton rejects as well.
If the transition instructs all heads to <em>Stay</em>, the automaton halts and accepts. The string is accepted if there exists a computation resulting in acceptance.</p>

<p>If $\Sigma = \{0,1,\#\}$, then your language is recognized by the following Stateless 2-head 1-way DFA:</p>

<pre><code>   ^   ,  ^   -&gt; S , R
   ^   ,{0,1} -&gt; S , R
   ^   ,  #   -&gt; R , R
   0   ,  0   -&gt; R , R
   1   ,  1   -&gt; R , R
   #   ,  #   -&gt; R , R
{0,1,#},  $   -&gt; S , S
</code></pre>

CC BY-SA 3.0
2016-09-22T12:40:23.993Z
2016-09-23T06:40:26.137Z
2016-09-23T06:40:26.137Z
Marzio De Biasi
<p>What is the simplest machine model accepting the following language? </p>

<p>$$ L = \{(w\# )^{k}\;|\; w\in \Sigma^{*},\;k\in \mathbb{N}\}$$</p>

<p>In other words, $L$ is obtained by taking each string $w$ in $\Sigma^*$, 
and then creating the strings $w\#\;,\; w\#w\#\;,\; w\#w\#w\#\;,...$</p>

<p>Here $\#$ is a separator symbol which is not in $\Sigma$.</p>

<p>The simplest I could think of was queue automata with $2$-queues. But these are already Turing complete. Is there some well studied class of machines that is not Turing complete and accepts $L$? </p>

CC BY-SA 3.0
2016-09-21T17:53:54.537Z
Why do you need two queues? Doesn't a single queue suffice?
Thomas Steinke
<automata-theory>
Simplest Machine Model for a langauge $ L = \{(w\# )^{k}\;|\; w\in \Sigma^{*},\;k\in \mathbb{N}\}$
verifying
# Simplest Machine Model for a langauge $ L = \{(w\# )^{k}\;|\; w\in \Sigma^{*},\;k\in \mathbb{N}\}$

(Asked by: username_0 on 2016-09-21)

What is the simplest machine model accepting the following language?

$$ L = \{(w\# )^{k}\;|\; w\in \Sigma^{\*},\;k\in \mathbb{N}\}$$

In other words, $L$ is obtained by taking each string $w$ in $\Sigma^\*$,
and then creating the strings $w\#\;,\; w\#w\#\;,\; w\#w\#w\#\;,...$

Here $\#$ is a separator symbol which is not in $\Sigma$.

The simplest I could think of was queue automata with $2$-queues. But these are already Turing complete. Is there some well studied class of machines that is not Turing complete and accepts $L$?

**Tags:** automata-theory
> **Comments:**
> **username_1**: Why do you need two queues? Doesn't a single queue suffice?  

---

## 2 answers

### Answer by username_2 on 2016-09-21. Score: 4 | Accepted answer

This language is in $ \mathsf{SL}^=\_\mathbb{Q} $, the class of co-exclusive rational stochastic language ([YS10](http://arxiv.org/abs/0902.2081)). (More details were added below as Appendix 1!)

A language L is in $ \mathsf{SL}^=\_\mathbb{Q} $ if there exists a probabilistic finite automaton (PFA) $P$ defined with only rational numbers such that every member is accepted by $P$ with probability $ 1 \over 2 $ and every non-member is accepted by $P$ with probability different than $ 1 \over 2 $.

$ \mathsf{SL}^=\_\mathbb{Q} $ is also exactly characterized by

* realtime universal quantum finite automata (you can think as the "complement" of realtime nondeterministic quantum automata ([YS10](http://arxiv.org/abs/0902.2081))),
* realtime deterministic blind vector automata ([SYS13](http://arxiv.org/abs/1303.6129)), and
* realtime (negative) one-sided bounded-error affine automata ([VY16](http://arxiv.org/abs/1602.05432)),
  where all machines are defined with rational numbers.

---

Your language can also be recognized by realtime universal one-counter automaton and realtime private alternating finite automaton ([DHRSY](http://arxiv.org/abs/1407.0334)), deterministic set automata ([KMW](https://dlt2014.sciencesconf.org/conference/dlt2014/pages/Session_1_Malcher.pdf)), and one-way deterministic 2-head finite automata.

Currently these are the ones that I could remember!

---

**Appendix 1:** More details on $ \mathsf{SL^=\_\mathbb{Q}} $. Here I use another model, which is simpler than PFA to program in our case.

An $n$-state Turakainen finite automaton (TuFA) $ T $ is a 5 tuple $$ T = (S,\Sigma,\{A\_\sigma \mid \sigma \in \Sigma\},v\_0,f), $$
where

* $ S = \{s\_1,\ldots,s\_n\}$ is the set of states,
* $ \Sigma $ is the input alphabet,
* $ A\_\sigma \in \mathbb{Q}^{n \times n} $ is the transition matrix for symbol $ \sigma \in \Sigma $,
* $ v\_0 $ is the initial state, and
* $ f $ is the final vector.

For a given input $ w \in \Sigma^\* $, the accepting value of $ T $ on $ w $ is given by
$$ f\_T(w) = f A\_{w\_{|w|}} \cdots A\_{w\_2} A\_{w\_1} v\_0, $$
where $ w\_i $ is the $i$-th symbol of $ w $. (Remark that $ f\_T(w) \in \mathbb{Q} $.) In the other words, $ T $ starts its computation in $ v\_0 $ and then read $ w $ from the left to the right symbol by symbol and for each symbol it applies the corresponding transition matrix. At the end, it takes inner product of the final state with the final vector and it gives the accepting value (it can also be seen as a weighted sum of the entries in the final state).

There exists a TuFA $ T $ that defines the language $ L = \{ w \in \Sigma^\* \mid f\_T(w) = 0 \} $ if and only if $ L \in \mathsf{SL^=} $.

By using a TuFA, you can encode a binary string. Let $ w \in \{0,1\}^\* $ be a given binary string and $ e(w) = 1w $ be its encoding.

The initial state is $ ( 1 ,1 ) $. For symbols 0 and 1, it applies the transition matrices
$$ A\_0 = \left( \begin{array}{cc} 1 & 0 \\ 2 & 0 \end{array} \right) \mbox{ and } A\_1 = \left( \begin{array}{cc} 1 & 0 \\ 2 & 1 \end{array} \right), $$ respectively.

After reading $ w $, the new state vector is $ (1,e(w)) $. Then, if it reads symbol 0, then the new state becomes $ (1,2e(w)) = (1,e(w0)) $; and, if it reads symbol 1, then the new state becomes $ (1,2e(w)+1) = (1,e(w1)) $.

The language $ \mathtt{TWIN} = \{ w \# w \mid w \in \{0,1\}^\* \} $ is in $ \mathsf{SL^=} $. We can design a TuFA using the above encoding. Let $ w\_1 \# w\_2 $ be the given input. Otherwise, set the accepting value to a nonzero value. Encode $ w\_1 $ and $ w\_2 $ in the values of two states and then set the accepting value to $ e(w\_1) - e(w\_2) $. Thus, $ f\_T(w\_1 \# w\_2) = 0 $ if and only if $ w\_1 = w\_2 $.

If we tensor $ T $ with itself, then we can also set the accepting value to $ (e(w\_1) - e(w\_2))^2 $. In fact, one can easily play with different combinations.

Let $ \mathtt{COPIES} = \{ (w\#)^k \mid w \in \{0,1\}^\*, k \geq 1 \} $. We design a TuFA $T$ for $ \mathtt{COPIES} $. It is trivial to detect $ k=1 $. Let $ w\_1 \# w\_2 \# \cdots \# w\_k \# $ be the given input for some $ k >1 $. Encode $ w\_1 $ into the value of a state and keep it until end of the computation. Also reserve the value of a state for the accepting values, which is zero at the beginning. After reading $ w\_i $ ($ 2 \leq k \leq k $), add $ (e(w\_1)-e(w\_i))^2 $ to the accepting value. The accepting value ends with 0 for any member and with some positive integers for any non-member. More precisely,
$$ f\_T(w\_1 \# w\_2 \# \cdots \# w\_k) = \sum\_{i = 2}^k (e(w\_1)-e(w\_i))^2 $$.

Therefore, $ \mathtt{COPIES} $ is in $ \mathsf{SL^=} $.

> **Comments:**
> **username_0**: thanks for your answer. But I have to admit that, except for the 2 head finite automata, I don't understand how the other models can be used to accept the language of the question. Would you be kind to add some comment on what do the $SL^=_Q$ machine does to accept the language?  
> **username_2**: I added some explanations for $ \mathsf{SL_\mathbb{Q}^=} $. I hope it would be sufficient to follow the missing details.  

---

### Answer by username_3 on 2016-09-22. Score: 5

Just to refine Abuzer's answer, the language can also be recognized by a
Stateless 2-head 1-way DFA which is usually defined in this way [Ibarra et al., On stateless multihead automata: hierarchies and the emptiness problem (2010)]:
For an input string $w \in \Sigma$, machines work on a tape containing $\text{^} w \$$ and
start with all heads on the left end marker. At every step of the computation,
the symbols $a_1,..., a_k$ currently scanned by all $k$ heads are considered, any
corresponding transition $a_1,...,a_k \to d_1,...,d_k \in \delta, a_i \in \Sigma \cup \{\text{^}, \$\}$ is chosen, and each $i$-th heads is moved according to $d_i \in \{ Stay, Right \}$. If no such transition exists, the automaton rejects. If any of the heads falls off the tape, the automaton rejects as well.
If the transition instructs all heads to Stay, the automaton halts and accepts. The string is accepted if there exists a computation resulting in acceptance.
If $\Sigma = \{0,1,\#\}$, then your language is recognized by the following Stateless 2-head 1-way DFA:
   ^   ,  ^   -> S , R
   ^   ,{0,1} -> S , R
   ^   ,  #   -> R , R
   0   ,  0   -> R , R
   1   ,  1   -> R , R
   #   ,  #   -> R , R
{0,1,#},  $   -> S , S


---

