{'fraction_non_alphanumeric': 0.045017291409945544, 'fraction_numerical': 0.012362364351870254, 'mean_word_length': 3.8333333333333335, 'pattern_counts': {'":': 1, '<': 4, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Number Conservation via Particle Flow in One-dimensional Cellular Automata

A number-conserving cellular automaton is a simplified model for a system of interacting particles. This paper contains two related constructions by which one can find all one-dimensional number-conserving cellular automata with one kind of particle. The output of both methods is a"flow function", which describes the movement of the particles. In the first method, one puts increasingly stronger restrictions on the particle flow until a single flow function is specified. There are no dead ends, every choice of restriction steps ends with a flow. The second method uses the fact that the flow functions can be ordered and then form a lattice. This method consists of a recipe for the slowest flow that enforces a given minimal particle speed in one given neighbourhood. All other flow functions are then maxima of sets of these flows. Other questions, like that about the nature of non-deterministic number-conserving rules, are treated briefly at the end.


Introduction
Cellular automata are microscopic worlds: extremely simple spaces in which time passes and events occur. Sometimes they are used to simulate aspects of this world. It is therefore an interesting question to ask which of these micro-worlds can be interpreted as containing particles that can move, collide or stick to each other, but are neither destructed nor created.
In this paper I provide a new answer to this question, valid for one-dimensional automata with only one kind of particles. The new idea is that such cellular automata are now constructed instead of testing whether a given system satisfies the requirements.
The cellular automata are constructed in terms of flow functions. These are functions that describe how many particles cross the boundary between two cells, depending on the neighbourhood of this boundary. By specifying the flow functions, one can find all number-conserving automata.
Flow functions did already occur in the literature. They were described by Hattori and Takesue [1,Th. 2.2] and by Pivato [2,Prop. 12] but not used for the construction of transition rules for cellular automata. Imai and Alhazov [3] have defined flow functions for cellular automata of radius 1 2 and 1, and their Proposition 3 contains a necessary and sufficient condition for number-conservation in radius 1 2 cellular automata -it is the case of = 1 for Theorem 4.3 of this paper, so to speak. This paper contains two related constructions for flow functions (and therefore number-conserving cellular automata). The first one works by stepwise refinement. It starts with very weak requirements on the flow function, which then are successively strengthened until a single function remains that satisfies all requirements. As a side effect, the construction gives an overview over the set of all number-conserving cellular automata; this could be used for e. g. the classification or enumeration of the automata.
To write about particle flows, one needs an appropriate notation. It should represent all flows and only them, and ideally it should relate in a meaningful way to the represented flows. So far, the flows were represented by functions from cellular neighbourhoods to the integers, which violated the second requirement because flow functions cannot easily be distingushed from non-flow functions.
To correct this, a second construction is introduced, based on the first one. It uses the fact that the flow functions form a lattice and the minimal elements of this lattice have a reasonably simple form: An arbitrary flow function can therefore always written as the maximum of some of these minimal flows.
Background The following paragraphs contain references to papers that are somewhat related to this work. The list is by no means complete. For a little bit of history of number conservation see Bhattacharjee et al. [4,Sec. 4.6] or the introduction of the related paper by Wolnik et al. [5].
The most important predecessor of the current work is the paper of Hattori and Takesue [1] about additive invariants of cellular automata. The number of particles is one of them. Hattori and Takesue found a simple way to test whether a one-dimensional cellular automaton is number-conserving. This method works only a posteriori, but it provides the base for most later papers about number conservation.
Boccara and Fukś [6] describe the behaviour of number-conserving cellular automata with the help of "motion representation" diagrams. These are diagrams that show the motion of individual particles in finite regions of the automaton. The authors find a set of equations for the transition rule of a number-conserving automaton and solve them. They also show that number-conserving rules can be identified by verifying that the number of particles is conserved on all circular cell configurations of a specified size.
Fukś [7] shows that in one-dimensional number-conserving automata, one can assign permanent identities to the "particles" and describe the evolution of the cellular automaton in terms of particle movements.
Pivato [2] derives several characterisations of conservation laws in the more general context of cellular automata on arbitrary groups.
Durand, Formenti and Róka [8] collect different definitions of number conservation and show that they are equivalent. They also derive conditions for number conservation in cellular automata of any dimension.
Overview The rest of this article, after the introduction and a section with definitions, consists of the following major parts.
In Section 3, the flow function for a number-conserving cellular automaton is defined and the flow conditions are derived: conditions on the flow functions that are satisfied if and only if the functions belong to a number-conserving cellular automaton.
In Section 4, all solutions to the flow conditions are found. Examples and a diagram notation for the flow function follow in the next section.
In Section 6, a lattice structure for the set of flow functions is found. This leads to the notion of a set of "minimal" flow functions from which all other flows can be built with the help of lattice operations. A recipe for minimal flow functions is found and examples for minimal flows are shown.
Two sections, one about related topics and one with open questions, follow at the end.

Definitions
A one-dimensional cellular automaton is a discrete dynamical system; its states are configurations of simpler objects, the cells. The cells are arranged in an infinite line -they are indexed by Z -and the state of each cell is an element of a finite set Σ.

Cells and states
In a number-conserving cellular automaton, we picture each cell as a container for a certain number of particles; the number of particles it contains is part of its state. Since the number of states is finite, there is a maximal number C of particles that a cell may contain, the capacity of the cellular automaton. We therefore have for each cell state α ∈ Σ a number #α ∈ {0, . . . , C}, the particle content of α. The expression stands for the complement of the particle content: It is the maximal number of particles one can still put into a cell of state α without exceeding its capacity.
To make things simpler, the mapping # : Σ → {0, . . . , C} is required to be surjective. On the other hand, it is not necessary that # is injective; the constructions in this paper will work even if this is not the case.
Sometimes we will take the numbers {0, . . . , C} directly as cell states. Such a state set is called a minimal set of states. Even then, we will keep the distinction between α and #α, to make it clearer whether we are speaking of cells or of the number of particles in them.

Configurations
We will need to speak about finite and double infinite sequences of cell states. Finite sequences are also called strings, while the infinite sequences are configurations.
A string is an element of Σ * = k 0 Σ k . If a ∈ Σ k is a string, then k is its length, and we write |a| for the length of a. For the string of length 0 we write .
Often we write a string a ∈ Σ k as a product of cell states, in the form a = a 0 . . . a k−1 . (2) The number of particles in a and its complement are then We will also need substrings of a. They are specified by start point and length, in the form A configuration of a cellular automaton is a doubly infinite sequence of cell states, in the form a = . . . a −3 a −2 a −1 a 0 a 1 a 2 a 3 . . . .
The conventions for substrings and particle content are the same for configurations as for strings, except that #a is only defined when the number of the a i that have a non-zero content is finite. Such a configuration is said to have a finite particle content.

Evolution
The configuration of a cellular automaton changes over time. This behaviour -the evolution of the automaton -is specified by the global transition ruleφ, which maps the configuration at time t to the configuration at time t + 1.
As a function,φ is determined by two integers r 1 and r 2 and a local transition rule ϕ : Σ r 1 +r 2 +1 → Σ, subject only to the condition that r 1 +r 2 0. The numbers r 1 and r 2 are the left and right radius of ϕ. (Almost always we will also require that r 1 and r 2 are non-negative numbers. The only exceptions are the shift rules in the example below.) Now we can express the valueφ(a) for an arbitrary configuration a by the condition that ϕ(a) x = ϕ(a x−r 1 , . . . , a x+r 2 ) for all x ∈ Z.
If we want to use the colon form for substrings that is defined in (3), we can write this rule also in the formφ(a) x = ϕ(a x−r 1 :r 1 +r 2 +1 ). This form, which emphasises the length of the local neighbourhood but is less symmetric, will soon be used.
(Often one only considers the symmetric case with r 1 = r 2 = r. Then r is called the radius of the transition rule.)

Rules with equivalent dynamics
When we create a new transition rule ϕ v by replacing the radii r 1 and r 2 of ϕ with r 1 = r 1 + v and r 2 = r 2 − v, the behaviour of the new transition ruleφ v does not differ significantly from that ofφ, except for a horizontal shift that occurs at each time step.
At every time step, the ruleφ v moves therefore the new cell states v positions more to the right than ϕ. We can say thatφ v isφ as seen by an observer who moves with speed v to the left. All rules ϕ v can be treated in essentially the same way, independent of the value of v. We therefore introduce a new parameter = r 1 + r 2 to characterise ϕ. The number is, anticipatingly, called the flow length of ϕ. 1 Shift rules The simplest example for rules with the same dynamics are the shift rulesσ k , which exist for all k ∈ Z. The ruleσ k moves in each time step the states of all cells by k positions to the right.
They have r 1 = k, r 2 = −k (therefore = 0) and a local transition rule of the form σ k : Σ → Σ. Since all shift rules have the same dynamics, all σ k must be the same function: It is the identity. All σ k are trivially number-conserving, independent of the particle contents of the cell states. This is not the only representation of the shift rules as cellular automata. We will soon see another representation for the rulesσ k with k 0.

The flow conditions
A formal definition for number conservation is still missing. We use this one: A transition ruleφ is number-conserving if #φ(a) = #a for every configuration a with finite particle content.
From now on we will therefore assume that every configuration has a finite particle content.
If we divide such a configuration into two parts, we can define the particle flow between them. It is the number of particles that move from the left to the right side under the action ofφ.
For the definition, consider the following setup: It shows the cells of a configuration, split by the vertical bar into a left part, u, and a right part, v. Its image underφ shall be Let now L = #u − #u be the change in the particle content in the left part and R = #v − #v be the change in the right part. The particle content in the configuration is preserved, therefore is R = −L.
The number R is then the particle flow; if it is positive, particles move to the right.
We apply this concept to the following setup, which is the same as (8), but with the cells named differently. .
The two parts are separated by a vertical bar as before, but but there are now also three regions, x, u, and y. Region u consists of r 1 cells to the right and r 2 cells to the left of the vertical bar. The numbers L and R are defined as before.
The interaction in a cellular automaton is local, therefore L can only depend on x and u, and R only on u and y. But R = −L, therefore they both can only depend on u. So we can find a function with f (u) = R = −L. This is the function which will allow us to describe the essential properties of a number-conserving cellular automaton. We call f the flow function of ϕ.
Next we try to reconstruct ϕ from f . To do this, we consider the following setup with + 1 named cells and two boundaries, We are interested in the state of the cell at the centre in the next time step. Initially, it contains #w r 1 particles. One step later, there are #ϕ(w) particles at this place. On the other hand, during this transition, f (w 0: ) particles must have entered the cell region through the left boundary, and f (w 1: ) of them must have left it to the right. The number of particles at the centre at the next time step must therefore be #ϕ(w) = f (w 0: ) + #w r 1 − f (w 1: ) .
With this equation, applied to all neighbourhoods w ∈ Σ +1 , we can partially reconstruct ϕ from f . If the state set Σ is minimal, the transition function can even be reconstructed uniquely from the values of #ϕ(w). Otherwise, there are several different transition functions for the same flow function. (How they are related would be the subject of another paper.) Since ϕ can be derived from f , it will be enough to consider f alone. We therefore need to find all functions f : Σ → Z for which there is a valid transition rule ϕ. These are exactly those functions f for which the right side of (13) is neither too small nor too large. We have therefore The inequalities (14) are called the flow conditions.

Solving the flow conditions
Great flows have little flows next to them to guide 'em, And little flows have lesser flows, but not ad infinitum.
We will now restrict out work to rules with r 1 = and r 2 = 0, so that particles only move to the right. This will make induction on the neighbourhood size much simpler. It does not reduce the generality of the conclusions because, as we have seen in Section 2.4, every rule is equivalent to such a rule. And at the end, in Section 7.2, we will return to the general case.
The flow conditions now have the form To find solutions for them, we define some functions related to f , the half-flows. They come in two variants, as bound and free half-flows, where the free half-flows are a generalisation of the bound half-flows.
The bound half-flows have their name from the fact that they are constructed from a specific flow function f . This makes their definition easier to understand and therefore they are introduced first. Properties of the bound half-flows will then lead to a definition for free half-flows, which do not refer to a flow function. Instead, each system of free half-flows is used to construct a flow function.
Bound half-flows We will now introduce the bound half-flows. There are two families of them, the lower and the upper half-flows, given by the equations, with 0 k and v ∈ Σ k . (Note that f 0 and f 0 are in fact constants.) Much more useful are however the inductive forms of these definitions, with w ∈ Σ , α ∈ Σ and v ∈ Σ k for 1 k .
Example: Flow functions for shift rules The shift rulesσ for 0 illustrate these definitions. Each shift rule has a flow function f : Σ → {0, . . . , C} with f (v) = #v for all v. Its half-flows are f k (w) = #w and f k (w) = ( − k)C + #w, for w ∈ Σ k . This shows that the particle flow can be quite large, greater than the capacity of a single cell.

Properties of the bound half-flows
The most important consequence of (17) is the following lemma, which shows how the half-flows are related to each other.
It especially shows that for 1 k , the flow conditions (15) split into pairs of inequalities, In the lemma, these inequalities follow from in (19): We can get them by removing the central terms of (19a) and (19b) and rearranging the remaining inequalities.

Lemma 4.1. (Interaction of half-flows)
Let 0 k < and w ∈ Σ k+1 . If f is the flow function of a number-conserving cellular automaton, then Proof: The two pairs of inequalities can be proved independently of each other, so we begin with (19a).
Its proof is a finite induction from k = down to k = 1. The induction step consists of showing that that from always follows The induction can begin because for k = , inequality (20) is equivalent to the left side of the flow condition (15).
To prove the induction step, note that the left side of (20) is independent of the choice of w 0 . At the right side of (20), we can therefore replace the term f k (w 0:k ) with the smallest possible value it can take when we vary w 0 and keep w 1:k−1 fixed. The result is f k−1 (w 1:k−1 ), and we get f k (w 1:k ) f k−1 (w 1:k−1 ) + #w k . This is already the right inequality of (21); we only need to write w 1:k as w . The left inequality, f k−1 (w 1:k−1 ) f k (w ), follows directly from the inductive definition (17a) of f k .
The proof of (19b) is similar. We only need to replace f with f , #β with −# c β and revert the order of the terms in the inequalities.
The next lemma is about the behaviour of f k (v) and f k (v) for a single value of v. and are valid for 0 k and v ∈ Σ k .

Proof:
The first two inequalities follow directly from the definitions of f k (v) and f k (v) in (16). For both half-flows, we have to consider all flows f (uv) with u ∈ Σ −k , i. e. the following setup: Only the particles in u and v may cross the boundary, and they may only move to the right. All possible values for f (uv) are therefore non-negative, and the same is true for f k (v) and f k (v). This proves the two lower bounds in (22). For the upper bound on f k (v), we note that the set of all f (uv) includes the case with #u = 0. Then at most #v particles may cross to the right, which means that also f k (v) #v. On the other hand it is also possible that all cells in u contain C particles and that #u = (l − k)C. Then ( − k)C + #v particles may cross the boundary, which explains the upper bound for f k (v).
The left side of (23) is clear; the right side can be proved with another setup: Here we assume that we know f (vw) and try to find upper and lower bounds for the number of particles that cross the left boundary. The highest possible number of particles is f (vw) + # c w, because then the w region will be completely filled up in the next time step. The smallest particle flow is f (vw) − #w, because then the w region will be empty. This means that from which the right side of (23) follows.

The construction of all flows
Now we can define the free half-flows. They provide us with a practical method to find the flow functions among all the functions f : Σ → {0, . . . , C}. This method is an algorithm of stepwise refinement, where at each step a choice takes place that never needs to be taken back.
A system of free half-flows is then a sequence (f k , f k ) 0 k of functions that satisfy the conditions of Lemma 4.1 and 4.2. This means that must be true for 0 k < and w ∈ Σ k+1 and must be true for 0 k and v ∈ Σ k . (To distinguish between the two kinds of half-flows, we write free half-flows with a bar and bound half-flows a tilde.) This definition ensures that each system of bound half-flows is also a system of free half-flows and also that free half-flows can be chosen without reference to a given flow function.
The following theorem then states how flow functions are constructed.

Theorem 4.3. (Flow construction)
All solutions of the flow conditions (15) can be found by constructing a sequence of free half-flows This means that if j < and f 0 , f 0 , f 1 , f 1 , . . . , f j , f j is a sequence of functions 2 satisfying the conditions in (26), it is always possible to extend it with two functions f j+1 and f j+1 so that the new sequence again satisfies (26).
At the end, we have f = f and the function f = f = f is the constructed flow. All flow functions can be found in this way.

Proof:
We have already seen that for every flow there is a sequence of free half-flows that satisfies the required inequalities. Therefore all possible flows can be reached by the construction of the theorem.
It remains to show that the construction can always be completed. We will now follow it step by step and show that at each step is always possible.
The construction starts with the choice of two constants f 0 and f 0 that satisfy the conditions in (26). For k = 0, the conditions reduce to so the first step can always be done.
Now assume that k < , that the half-flows f k and f k are already constructed and we want to construct f k+1 and f k+1 . We must then find solutions for the inequalities (26). I will now rewrite them in the order in which we will try to find solutions for them.
The result is the following system of inequalities. For any v ∈ Σ k+1 it contains all conditions on f k+1 (v) and f k+1 (v).
There are |Σ| k+1 of such systems of inequalities, but each pair of f k+1 (v) and f k+1 (v) occurs in only one of them. The values of f k+1 (v) and f k+1 (v) can therefore be chosen independently for each v.
First we note that each of the requirements in (29) can be satisfied individually. The only cases in which this is not obvious are (29a) and (29c). But when we remove the central term in both, a halfflow condition (18) for f k or f k remains, which is true by induction. The upper and lower bounds on f k+1 and f k+1 in each of the two requirements are therefore consistent with each other and we can find solutions for them.
Next we verify that all requirements in (29) except the right inequality in (29e) can be satisfied together. We do that by choosing as our candidate for a solution. This is the "lazy" solution in which f k+1 (v) is as small and f k+1 (v) as large as possible. The first two requirements in (29) are then clearly satisfied. For the next two, we need only to verify the left inequality of (29c). It is equivalent to the two inequalities The left inequality is part of (29c) and true by induction. For the right inequality, we add on both sides # c v k and get f k (v 0:k ) #v 0:k + ( − k)C. This is the version of (29d) with v 0:k instead of v and again true by induction.
What remains is the right inequality in (29e). It may be violated by the solution candidate (30). If that is the case, we move the candidates for f k+1 (v) and f k+1 (v) stepwise towards each other until we have either found a full solution or cannot continue. If we cannot continue, f k+1 (v) cannot be made larger or f k+1 (v) smaller. That is, one of the left inequalities of (29a) and (29b) and one of the right inequalities of (29c) and (29d) must have become equalities, or f k+1 (v) = f k+1 (v).
Three cases can be excluded. If f k+1 (v) = f k+1 (v), then all of (29e) is satisfied and we have a solution to the full system of inequalities. If f k+1 (v) = 0, then f k+1 (v) = 0 too and we have again a solution. And f k+1 (v) = #v cannot occur without f k+1 (v) = f k (v 0:k ) + #v k because by induction, f k (v 0:k ) #v 0:k and therefore f k (v 0:k ) + #v k #v.
So the right inequality of (29e) can always be satisfied.
In other words, the step from f k and f k to f k+1 and f k+1 is always possible, and f and f can always be constructed. That they are equal follows from (23).

Examples and diagrams
We will now, as an illustration for Theorem 4.1, construct all number-conserving elementary cellular automata.
This would lead to a quite voluminous computation if it were done directly. So I will at first introduce a diagram notation for all the flows and half-flows of a number-conserving cellular automaton. With these box diagrams, the computation can be shown in a reasonable amount of space.

A rule with a maximal half-flow
Before we can begin to work with elementary cellular automata, I will illustrate the method by applying it to a simpler example. We will now construct a flow function f for which the half-flow f 0 takes the largest possible value. We will do this for the minimal state set with capacity C = 1, i. e. the set Σ = {0, 1}, so that every cell contains at most one particle. The diagrams for the computation are shown in Figure 1.
The construction starts with the box at the top; that at the bottom represents the resulting flow function. I will first describe how the diagrams must be read and the how the construction proceeds.
• Each box stands for a pair of half-flow values, f k (w) and f k (w) for some w. The box for f k (w) and f k (w) is called the k-box for w.
In the construction, it influences the flow values for all neighbourhoods with w at its right end.
In the figure, one can find these neighbourhoods at the bottom, deep below the k-box.
• The values of f k (w) and f k (w) are given by the position of the lower and the upper edge of the k-box for w.
• The values of w for the innermost k-boxes in a diagram appear at its bottom, below the box.
• The dots in the bottom diagram stand for the value of f and at the same time for the values of the half-flows f and f , since they all are the same.
Under each dot stands the neighbourhood which it represents. (The neighbourhoods are ordered lexicographically by their mirror-images.) • The grey lines in the diagrams are restrictions for the upper and lower edges of the (k +1)-boxes that will be constructed in the next step.
The construction itself obeys the following rules, which are a "graphical version" of Theorem 4.3.
• All k-boxes except the outermost one must be drawn directly inside a (k + 1)-box. This ensures that the conditions f k (v 1:k ) f k+1 (v) and f k+1 (v) f k (v 1:k ) of (29a) and (29c) are satisfied.
• The maximal height of a k-box is − k. This ensures that (29e) is satisfied.
• The upper edge of a k-box is not higher than the greatest particle content of all the neighbourhoods that it influences.
This ensures condition (29d), because the upper edge of the k-box v stands for f k (v), which is the maximum of all neighbourhoods of the form uv with u ∈ Σ −k : Their highest particle content is therefore ( − k)C + #v, as required in the condition.
• When a new k-box is constructed, its dimensions are partially determined by the pair of grey lines in the diagram above it that have the same horizontal extension as itself. The new k-box must have an upper edge that is not lower than the upper grey line, and a lower edge that is not higher than the lower grey line. This is to make sure that the conditions f k+1 (v) f k (v 0:k ) + #v k and f k (v 0:k ) − # c v k f k+1 (v) of (29a) and (29c) are satisfied.
• Finally, to keep the promise we just made, we need to draw new grey lines at the right positions in the new diagram. The grey lines that we need to draw are copies of the arrangement of kboxes that we just have constructed -but with modifications. (a) The first one is that we create C copies of the arrangement and squeeze them horizontally by a factor C −1 , so that they again fit into the same space. One will then be above the neighbourhoods that have 0 as its rightmost state, one above those that end with 1, and so on. (b) We now move the arrangements upward by rising amounts: The first copy not at all, the next one by 1, and so on. (c) Then we replace the boxes in all arrangements by pairs of grey lines: the lower edge by a grey line at the same position, but the upper edge by an upper grey line that is C positions below.
To justify these rules, write the inequalities from (29a) and (29c) that were mentioned above in the form  This is the way in which the diagrams in Figure 1 were constructed. As an example for the most difficult part, namely the construction of the thin lines, we will now look at the first diagram in detail. In it, we see two pairs of grey lines that form the "shadows" of two 1-boxes. Both are smaller versions of the outer 0-box with the upper edge lowered by C = 1; the right one is also moved upward by 1.
We can also see that in the first three diagrams of Figure 1, the arrangement of grey lines in the right half is a shifted version of the arrangement of grey lines in the right half.
In the diagrams of Figure 1, the pairs of thin lines always have the maximal possible distance, so there is no choice in the following step. This means that the flow function forσ 3 is the only one with f = 3 -an observation that can be easily extended to allσ with 0.

Elementary cellular automata
Now we can begin with the construction of all number-conserving elementary cellular automata. Elementary cellular automata, or ECA [9], are simply the one-dimensional cellular automata with radius r 1 = r 2 = 1 and state set Σ = {0, 1}. They therefore have a transition rule ϕ : Σ 3 → Σ and a flow function of width = 2 for capacity C = 1. We must now find all number-conserving flows. This is done in Figure 2. The figure must be read from left to right and from top to bottom. The first column contains all possible box diagrams for the first step of the construction. To the right of each diagram and right-below of it are its refinements, the diagrams for all the possible next steps of the construction. So the second box diagram in the first column has four refinements, and the second of them, two.
The rightmost column contains the code numbers of the ECA that belong to the flows in column 3. The code numbers were given by Wolfram [9]. If a rule is a shift ruleσ k , the name of the rule is also given. Since we have here switched back to a symmetrical cellular neighbourhood, the shift speed is different from that what we would have seen in the context of Figure 1.
Some rule names are put in braces. They belong to rules that occur more than once in the diagram, constructed in different ways. For an unknown reason it is only Rule 204, the identity function, that occurs more than once. But there is only one construction of Rule 204 that uses bound half-flows; it is that one in which the rule name is not put in braces.
One new phenomenon appears here: It can happen that the "upper" grey line is below the "lower" grey line. This occurs the first time in the construction of Rule 184. It is the reason why the two types of grey lines have distinct shapes.
The result of this calculation is that the only number-conserving ECA rules are the shift rulesσ −1 , σ 0 ,σ 1 , the so-called "traffic rule" 184, and Rule 226, which is Rule 184 with left and right exchanged.

Minimal flows
We have now found all flow functions with rule width = 2 and for a minimal state set Σ of capacity C = 1. Similar computations for larger or Σ would soon become unwieldy. I will therefore now describe another method to construct all flows for a given and Σ. It is based on a lattice structure on the set of flows.
The lattice structure also provides formulas that can serve as names for all the flow functions.

Sets of flows
To keep the following arguments short (or at least not too long), we will introduce some notation. We will write F( , Σ) for the set of flows of width and state set Σ, i. e. the set of functions f : Σ → {0, . . . , C}, with C = max{ #α : α ∈ Σ } that satisfy the flow conditions (15). (The restriction to r 1 = and r 2 = 0 is again in place.) We will also write H( , Σ) for the set of free half-flows related to and Σ. It is the set of function families (f k , f k ) 0 k that satisfy the inequalities (26).
If Σ is a minimal state set of capacity C, we will also write these sets as F( , C) and H( , C). When the intended meaning is clear, we may also write F or H.

Flows as a partially ordered set
Our next step is the introduction of a partial order on F and H. We define the order pointwise: For two flows f , g ∈ F, the relation f g shall be true if For systems of half-flows f , g ∈ H, conditions similar to (33) must be satisfied for all of their halfflows to make f g true.
The minimum f ∧ g and maximum f ∨ g of two flow functions f , g ∈ F is defined pointwise too, in the form For systems of half-flows, f ∧ g and f ∧ h are defined in the same way -here the formulas of (34) are applied to all pairs of half-flows in f and g with the same type.
The minimum and maximum of a set S of flows (or half-flow systems) is written S and S. For S ⊆ F we have then and again the formulas for half-flows are similar.
The following theorem shows that these definitions are useful.
Theorem 6.1. With the operations ∧ and ∨ as defined above, the sets F( , Σ) and H( , Σ) each form a distributive lattice.

Proof:
We will prove the theorem for F and then sketch a similar argument for H. First we note that the set {0, . . . , C} Σ of functions from Σ to {0, . . . , C} is a distributive lattice. This is because {0, . . . , C}, as a linear order, is distributive, and {0, . . . , C} Σ , as a product of distributive lattices, is so too [10,Proposition 4.8].
It is therefore enough to show that F is closed under minimum and maximum; then it is a sublattice of the full function space and also distributive [10,Section 4.7].
To do this, let f , g ∈ F be two flows and h = f ∧ g. We have then to verify that the following inequalities are true for all v ∈ Σ and w ∈ Σ +1 : The first two inequalities control the upper and lower bounds on h and are clearly satisfied. The other two represent the flow conditions (15) for h. We first look at (36c). The two flow values at its left side each stand either for a value of f or of g. If both belong to the same flow, say f , then (36c) is actually the same inequality for that flow and therefore true. The only interesting case is therefore that in which the two h values stem from different flows. Without loss of generality we may assume that the first one is from f and the second from g, so that we need to find an upper bound for f (w 1: ) − g(w 0: ). But since h(w 1: ) = f (w 1: ), we must have f (w 1: ) g(w 1: ) and can calculate so (36c) must be true. Inequality (36d) has the same form and can be proved in the same way. This proves that f ∧ g ∈ F.
When we set instead h = f ∨ g, the proof of (36c) is a bit different. Now we conclude instead from h(w 0: ) = g(w 0: ) that g(w 0: ) f (w 0: ), and (37) becomes The rest of the argument is the same, and we have now proved that F is a distributive lattice.
The space H of free half-flows is a subset not of a single function space but the product of several, one for each half-flow. This product is still a distributive lattice. Therefore it again is enough to check whether it is closed under ∧ and ∨. There are a lot more inequalities to consider, but they all can be brought to one of the three forms In these inequalities, the h terms stand either for h or h, with possibly different choices in the same inequality, 3 K is a constant that does not depend on the half-flow functions, and v ∈ Σ j and w ∈ Σ k . These inequalities have the same form as those for F, therefore the same arguments can be used, and H too is a distributive lattice.

Minimal flows as building blocks for all the flows
Now, with the lattice structures of F and H, we can use a subset of all flows as building blocks for the rest. These are the minimal flows with v ∈ Σ and k ∈ {0, . . . , #v}. So m(v, k) is the smallest flow that at the neighbourhood v has at least the strength k.
Every flow can then be represented as a maximum of minimal flows, To see why this is so, we note that m(v, f (v)) is a flow that is less than or equal than f and agrees with f when evaluated at v. This is true because for m(v, f (v)), the right side of (40) becomes This expression is the minimum of a set of flows which contains f , therefore m(v, f (v)) f . And it is the minimum of a set of functions whose values at v are greater or equal to f (v) and which contains f , therefore m(v, f (v))(v) = f (v).
The first fact proves that the right side of (41) is less than or equal to f ; the second fact, that for each neighbourhood v, the right side of (41) has a value that is not less than f (v). So the right side of (41) must be f .
Apart from being building blocks, the minimal flows are also interesting in their own right. They answer the questions: If I require that f (v) = k, which influence has this on other neighbourhoods? Does pushing the particles forward in one place set particles in other place in motion? We will therefore construct the minimal flows.
for all u, v, w, u , w ∈ Σ * with a = uvw and u vw = b.

Proof:
According to Theorem 4.3, m(a, k) can be constructed from free half-flows. We take now the minimum of all half-flow sequences that lead to m(a, k), i. e. the system It consists of a sequence of half-flows that leads to m(a, k) "greedily": M (a, k) is a sequence (f i , f i ) 0 i of half-flow pairs in which every value f (v) and f (v) is the smallest possible for which the construction sequence can still end in m(a, k). We will now construct such a sequence.
To do this, we will use the inequalities of (26), but in a much more compressed form. In a first simplification, we write them as and they are valid for all v, w ∈ Σ * with |vw| .
These inequalities differ from their representation in (26) in two aspects: (a) The indices on f and f are dropped, since they can be derived from their arguments, and writing them would make the formulas only more complicated. (b) In the first two lines, the formulas have been iterated and the variables renamed. From the inequality f k+1 (w) f k (w 0:k ) + #w k in (19a), valid for w ∈ Σ k+1 , we get by induction f k+n (w) f k (w 0:k ) + #w k:n for w ∈ Σ k+n , and then, after renaming w 0:k and w k:n to v and w, the right side of (44a). The other derivations are similar.
You may also have noticed that conditions (26c) and (26d) have disappeared. They are less important. Their left parts state that all half-flows must be non-negative, which we will keep in mind, while their right parts contain upper bounds to the half-flows. We will not need them because in our construction, all half-flows are as small as possible.
In a second compression step, we now express the inequalities (44) with arrows. We write an inequality as an arrow u and do the same for all other combinations of upper and lower bars. The number n on an arrow is called its strength, and it is omitted when n = 0.
An arrow as in (46)  When we now translate the inequalities of (44) into arrows, they become In principle, we must consider all arrow chains from a to b. But most of them can be replaced by stronger chains, and only two remain. The following arguments show how this is done.

1.
We can ignore all chains in which two arrows of the same form occur in sequence.
An example for such a chain is vww 2. In the next reduction step, we consider arrow chains that consists of arrows of the same "type".
Two arrows have the same type if they either lead from an upper half-flow to an upper half-flow or from a lower to an lower half-flow. Any chain of same-type arrows can be brought to one of the forms without loss of strength.
In other words, we can assume that a shortening arrow always occurs before a lengthening one.
To prove this, we first show that if a lengthening arrow is followed by a shortening arrow, they can be rearranged without loss of strength. For lower half-flows, such a chain must have the Form (a) occurs when the first arrow adds cell states that the second takes away, while (b) occurs when there is a common substring v in the first and third half-flow of the chain.
But in (a), we can remove x and get a stronger arrow chain. This chain is the special case of (b) with v = , so that we only need to consider (b). And (b) can be replaced with (48a), so that we have proved our assertion for chains of two arrows.
Chains of more than two arrows can now be rearranged so that there is first a chain of shortening and then one of lengthening arrows. But arrows of the same form can be condensed to a single arrow, as we have seen before. So we end up again with (48a).
Chains of less than two arrows can be extended by adding "empty" arrows, say by setting u = . Therefore all sequences of arrows between lower half-flows can be brought into the form (48a). The proof for upper half-flows is similar.
3. Another simplification concerns the type-changing arrows in (47c). We can assume that two type-changing arrows never occur directly in sequence. For if they occur, as in we can remove them both and get an arrow chain that is at least as strong.
4. Next we consider a chain of three arrows with a type-changing arrow in its centre. As we now can conclude, they can only have the following two forms (with uv = u v or vu = v u , respectively): But for them we can assume that either u = or u = and simplify the arrow chains accordingly. (In other words, do not take away what you just have added.) The proof consists of four cases. For for each arrow chain, one must distinguish between |u| |u | and |u| |u |. We will look only at one case, namely that in which |u| |u | is true in (49b). There we can write u = xu for a suitable and then remove u to get a stronger chain, The other cases are similar and always lead to a new chain that is at least as strong as the original one.
5. Now we can construct the two chains that lead to inequality (42) of the theorem: We must collect the arrow chains for all possible u, v, w, u , v ∈ Σ * to get all requirements on f (b) for a given f (a).
The chains arise naturally once we note that a has maximal length and that therefore the first arrow must necessarily be shortening. After that, there is only one possible successor for each arrow, until the arrow chain ends in b.
The first chain has the weight −#w − # c w − |u |C and the second, −#w − # c w − |u|C, from which we can see that (42) is the right formula.
6. Our argument is not yet complete. The arrow chains of (52) consist of a single cycle of shortening and lengthening arrows, from uvw to u v w . What if we created arrow chains of more than one such cycle? Would we then get more conditions on f (b)?
To resolve this question, we first need shorter expressions for the cycles. We write the chains in (52) as single arrows, as The two cycles have essentially the same form, so it will be enough to consider only the first one.
When we now connect two arrows of the form (53a), the result can always be written as This is because the action of each arrow can be understood as taking away cell states from both sides of the string at its left and then adding others, resulting in the string at its right. (In (53), the regions u and w are removed and u and w then added.) A region in the centre is left unchanged. With two arrows, the unchanged region of the first arrow might be shortened by the second. In (54) we therefore have assumed, that xyz is the unchanged region of the first and y that of the second arrow.
The strength of the arrow chain in (54) is −|u w u |C − #zw − # c w . But we can achieve the same result with a single arrow, Its strength differs from that of (54) by −|u w |C, which is never a positive number. This means that we can replace (54) with (55) in a chain of arrows and, by induction, that a single cycle (53) is enough.

7.
Finally, what about shorter chains? One could omit the type-changing arrows and get chains of the form which look as if they could be stronger that those in (52). But in fact they are just special cases of these chains. One can e. g. see that (56a) is just (52b) with u = w = . Recall that a = a and b = b and note that, since |vw| = , the arrow vw has strength 0. In the same way one can see that (56b) is a special case of (52a).
We have now shown that all relations between f (b) and f (a) derive from the arrow chains in (52). Therefore the conditions in (42) define m(a, k). 4

Examples
With Theorem 6.2, we can now find examples for minimal number-conserving automata. As before with the elementary cellular automata, we use the minimal state set Σ = {0, 1}. So we have C = 1, and every cell may contain at most one particle. Even with these restrictions, we can find cellular automata with an interesting behaviour. The influence of the particle density An example is m(0110, 2) in Figure 3. In the figure, cells in state 0 are displayed in white, and cells in state 1 in black. Time runs upward, and the line at the bottom is a random initial configuration.
In an ordinary cellular automaton, one can expect that the number of ones and zeroes in a random initial configuration has no great influence on the patterns that arise after a few generation. Under most rules, the fraction of cells in state 1 changes over time. With number-conserving automata this is no longer true. Figure 3 therefore contains four evolutions of m(0110, 2) with different densities: the density is the fraction of cells in state 1 in the initial configuration -which then stays constant during the evolution of the cellular automaton.
Especially in the two low density evolutions (with density = 0.1 and 0.2), one can see that particles move with three possible speeds: Isolated particles move with speed 1, blocks of two particles, like 0110, move with speed 3, and blocks of three particles move 5 steps over two generations (from 0111000000 via 0001101000 to 0000001110) and therefore have a speed of 2.5. For very low densities like 0.1, the evolution is initially dominated by non-interacting single particles, but we can already see how they are collected by the faster structures and integrated into their particle stream. In the density 0.2 image we can see how the fast structures interact: When a middle speed particle group interacts with a fast one, a short "traffic jam" of high particle density occurs, but then the two particle groups separate again. (Note that the middle-speed groups before and after the interaction consist of different particles.) With density 0.5, the traffic jams are more common, and also highly regular structures between them. With the moderately high density of 0.6, all interesting behaviour stops early, and the automaton looks like σ 1 . So m(0110, 2) already establishes a vaguely traffic-like behaviour, except that the speed of a particle also depends on the location of the particles next to it. Figure 4 illustrates other phenomena that occur with minimal number-conserving cellular automata.

Other phenomena
Often, especially at low densities, nothing or almost nothing happens. The evolution of rule m(11010, 2) at the top left of the figure is an example. Most of the time, almost all particles are arranged in a pattern in that no non-zero flow arises. From time to time, a disturbance moves over the cells.
Rule m(01110, 2), at the top right, consists too of times of inactivity and moving high-density regions. The high-density regions have however their own intricate structure.
When we then have constructed a flow function f for a non-minimal state set, we can construct a non-deterministic number-conserving rule with the help of a relaxed form of (13), namely ϕ(w) ⊆ { α ∈ Σ : #α = f (w 0: ) + #w r 1 − f (w 1: ) } .
Such a function is clearly number-conserving, since all possible choices for the next state of a cell have the same particle content.
The condition that for each w ∈ Σ +1 , all elements of ϕ(w) must have the same particle content is also necessary: If there are α, β ∈ ϕ(w) with #α = #β, we can use a configuration a which contains w as a substring to construct a counterexample. Among the possible successor configurations of a in the next time step, there must be two that only differ at one cell, which is in one configuration in state α and in the other one in state β. Since #α = #β, number conservation cannot hold for both configurations.

Two-sided neighbourhoods
We now return to the case where r 1 and r 2 are arbitrary non-negative numbers. The flow functions for such two-sided neighbourhoods are related in a very simple way to the one-sided neighbourhoods that we have so far investigated.
Letφ be a global transition rule with arbitrary r 1 and r 2 and letφ be the transition rule with a one-sided neighbourhood that is related to it. Let f and f be their flow functions. Then we can writê This is because we can get the effect ofφ by first moving the content of all cells by r 2 positions to the left and then applyingφ . The corresponding equation for flows is for all u ∈ Σ r 1 and v ∈ Σ r 2 : The shiftσ −r 2 produces an additional flow of −#v particles over the boundary between u and v.
As a corollary of (60), we see that the new two-sided flows obey the same partial order as the one-sided do. If g is another flow with radii r 1 and r 2 and f is its one-sided equivalent, then as we easily can conclude from (60) and the definition of the partial order in (33).
The theory of minimal flows for two-sided neighbourhoods is therefore isomorphic to that for one-sided neighbourhoods. As a good notation for two-sided minimal flows I would propose m(u, v; k) = m(uv, k) − #v .
(62) In automata of the second type, there is only one container in each cell and particles of different "colours" that move between the the cells. Here the theory will be more complex.
8. What about particles in higher dimensions?
The derivation of Theorem 4.3 only works in one dimension. For higher-dimensional cellular automata therefore new ideas are needed.
9. Are there practical or theoretical applications for this theory?
With practical applications I mean e. g. simulations of physical systems. A theoretical application could be the construction of a universal number-conserving cellular automaton or something similar.
10. Can the theory be simplified?
In the proofs and calculations of this paper, a small number of types of inequalities are used over and over again. Is there a theory with which the repetitions can be compressed into a few lemmas at the beginning, such that the actual proofs take only (say) two pages? This would also be helpful for multi-particle and higher-dimensional systems.