Table of Contents
Fetching ...

Random state comonads encode cellular automata evaluation

Madalina I Sas, Julian H J Sutherland

TL;DR

Addressing the gap between practical CA implementations and category-theoretic modeling, the paper introduces a comonadic CA framework implemented in Haskell using random-comonad arrays to support stochasticity and multi-dimensional grids ($W i c$). The method applies a CA rule via extend on comonads and supports arbitrary dimensions through an index type $i$ with $Ix$. Four case studies—Wolfram CA, Conway's Life, Greenberg–Hastings, and stochastic Forest Fire—demonstrate the approach's versatility and ability to encode randomness with seeds such as $s_1=4123$. The work argues that the Curry-Howard-Lambek isomorphism provides a bridge between semantics, mathematics, and simulations, enabling a principled path toward comonadic networks and generalized theories of emergence.

Abstract

Cellular automata (CA) are quintessential ALife and ubiquitous in many studies of collective behaviour and emergence, from morphogenesis to social dynamics and even brain modelling. Recently, there has been an increased interest in formalising CA, theoretically through category theory and practically in terms of a functional programming paradigm. Unfortunately, these remain either in the realm of simple implementations lacking important practical features, or too abstract and conceptually inaccessible to be useful to the ALife community at large. In this paper, we present a brief and accessible introduction to a category-theoretical model of CA computation through a practical implementation in Haskell. We instantiate arrays as comonads with state and random generators, allowing stochastic behaviour not currently supported in other known implementations. We also emphasise the importance of functional implementations for complex systems: thanks to the Curry-Howard-Lambek isomorphism, functional programs facilitate a mapping between simulation, system rules or semantics, and categorical descriptions, which may advance our understanding and development of generalised theories of emergent behaviour. Using this implementation, we show case studies of four famous CA models: first Wolfram's CA in 1D, then Conway's game of life, Greenberg-Hasings excitable cells, and the stochastic Forest Fire model in 2D, and present directions for an extension to N dimensions. Finally, we suggest that the comonadic model can encode arbitrary topologies and propose future directions for a comonadic network.

Random state comonads encode cellular automata evaluation

TL;DR

Addressing the gap between practical CA implementations and category-theoretic modeling, the paper introduces a comonadic CA framework implemented in Haskell using random-comonad arrays to support stochasticity and multi-dimensional grids (). The method applies a CA rule via extend on comonads and supports arbitrary dimensions through an index type with . Four case studies—Wolfram CA, Conway's Life, Greenberg–Hastings, and stochastic Forest Fire—demonstrate the approach's versatility and ability to encode randomness with seeds such as . The work argues that the Curry-Howard-Lambek isomorphism provides a bridge between semantics, mathematics, and simulations, enabling a principled path toward comonadic networks and generalized theories of emergence.

Abstract

Cellular automata (CA) are quintessential ALife and ubiquitous in many studies of collective behaviour and emergence, from morphogenesis to social dynamics and even brain modelling. Recently, there has been an increased interest in formalising CA, theoretically through category theory and practically in terms of a functional programming paradigm. Unfortunately, these remain either in the realm of simple implementations lacking important practical features, or too abstract and conceptually inaccessible to be useful to the ALife community at large. In this paper, we present a brief and accessible introduction to a category-theoretical model of CA computation through a practical implementation in Haskell. We instantiate arrays as comonads with state and random generators, allowing stochastic behaviour not currently supported in other known implementations. We also emphasise the importance of functional implementations for complex systems: thanks to the Curry-Howard-Lambek isomorphism, functional programs facilitate a mapping between simulation, system rules or semantics, and categorical descriptions, which may advance our understanding and development of generalised theories of emergent behaviour. Using this implementation, we show case studies of four famous CA models: first Wolfram's CA in 1D, then Conway's game of life, Greenberg-Hasings excitable cells, and the stochastic Forest Fire model in 2D, and present directions for an extension to N dimensions. Finally, we suggest that the comonadic model can encode arbitrary topologies and propose future directions for a comonadic network.
Paper Structure (14 sections, 5 figures)

This paper contains 14 sections, 5 figures.

Figures (5)

  • Figure 1: Artificial versus natural emergent patterns. (a) A Wolfram CA using rule 30 and an initial world with only one live cell in the middle. (b) The rule 30 CA shows very similar patterns to the Conus textile shell.
  • Figure 2: Simulation of Wolfram rule 22. Consecutive snapshots from a 65 cell system, with initial conditions given by one living cell in the middle.
  • Figure 3: Simulation of Game of Life . Consecutive snapshots from a 27x27 system with random initial conditions (seed $s_1=4123$) and $p=0.1$ of being alive. A 'Traffic Light' period-2 pattern is recognisable in the top-left corner.
  • Figure 4: Simulation of an excitable medium. Snapshots separated by $\Delta t=2$ timesteps from a 27x27 system, using random initial conditions ($s=37873$) with probability of $0.1$ for cells to be spiking and $0.1$ for cells to be resting. After some irregular behaviour for 19 timesteps, the system settles into a periodic configuration of spirals, which in this case shows period 3.
  • Figure 5: Simulation of a stochastic Forest Fire model. Snapshots from a 27x27 system, separated by $\Delta t=2$ timesteps, evolving randomly (seed $s_1=4123$) with firing rate $f=0.0005$ and growing rate $p=0.1$, and random initial conditions ($s_1=1978$) given by the same rates. The balance between the growth rate and firing rate maintains the model in the critical state, where neither all trees have died nor do they survive forever.