A Quantum Finite Automata Approach to Modeling the Chemical Reactions

In recent years, the modeling interest has increased significantly from the molecular level to the atomic and quantum scale. The field of computational chemistry plays a significant role in designing computational models for the operation and simulation of systems ranging from atoms and molecules to industrial-scale processes. It is influenced by a tremendous increase in computing power and the efficiency of algorithms. The representation of chemical reactions using classical automata theory in thermodynamic terms had a great influence on computer science. The study of chemical information processing with quantum computational models is a natural goal. In this paper, we have modeled chemical reactions using two-way quantum finite automata, which are halted in linear time. Additionally, classical pushdown automata can be designed for such chemical reactions with multiple stacks. It has been proven that computational versatility can be increased by combining chemical accept/reject signatures and quantum automata models.


I. INTRODUCTION & MOTIVATION
Recently, the connection between complex reactions and their thermodynamics has got overwhelming response among research communities. Initially, in the 1970s, Conrad [1] processed the information of molecular systems and stated that complex biochemical systems cannot be analyzed on classical computers. Till now, artificial approaches use complex biomolecules or logic gates based reaction-diffusion systems to solve the problems [2][3][4]. Classical systems are not robust and capable to describe quantum systems. Some tasks that are impossible in classical systems can be realized in quantum systems. Quantum computing is concerned with computer technology based on the principles of quantum mechanics, which describes the behavior and nature of matter and energy on the quantum level [5]. Quantum computation demonstrates the computation power and other properties of the computers based on principles of quantum mechanics.
Models of finite automata are abstract computing devices, which play a crucial role to solve computational problems in theoretical computer science. Classical automata theory is closely associated with formal language theory, where automata are ranked from simplest to most powerful based on their language recognition power [6]. Classical automata theory has been of significant importance due to its practical real-time applications in the development of several fields. Therefore, it is a natural goal to study quantum variants of classical automata models, which play an important role in quantum information processing.
The quantum automata theory has been developed using the principles of quantum mechanics and classical automata. Quantum computational models make it possible to examine the resources needed for computations. Soon after the brainstorm of Shor's factorization quantum algorithm [7], the first models of quantum finite automata (QFAs) have been introduced. Initially, Kondacs and Watrous [8], and Moore and Crutchfield [9] proposed the concept of quantum automata separately. There is a diversity of quantum automata models have been studied since then and demonstrated in various directions such as quantum finite automata [9], Latvian QFA, 1.5-way QFA, two-way QFA (2QFA) [8], quantum finite state machines of matrix product states [10], quantum sequential machines [11], quantum pushdown automata, quantum Turing machine, quantum queue automata [12], quantum multicounter machines (QMCM), quantum multihead finite automata (QMFA), quantum finite automata with classical states (2QCFA) [13,14], quantum omega automata [15], state succinctness of two-way probabilistic finite automata (2PFA), QFA, 2QFA and 2QCFA [16][17][18], interactive proof systems with quantum finite automata [19,20] and semi-quantum twoway finite automata [21,22] and many more since last two decades [23][24][25][26][27]. These models are effective in determining the boundaries of various computational features and expressive power. Quantum computers are more powerful than Turing machines and even probabilistic Turing machines. Thus, mathematical models of quantum computation can be view as generalizations of its physical models.
Computational biochemistry has been a rapidly evolving research area at the interface between biology, chemistry, computer science, and mathematics. It helps us to apply computational models to understand biochemical and chemical processes and their properties. A combination of chemistry and classical automata theory provides a constructive means of refining the number of objects that allow to understand the energetic cost of computation [28]. The research has been consistently grown in the field of chemical computing. There exist two ways to model complex chemical reactions: abstract devices and formal models based on multiset rewriting [29]. The complex chemical reaction networks carry out chemical processes that mimic the workings of classical automata models. Recently, Duenas-Diez and Perez-Mercader [28,30] have designed chemical finite automata for regular languages and chemical automata with multiple stacks for context-free and context-sensitive languages. Further, the thermodynamic interpretation of the acceptance/rejection of chemical automata is given. It is useful to understand the energetic cost of chemical computation. They have used the one-pot reactor (mixed container), where chemical reactions and molecular recognition takes place after several steps, without utilizing any auxiliary geometrical aid.
In classical automata theory, it is known that two-way deterministic finite automata (2DFA) can be designed for all regular languages. It has also been investigated that two-way probabilistic finite automata (2PFA) can be designed for a non-regular language L = {a n b n | n ≥ 1} in an exponential time [31,32]. The research has consistently evolved in the field of quantum computation and information processing. In quantum automata theory, it has been proved that 2QFA can be designed for L with one-sided bounded error and halted in linear time. Moreover, it has been demonstrated that 2QFA can be also designed for non-context free language L = {a n b n c n | n ≥ 1} [8]. Hence, 2QFA is strictly more powerful than its classical counterparts based on language recognition capability.
The field of chemistry and chemical computing plays a significant role in the evolution of computational models to mimic the behavior of systems at the atomic level. It is greatly influenced by the computing power of quantum computers. Motivated from the above-mentioned facts, we have modeled chemical reactions in the form of formal languages and represented them using two-way quantum finite automata. The main objective is to examine how chemical reactions perform chemical sequence identification equivalent to quantum automata models without involving bio-chemistry or any auxiliary device. The crucial advantage of this approach is that chemical reactions in the form of accept/reject signatures can be processed in linear time with one-sided bounded error. The organization of rest of this paper is as follows: Subsection is devoted to prior work. In Sect. 2, some preliminaries are given. The definition of two-way quantum finite automata is given in Sect. 3. In Sect. 4, the chemical reactions are transcribed in formal languages and modeled using two-way quantum finite automata approach. Summary of work is given in Section 5. Finally, Sect. 6 is the conclusion.

A. Prior work
The field of chemical computation has rich and interesting history. Various researchers have represented the chemical computation using the concept of logic gates based reaction-diffusion systems and artificial intelligence approaches. In early 1970s, Conrad [1] differentiated the information processing on molecules from digital computing. Nearly a decade after, Okamoto et al. [33] proposed the concept of a theoretical chemical diode for cyclic enzyme systems. It has been proved that it can be used to analyze the dynamic behavior of metabolic switching events in bio-computer. In 1991, Hjelmfelt et al. [34] designed neural networks and finite state machines using chemical diodes. It has been investigated that the execution of a universal Turing machine is possible using connecting chemical diodes.
In 1995, Tth and Showalter [35] implemented AND and OR logic gates using reaction-diffusion systems, where the signals are programmed by chemical waves. It was the first empirical realization of chemical logical gates. In 1997, Magnasco [36] showed that logic gates can be constructed and executed in the chemical kinetics of homogeneous solutions. It has been proved that such constructions have computational power equivalent to Turing machine. Adamatzky and Lacy Costello [37] experimentally realized the Chemical XOR gate by following the same approach of Toth and Showlter in 2002. Further, Grecki et al. [38] constructed the chemical counters for an information processing in the excitable reaction-diffusion systems.
It is one of the most promising new areas of research. Some of the difficulties can be caused by connecting several gates together for advanced computation. Thus, recently, researchers started focusing on native chemical computation, i.e. without reaction-diffusion systems. In 1994, Adleman [39] proposed the concept of DNA computing and solved the Hamiltonian path problem by changing DNA strands. In 2009, Benenson [2] reviewed biological measurement tools for new generation biocomputers. Prohaska et al. [3] studied protein domain using chromatin computation and introduced chromatin as a powerful machine for chemical computation and information processing. In 2012, Bryant [4] proved chromatin computer as computationally universal and used to solve an example of combinatorial problem.
The structures of DNA and RNA are represented using the concept of classical automata theory [40] [41]. Krasinski et al. [42] represented the restricted enzyme in DNA with pushdown automata in circular mode. Khrennikov and Yurova [43] modeled the behavior of protein structures using classical automata theory and investigated the resemblance between the quantum systems and modeling behavior of proteins. Bhatia and Kumar [44] modeled ribonucleic acid (RNA) secondary structures using two-way quantum finite automata, which are halted in linear time.
Recently, Duenas-Diez and Perez-Mercader designed molecular machines for chemical reactions. The native chemical computation has been implemented beyond the scope of logic gates i.e. with chemical automata [30]. It has been demonstrated that chemical reactions transcribed in formal languages, can be recognized by Turing machine without using biochemistry [28].

II. PRELIMINARIES
In this section, some preliminaries are given. We assume that the reader is familiar with the classical automata theory and the concept of quantum computing; otherwise, reader can refer to the theory of automata [6], quantum information and computation [5] [45]. Linear algebra is inherited from quantum mechanics to describe the field of quantum computation. It is a crucial mathematical tool. It allows us to represent the quantum operations and quantum states by matrices and vectors, respectively, that obey the rules of linear algebra. The following are the notions of linear algebra used in quantum computational theory: • Vector space (V ) [45]: A vector space (V ) is defined over the field F of complex numbers C consisting of a non-empty set of vectors, satisfying the following operations: -Addition: If two vectors |a and |b belong to V, then |a + |b ∈ V .
-Multiplication by a scalar: If |a belongs to V, then λ |a ∈ V , where λ ∈ C.
• Dirac notation [5]: In quantum mechanics, the Dirac notation is one of the most peculiarities of linear algebra. The combination of vertical and angle bars (| |) is used to unfold quantum states. It provides an inner product of any two vectors. The bra b| and ket |a represent the row vector and column vector, respectively.
where β * i indicates the complex conjugate of complex number α i . • Quantum bit [27]: A quantum bit (qubit) is a unit vector defined over complex vector space C 2 . In general, it is represented as a superposition of two basis states labeled |0 and |1 .
• Quantum state [5]: A quantum state |ψ is defined as a superposition of classical states, where α ′ i s are complex amplitudes and |w i ′ s are classical states for 1 ≤ i ≤ n. Therefore, a quantum state |ψ can be represented as n-dimensional column vector.
• Unitary transformation: In quantum mechanics, the transformation between the quantum systems must be unitary. Consider a state |ψ of quantum system at time t : [5]. • Hilbert space: A physical system is described by a complex vector space called Hilbert space H [45]. It allow us to describe the basis of the quantum system. The direct sum x|y : H⊕ H → C or inner product x|v : H⊗ H → C of two subspaces, satisfying the following properties for any vectors: -Linearity: (α x| + β y|)|z = α x|z + β y|z where x, y, z ∈ H and α, β ∈ C.
• Quantum finite automata (QFA) [46]: It is defined as a quadruple (Q, Σ, s int , U σ ), where -Q is a set of states, -Σ is an input alphabet, -Hilbert space H and s init ∈ H is an initial vector such that |s init | 2 = 1, -H acc ⊂ H and P acc is an acceptance projection operator on H acc , -U σ denotes a unitary transition matrix for each input symbol (σ ∈ Σ).
The computation procedure of QFA consists of an input string w = σ n σ 2 ...σ n . The automaton works by reading each input symbol and their respective unitary matrices are applied on the current state, starting with an initial state. The quantum language accepted by QFA is represented as a function f QF A (w) = |s init U w P acc | 2 , where U w = U σ1 U σ2 ...U σn . The tape head is allowed to move only in the right direction. Finally, the probability of QFA being in an acceptance state is observed; i.e. indicating whether the input string is accepted or rejected by QFA. It is also called as a real-time quantum finite automaton.
Based on the movement of tape head, QFA is classified as one-way QFA, 1.5-way QFA, and 2QFA. In 1.5-way QFA, the tape head is permitted to move only in the right direction or can be stationary, but it cannot move towards the left direction. It has been proved that it can be designed for non-context free languages, if the input tape is circular [47]. In this paper, we focused on the 2QFA model due to its more computational power than classical counterparts.

III. TWO-WAY QUANTUM FINITE AUTOMATA
A quantum finite automaton (QFA) is a quantum variant of a classical finite automaton. In QFA, quantum transitions are applied on reading the input symbols from the tape [9]. Two-way quantum finite automaton (2QFA) is a quantum counterpart of a two-way deterministic finite automaton (2DFA). In 2QFA, the tape head is allowed to move either in the left or right direction or can be stationary. The illustration of 2DFA is shown in Fig 1. It consists of a read-only input tape consisting of a sequence of cells, each one storing a input symbol. The read-only input tape is scanned by an input head, which is allowed to move in both directions or can be stationary. At each step of a computation, a finite state control should be in state from a finite set Q. • Q = Q acc ∪ Q rej ∪ Q non , where Q non , Q acc , Q rej represent the set of non-halting, accepting, rejecting states respectively. The transition function must satisfies the following conditions: (i) Local probability and orthogonality condition: δ(q 1 , σ, q ′ , d)δ(q 2 , σ, q ′ , d) = 1 q 1 = q 2 0 q 1 = q 2 (ii) First separability condition: ∀(q1,σ1),(q2,σ2)∈Q×Γ q ′ ∈Q δ(q 1 , σ 1 , q ′ , +1)δ(q 2 , σ 2 , q ′ , 0) + δ(q 1 , σ 1 , q ′ , 0)δ(q 2 , σ 2 , q ′ , −1) = 0 (iii) Second separability condition: For each σ ∈ Γ, a 2QFA is said to be simplified, if there exists a unitary linear operator V σ on the inner product space such that L 2 {Q} → L 2 {Q}. The transition function is represented as Consider an input string w , written on the input tape enclosed with both end-markers such as #w$. The computation of 2QFA is progress as follows. The tape head is above the input symbol σ and the automaton is in any state q. Then, the state of 2QFA is changed to q ′ with an amplitude δ(q, σ, q ′ , d) and moves the tape head one cell towards right, stationary and in left direction according to ∈ {−1, 0, +1}. It corresponds to a unitary evolution in the inner-product space H n .
A computation of a 2QFA is a chain of superpositions c 0 , c 1 , c 2 , ...., where c 0 denotes an initial configuration. For any c i , when the automaton is observed in a superposition state with an amplitude α c , then it has the form U δ |c i c∈Cn α c |c i , where C n represents the set of configurations. The probability associated with a configuration is calculated by absolute squares of amplitude. Superposition is said to be valid; if the sum of the squared moduli of their probability amplitudes is unitary. In quantum theory, the time evolution is specified by unitary transformations. Each transition function δ prompts a transformation operator over the Hilbert space H n in linear time.
for each (q, j) ∈ C |w| , where q ∈ Q, j ∈ Z |w| and extended to H n by linearity [9,48]. Before, we recognize the chemical reactions using two-way quantum finite automata model, it is important to show how computational chemistry works. Fig 2. shows the illustration of language recognition by the chemical computation model. It consists of three parts: (i) a mixed container where the computation process occurs, (ii) an input translator that translates the chemical aliquots into input symbols and gives them consecutively depending upon the processing time, (3) a system to monitor the response of an automaton as a chemical criterion. Finally, the chemical computation produces well-defined chemical accept/ reject signatures for the input. For instance, if the number of a's and b's are equal in the input, then the chemical computation produces heat i.e. an input is said to be accepted. Otherwise, if no heat is released at the end of computation, then the input is said to be rejected by the system. The following are the construction of two-way quantum finite state machines of chemical reactions. Theorem 1. Two-way quantum finite automata can recognize all regular languages.

IV. MODELING OF CHEMICAL REACTIONS
Proof. The proof has been shown in [9].

A. Chemical reaction-1 consisting regular language
For an illustrative and visual implementation, we can choose a precipitation reaction in an aqueous medium such as If, during computation, a white precipitate of silver iodate is observed, then the input string is said to be accepted; if the solution is clear from precipitate, the string has been rejected because there was no reaction. Therefore, we have chosen the recipes of alphabet symbols a for potassium iodate (KIO 3 ) and b for silver nitrate (AgN O 3 ), quantitatively. Fig. 3 shows the chemical representation of symbols a and b, the bimolecular precipitation reaction [28]. If the precipitate AgIO 3 is not presented in the solution, then the computation is said to be rejected. For example, the input string w = aaab is said to be accepted due to presence of precipitate or, equally, the heat has been determined during computation. But, the input w = aa is said to be rejected due to absence of precipitate, or, precisely, the heat has not been observed. The Kleene star (Σ * ) operator is a set of infinite strings of all lengths over input alphabet as well as empty string (ǫ). Fig. 4 shows the corresponding theoretical 2QFA state transition graph to recognize L 1 . Theorem 2. A language L 1 = {(a + b) * a(a + b) * b(a + b) * aa * bb * } representing precipitation reaction in Eq. (6) can be recognized by 2QFA.

FIG. 3: Illustration of acid/base reaction of
Proof. The idea of this proof is as follows. The initial state q 0 reads a right-end marker # and moves the head towards the right direction. If there is no occurrence of symbol b, then it shows no precipitate, and the input is said to be rejected by the 2QFA. Similarly, on reading the symbol b, the state q 0 is changed into q 1 . If there is no occurrence of symbol a, then the state is transformed into rejecting state q r1 . If the input string w ∈ L 1 contains at least one a and one b, then silver iodate is present during computation and it is said to be recognized by 2QFA. A 2QFA for L 1 is defined as follows: where -Q = {q 0 , q 1 , q 2 , q 3 , q 4 , q 5 , q 6 , q 7 , q a1 , q a2 , q r1 , q r2 }, where q 0 and q 2 are used to move the head towards the $ on reading a's and b's respectively. The states q 1 and q 3 are used to confirm the last symbol read by head is a and b, respectively. .
-The specification of transition functions are given in Table 1.
It can be noted that in 2QFA where transition matrices consist 0 and 1, i.e. basically a two-way reversible finite automata (2RFA). Therefore, 2QFA can be designed for all the languages accepted by 2RFA. In transition matrix, each column and row have exactly only one entry 1. Hence, the dot product of any two rows is equal to zero. It is known that the language recognition power of 2RFA is an equivalent to 2DFA.  Next, we have considered the context-free language from Chomsky hierarchy satisfying the balanced chemical reaction between NaOH and malonic acid is as follows: The language generated by the above-mentioned chemical reaction is L 2 consisting Dyck language of all words with balanced parentheses. 2QFA is designed for L 2 is as follows: Theorem 3. A language L 2 consisting Dyck language of all words with balanced parentheses can be recognized by 2QFA with probability 1, otherwise rejected with probability at least 1 − 1 N , where N is any positive number.
Proof. The idea of this proof is as follows. It consists of three phases. First, the initial state q 0 reads a first symbol and both heads start moving towards the right-end marker $. If the input string starts with closed parentheses, then it is said to be rejected. On reading the left-end marker #, the computation is split into N paths, denoted to the closed parentheses. If at the end of computation, the excess of open parentheses is observed, then it is said to be rejected. It means pH value is greater than midpoint pH and intermediate gray tone is observed. Secondly, if there is an excess of closed parentheses, then the darkest gray tone is observed i.e. pH value is less than midpoint pH. It is said to be rejected by 2QFA with probability 1 − 1 N . If there is a balanced occurrence of open and closed parentheses, the input string is said to be accepted with probability 1. Hence, pH value is equal to midpoint pH and the lightest gray tone is observed at the end of computation. A 2QFA for L 2 is defined as follows: where q 1 is used to check whether the first symbol is an open parentheses or not, q 2 and q 3 are used to traverse the input string.
-The specification of transition functions is given in Table 2.  To implement a chemical 2QFA for context-sensitive language, we have used Belousov-Zhabotinsky (BZ) reaction network for the non-linear oscillatory chemistry [28], which consists temporal oscillation in the sodium bromate and malonic acid system [49] as In 2019, Duenas-Diez and Perez-Mercader [28] designed chemical Turing machine for BZ reaction network. The chemical reaction is fed sequentially to the reactor as {(BrO − 3 ) n (M A) n (N aOH) n }, where n>0. It is transcribed in formal language as L 3 = {a n b n c n |n > 0}. The symbol a is interpreted as a fraction of sodium bromate, b is used for malonic acid and symbol c is transcribed as a quantity of NaOH. It is known that L 3 is a context-sensitive language and cannot be recognized by finite automata or pushdown automata with a stack. Although, it can be recognized by two-stack PDA. We have shown that L 3 can be recognized by 2QFA without using any external aid. Theorem 4. A language L 3 = {a n b n c n |n > 0} can be recognized by 2QFA in linear time. For a language L 3 = {a n b n c n |n > 0} and for arbitrary N-computational paths, there exists a 2QFA such that for w ∈ L 3 , it accepts w with bounded error ǫ and rejects w / ∈ L 3 with probability at least 1 − 1 N .

FIG. 8: State transition diagram of L3
Proof. The design of proof for BZ reaction network is as follows. It consists of two phases. First, the 2QFA traverse the input to check the form a + b + c + . On reading the right-end marker $, the computation is split into N paths such that w 1,0 , w 2,0 , ..., w N,0 . Secondly, the first path is used to check the number of b's and c's are equal or not. The second path is used to check the initial part of an input string to identify it is in {a n b n | n > 0}. On reading the right-end marker $, the both paths are split into N different paths with an equal amplitude 1 √ N . Finally, upon reading the right-end marker #, if the number of a's and b's and b's and c's are equal in respective computational paths. Then, all paths come into N -way Quantum Fourier transform (QFT) and either one acceptance state or rejectance states are observed. Suppose, if the input string is not in the corrected form, then all computation paths read the # at different times. Thus, their amplitudes do not cancel each other and the input string is said to be rejected with probability 1 − 1 N . Otherwise, the input string is said to be recognized by 2QFA with probability 1.

V. SUMMARY
In summary, 2QFA model can be efficiently designed for balanced chemical reaction and Belousov-Zhabotinsky (BZ) reaction network with one-sided error bound, which are halted in linear time. Table 3 shows the language recognition ability of different computational models. The classical 2DFA and 2PFA are known to be equal in computational power to one-way deterministic finite automata (1DFA) [21,50]. It has been proved that 2PFA's can be designed for non-regular languages in expected polynomial time. Additionally, it has been demonstrated that the chemical PDA can be designed for aforementioned chemical reactions with multiple stacks. The recognition of languages by native chemical automata cab be found in [29][30][31]. But, we have shown that 2QFA can recognize such chemical reactions, without any external aid. It has been proved that 2QFA is more powerful than classical variants, because it follows the quantum superposition principle to be in more than one state at a time on the input tape. For the execution, it needs atleast O(log n) quantum states to store the position of tape head, where n denotes the length of an input string.

VI. CONCLUSION
The enhancement in many existing computational approaches provides momentum to molecular and quantum simulations at the atomic level. It helps to test new abstract approaches for considering molecules and matter. Previous attempts to model the aforementioned chemical reactions used finite automata and pushdown automata with multiple stacks. In this paper, we focused on well-known languages of Chomsky hierarchy and modeled them using two-way quantum finite automata. The crucial advantage of the quantum approach is that these chemical reactions transcribed in formal languages can be parsed in linear time, without using any external aid. We have shown that two-way quantum automata are more superior than its classical variants by using quantum transitions. To the best of our knowledge, no such modeling of chemical reactions is performed using quantum automata theory so far. For the future purpose, we will try to represent complex chemical reactions in formal languages and model them using other quantum computational models.

VII. ADDITIONAL INFORMATION
Conflict of interest The authors declare that they have no conflict of interest.