Muller's pre-injective non-surjective automaton on F2
Muller's automaton on the free group F2, pre-injective but not surjective.
- Class:
MullerAutomatonSystem - Import:
from skcomplex.systems.computer_science.automata import MullerAutomatonSystem - Field:
computer_science/automata - Topics:
group,cellular automaton,free group,Garden of Eden - References:
- Ceccherini-Silberstein and Coornaert 2023
Use this system
The block imports the class and simulates the system with its default parameters and its tuned run settings.
from skcomplex.systems.computer_science.automata import MullerAutomatonSystem
trajectory = MullerAutomatonSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
radius |
5 |
modulus |
2 |
initial |
None |
random_state |
0 |
solver |
'auto' |
backend |
'auto' |
Tags
The system with its default parameters has these capability tags, which solvers and analyses check.
| Tag | Values |
|---|---|
| Time | discrete |
| Space | lattice |
| Laws | update |
| Randomness | unknown |
| Domains | integer |
| Structure | fixed |
Class
The source of the class shows how it builds its components from its model parameters.
class MullerAutomatonSystem(BaseSystem):
"""Muller's automaton on the free group F2, pre-injective but not surjective.
The alphabet is `A = H x H` for the cyclic group `H` of order `modulus`, and every cell becomes `p1(x(ga)) +
p2(x(gb)) + p1(x(ga^-1)) + p2(x(gb^-1))`, where `p1(h, k) = (h, 0)` and `p2(h, k) = (k, 0)` (Ceccherini-Silberstein
and Coornaert 2023, Section 5.11). The image lies in `H x {0}`, so the automaton is not surjective, yet two
configurations that differ on a finite set have different images, so it is pre-injective, which the Garden of Eden
theorem forbids on amenable groups. For a prime modulus it is the linear automaton over `K^2` of Section 8.10. Cells
on the boundary of the ball read 0 outside it. The system has the coordinates `cells.first` and `cells.second`.
Args:
radius:
The radius of the ball of F2.
modulus:
The order of `H`, at least 2.
initial:
The initial pairs, an array of shape `(sites, 2)`, or `None` for random ones.
random_state:
The seed or generator of the random initial pairs.
label:
The label of the system, which names it when it is nested in another one.
solver:
The solver of the problem, or `'auto'` for the one the system chooses.
backend:
The backend that evaluates the compiled functions, or `'auto'` for the one the system chooses.
Raises:
ParameterError:
The modulus is below 2.
Examples:
>>> from skcomplex.systems.computer_science.automata import MullerAutomatonSystem
>>> MullerAutomatonSystem(radius=2).prepare().simulate(until=1).get_values('cells.first').shape
(2, 17)
"""
field = 'computer_science/automata'
topics = ('group', 'cellular automaton', 'free group', 'Garden of Eden')
references = ('Ceccherini-Silberstein and Coornaert 2023',)
until = 10
dt = 1
observables = (
Observable('first_mean', group='cells', variable='first'),
Observable('second_mean', group='cells', variable='second'),
)
def __init__(
self,
*,
radius: int = 5,
modulus: int = 2,
initial: npt.ArrayLike | None = None,
random_state: int | np.random.Generator | None = 0,
label: str = 'system',
solver: BaseSolver | str = 'auto',
backend: BaseBackend | str = 'auto',
) -> None:
super().__init__(label, solver=solver, backend=backend)
self.radius = radius
self.modulus = modulus
self.initial = initial
self.random_state = random_state
def _get_pairs(self, space: BaseSpace) -> Array:
"""Return the initial pairs, one row of two coordinates per site, random modulo the modulus by default."""
if self.modulus < MIN_MODULUS:
error_msg = f'The order of the cyclic group H is at least 2, but it is {self.modulus}.'
raise ParameterError(error_msg)
size = space.prepare().size_
if self.initial is not None:
return np.asarray(self.initial, dtype=float).reshape(size, 2)
return np.random.default_rng(self.random_state).integers(0, self.modulus, (size, 2)).astype(float)
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of pairs on a ball of the free group of rank 2 and Muller's rule."""
super()._prepare(context)
space = CayleySpace(free_group(2), ball=self.radius)
pairs = self._get_pairs(space)
self.system_ = System(
self.label,
elements=[PairCellElement('cells', first=pairs[:, 0], second=pairs[:, 1], space=space)],
interactions=[MullerRuleInteraction('rule', target='cells', modulus=self.modulus)],
)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
PairCellElement, fromElement
Interactions:
MullerRuleInteraction, fromInteraction
class PairCellElement(Element):
"""Cell of an automaton over the product `H x H` of the integers modulo `n`.
For a prime `n` the product is `K^2`. With `space`, the element holds one cell on every site.
Args:
label:
The label of the cells.
first:
The initial first coordinate, an integer from 0 to `n - 1`, or one per cell.
second:
The initial second coordinate, an integer from 0 to `n - 1`, or one per cell.
space:
The space with one cell on every site, such as a group, or `None` for one cell.
Examples:
>>> from skcomplex.systems.computer_science.automata import PairCellElement
>>> PairCellElement('cell', first=1).first
1
"""
def __init__(
self,
label: str,
*,
first: Annotated[float | Array, ZZ] = 0,
second: Annotated[float | Array, ZZ] = 0,
space: BaseSpace | None = None,
) -> None:
super().__init__(label, space=space)
self.first = first
self.second = second
class MullerRuleInteraction(Interaction):
"""Muller's rule on pairs, `p1(x(ga)) + p2(x(gb)) + p1(x(ga^-1)) + p2(x(gb^-1))`.
The projections are `p1(h, k) = (h, 0)` and `p2(h, k) = (k, 0)`, and the sum is taken modulo the order of the
cyclic group, so every image lies in `H x {0}`.
Args:
label:
The label of the interaction.
target:
The cells on the free group, whose states `first` and `second` the rule updates.
modulus:
The order `n` of the cyclic group `H`.
Examples:
>>> from skcomplex.systems.computer_science.automata import MullerRuleInteraction
>>> MullerRuleInteraction('rule', target='cells', modulus=3).modulus
3
"""
def __init__(self, label: str, *, target: Role = 'cells', modulus: int = 2) -> None:
super().__init__(label)
self.target = target
self.modulus = modulus
def _get_function(self) -> Callable[..., tuple[Array, Array]]:
"""Return the rule on the pairs at `a`, `a^-1`, `b`, and `b^-1`."""
modulus = self.modulus
def muller(*values: Array, **kwargs: object) -> tuple[Array, Array]:
first, second = values[:4], values[4:]
total = first[0] + first[1] + second[2] + second[3]
return total % modulus, np.zeros_like(total)
return muller
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the rule of the pairs as the law.
Args:
context:
The namespace of the elements a binding of the roles names.
"""
super()._prepare(context)
states = (context.target.first, context.target.second)
self.laws_: list[BaseLaw] = [
UpdateLaw(states, self._get_function(), neighborhood=FREE_GENERATORS, label=self.label),
]