Skip to content

Self-indexed shift over a group alphabet

The map τ(x)(g) = x(g · x(g)) over the group as alphabet.

  • Class: SelfIndexedShiftSystem
  • Import: from skcomplex.systems.computer_science.automata import SelfIndexedShiftSystem
  • Field: computer_science/automata
  • Topics: group, infinite alphabet, equivariant, free 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 SelfIndexedShiftSystem

trajectory = SelfIndexedShiftSystem().prepare().simulate()

Parameters

The model parameters take these defaults, and set_params changes them.

Parameter Default
group None
radius 4
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 SelfIndexedShiftSystem(BaseSystem):
    """The map `τ(x)(g) = x(g · x(g))` over the group as alphabet.

    It is continuous and equivariant but no automaton. Every cell holds a group element, the number of its site, and
    takes the value of the cell at the product of its site and its value, so the cell it reads moves with the
    configuration. On an infinite group no finite memory set describes the map, which is continuous and commutes with
    the shifts but is no cellular automaton (Ceccherini-Silberstein and Coornaert 2023, Example 1.8.2). The simulation
    truncates the group: on a ball, a product outside it reads `-1`, a value that names no element and stays, and a
    finite group, without a radius, keeps every product. The system has the group elements `cells.value`.

    Args:
        group:
            The group, a Sage or GAP group, or `None` for the free group of rank 2.

        radius:
            The radius of the ball, or `None` for a finite group.

        initial:
            The numbers of the initial elements, one per site, or `None` for random ones.

        random_state:
            The seed or generator of the random initial elements, drawn uniformly among the sites.

        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 SelfIndexedShiftSystem
        >>> SelfIndexedShiftSystem(radius=2).prepare().simulate(until=1).get_values('cells.value').shape
        (2, 17)
    """

    field = 'computer_science/automata'
    topics = ('group', 'infinite alphabet', 'equivariant', 'free group')
    references = ('Ceccherini-Silberstein and Coornaert 2023',)
    until = 6
    dt = 1

    def __init__(
        self,
        group: object | None = None,
        *,
        radius: int | None = 4,
        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.group = group
        self.radius = radius
        self.initial = initial
        self.random_state = random_state

    def _prepare(self, context: Sequence[Observable] | None = None) -> None:
        """Set the system of the cells on a ball of the group and the self-indexed shift."""
        super()._prepare(context)
        space = CayleySpace(free_group(2) if self.group is None else self.group, ball=self.radius, fill=NO_ELEMENT)
        size = space.prepare().size_
        if self.initial is None:
            values = np.random.default_rng(self.random_state).integers(0, size, size).astype(float)
        else:
            values = np.asarray(self.initial, dtype=float)
        self.system_ = System(
            self.label,
            elements=[GroupCellElement('cells', value=values, space=space)],
            interactions=[SelfIndexedShiftInteraction('translation', target='cells')],
        )

Components

The system uses these element and interaction classes, each with its nearest class of the core.

Elements:

Interactions:

  • SelfIndexedShiftInteraction, from Interaction
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 SelfIndexedShiftInteraction(Interaction):
    """Map `τ(x)(g) = x(g · x(g))` of cells whose values are elements of the group of their sites.

    Every cell takes the value of the cell at the product of its site and its own value, so the cell it reads moves
    with the configuration.

    Args:
        label:
            The label of the interaction.

        target:
            The cells on a group space, whose state `value` the map changes.

    Examples:
        >>> from skcomplex.systems.computer_science.automata import SelfIndexedShiftInteraction
        >>> SelfIndexedShiftInteraction('translation', target='cells').target
        'cells'
    """

    def __init__(self, label: str, *, target: Role = 'cells') -> None:
        super().__init__(label)
        self.target = target

    @staticmethod
    def _translate(value: Array, **kwargs: object) -> Array:
        """Return the value read at the product of a site and its own value, `x(g · x(g))`."""
        return value

    def _prepare(self, context: SimpleNamespace) -> None:
        """Set the read at the product of every site and its value 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._translate, neighborhood=StateTranslationNeighborhood(), label=self.label),
        ]