Core definitions for Reversible Binary 2D Cellular Automata
DefinitionReversibleCA_CoreCore definitions for reversible binary 2D cellular automata on the Moore neighborhood.
Definition code
import Lean
namespace ReversibleCA
def Coord : Type := Int × Int
def Config : Type := Coord → Bool
def Bijective {α β : Type} (f : α → β) : Prop := (∀ x y, f x = f y → x = y) ∧ (∀ y, ∃ x, f x = y)
def Nbhd : Type := Fin 3 × Fin 3
deriving BEq, DecidableEq
def LocalRule : Type := (Nbhd → Bool) → Bool
instance : Inhabited LocalRule := ⟨fun _ => false⟩
def globalMap (f : LocalRule) (c : Config) : Config :=
fun z => f (fun ⟨i, j⟩ => c (z.1 + (i.val - 1 : Int), z.2 + (j.val - 1 : Int)))
def IsReversible (f : LocalRule) : Prop := Bijective (globalMap f)
opaque G4 (i : Nat) : LocalRule
end ReversibleCA