# Unary Quantum Finite State Automata with Control Language
## 3 Qfa Models Simulations by Qfcs
* \(\Omega=\sum_{i=0}^{\theta-1}a_{i}\cdot\Lambda_{i}+\sum_{i=0}^{\theta-1}b_{i} \cdot\Lambda_{\theta+i_{i}}\) with projectors \(\Lambda_{j}=[\mathbf{0}]_{j\cdot q}\oplus I^{(\theta)}\oplus[\mathbf{0}]_{(2\theta-j -1)\cdot q}\) for \(0\leq j\leq 2\theta-1\) is a \(2\theta\cdot q\times 2\theta\cdot q\) Hermitian matrix representing an observable with the set of outcomes \(C=\bigcup_{i=0}^{\theta-1}\{a_{i},b_{i}\}\); we notice that the projector \(\Lambda_{j}\) resets to zero all blocks in a superposition of \(B\) with the exception of the \((j+1)\)th block. * \(\mathcal{L}\subseteq\mathbb{C}^{*}\) is the regular control language recognized by the dfa \[D=(\{s_{0},\ \ldots,\ s_{\theta-1}\},\ C,\ s_{0},\ \delta,\{s_{0}\})\] for which the transition function is defined for \(0\leq i,j\leq\theta-1\) as \[\delta(s_{i},c)= \begin{cases}s_{j}&\text{if }c=a_{j}\\ s_{(i+j)\bmod\theta}&\text{if }c=b_{j}.\end{cases} \]  
Let us overview the dynamics of \(B\). A superposition of \(B\) is a norm \(1\) vector in \(\mathbb{C}^{2\theta\cdot q}\), which can be seen to be divided into a left half and a right half. Each half consists of \(\theta\) consecutive \(q\)-dimensional blocks. On the input symbol \(\sigma\
eq\sharp\), the matrix \(Y(\sigma)\) replicates in the left half the corresponding evolution step of the simulated lqfa\(A\) together with all the \(\sigma_{\sigma}\) many projections arising from measuring \(\mathcal{O}_{\sigma}\) and stores all such resulting projection vectors into the \(\theta\) many blocks of the left half of the superposition. At the same time,\(Y(\sigma)\) leaves the right half of the superposition unchanged. The endmarker evolution \(Y(\sharp)\) behaves similarly plus swaps the left half with the right half of the superposition. It is not hard to see that measuring the observable \(\Omega\) along processing _before_\(\sharp\) basically takes place on the left half of superpositions, and outcomes of the form \(a_{i}\) are always returned. On the other hand, measuring \(\Omega\) after evolving on \(\sharp\) basically takes place on the right half of superpositions, and always outcomes of the form \(b_{i}\) are returned. Clearly, this latter fact enables the classical component of \(B\), i.e., the dfa\(D\), to detect the moment in which the quantum component of \(B\) has parsed the endmarker \(\sharp\). We now formally show that \(\mathcal{E}_{B}=p_{A}\). By Equation (9), the probability for \(B\) to accept the word \(x=x_{1}\cdots x_{n}\in\Sigma^{*}\) is  
\[\mathcal{E}_{B}(x)=\sum_{a_{i_{1}}\cdots a_{i_{n}}b_{f}\in\mathcal{K}}\left\| \phi\cdot\left(\prod_{j=1}^{n}Y(x_{j})\cdot\Lambda_{i_{j}}\right)\cdot Y(\sharp )\cdot\Lambda_{f}\right\|^{2}. \tag{10}\]  
To process Equation (10), we observe that:  
* The operator \(Y(\sigma)\cdot\Lambda_{s}\) in the product of (10) acts on the \((r+1)\)th \(q\)-dimensional block of the current superposition of \(B\) and _(i)_ transforms the block by the matrix \(U(\sigma)\cdot P_{(r+s)\bmod\theta}(\sigma)\), and then _(ii)_ it moves the transformed block to the \((s+1)\)th block position. To formally explain the action of the operator \(Y(\sigma)\cdot\Lambda_{s}\), assume that the \((r+1)\)th \(q\)-dimensional block is the row vector \(\xi\in\mathbb{C}^{q}\). Then, we have \[(\mathbf{0}_{r\cdot q}\oplus\xi\oplus\mathbf{0}_{(2\theta-r-1)\cdot q})\cdot Y (\sigma)\cdot\Lambda_{s}=(\mathbf{0}_{s\cdot q}\oplus\xi\cdot U(\sigma)\cdot P _{(r+s)\bmod\theta}(\sigma)\oplus\mathbf{0}_{(2\theta-s-1)\cdot q}).\] (11)
* Given that the initial superposition \(\phi\) of the qfc\(B\) has a single nonzero block and considering Equation (11), we get that at any step along the computation of \(B\), the nonzero entries of the superposition are always in a single \(q\)-dimensional block. So when evaluating the event \(\mathcal{E}_{B}\) in (10), we can focus only on the single nonzero \(q\)-dimensional block.