# Second-order cellular automaton Elementary CA rule 18 (left) and its second-order counterpart rule 18R (right). Time runs downwards. Note the up/down asymmetric triangles in the nonreversible rule.

A second-order cellular automaton is a type of reversible cellular automaton (CA) invented by Edward Fredkin where the state of a cell at time t depends not only on its neighborhood at time t − 1, but also on its state at time t − 2.

## General technique

In general, the evolution rule for a second-order automaton may be described as a function f that maps the neighborhood of a cell to a permutation on the states of the automaton. In each time step t, for each cell c of the automaton, this function is applied to the neighborhood of c to give a permutation σc. Then, this permutation σc is applied to the state of cell c at time t − 1, and the result is the state of the cell at time t + 1. In this way, the configuration of the automaton at each time step is computed from two previous time steps: the immediately previous step determines the permutations that are applied to the cells, and the time step before that one gives the states on which these permutations operate.

The reversed time dynamics of a second-order automaton may be described by another second-order automaton with the same neighborhood, in which the function g mapping neighborhoods to permutations gives the inverse permutation to f. That is, on each possible neighborhood N, f(N) and g(N) should be inverse permutations. With this reverse rule, the automaton described by function g correctly computes the configuration at time t − 1 from the configurations at time t and t + 1. Because every second-order automaton can be reversed in this way, it follows that they are all reversible cellular automata, regardless of which function f is chosen to determine the automaton rule.

## For two-state automata

If a cellular automaton has only two states, then there are also only two possible permutations of states: the identity permutation that maps each state to itself, and the permutation that maps each state to the other state. We may identify these two permutations with the two states of the automaton. In this way, every second-order cellular automaton (defined by a function from neighborhoods to permutations) corresponds uniquely to an ordinary (first-order) cellular automaton, defined by a function directly from neighborhoods to states. Two-state second-order automata are symmetric under time reversals: the time-reversed dynamics of the automaton can be simulated with the same rule as the original dynamics.

If we view the two states as Boolean values, this correspondence between ordinary and second-order automaton can be described simply: the state of a cell of the second-order automaton at time t + 1 is the exclusive or of its state at time t − 1 with the state that the ordinary cellular automaton rule would compute for it. In fact, all two-state second-order rules may be produced in this way. The resulting second-order automaton, however, will generally bear little resemblance to the ordinary CA it was constructed from. Second-order rules constructed in this way are named by Stephen Wolfram by appending an "R" to the number or Wolfram code of the base rule.

## Applications

Second-order automata may be used to simulate billiard-ball computers and the Ising model of ferromagnetism in statistical mechanics. They may also be used for cryptography.