Efficient methods to determine the reversibility of general 1D linear cellular automata in polynomial complexity
EEfficient methods to determine the reversibility of general 1D linear cellularautomata in polynomial complexity
Xinyu Du , Chao Wang ∗ , Tianze Wang , Zeyu Gao a Address: College of Software, Nankai University, Tianjin 300350, China b Address: Department of Software and Computer Systems, KTH Royal Institute of Technology, Stockholm 16440, Sweden
Abstract
In this paper, we study reversibility of one-dimensional(1D) linear cellular automata(LCA) under null bound-ary condition, whose core problems have been divided into two main parts: calculating the period of re-versibility and verifying the reversibility in a period. With existing methods, the time and space complexityof these two parts are still too expensive to be employed. So the process soon becomes totally incalculablewith a slightly big size, which greatly limits its application. In this paper, we set out to solve these twoproblems using two efficient algorithms, which make it possible to solve reversible LCA of very large size.Furthermore, we provide an interesting perspective to conversely generate 1D LCA from a given period ofreversibility. Due to our methods’ efficiency, we can calculate the reversible LCA with large size, which hasmuch potential to enhance security in cryptography system.
Keywords:
Cellular automata, Reversibility, Linear rule, Null boundary, Polynomial complexity (cid:73)
Fully documented templates are available in the elsarticle package on CTAN. ∗ Corresponding author.
Email addresses: [email protected] (Xinyu Du), [email protected] (Chao Wang), [email protected] (Tianze Wang), [email protected] (Zeyu Gao)
Preprint submitted to Information Sciences July 16, 2019 a r X i v : . [ c s . CC ] J u l . Introduction Cellular automata (CA) are discrete dynamical systems and models of massively parallel computationthat share many properties of the physical world. It’s one of the most classic models ever proposed, and ithas been widely applied to parallel systems[9], secret sharing[19], image encryption[32], traffic simulation[22],thermodynamic simulation[34],skin disease diagnosis[18] and many other fields. Recently, Stephen Wolframsummarized classic CA papers, which has aroused resurgent research interests in CA[38].As for reversibility, a reversible CA is a CA in which every configuration has a unique predecessor. Sothe previous state of any cell before an update can be determined uniquely from the updated states ofall the cells. Reversibility of CA has broadened its applications in image security and have a fairly goodperformance. There are a lot of studies about it. [17, 37, 41]Thanks to CA’s property of finiteness, its studies mainly fall into 3 categories: periodic boundary,reflective boundary and null boundary. Before detailing the null boundary condition in this paper, we wantto introduce some good studies of the other two categories as well.For reflective boundary, LCA of radius 1 has been well studied[1]. For periodic boundary, there aresome good studies of the following cases: the hybrid elementary CA(ECA) 90/150[24], the ECA 150[15, 13],the five-neighbor case F p [8, 31], the general 1D CA case[21], CA with memory[25], σ/σ + -automata[33],undecidable 2D case[16] and hexagonal 2D CA[35]. There are also novel methods like Welch Sets[26], CayleyTrees[6] and graphs[27].As for null boundary condition, which is discussed in this paper, studies fall into one-dimensional andmultidimensional cases. In the one-dimensional case, the following rules have been studied: the hybrid ECA90/150[24], the ECA 150[10], the symmetric no-dummy-neighbor linear rules[11], the five-neighbor linearrule 11111[12] and the ECA 150 over finite state set F p [14]. As for multidimensional cases, there are resultsabout the 2D linear rules group 2460 over the ternary field Z [29], hexagonal 2D CA [30] and 3D linearrules over Z m [23]. Recently, Chang[7] proposed a criterion for testing the reversibility of a multidimensionallinear cellular automaton under null boundary condition and an algorithm for the computation of its reverse.There are two existing methods to deal with the reversibility of 1D LCA over binary field Z undernull-boundary condition. The first is to use transition matrix [12] and the second is to construct a DFA [40].We will analyze these two methods and compared our algorithms with them later.The aim of this paper is to design and optimize algorithms to efficiently calculate reversibility of 1D LCA,which make reversibility of bigger size calculable and thus greatly extend reversibility of LCA’s area to use.In practice, one LCA corresponds with one polynomial. For any given linear rule λ ...λ m ( λ = λ m = 1),we can find its corresponding polynomial f ( x ) = 1 + (cid:80) m − i =1 λ m − i x i . For example, 1011011 corresponds to x + x + x + x + 1. If we have a rule whose λ = 0 or λ m = 0, then for the calculation of period we can2implify it to a smaller rule whose λ = λ m = 1 by eliminating “0” in both borders and give a correspondingpolynomial after that. Moreover, we prove that the period of reversibility of LCA equals to the polynomialperiod in Section 4. Based on this period, we just need to verify the reversibility within it.The paper is organized as follows: Section 2 describes the basic mathematical symbols used in thispaper.
Section 3 gives a brief introduction of two existing methods.
Section 4 details using polynomialmethod to calculate the CA period.
Section 5 optimizes an algorithm to give reversibility in a period.
Section 6 conversely generates LCA from a given period.
Section 7 makes a brief summary.
2. Mathematical description p is a prime number which represents the number of elements in a finite field. In this paper we alwayssuppose p = 2.Four-tuple A = { d, S, (cid:126)N , f } is usually used to describe CA. • d ∈ Z + denotes the dimension of the cellular space. • S = { , , ..., p − } is a finite state set including all states of any cell at any time. • (cid:126)N = ( (cid:126)n , (cid:126)n , . . . , (cid:126)n m ) is the neighbor vector, in which (cid:126)n i ∈ Z d and (cid:126)n i (cid:54) = (cid:126)n j when i (cid:54) = j . Therefore, theneighbors of the cell (cid:126)n ∈ Z d are the m cells (cid:126)n + (cid:126)n i , i = 1 , , . . . , m . Here m is called the size of theLCA. • f : S m → S is a local rule, which maps the current states of all neighbors of a cell to the next state ofthis cell.A configuration is a mapping c : Z d → S which assigns each cell a state. If we use c t to denote theconfiguration(states of all cells) at time t , then the state of cell (cid:126)n at time t is c t ( (cid:126)n ) and state at time t + 1goes like c t +1 ( (cid:126)n ) = f ( c t ( (cid:126)n + (cid:126)n ) , c t ( (cid:126)n + (cid:126)n ) , . . . , c t ( (cid:126)n + (cid:126)n m )) . For linear cellular automata(LCA), the local rule f should be a linear function as follows: f ( c ( (cid:126)n + (cid:126)n ) , c ( (cid:126)n + (cid:126)n ) , . . . , c ( (cid:126)n + (cid:126)n m ))=[ λ c ( (cid:126)n + (cid:126)n ) + λ c ( (cid:126)n + (cid:126)n ) + · · · + λ m c ( (cid:126)n + (cid:126)n m )] mod p, (1)where λ i ∈ S is the rule coefficient of cell (cid:126)n + (cid:126)n i , i = 1,2,..., m .3or an LCA, the next state of a cell is the linear combination of the rules coefficients and its neighbors’current states modulo p . Usually, there are infinite number of cells in a d -dimensional integer space Z d .However, when we try to apply CA to practical problems, the cellular space must be finite. So boundaryconditions are taken into consideration and null boundary is most often used. In the condition of a nullboundary: c ( (cid:126)n ) ≡ (cid:126)n ∈ Z d and (cid:126)n not in the cellular space.In this paper, we discuss 1D null-boundary LCA of n cells over Z , in which p = 2, d = 1, S = Z = { , } .We use s ti to denote the state of cell i at time t , in which i = 1 , , ..., n . Then we define neighbor vectoras ( − r L ,...,0,..., r R ), linear coefficients as λ − r L ,..., λ ,..., λ r R . Then according to Eq.(1) , the next state of cell i is defined as follows: s t +1 i = [ λ − r L s ti − r L + ... + λ − s ti − + λ s ti + λ s ti +1 + ... + λ r R s ti + r R ] mod 2 , (2)in which λ − r L = 1 when r L > λ r R = 1 when r R >
0. If we are given a rule whose λ − r L = 0 or λ r R = 0,we delete the border elements until it satisfies λ − r L = 1 and λ r R = 1. Moreover, under null boundarycondition, s ti = 0 for i / ∈ { , , . . . , n } .From Eq.(2) , we know that a linear rule can be denoted by LCA’s linear coefficients and its neighborvector. We use λ − r L ...λ ...λ r R and ( − r L , . . . , , . . . , r R ) to represent linear coefficients and neighbor vector.As examples, in [12], the linear rule 11111 with neighbor vector(-2, -1, 0, 1, 2) were discussed. The rule λ i = 1, ( i = − k, . . . , k ) with neighbor vector ( − k, . . . , − , , , . . . , k ) were discussed in [11].Moreover, the condition of unilateral rules( r L = 0 or r R = 0) has been discussed [40] and they got thefollowing conclusion: a one-dimensional LCA with a unilateral rule under null boundary conditions is alwaysirreversible if λ = 0 and always reversible if λ = 1. So in this paper, we just discuss the bilateral condition r L > r R >
3. Two existing solutions
Solution1: Transition matrix
In 2011, Mart´ın del Rey and Rodr´ıguez S´anchez explained the reversibility of LCA with analysis oftransition matrix and achieved great performance for case 11111[12]. In this case, for a transition matrix M n over Z , the determinant | M n | can only be 0 or 1. When | M n | = 1, it is invertible, vice versa. Theyanalyzed the determinant of the transition matrix and demonstrated that the determinant of the { n + 5 } th matrix identically equals to the determinant of n th matrix. Furthermore, they proved that when n = 5 k or5 k + 1, it is invertible, in which n is the cell number of the LCA.4 .1.1. Brief description Here is the simple process of the linear rule 11111 using the first solution. For further details, please referto [12].1. Configuration transition: M n ∗ ( c t ) T = ( c t +1 ) T , in which M n denotes the transition matrix, c t and c t +1 denote the configurations at t and t + 1.2. Transition matrix of case 11111: M n = · · · · · · · · · · · · · · · · · · · · · .
3. Conclusion:The matrix can be written as follows: M n = M AA T M n − and then it can be proved | M n | = | M n − | mod 2Furthermore, the determinant of M n satisfies: | M n | mod 2 = , if n = 5 k or n = 5 k + 1 , with k ≥ , , otherwise. To compute the inverse matrix M − n , they use the following decomposition:If n = 5 k , then M n − = M − B · · · BB T M − . . . ...... . . . . . . BB T · · · B T M − n = 5 k + 1, then M n − = M − Q · · · QQ T R . . . ...... . . . . . . QQ T · · · Q T R B, R, Q are three constant matrixes.
There are two choices using this method to find period of reversibility: the first is to calculate determinant,find and prove period manually, which has great performance for specific case but is difficult to generalize.The second is to find period with determinant value sequence of 0 and 1, which saves human labor, butexpensive in calculation cost and difficult to prove periodicity in mathematics.For generalization, we use the second choice to calculate period through transition matrix, which alsoneeds to cost O ( n ) for increasing cell number n by row reducing the transition matrix to an echelon formto calculate determinant. Furthermore, for verifying a period, we at least cost O ( (cid:80) periodn =1 n ) ≈ O ( period ).In the worst case, period = 2 r R + r L − O (2 r R + r L ) ), which is pretty expensive. Solution2: DFA
Inspired by the former result[12], Bin Yang and Chao Wang proposed DFA to solve the problem ofthe reversibility of general 1D LCA over the binary field Z under null boundary condition[40]. First theyconstructed a DFA with all 2 r R tuples in a node. Then they got the period by judging if nodes repeated.Finally they verified reversibility by judging if postfixes repeat in a node. Fig.1 shows the former DFA with tuples in each node. In these DFA figures, the tuple (0 , , ,
1) issimplified to 0001. In the theoretical demonstration part, we use (0 , , ,
1) to denote the tuple.6 igure 1: The DFA of linear rule 11001 with the neighbor vector (-2, -1, 0, 1, 2) we use the following terms to describe DFA. For further details, please refer to [40]. • node: 2 r R tuples contained in one rectangle in the DFA figure. • tuple: one row of a node, length of a tuple equals to r L + r R . • period: the number of nodes in a DFA figure. • prefix: the first r L elements of a tuple. • postfix: the last r R elements of a tuple, postf ix i : the i th postfix in a node and postf ix i = ( e , e , ..., e i , ..., e r R ). • symbol *: the current node is reversible (node i is reversible means: LCA with cell number n = i + k ∗ period is reversible, where k is a non-negative integer). Here is the simple process with DFA:1. Constructing DFA: 7 tep1.
First construct the initial node: Set all prefixes as ”0 ... r L , all postfixesas 2 r R ”0-1” permutation of length r R . Step2.
Construct 0-labelled edge to the next node.
Figure 2: Constructing 0-labelled edge to get the next node
Fig. 2 , we need to calculate the next node by solving
Eq.(2) , in which the number ”0” on the edge means s t +1 i = 0, for any given tuple: s ti − r L = tuple [0]... s ti − = tuple [ r L − s ti = tuple [ r L ] s ti +1 = tuple [ r L + 1]... s ti + r R − = tuple [ r L + r R ],and s ti + r R is the element we want to get, which is also the rightmost element in the next node.Two adjacent tuples have the same elements except the leftmost one and the rightmost one. So8fter getting the rightmost element of each tuple in the next node, we get the whole next node.For example, with linear rule 11001 and neighbor vector (-2, -1, 0, 1, 2), the process can bedescribed by Fig.2 . Step3.
Repeat
Step2 until the next node is the same as the initial node to form a 0-edged circle.
Step4.
Get the period from the number of nodes in a circle.
Step5.
Pick up reversible nodes n , n , . . . whose postfixes do not repeat and mark these nodes with”*”. Step6.
Finally, for nodes in the circle with period p , the LCA is reversible if and only if n = n , n , . . . mod p , where n is the number of cells.2. Important theorems:(1) Two adjacent nodes have the same elements except the leftmost element of the first node and therightmost element of the second node.(2) The DFA graph is periodic and each node contains 2 r R tuples of length r L + r R . The last edge willlead back to the initial node.3. Conclusion:(1) If a 0-edged circle is formed, then the number of nodes in this circle equals to the period.(2) One node is reversible if and only if all postfixes in it perform a complete permutation of r R binaryelements, which equals to 2 r R kinds of all different 0-1 postfixes of length r R . The DFA method is applicable to some more general case, but it still needs O ( period ∗ r R ∗ r R ) spacecomplexity to store all nodes in a period and O ( period ∗ r R ∗ r R ) time complexity to judge if they repeat,both of which are at least exponential complexity. In this way, with r R increasing, both the period andreversibility become incalculable.
4. Polynomial method to calculate the period of the reversibility of LCA
In this section we discuss one of the core problems: calculating the period of the reversibility of 1D LCAof N cells. Fig.3 shows the process of calculating the period of the reversibility of LCA by polynomial method.
Theorem 4.1.
The period of the reversibility of LCA is equal to the period of its corresponding DFA. Itis also equal to the period of its corresponding linear feedback shift register(LFSR) and the period of itscorresponding polynomial as well. igure 3: Translate linear rule to polynomial to calculate the period of the reversibility of LCA Proof.
In [40], it has been proved that the period of the reversibility of LCA is equal to the period of itscorresponding DFA and the period of its corresponding LFSR. Furthermore, it is widely known that theperiod of the LFSR is equal to the period of its corresponding polynomial from the coding theory. we assume f ( x ) is an irreducible polynomial of degree n on a general finite field GF ( q ), where q is thepower of a prime. Here we demand f (0) (cid:54) = 0 .1. Factorize q n − q n − p e p e ...p e r r .Suppose there are r different primes.2. For i = 1,2,..., r , calculate ( x ( q n − /p i ) f ( x ) , ( x ( q n − /p i ) f ( x ) , ( x ( q n − /p i ) f ( x ) ,... until we get a nonneg-ative f i ≤ e i , such that ( x ( q n − /p ( fi ) i ) f ( x ) = 1, ( x ( q n − /p ( fi +1) i ) f ( x ) (cid:54) = 1(the subscript f ( x ) means mod f ( x )in finite field). Thus, p ( f ) | ( q n − /p f i i , p ( f ) (cid:45) ( q n − /p f i +1 i . Then, p ( f ) = p e − f p e − f ... p e r − f r r As for the details of calculating ( x q n − /p si ) f ( x ) , s = 1 , , ... , i = 1 , , . . . , r , please refer to page 150 of“Algebraic Coding Theory”[4].
1. Factorization. There are several good factorization methods we need to mention: Berlekamp’s algo-rithm [2], CantorCZassenhaus algorithm [5], Victor Shoup’s algorithm [28], we can also see the comparisonamong these algorithms’ performances [36]. 10 able 1: Comparison among three methods to calculate the period of the reversibility of LCA with N cells r L + r R + 1 Linear Rule TMS [12] DFA [40] PP[ours]5 10011 0.032s 0.004s 0.0005s7 1000011 1.049s 0.004s 0.0005s9 101100011 70.060s 0.004s 0.0005s11 10000001001 5187.539s 0.004s 0.0005s13 1000010011001 Timeout 0.030s 0.0070s15 101100000000011 Timeout 0.194s 0.0080s17 10000000000101101 Timeout 1.575s 0.0210s19 1000000000010000001 Timeout 16.422s 0.0660s21 100000000000000001001 Timeout 153.955s 0.2570s23 10000000000000000000011 Timeout 1418.936s 0.6200s25 1000000000000000000011011 Timeout 11711.469s 5.1670s27 100000000000000000110000011 Timeout Timeout 9.1210sTime Complexity(worst case) O (2 r L + r R ) ) O (2 r L +2 r R − ) O (( r L + r R ) k )In this paper, we use Berlekamp’s algorithm to factorize f ( x ) into the product of irreducible polynomials f i ( x ). This algorithm has a polynomial complexity in fixed finite field and thus is efficient enough over Z .2. Calculate the period of each irreducible polynomial f i ( x ) by Subsection 4.1 .3. Calculate the period of f ( x ) from Theorem 4.2 after all periods of irreducible polynomials have beenobtained.
Theorem 4.2.
Let f ( x ) be a reducible polynomial and f (0) (cid:54) = 0 , Assume f ( x ) = f ( x ) e f ( x ) e · · · f r ( x ) e r ,where f ( x ) , f ( x ) , . . . , f r ( x ) are r different irreducible polynomials over Z and e , e , . . . , e r are r positiveintegers, then we get: p ( f ) = lcm [ p ( f ) , p ( f ) , ..., p ( f r )] min (cid:8) t | t ≥ e , e , . . . , e r (cid:9) , (3) where lcm means the least common multiple.Proof. Please refer to page 150 of “Algebraic Coding Theory”[4].
Compared with the former result of [12] and [40], we have greatly saved the time to calculate the periodof the reversibility of LCA. Our experiment by a laptop is showing in Table 1. TMS is the method usingtransition matrix sequence[12]. DFS is the method using DFA and de Bruijn graph[40]. PP is our proposed11ethod which calculates the period of the polynomial instead. This method successfully reduced the timecomplexity to O (( r L + r R ) k ) where k is a constant. If the time is more than 4 hours, which is too long forus to wait, we label it as ”timeout”.
5. Standard-basis-postfix(SBP) algorithm for verifying the reversibility of LCA
The basic definitions of DFA has been proposed in
Section 3.2 . In this section we will propose anefficient algorithm, which is called ”standard-basis-postfix algorithm”, to solve the other core problem -verifying reversibility in a period.
Theorem 5.1.
If there are two or more tuples in a node which have the same postfix, the node is irreversible,or else it is reversible.Proof.
We need to mention one conclusion of the former DFA result[40], which is also mentioned as (2) ofconclusion in Subsection 3.2.2. It is: one node is reversible if and only if all tuples in it perform a completepermutation of r R binary elements.We can change this conclusion which has been proved in [40] to the theorem we need to prove: If thereare two or more tuples in a node which have the same postfix, the node is irreversible, or else the node isreversible.So the theorem is proved. Theorem 5.2. postf ix ≡ (0 , ..., , ..., Proof.
We use mathematical induction to prove it:
For the 1 st node , it’s obvious that postf ix = (0 , ..., , ..., For the k th node , we suppose postf ix = (0 , ..., , ..., For the ( k + 1) th node , we just need to prove: the rightmost element of postf ix in the ( k + 1) th nodeis still 0. According to Eq.(2) , s t +1 i = [ λ − r L s ti − r L + ... + λ − s ti − + λ s ti + λ s ti +1 + ... + λ r R s ti + r R ] mod 2.0-labelled edge means s t +1 i = 0. Because postf ix = (0 , ..., , ...,
0) in k th node, s ti − r L ,..., s ti ,..., s ti + r R − are all”0”, so: λ r R s ti + r R = 0So the rightmost element s i + r R in the ( k + 1) th node is 0.So postf ix ≡ (0 , ..., , ...,
0) and the theorem is proved.12 heorem 5.3.
Over Z , ∀ r R , the initial node in a DFA with 0-labelled edge has r R tuples whose postfixesare r R ”0-1” permutation of length r R . In the initial node, We can denote all r R − postfixes except postf ix ≡ with a linear combination of r R standard basis postfixes, which are as follows: postf ix = (1 , , . . . , , . . . ,
0) =
SBP postf ix = (0 , , . . . , , . . . ,
0) =
SBP ... postf ix rR − = (0 , , . . . , , . . . ,
1) =
SBP r R − .Proof. In the initial node, ∀ postf ix i ( i (cid:54) = 0), we set a group of coefficients ( e , e , . . . , e i , . . . , e r R ) (cid:54) =(0 , ... , ..., , e i ∈ { , } . Then the postfix can be denoted by the linear combination of r R standard ba-sis postfixes mentioned in the theorem: postf ix i = e ∗ postf ix + e ∗ postf ix + · · · + e i ∗ postf ix i + · · · + e r R ∗ postf ix rR − . Theorem 5.4.
The linear combination of standard basis postfixes with coefficients e , e ... e r R are used torepresent postf ix , ..., postf ix i , ..., postf ix rR − . There are r R − different types of linear combinationwith coefficients e , e ... e r R ( e , e , . . . , e i , . . . , e r R ) (cid:54) = (0 , ... , ..., corresponding to r R − different typesof postf ix i ( < i < r R ), which is a bijection.Proof. e i ∈ { , } , so e , e ... e r R could be all ”0-1” permutation of length r R except (0 , ..., , ..., r R − e , e ... e r R correpsonding to 2 r R − Theorem 5.3 , For 2 r R − r R − postf ix i = e ∗ postf ix + e ∗ postf ix + · · · + e i ∗ postf ix i + · · · + e r R ∗ postf ix rR − (0 < i < r R ) . So thereis a bijection between 2 r R − e , e ... e r R and postf ix , ..., postf ix rR − . Fig.4 shows how to use linear combination of r R tuples to represent all the other 2 r R − r R − Theorem 5.5.
Every tuple transformed from the initial node can still be represented by the linear combina-tion of tuples in its current node of index j ( j = 0 , , .., r R − with the same coefficients e , e ... e r R as itis represented in the initial node, which means: If in node k : tuple i = (cid:80) r R − j =0 e j +1 tuple j = e tuple + e tuple + ... + e r R tuple rR − , then in node k + 1 : tuple i = (cid:80) r R − j =0 e j +1 tuple j igure 4: Use r R tuples to represent 2 r R − r R − r L = r R = 3. Every tuple transformed fromthe initial node can still be represented by the linear combination of tuples in its current node of index 2 j ( j = 0 , , .., r R − e , e ... e r R as it is represented in the initial node. e tuple + e tuple + ... + e r R tuple rR − , The coefficients e , e , ..., e r R are the same betweennode k and node k + 1 . Proof.
We use mathematical induction to prove it:
For the 1 st node (the initial node): Every tuple have the same prefix ”0...0”(all-zeros) of length r L , andwe have proved every postf ix i in the initial node can be represented by the linear combination of standardbasis postfixes according to Theorem 5.3 . So it’s obvious tuple i = ( pref ix i , postf ix i ) = e ∗ ( pref ix , postf ix )+ e ∗ ( pref ix , postf ix )+ · · · + e i ∗ ( pref ix i , postf ix i )+ · · · + e r R ∗ ( pref ix rR − , postf ix rR − ) . For the k th node , we suppose the theorem is true. For the ( k + 1) th node , we just need to prove: the rightmost element of its transformed tuple in the( k + 1) th node can still be represented by the same group of tuples with index 2 j ( j = 0 , , .., r R −
1) and thesame coefficients e , e ... e r R as node k th , and we prove it as follows: For any tuple i in node k , we can denote tuple i as follows: tuple i = (cid:80) r R − j =0 e j +1 tuple j = e tuple + e tuple + ... + e r R tuple rR − = ( (cid:80) r R − j =0 e j +1 ∗ tuple j [0] , (cid:80) r R − j =0 e j +1 ∗ tuple j [1] , ..., (cid:80) r R − j =0 e j +1 ∗ tuple j [ r L − , (cid:80) r R − j =0 e j +1 ∗ tuple j [ r L ] , (cid:80) r R − j =0 e j +1 ∗ tuple j [ r L + 1] , ..., (cid:80) r R − j =0 e j +1 ∗ tuple j [ r L + r R − Eq.(2) with 0-labelled edge, for tuple i , the rightmost element in the next node is: λ r R ∗ s i + r R (of postf ix i ) = λ − r L ∗ (cid:80) r R − j =0 e j +1 ∗ tuple j [0] + λ − r L +1 ∗ (cid:80) r R − j =0 e j +1 ∗ tuple j [1] + ... + λ − ∗ (cid:80) r R − j =0 e j +1 ∗ tuple j [ r L −
1] + λ ∗ (cid:80) r R − j =0 e j +1 ∗ tuple j [ r L ] + λ ∗ (cid:80) r R − j =0 e j +1 ∗ tuple j [ r L + 1] + ...λ r R − ∗ (cid:80) r R − j =0 e j +1 ∗ tuple j [ r L + r R − For any tuple j in node k , use Eq.(2) with 0-labelled edge, the rightmost element in the next nodeis: λ r R ∗ s i + r R (of tuple j ) = λ − r L ∗ tuple j [0] + λ − r L +1 ∗ tuple j [1] + ... + λ − ∗ tuple j [ r L −
1] + λ ∗ tuple j [ r L ] + λ ∗ tuple j [ r L + 1] + ...tuple j [ r L + r R − tuple i and tuple j , we know: λ r R ∗ s i + r R (of tuple i )= λ r R ∗ (cid:80) r R − j =0 e j +1 ∗ s i + r R (of tuple j ), from which we could conclude that therightmost number in node k + 1 can also be represented by the same coefficients e , e ... e r R as node k .Furthermore, according to (2) in ”Important Theorem” in Section 3.2.2 : Two adjacent nodes have thesame elements except the leftmost element of the first node and the rightmost element of the second node.So the coefficients e , e ... e r R are the same between k th node and ( k + 1) th node.15o the theorem is proved.With the explanation of 0-labelled edge in Section 3.2.2 , we define L −→ = L −→ L −→ ... L n −→ as a groupof transformation where L i −→ represent a 0-labelled transformation from a tuple in a previous node to itscorresponding tuple in the next node. Example 1.
Over Z , we assume a , b are two postfixes. If a L −→ a , b L −→ b , then a + b L −→ a + b .In Fig.4 , r R = 3, we have 2 − postf ix and these postfixes are (0 , , , , , , , , , , , , , , , , , ,
0) and (1 , , , ,
1) = (0 , ,
1) + (0 , , , ,
1) = (0 , ,
1) + (1 , , , ,
0) = (0 , ,
0) + (1 , , , ,
1) = (0 , ,
1) + (0 , ,
0) + (1 , , Fig.4 as L ,(0 , ,
1) = (0 , , , , , , L −→ (0 , , , , L −→ (1 , , , ,
1) = (0 , , , , L −→ (0 , ,
0) + (1 , ,
0) = (1 , , Theorem 5.6.
T rans , T rans , ..., T rans r R are r R postfixes in a node which transformed from SBP , . . . , SBP i , . . . , SBP r R in the initial node. If T rans , T rans , ..., T rans r R are linearly independent, we classifythis node as reversible, or otherwise we classify the node as irreversible.Proof. For the former part of this theorem: if
T rans , T rans , ..., T rans r R are linearly independent, Thenaccording to Theorem 5.5 , ∀ ( e , e ... e r R ) (cid:54) = (0 , ..., , ..., e ∗ T rans + · · · + e i ∗ T rans i + · · · + e r R ∗ T rans r R (cid:54) = (0 , ..., , ...,
0) in this node.Next we need to prove: for any two postf ix m and postf ix n (0 < m, n < r R ), e ∗ T rans + · · · + e i ∗ T rans i + · · · + e r R ∗ T rans r R won’t be the same.We use reduction to absurdity to prove it: First define postf ix m and postf ix n (0 < m, n < r R ), postf ix m = e m ∗ T rans + · · · + e mi ∗ T rans i + · · · + e mr R ∗ T rans r R and postf ix n = e n ∗ T rans + · · · + e ni ∗ T rans i + · · · + e nr R ∗ T rans r R . We suppose postf ix m = postf ix n (0 < m, n < r R ). Because e i ∈ { , } , according to Theorem 5.5 ,there must be postf ix o = e o ∗ T rans + · · · + e oi ∗ T rans i + · · · + e or R ∗ T rans r R = (0 , ..., , ...,
0) where e o = e m + e n , ..., e oi = e mi + e ni , ..., e or R = e mr R + e nr R (over Z ), which contradict with the conclusion: e ∗ T rans + · · · + e i ∗ T rans i + · · · + e r R ∗ T rans r R (cid:54) = (0 , ..., , ...,
0) in this node.So every two postfixes in this node is different. According to
Theorem 5.1 , the node is reversible. Sothe former part of the theorem is proved.For the latter part of this theorem: if
T rans , T rans , ..., T rans r R has a linear correlation with coefficients( e ,..., e i ,..., e r R ) and e ∗ T rans + · · · + e i ∗ T rans i + · · · + e r R ∗ T rans r R = (0 , ..., , ...,
0) in the current node.16hen according to
Theorem 5.5 , there must be an initial postfix postf ix i in the first node which equals to e ∗ SBP + · · · + e i ∗ SBP i + · · · + e r R ∗ SBP r R = 0, i.e.( e , e , ..., e r ), and it is transformed to (0 , . . . , , . . . , postf ix = (0 , · · · , , · · · ,
0) in current nodeincluding postf ix ≡
0. According to
Theorem 5.1 , we classify the current node as irreversible.
Example 2.
When r R = 5, if we have one postf ix i = (1 , , , ,
1) in the initial node,if (1 , , , , L −→ (0 , , , , , , , , L −→ a (0 , , , , L −→ b (0 , , , , L −→ c (0 , , , , L −→ d (1 , , , , L −→ e Based on
Theorem 5.6 , we can conclude the current node is reversible if a, b, c, d, e are linearly independent.On the other hand, if there is a linear correlation among a, b, c, d, e , we can conclude the current node isirreversible.
Fig. 5 shows the process of using standard basis postfix to judge whether a node is reversible in a period.
SBP(Standard-basis-postfix) algorithmStep1.
Take r R tuples which contain r R standard basis postfixes in initial node to construct a r R ∗ ( r L + r R )subset node. Step2.
Construct 0-labelled edge to the next node.
Step3.
Repeat
Step2 until the node number reach the period we get in Section.4 to form a 0-edged circleback to initial node.
Step4.
Construct a square matrix with size r R ∗ r R formed by standard basis postfixes. Step5.
Row reduce the matrix to an echelon form to determine whether this matrix is linearly independent.
Step6.
Determine whether the current node is reversible by
Step5 and mark reversible node with ”*”.17 igure 5: Use standard basis postfix to judge reversibility able 2: Comparison among three methods to verify the reversibility of LCA Algorithm Time complexity Spatial complexityDFA O ( r R ∗ r R ) O (( r L + r R ) ∗ r R )Standard basis postfix O ( r R ) O ( r R ∗ ( r L + r R )) Finally we compare this algorithm with the former DFA in [40].In the original DFA algorithm, we have to store all 2 r R tuples with length r L + r R and verify if theyrepeat, so we have a time complexity of O ( r R ∗ r R ) and a space complexity of O (( r L + r R ) ∗ r R ). Thusfor LCA of a slightly big r R , we soon get memory overflow or it becomes incalculable for time.In current standard-basis-postfix algorithm, we only need to have r R rows and verify the linear correlationin this r R ∗ r R matrix by row reducing the matrix to an echelon form. In this way, we reduce time complexityto O ( r R ) and space complexity to O ( r R ∗ ( r L + r R )).The comparison is shown in Table 2 .
6. Generate LCA rules with given period T and give a lower bound of these rules’ quantity Now, we consider an interesting inverse problem: Given a positive integer T , can we generate an LCArule whose period of the reversibility is T ? If the answer is ’Yes’, how to generate such LCA rule? And howmany LCA rules with the period T can we generate?After analysis of Theorem 4.2 , we divide this formula into two parts, the former part is lcm [ p ( f ) , p ( f ) , . . . , p ( f r )],the latter part is min { t | t ≥ e , e , . . . , e r } . We use U to represent the former part and V to represent thelatter part from now on in this paper.Suppose T is the given number as a period. Our goal is to find an appropriate LCA rule whose polynomialis f ( x ) such that the period of the reversibility of it is T , i.e., T = p ( f ).First, let T = U V , where U is an odd integer and V = 2 t . Lemma 6.1.
The period of any irreducible polynomial is odd over Z .Proof. Over Z , in the process of calculating irreducible polynomials’ period in Section 4.1 , we know that p ( f ) | n −
1. And it’s obvious that 2 n − Theorem 4.2 , p ( f ) must bean odd number. 19 able 3: Part of period table of some irreducible polynomials over Z deg( f ( x )) f ( x ) period1 11 12 111 33 1011 74 11111 55 100101 318 100111001 179 1000000011 7310 11111111111 11First according to Lemma 6.1 , we get the prime factorization of p ( f ): p ( f ) = 2 t × m n m n · · · m n k k , inwhich m i is an odd prime factor, V = 2 t and U = m n m n · · · m n k k .Suppose for a given prime number w , there are g ( w ) irreducible polynomials in the period table whoseperiods equal w .Then for each prime factor in U whose power is 1, we find period m i in the polynomial period table anddirectly give its corresponding polynomials f i , f i , ..., f i g ( mi ) . For those m i whose powers are bigger than 1,we use the following Theorem 6.2 and
Theorem 6.3 to calculate them.
Theorem 6.2.
Let f ( x ) be an irreducible polynomial of period n over Z , and let t be a prime, t (cid:45) . If t | n ,then every irreducible factor of f ( x t ) has period tn. If t (cid:45) n , then one irreducible factor of f ( x t ) has period n and the other factors have period tn .Proof. The proof of this theorem can be found in page 153 of Algebraic Coding Theory[4].
Theorem 6.3.
For any prime factors m i in U , we can get polynomials whose periods equal to any powersof m i .Proof. From
Lemma 6.1 , we know that the period of irreducible polynomial p ( f i ) over Z must be an oddnumber.So according to Theorem 6.2 , any m i in U meet the requirement m i (cid:45) t (cid:45) h ( x ) has periods m i . We can get an (maybe more than one) irreducible polynomial as a factorof h ( x m i ) whose period equals to m i ∗ m i = m i by using Theorem 6.2 . We denote it as h ( x ).Similarly we can get an (maybe more than one) irreducible polynomial as a factor of h ( x m i ) whoseperiod equals to m i ∗ m i = m i by using Theorem 6.2 . We denote it as h ( x ).20y using this methods recursively, we can get polynomials whose periods equal to any powers of m i . Theorem 6.4.
For any integer t ≥ , we can get a polynomial whose period equals to t .Proof. We consider the polynomial g ( x ) = ( x + 1) s , where 2 t − + 1 ≤ s ≤ t . Because the period of theirreducible polynomial x + 1 equals to 1, it is easy to see that g ( x ) has period equals to 2 t according to Theorem 4.2 .Now we could find a group of polynomials which meet the requirement U = lcm [ p ( f ) , p ( f ) , . . . , p ( f r )]from a period table which maps period to irreducible polynomials over Z .(We draw part of the period tableas Table 3 . As for the full table, please refer to [20]). Furthermore, We need to give a group of powers { e , e , . . . , e r } to control the part V to meet the requirement 2 t − < max { e , e , . . . , e r } ≤ t too. Suppose the given period T has the prime factorization T = m e m e · · · m e r r ∗ t = U V, (4)where m , m · · · , m r are odd primes. We have supposed there are g ( m i ) irreducible polynomials whoseperiods equal to m i . Theorem 6.5.
There are at least (2 tr − ( t − r ) (cid:81) ri =1 g ( m i ) different kinds of polynomials for given period T without irreducible polynomial x+1 as a factor of f ( x ) .Proof. From
Theorem 4.2 , we can construct the polynomial of the following form: f ( x ) = f e ( x ) · · · f e r r ( x ) , where the periods of f ( x ) , . . . , f r ( x ) are m , . . . , m r respectively. Notice that e , e , ..., e r must meet re-quirements: 2 t − < max { e , e , ..., e r } ≤ t . So we have 2 tr − ( t − r kinds of e , e , . . . , e r . Then for eachprime factor m i , if we have g ( m i ) kinds of corresponding irreducible polynomials, there must be at least(2 tr − ( t − r ) (cid:81) ri =1 g ( m i ) different kinds of combinations to get the polynomials for the given period T without irreducible polynomial x+1 as a factor of f ( x ).Due to the period of f ( x ) = x + 1 is 1, it is optional as a factor of f ( x ) when we generate the polynomialwith given period. If we take x + 1 into consideration, and set f = x + 1, we will get the next theorem. Theorem 6.6.
There are at least (2 t − tr − ( t − r ) (cid:81) ri =1 g ( m i ) + 2 tr (cid:81) ri =1 g ( m i ) extra different kindsof polynomials for period T with x + 1 as a factor of f ( x ) . roof. Consider the polynomial of the following form: f ( x ) = f e ( x ) f e ( x ) · · · f e r r ( x ) . If we demand that f ( x ) has the factor f ( x ) = x + 1, then e = 1 , , . . . , t . And when e = 2 t , therequirement that max { e , e , ..., e r } > t − is no need, so we have at least(2 t − tr − ( t − r ) r (cid:89) i =1 g ( m i ) + 2 tr r (cid:89) i =1 g ( m i )extra polynomials for period T with x + 1 as a factor of f ( x ).Finally, We translate all f ( x ) back to LCA rules whose periods equal to the given one. Example 3.
For example, if we have a period T = 84 = 2 ∗ ∗
7, then according to Eq.(4), V = 2 , U = 3 ∗
7, and we know g (3) ≥ g (7) ≥ Table 3 ,For period 3, f ( x ) = x + x + 1. For period 7, f ( x ) = x + x + 1. Therefore, we can get at least(4 ∗ − ∗ ∗ ∗ x + 1 as a factor.If we take f ( x ) = x + 1 into consideration, we can get 3 ∗ (4 ∗ − ∗ ∗ ∗ ∗ ∗ ∗ ∗ − ∗ ∗ ∗ ∗ ∗ ∗ Example 4.
Another example, if we have a period T = 360 = 2 ∗ ∗
5, then according to
Lemma 6.1 , V = 2 , U = 3 ∗
5, and we know g (3) ≥ g (5) ≥ Table 3 .For period 3 , we take two steps: pre f ( x ) = x + x + 1 , mid f ( x ) = pre f ( x ) = ( x ) + ( x ) + 1 = x + x + 1 . If mid f ( x ) is irreducible, then it equals to the final f ( x ), else, from Theorem 6.2 , we know that it hasan irreducible factor whose period is 3 , and we take this factor as f ( x ).For period 5, f ( x ) = x + x + x + x + 1.Therefore, we can get at least (8 ∗ − ∗ ∗ ∗ x + 1 as a factor.If we take f ( x ) = x + 1 into consideration, we can get 7 ∗ (8 ∗ − ∗ ∗ ∗ ∗ ∗ ∗ ∗ (8 ∗ − ∗ ∗ ∗ ∗ ∗ ∗ T Step1.
For a given period T , factorize it to prime factors T = 2 t × m e m e · · · m e r r , where each m i (1 ≤ i ≤ r ) is an odd prime. 22 tep2. Set V = 2 t and U = m e m e · · · m e r r . Step3.
For each e i = 1, look up the corresponding polynomial f i ( x ) with period m i from the polynomialperiod table over Z .For each e j >
1, look up the corresponding polynomial f j ( x ) with period m j from the polynomialperiod table, and find at least one irreducible polynomial with period m i as a factor of f j ( x m j ),denote it as f j ( x ). Similarly we can find least one irreducible polynomial with period m i as a factorof f j ( x m j ), denote it as f j ( x ). From Theorem 6.2 , continually doing this, we could always get anirreducible polynomial whose period equals to m e i i at last. Step4.
Get f ( x ) by combining these f i ( x ) using Theorem4.2 . Step5.
Translate these f ( x ) back to LCA rules. The lower bound of the numbers of LCA rules, whoseperiod is T , is 2 t (2 tr − ( t − r ) (cid:81) ri =1 g ( m i ) + 2 tr (cid:81) ri =1 g ( m i ).
7. Conclusions
The paper has proposed polynomial substitution and standard basis postfix algorithms to efficiently calcu-late reversibility of LCA, which reduce former algorithms’ exponential complexity to polynomial complexity.Furthermore, a novel perspective is proposed to generate rules from period conversely.The polynomial algorithm replace the former DFA to calculate the period, which reduce time complexityfrom O (2 r L +2 r R − ) to O (( r L + r R ) k ), where k is a constant. With this period, we have a range for furtherreversibility verification.The standard-basis-postfix algorithm verify reversibility for a specific node, which decreases the timecomplexity from O(2 r R ) to O( r R ), space complexity from O(( r R + r L ) ∗ r R ) to O(( r R + r L ) ∗ r R ).Moreover, when we are given a positive integer as the period of the reversibility of a specific LCA, basedon the polynomial formula mentioned before, we can conversely give LCA rules corresponding with it.To summarize, the main objective of this paper is to propose a more efficient way to cope with reversibilityof LCA with large size, which is incalculable before. With this improvement, reversible LCA will have betterand broader applications in data encryption, decryption and error-correcting codes.Additional further work may include the analysis of properties of all kinds of LCA with various boundaryconditions and extend the result of this article to multidimensional cases. References [1] H. Akin, F. Sah and I. Siap, On 1D Reversible Cellular Automata with Reflective Boundary Over thePrime Field of Order p , Int. J. Mod. Phys. C, 23(1)(2012) 1250004:1-13.232] E. Berlekamp, Factoring polynomials over finite fields, Bell System Technical Journal, 46(8)(1967)1853-1859.[3] A. Bakhshandeh and Z. Eslami, An authenticated image encryption scheme based on chaotic mapsand memory cellular automata, Optics and Lasers in Engineering, 51(6)(2013) 665-673.[4] E. Berlekamp, Algebraic coding theory, World Scientific, New Jersey, 2015.[5] D. G. Cantor and H. Zassenhaus, A new algorithm for factoring polynomials over finite fields, Mathe-matics of Computation, (1981) 587-592.[6] C. Chang, J. Su, etc., Reversibility of linear cellular automata on Cayley trees with periodic boundarycondition, Taiwanese Journal of Mathematics, 21(6)(2017) 1335-1353.[7] C. Chang, J. Su, H. Akın and F. S¸ah, Reversibility Problem of Multidimensional Finite CellularAutomata, Journal of Statistical Physics, 168(1)(2017) 208-231.[8] Z. Cinkir, A. Hasan and I. Siap, Reversibility of 1D Cellular Automata with Periodic Boundary overFinite Fields Z ( p ), J. Stat. Phys., 143(4)(2011) 807-823.[9] D. Das and A. Ray, A parallel encryption algorithm for block ciphers based on reversible programmablecellular automata, arXiv:1006.2822, 2010.[10] A. M. del Rey and G. Rodr´ıguez S´anchez, On the reversibility of 150 Wolfram cellular automata, Int.J. Mod. Phys. C, 17(7)(2006) 975-983.[11] A. M. del Rey and G. Rodr´ıguez S´anchez, Reversibility of a Symmetric Linear Cellular Automata, Int.J. Mod. Phys. C, 20(7)(2009) 1081-1086.[12] A. M. del Rey and G. Rodr´ıguez S´anchez, Reversibility of linear cellular automata, Appl. Math.Comput., 217(21)(2011) 8360-8366.[13] A. M. del Rey, A Note on the Reversibility Of Elementary Cellular Automaton 150 With PeriodicBoundary Conditions, Rom. J. Inf. Sci. Tech., 16(4)(2013) 365-372.[14] A. M. del Rey and G. Rodr´ıguez S´anchez, On the invertible cellular automata 150 over F p , Appl.Math. Comput., 219(10)(2013) 5427-5432.[15] L. Hern´andez Encinas and A. Mart´ın del Rey, Inverse rules of ECA with rule number 150, Appl. Math.Comput., 189(2)(2007) 1782-1786.[16] J. Kari, Reversibility of 2D cellular automata is undecidable, Physica D, 45(1-3)(1990) 379-385.[17] J. Kari, Cryptosystems based on reversible cellular automata, Manuscript, 1992.2418] S. Kippenberger, A. Bernd, D. Tha¸ci, etc., Modeling pattern formation in skin diseases by a cellularautomaton, The Journal of investigative dermatology, 133(2)(2013) 567.[19] G. ´A. Mara˜n´on, L. H. Encinas and A. M. del Rey, A new secret sharing scheme for images basedon additive 2-dimensional cellular automata, Iberian Conference on Pattern Recognition and ImageAnalysis, 2005, 411-418.[20] R. W. Marsh, Table of irreducible polynomials over GF(2) through degree 19, Office of TechnicalServices, US Department of Commerce, 1957.[21] A. Nobe and F. Yura, On reversibility of cellular automata with periodic boundary conditions, J. Phys.A-Math. Gen., 37(22)(2004) 5789-5804.[22] M. Rickert, K. Nagel, M. Schreckenberg and A. Latour, Two lane traffic simulations using cellularautomata, Physica A: Statistical Mechanics and its Applications, 231(4)(1996) 534-550.[23] F. Sah, I. Siap and H. Akin, Characterization of Three Dimensional Cellular Automata over Z ( m ),AIP Conference Proceedings, 1470, Aug.2012, 138-141.[24] Palash Sarkar and Rana Barua, The set of reversible 90 //