AUTOMATA 2015 Turku - Finland Merging Cellular Automata Rules to Optimise a Solution to the Modulo-n Problem Claudio Martins Pedro de Oliveira Universidade Presbiteriana Mackenzie São Paulo, SP Brazil 1. The Modulo-n Problem in Cellular Automata Definitions • Definition 1: The MODn Problem It consists of determining whether the number of 1-bits in a cyclic binary string is multiple of n or not. • Example 1: Solution for the MOD2 Problem Initial Configuration MOD2 Final Configuration >>> >>> • Example 2: Solution for the MOD3 Problem Initial Configuration MOD3 Final Configuration >>> >>> >>> 3 1. The Modulo-n Problem in Cellular Automata Examples of ill-defined problem • MOD2 (ill-defined Problem) Initial Configuration MOD2 Final Configuration 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 >>> • MOD3 (ill-defined Problem) Initial Configuration MOD3 Final Configuration 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 >>> It is always ill-defined for lattice sizes multiple of n ! 4 1. The Modulo-n Problem in Cellular Automata Definitions • Definition 2: Rule Composition (temporal sequences of Rules) Rjaj … R3a3 R2a2 R1a1 • Examples Solution for the MOD2 Problem [Lee, Xu and Chau, 2001] ’ = S() = N R132 2 R N 2 222 N 2 Solution for the MOD3 Problem [Lee, Xu and Chau, 2003] ’ = S() = N N N N N N 3 3 N R R R R E 254 4 2 3 1 N 5 2. The Partition of a Binary String Definitions • Definition 3: The Partition number The number of groups of 0s that is equal to the number of groups of 1s (because of the periodic boundary condition). Configuration Partition 3 0 0 1 7 3. Active State Transition Definitions • Definition 4: Active State Transition By active transition, we mean those that change the state value of the cell at the centre of the neighbourhood. Rule 238 Transition 7 6 5 4 3 2 1 0 Neighbourhood 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 Output bit 1 1 1 0 1 1 1 0 23810 = 111011102 8 4. The Replacement Rules (R) Definition • A rule that can replace n end bits, of a sequence of n or more consecutive identical bits, with n opposite bits. Left end bits Right end bits 1 2 3 ... n -2 n -1 n ↓ ↓ ↓ ↓ ↓ ↓ .... n n -1 n -2 ... 3 2 1 ↓ .... ↓ ↓ ↓ ↓ ↓ ↓ ↓ .... ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ .... .... .... ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ .... ↓ .... ↓ .... 9 4. The Replacement Rules (R) Representation • Rn0 to replace n 0s with n 1s, and R1n to the opposite. R30,0 1 2 3 .... .... 3 2 1 ↓ ↓ ↓ .... .... R00,3 1 2 3 R10,2 1 2 3 .... .... 3 2 1 ↓ ↓ ↓ .... .... R30 R20,1 1 2 3 .... .... 3 2 1 ↓ ↓ ↓ .... .... .... .... 3 2 1 ↓ ↓ ↓ .... .... • Rn0,0 or R00,n require radius n. • Rn01,1 or Rn02,2 … or … R20,n2 or R10,n1 require radius n-1. • MODn-conserving rules. 10 4. The Replacement Rules (R) Observations R20,1 Transition 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ↓ 1 0 0 0 .... 0 0 0 1 Rule 4.059.296.252 Neighbourhood 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 0 1 1 0 1 0 1 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 Output bit / Note 1 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 Radius =1 =2 =2 ↓ 1 0 0 0 .... 0 0 0 1 1 st 0 from the left =2 Radius =3 Radius =1 ↓ 1 0 0 0 .... 0 0 0 1 =1 =1 ↓ 1 0 0 0 .... 0 0 0 1 2 nd 0 from the left 2 nd 0 from the left ↓ 1 0 0 0 .... 0 0 0 1 =2 ↓ 1 0 0 0 .... 0 0 0 1 =0 =0 Simplified Representation R20,1 =3 Rule 4.059.296.252 1 st 0 from the left 1 st 0 from the right 1 st 0 from the right Active Transition 24 17 16 8 3 2 Neighbourhood 1 1 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 1 0 Output bit / Note 1 1 1 1 1 1 1 st 0 from the left 2 nd 0 from the left 2 nd 0 from the left 1 st 0 from the left 1 st 0 from the right 1 st 0 from the right Active Transitions 24 & 8 17 & 16 3&2 Neighbourhood * 1 0 1 0 0 0 0 0 0 0 1 0 * * Output bit / Note 1 1 1 11 1 st 0 from the left 2 nd 0 from the left 1 st 0 from the right 4. The Replacement Rules (R) Observations • The Partition can be reduced. Appying R20,1 on the Configuration 1 2 3 4 5 6 7 8 Partition 9 10 11 12 t0 t1 t2 t3 2 2 1 1 • There is no effect without n or more consecutive identical bits, or on a string with only 0s or only 1s. Appying R20,1 on the Configuration 1 t0 t1 t2 t3 2 3 4 5 6 7 8 Partition 9 10 11 12 3 3 3 3 12 5. The Grouping Rules (G) Definition and Representation • A rule that can shift, to the left or to the right, strings of m bits (10m1 or 01m0), in order to group them with larger strings of the bit at concern. Gm0 1 Gm G30 G40 1 2 3 .... m ↓ ↓ 1 2 3 .... m 1 2 3 .... m ↓ ↓ 1 2 3 .... m 1 0 0 0 1 ↓ ↓ 0 0 0 1 1 1 0 0 0 0 1 ↓ ↓ 0 0 0 0 1 1 Gm0 1 Gm G30 G40 1 2 3 .... m ↓ ↓ 1 2 3 .... m 1 2 3 .... m ↓ ↓ 1 2 3 .... m 1 0 0 0 1 ↓ ↓ 1 1 0 0 0 1 0 0 0 0 1 ↓ ↓ 1 1 0 0 0 0 13 5. The Grouping Rules (G) Observations 0 or G1 require radius m+1. • Gm m G30 ↓ 1 0 0 0 1 =4 Radius = 0 G40 ↓ 1 0 0 0 1 =3 ↓ ↓ 1 0 0 0 0 1 Radius = 0 =1 =5 1 0 0 0 0 1 =4 =1 • There is no effect without m consecutive identical bits, or on a string with only 0s or only 1s. • MODn-conserving rules. 14 5. The Grouping Rules (G) Observations • The Partition can be reduced. Appying G10 on the Configuration 1 2 3 4 5 6 7 8 Partition 9 10 11 12 t0 t1 t2 t3 3 3 2 2 • They can cause only Shifts on the lattice (only identical blocks). Appying G10 on the Configuration 1 t0 t1 t2 t3 2 3 4 5 6 7 8 Partition 9 10 11 12 3 3 3 3 15 5. The Grouping Rules (G) Observations G10 Transition 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Rule 3.704.675.536 Neighbourhood 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 0 1 1 0 1 0 1 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 Output bit / Note 1 1 0 1 on the left 1 1 Isolated 0 1 Isolated 0 0 0 1 1 0 1 on the left 1 0 0 0 0 1 1 0 1 on the left 1 1 Isolated 0 1 Isolated 0 0 0 1 1 0 1 on the left 1 0 0 0 0 G10 ↓ ↓ 1 0 1 Radius = 0 1 0 1 =2 =1 =1 G10 Simplified Representation Active Transition 29 27 26 21 13 11 10 5 Neighbourhood 1 1 1 1 0 0 0 0 1 1 1 0 1 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 0 1 1 0 1 1 0 1 1 1 0 1 Output bit / Note 0 1 1 0 0 1 1 0 1 on the left Isolated 0 Isolated 0 1 on the left 1 on the left Isolated 0 Isolated 0 1 on the left Active Transitions 27, 26, 11 & 10 29, 21, 13 & 5 Rule 3.704.675.536 Neighbourhood * * 1 * 0 1 1 0 Output bit / Note * 1 1 0 16 Isolated 0 1 on the left 6. Composing Replacement and Grouping Rules The Correct Sequence of the Rules • The correct temporal composition of the Replacement and the Grouping rules is: ’ = S() = G1 n2 N 2 N 2 ...G11 R1n N n Gn02 N 2 ...G10 N 2 Rn0 N n N n or N N N N N N ’ = S() = Gn02 2 ...G10 2 Rn0 n Gn12 2 ...G11 2 R1n n N n 0 and n-2 rules G1 are necessary. • n-2 rules Gm m 18 6. Composing Replacement and Grouping Rules Necklace Configurations • Necklaces are configurations of the form (0A1B)C : for positive integers A, B and C, where A < n and B < n, or A < n and B > n, but B is not multiple of n, or B < n and A > n, but A is not multiple of n, or B > n and A > n, but A and B are not multiple of n. • For Necklaces Grouping rules just cause Shifts on the lattice (only identical blocks). Replacement rules cause no effect when A < n and B < n, or may lead to periodic regimes (resulting Shifts) only when A > n or B > n, by continuously transforming (0A1B )C into (0A’1B’ )C, back and forth. 21 6. Composing Replacement and Grouping Rules Necklace Configurations • Example 2: A Replacement rule for the MOD4 Problem • Example 1: A Replacement rule for the MOD3 Problem (0712)2 (0316)2 (0711)2(0414)2(0117)2 t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t 10 t 11 t 12 Necklace Initial Configuration (0711)2 R20,1 R12,1 R20,1 R12,1 (0414)2 (0117)2 (0117)2 (0414)2 (0711)2 (0711)2 (0414)2 (0117)2 (0117)2 (0414)2 (0711)2 (0711)2 t0 Necklace Initial Configuration (0712)2 t1 R30,1 t2 t3 t4 R31,1 t5 t6 t7 R30,1 t8 t9 t 10 R31,1 t 11 t 12 22 (0316)2 (0316)2 (0316)2 (0712)2 (0712)2 (0712)2 (0316)2 (0316)2 (0316)2 (0712)2 (0712)2 (0712)2 6. Composing Replacement and Grouping Rules What these compositions may cause in the lattice? • Let ’ = G1 N ...G1N R n 1 n2 N 1 n N N n 0 n Gn0 2 N ...G10 N Rn , • Then ’ will be one of the following: 0N (Partition = 0); 1N (Partition = 0); 0N-MODn(||1)1MODn(||1), (Partition = 1); ||1 is the quantity of 1-bits inside string N-MODn(||1) ≠ multiple of n MODn(||1) ≠ 0 Necklaces (0A1B )C, (Partition > 1). C > 1, B < n, A ≠ multiple of n, and (A+B)C = N. 23 6. Composing Replacement and Grouping Rules Final Configurations for Lattice Size Not Multiple of N or Not Multiple of Any Factor of n If MODn(N) = MODn(||1): MODn(||1) ≠ 0: ’ = 1N If MODn(N) ≠ MODn(||1): MODn(||1) = 0: ’ = 0N MODn(||1) ≠ 0: ’ = 0N-MODn(||1)1MODn(||1) or ’ =(0A1B)C (necklaces) • For all initial configurations: When MODn(||1) = 0, the problem is solved, as defined. However, in order for all the other initial configurations to lead to 1N, elementary rule 254 can be used. 26 7. The Modulo-n Problem Solution The Generic Solution • The generalisation of the solution for MODn finally leads to: N 2 Sn = E254 1 G n 2 N 2 ... N 1 2 N 1 n G1 Rn Gn0 2 N 2 ... N 0 2 G1 N N n 0 n Rn • 2 Replacement rules, Rn0 and R1n (radius n-1) 0 and G1 • n-2 Grouping rules, Gm m 0 1 • G1 and G1 shift isolated bits (radius 2) • G20 and G21 shift isolated pair of bits (radius 3) • and so on, up to • Gn02 and Gn12 shift isolated strings of n-2 bits (radius n-1) • All these rules may have radius n-1. 27 8. The Merging Operation Joining and Separating the Active State Transitions • What happens when we separate the active transitions of a rule or simply join active transitions of some rules in a single one? Rule 238 Transition Neighbourhood 7 6 5 4 3 2 1 0 N/2 R252 1 1 1 1 0 0 0 0 N/2 R238 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 N/2 R238 Rule 252 Output bit 1 1 1 0 1 1 1 0 N/2 R252 Neighbourhood + 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 N/2 (R252 R238) Rule 254 Output bit 1 1 1 1 1 1 0 0 Neighbourhood = 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 N/2 (R238 R252) 1 0 1 0 1 0 1 0 Output bit 1 1 1 1 1 1 1 0 ? N R254 t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t 10 t 11 t 12 28 8. The Merging Operation Decomposing the Active State Transitions of the Elementary Inverting Rule • Of course it will not always work! Rule 51 Transition 7 6 5 4 3 2 1 0 Neighbourhood 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 Rule 76 Output bit 0 0 1 1 0 0 1 1 Neighbourhood 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 Rule 140 Output bit 0 1 0 0 1 1 0 0 Neighbourhood 1 1 1 1 0 0 0 0 Rule 196 Transition 7 6 5 4 3 2 1 0 Neighbourhood 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 Rule 236 Output bit 1 0 0 0 1 1 0 0 Neighbourhood 1 1 1 1 0 0 0 0 Rule 200 Output bit 1 1 0 0 0 1 0 0 Neighbourhood 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 Rule 220 Output bit 1 1 1 0 1 1 0 0 Neighbourhood 1 1 1 1 0 0 0 0 Rule 206 Output bit 1 1 0 0 1 0 0 0 Neighbourhood 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 Output bit 1 1 0 1 1 1 0 0 Rule 205 Output bit 1 1 0 0 1 1 1 0 Neighbourhood 1 1 1 1 0 0 0 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 29 Output bit 1 1 0 0 1 1 0 1 8. The Merging Operation Decomposing the Active State Transitions of the Elementary Inverting Rule • Even the ordering of these rules can change the final result! E 5116 (E205 E206 E200 E196 E220 E236 E140 E76) 16 (E76 E206 E200 E196 E220 E236 E140 E205)16 t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t 10 t 11 t 12 t 13 t 14 t 15 t 16 30 9. Merging Replacement with Grouping Rules The MOD3 Case • How about merging Replacement and Grouping rules? R20,1 Transition 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 G10 Rule 4.059.296.252 Neighbourhood 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 0 1 1 0 1 0 1 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 Output bit / Note 1 1 1 1 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 1 st 0 from the left 2 nd 0 from the left 2 nd 0 from the left 1 st 0 from the left 1 st 0 from the right 1 st 0 from the right Transition 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 R20,1 Rule 3.704.675.536 Neighbourhood 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 1 0 1 0 0 0 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 0 1 1 0 1 0 1 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 Output bit / Note 1 1 0 1 on the left 1 1 Isolated 0 1 Isolated 0 0 0 1 1 0 1 on the left 1 0 0 0 0 1 1 0 1 on the left 1 1 Isolated 0 1 Isolated 0 0 0 1 1 0 1 on the left 1 0 0 0 0 Active Transition 24 17 16 8 3 2 1 1 1 0 0 0 Active Transitions 24 & 8 17 & 16 3&2 * 1 0 Rule 4.059.296.252 Neighbourhood 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 Active Transitions 27, 26, 11 & 10 29, 21, 13 & 5 1 1 1 1 1 1 Neighbourhood 1 0 0 0 0 0 0 0 1 G10 Active Transition 29 27 26 21 13 11 10 5 Output bit / Note 0 1 0 0 1 0 Output bit / Note 0 * * 1 1 1 1 1 1 0 1 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 0 1 1 0 1 1 0 1 1 1 0 1 Neighbourhood * * 1 * 1 st 0 from the left 2 nd 0 from the left 1 st 0 from the right Rule 3.704.675.536 Neighbourhood 1 1 1 1 0 0 0 0 1 st 0 from the left 2 nd 0 from the left 2 nd 0 from the left 1 st 0 from the left 1 st 0 from the right 1 st 0 from the right 0 1 1 0 * 1 Output bit / Note 0 1 1 0 0 1 1 0 1 on the left Isolated 0 Isolated 0 1 on the left 1 on the left Isolated 0 Isolated 0 1 on the left Output bit / Note 1 0 Isolated 0 1 on the left 31 9. Merging Replacement with Grouping Rules The MOD3 Case and the Grouping rule G 0 have 1 R20,1 • Replacement rule different active state transitions. 0 0 • Merging these two rules, R and G1 , results the rule M 0 . 2,1 2,1 M 20,1 Rule 3.721.649.628 Active Transitions 27, 26, 11 & 10 29, 21, 13 & 5 24 & 8 * * * 1 * 0 1 1 0 * 1 1 0 Is ol a ted 0 1 on the l eft 1 0 0 1 1st 0 from the l eft 17 & 16 1 0 0 0 0 * 1 2nd 0 from the l eft 3&2 0 0 0 1 * 1 1 0 from the ri ght Neighbourhood Output bit / Note st • Can these 3 alternatives perform the same tasks? N N 0 0 G1 R2,1 N , N N 0 0 R2,1 G1 N , or N 0 M 2,1 N 32 9. Merging Replacement with Grouping Rules The MOD3 Case 13 13 0 0 G R 2,1 1 t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t 10 t 11 t 12 t 13 t 14 t 15 t 16 t 17 t 18 t 19 t 20 t 21 t 22 t 23 t 24 t 25 t 26 t 27 t 28 t 29 t 30 t 31 t 32 t 33 t 34 t 35 t 36 t 37 t 38 t 39 t 40 t 41 t 42 t 43 t 44 t 45 t 46 t 47 t 48 t 49 t 50 t 51 t 52 2 13 13 0 0 R 2,1 G1 2 13 0 M 2,1 2 33 9. Merging Replacement with Grouping Rules The MOD3 Case • From a superficial analysis, we would say no! • But, going back to the initial goals, these three alternatives transform the lattice into a final configuration as desired. • All final configurations have at most two consecutive 0s, and there are no isolated 0s and isolated pairs of 0s occurring simultaneously. 34 9. Merging Replacement with Grouping Rules The MOD3 Case • Applying : rule M 30 instead of R30 and G10 , and rule M 31 instead of G11 and R31 , the solution S3 is simplified to Ss3 : S3 = E254 N 2 G1 1 Ss3 = E254 N 2 N 2 R31 N 3 G10 N 2 R30 N 1N 0 M 3 M3 N 3 N 3 N 3 35 9. Merging Replacement with Grouping Rules The MOD3 Case • Comparing S3’ and Ss3’ S3’ = G1 1 N 2 R31 N 3 G10 N 2 R30 N 3 N 3 Ss3’ = N 1N 0 M 3 M3 N 3 • Summary of all final configurations left, after applying these two solutions to all possible initial configurations with N=16. Original Sequence S3' Amount of 1s Final Configuration with some Necklaces 0 0000000000000000 0000000000000011 0000000100000001 2 Simplified Sequence Ss3' No. Of Configs. 21845 19232 2608 Amount of 1s Final Configuration with some Necklaces 0 0000000000000000 0000000000000011 0000000100000001 2 No. Of Configs. 21845 14576 656 Amount of 1s 2 5 8 16 0011001100110011 0101010101010101 1111111111111111 TOTAL 4 2 21845 65536 8 16 0011001100110011 0101010101010101 1111111111111111 TOTAL Final Configuration with some Partial Necklaces 0000000000000101 0000000000100001 0000000101010101 0000100001010101 0000101000010101 4 2 21845 65536 36 No. Of Configs. 4768 1568 144 64 64 9. Merging Replacement with Grouping Rules The MOD3 Case – Partial Necklaces • Partial Necklaces in the MOD3 Problem, are configurations of the form ((03)+(01)+ )+ or ((13)+(10)+ )+. • The lattice “gets locked” on these configurations when the partial simplified solution is applied. 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 = (03)2 = (01)5 Necklace 0 0 0 0 1 0 0 0 0 1 0 1 0 1 0 1 = 03 = 01 = 03 Necklace = 01 = (01)3 Necklace 37 9. Merging Replacement with Grouping Rules The MOD3 Case – Partial Necklaces S'3 in 0000000101010101 S'3 in 0000100001010101 Ss'3 in 0000000101010101 06(01)5 <<>> 16(10)5 Ss'3 in 0000100001010101 (0301)2(01)3 <<>> (1310)2(10)3 38 9. Merging Replacement with Grouping Rules The MOD4 Case Merging Rules Results ? R40 + G10 + G20 = M 40 R14 + G11 + G21 = M 14 • The first problem is related to the Grouping rules (G 0 and G 0 ) 1 2 because of possible shifts of isolated 0s and isolated pairs of 0s simultaneously. • Next figure shows the joining of these rules and also the temporal evolution of an initial configuration where the problem occurs. 39 9. Merging Replacement with Grouping Rules The MOD4 Case and the Problem of Shifts R20,2 + G10 G20 + = Rule 321600197915107966665688126986998903292 Active State Transitions R20,2 G10 G20 112 97 7 67 123 119 121 103 80 96 6 66 122 118 105 102 48 33 5 3 107 117 89 101 16 32 4 2 106 116 73 100 91 87 57 39 90 86 41 38 75 85 25 37 74 84 9 36 t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t 10 t 11 t 12 t 13 t 14 t 15 t 16 t 17 59 55 58 54 43 53 42 52 7 7 3 G20 G10 R20,2 27 23 26 22 11 21 10 20 * * 0 * * * * * * 1 0 0 * * * 1 Neighbourhood 1 0 0 0 0 0 0 0 1 0 0 0 * 1 0 1 0 1 * 1 0 0 0 1 0 0 * 1 1 * 0 * 0 * * * * * 1 * 7 R 0 G 0 G 0 2, 2 1 2 40 Output bit 1 1 1 1 0 1 0 1 9. Merging Replacement with Grouping Rules Removing and Inserting Active Transitions to Change the Displacement Step of the Rule • A solution is to change the displacement step of rule G10 . • Instead moving just 1 position, move 2 positions, whenever possible. • The new rule with this feature: G 0,2 . 1 G10 119 118 117 116 87 123 122 107 106 91 86 90 = Rule 324253482922812750238312970506082513664 85 75 G10,2 119 118 117 116 87 107 106 125 109 93 TA's 84 55 74 59 54 58 53 43 52 42 23 27 22 26 21 11 20 10 * * Neighbourhood * 1 0 1 * * * 1 0 1 * * Output bit 1 0 * * 1 Output bit 1 0 0 = Rule 297668273963817264613187722719825810176 Active State Transitions 86 85 84 55 54 53 75 74 43 77 61 45 52 42 23 22 29 13 21 11 20 10 * * * Neighbourhood * 1 0 1 * * 0 1 0 1 * * 1 1 0 41 9. Merging Replacement with Grouping Rules Removing Active State Transitions to Eliminate Remaining Shifts • Finally, the second problem: a simultaneous shift of a single bit and its respective pair of bits will continue to occur when there is a string as *100101*. INSTEAD BETTER 1 0 0 1 0 1 1 0 0 1 0 1 ↓ ↓ ↓ ↓ ↓ 0 0 1 0 1 1 ↓ 0 0 0 1 1 1 • Some active state transitions should be turned off. • Rules G10,2 and G20 become G10*,2 and G20* . 42 9. Merging Replacement with Grouping Rules Removing Active State Transitions to Eliminate Remaining Shifts • For clarity purposes, notice that: String **0101* has been instantiated into strings 000101*, 010101*, 100101*, 110101*, and String *1001** into *100100, *100101, *100110, *100111. G10,2 119 118 117 116 87 86 = Rule 297668273963817264613187722719825810176 Active State Transitions 85 84 55 54 53 52 43 42 75 23 22 29 13 74 107 106 125 109 93 121 105 89 73 57 103 39 102 101 100 77 G20 41 61 45 21 11 20 10 * 0 0 1 1 * * 0 1 0 1 * Neighbourhood 1 0 1 0 1 0 0 1 0 0 1 0 0 1 0 * 1 1 * 1 1 1 1 0 * * * * * 1 Output bit 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 Output bit 0 1 1 0 1 = Rule 336299833476273345402472786266733739264 Active State Transitions 25 9 38 37 36 * * * * * * 1 1 1 1 Neighbourhood * 1 0 0 0 1 0 0 1 0 0 1 0 0 1 43 9. Merging Replacement with Grouping Rules Removing Active State Transitions to Eliminate Remaining Shifts 0 , 2 0 0 M 2,2 R2,2 G1* G20* = Rule 295014986420811337252501870505639399932 Active State Transitions 112 80 97 96 7 6 67 66 48 33 5 3 Neighbourhood 16 32 4 2 119 118 117 116 87 86 85 84 55 54 53 52 43 42 23 22 29 13 107 106 125 109 121 105 89 103 102 73 93 77 57 39 41 61 25 9 38 100 36 45 21 11 20 10 Output bit * * 0 * * 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 * 1 0 * * * 1 1 1 1 * 0 0 1 * * 0 1 1 * 1 0 0 0 * 0 1 1 1 1 1 0 0 0 1 * 1 1 1 0 * * * * 1 1 0 0 0 0 * * * * * 1 1 1 * 0 0 0 1 0 0 0 0 1 1 1 0 1 1 0 1 1 0 0 0 1 1 1 • The leads us to rule M 12,2 , composed by R1 , same rationale 2,2 1 , 2 1 G1* , and G . 2* • Wolfram number: 255816358659918533639648036274123862084 44 10. The Modulo-n Problem Simplified Solution The Generic Simplified Solution • The solution S4 is simplified to Ss4 : Ss4 = E254 N 2 1N 0N M M 4 4 N 4 • Testing the same procedure for MOD5 and obtaining similar results, we conclude that the simplified solution that can solve the MODn problem is : Ssn = E254 N 2 N 1N M n M n0 N n • It has only 3 rules, one elementary, and two with radius n-1 • The size N of the binary string cannot be multiple of n • N and n have to be numbers relatively prime. 45 11. Concluding Remarks and Next Steps Concluding Remarks • To solve the MOD5 problem and to merge satisfactorily the rules G10*,3, G20*,2 and G30* , or rules G11*,3 , G21,*2 and G31* we have to disable active transitions in the rule pairs involved in simultaneous shifts of strings, as shown below : • G stands for either G 0 or G1 46 11. Concluding Remarks and Next Steps Concluding Remarks • For the suitability of M 50 and M 51 , we then have to disable 5 pairs of groups of active transitions. In general, this number depends on n, as below: Pairs of groups of active state transitions to be disabled n =5 1 Step 1 Step 2 Steps G 3* G 2* G 2* G 2* 1 G 1* 1 1 1 2 Steps G 1* 1 3 Steps n =6 1 Step 2 Steps G 4* G 3* G 2* G 3* G 2* G 3* 1 G 2* 1 G 1* 1 1 1 G 2* G 1* 1 1 1 1 1 G 1* 3 Steps G 2* 1 G 4* G 3* G 2* G 1* 1 1 1 G 3* G 2* G 1* 1 G 2* G 1* Total 1 Step 2 Steps 3 Steps G 5* G 4* G 3* G 2* G 4* G 3* G 2* G 3* G 2* 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Cn -2,2 2(Cn -3,2) Cn -2,2 3 2 6 5 2(C n -3,2) 3(Cn -4,2) 6 15 3 4 Steps G 2* 1 1 1 1 1 1 1 1 1 1 1 1 1 1 G 1* 4 Steps Subtotal n =7 1 C n -2,2 2(C n -3,2) 10 12 3(C n -4,2) 4(C n -5,2) 9 4 35 47 11. Concluding Remarks and Next Steps Concluding Remarks • The solution to the MODn problem was generalised for any value of n. • The generalised solution was simplified by merging cellular automata rules through the joining of the active transitions. • In order to merge rules for performing equivalent operation, tasks were modified and conflicts solved, following a standard that allowed us to generalise the MODn simplified solution. • Much study is still necessary for the understanding and the generalisation of these mergings. 48 Acknowledgements We are grateful to: IPM – Instituto Presbiteriano Mackenzie MackPesquisa – Fundo Mackenzie de Pesquisa Thank You Very Much! Muito Obrigado! 55