Group-valued difference automaton
The automaton τ(x)(n) = x(n)^-1 x(n + 1) whose alphabet is a finite group.
- Class:
GroupDifferenceAutomatonSystem - Import:
from skcomplex.systems.computer_science.automata import GroupDifferenceAutomatonSystem - Field:
computer_science/automata - Topics:
lattice,group alphabet,surjective,symmetric group - 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 GroupDifferenceAutomatonSystem
trajectory = GroupDifferenceAutomatonSystem().prepare().simulate()
Parameters
The model parameters take these defaults, and set_params changes them.
| Parameter | Default |
|---|---|
size |
60 |
group |
None |
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 GroupDifferenceAutomatonSystem(BaseSystem):
"""The automaton `τ(x)(n) = x(n)^-1 x(n + 1)` whose alphabet is a finite group.
It runs on a ring. Over the integers, with the generator `s0 = 1` of infinite order and a nontrivial group alphabet,
the automaton is surjective but not injective (Ceccherini-Silberstein and Coornaert 2023, Exercise 3.24): every
constant configuration maps to the identity. The ring is the finite quotient of order `size`, where the product of
the image around the ring is the identity. Cells hold group elements by their number in the Cayley table of Sage,
the identity first. The system has the group elements `cells.value`.
Args:
size:
The number of cells of the ring.
group:
The finite group, a Sage permutation group, or `None` for the symmetric group of degree 3.
initial:
The initial numbers of the elements, or `None` for random ones.
random_state:
The seed or generator of the random initial elements.
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.
Examples:
>>> from skcomplex.systems.computer_science.automata import GroupDifferenceAutomatonSystem
>>> GroupDifferenceAutomatonSystem(10).prepare().simulate(until=1).get_values('cells.value').shape
(2, 10)
"""
field = 'computer_science/automata'
topics = ('lattice', 'group alphabet', 'surjective', 'symmetric group')
references = ('Ceccherini-Silberstein and Coornaert 2023',)
until = 30
dt = 1
def __init__(
self,
size: int = 60,
*,
group: PermutationGroup_generic | None = None,
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.size = size
self.group = group
self.initial = initial
self.random_state = random_state
def _prepare(self, context: Sequence[Observable] | None = None) -> None:
"""Set the system of a ring of group elements and their difference."""
super()._prepare(context)
order = int((SymmetricGroup(3) if self.group is None else self.group).order())
if self.initial is None:
values = np.random.default_rng(self.random_state).integers(0, order, self.size).astype(float)
else:
values = np.asarray(self.initial, dtype=float)
self.system_ = System(
self.label,
elements=[GroupCellElement('cells', value=values, space=LatticeSpace(self.size))],
interactions=[GroupDifferenceInteraction('difference', target='cells', group=self.group)],
)
Components
The system uses these element and interaction classes, each with its nearest class of the core.
Elements:
GroupCellElement, fromElement
Interactions:
GroupDifferenceInteraction, fromInteraction
class GroupCellElement(Element):
"""Cell of an automaton whose alphabet is a group.
It holds a group element by its number. The number is the site of the element in a group space, or its position in
the list of a finite group, and a negative number names no element, the fill value read outside a ball. With
`space`, the element holds one cell on every site.
Args:
label:
The label of the cells.
value:
The number of the initial group element, 0 for the identity, or one number per cell.
space:
The space with one cell on every site, such as a lattice or a group, or `None` for one cell.
Examples:
>>> from skcomplex.systems.computer_science.automata import GroupCellElement
>>> GroupCellElement('cell', value=2).value
2
"""
def __init__(
self,
label: str,
*,
value: Annotated[float | Array, ZZ] = 0,
space: BaseSpace | None = None,
) -> None:
super().__init__(label, space=space)
self.value = value
class GroupDifferenceInteraction(Interaction):
"""Difference `τ(x)(n) = x(n)^-1 x(n + 1)` of cells holding elements of a finite group.
Cells hold group elements by their number in the Cayley table of Sage, the identity first.
Args:
label:
The label of the interaction.
target:
The cells whose state `value` the difference changes.
group:
The finite group, a Sage permutation group, or `None` for the symmetric group of degree 3.
Examples:
>>> from skcomplex.systems.computer_science.automata import GroupDifferenceInteraction
>>> GroupDifferenceInteraction('difference', target='cells').group is None
True
"""
def __init__(self, label: str, *, target: Role = 'cells', group: PermutationGroup_generic | None = None) -> None:
super().__init__(label)
self.target = target
self.group = group
def _get_function(self) -> Callable[[Array, Array], Array]:
"""Return the number of `x(n)^-1 x(n + 1)`, read from the Cayley table and the inverses."""
alphabet = SymmetricGroup(3) if self.group is None else self.group
product = np.asarray(alphabet.cayley_table().table(), dtype=np.intp)
inverse = np.argmin(product, axis=1).astype(np.intp)
def difference(here: Array, right: Array, **kwargs: object) -> Array:
return product[inverse[here.astype(np.intp)], right.astype(np.intp)].astype(float)
return difference
def _prepare(self, context: SimpleNamespace) -> None:
"""Set the difference with the cell to the right as the law.
Args:
context:
The namespace of the elements a binding of the roles names.
"""
super()._prepare(context)
value = context.target.value
self.laws_: list[BaseLaw] = [
UpdateLaw(value, self._get_function(), neighborhood=FORWARD, label=self.label),
]