Documentation

LeanPool.CryptidsGoldbach.Machines

Finite-state Turing machines #

A machine has a finite transition table and a tape from Mathlib. This module preserves the execution definitions and the two Goldbach tables from google-deepmind/cryptids. The tables are embedded as Lean literals so importing the project needs no external files.

structure ConjectureMachines.Machine (states symbols : ℕ) :

A transition table: for a state and the symbol under the head, either the symbol to write, the direction to move and the state to enter, or none to halt.

Instances For
    structure ConjectureMachines.Cfg (states symbols : ℕ) [NeZero symbols] :

    A configuration: the current state and the tape, whose head is the symbol under the head.

    • state : Fin states

      The current control state.

    • tape : Turing.Tape (Fin symbols)

      The tape and head position.

    Instances For
      def ConjectureMachines.step {states symbols : ℕ} [NeZero symbols] (M : Machine states symbols) :
      Cfg states symbols → Option (Cfg states symbols)

      One step, or none when the transition is missing.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def ConjectureMachines.init {states symbols : ℕ} [NeZero states] [NeZero symbols] :
        Cfg states symbols

        The start state on the all-blank tape.

        Equations
        Instances For
          def ConjectureMachines.Halts {states symbols : ℕ} [NeZero states] [NeZero symbols] (M : Machine states symbols) :

          M halts when started in state 0 on the all-blank tape.

          Equations
          Instances For
            def ConjectureMachines.Machine.ofRows {states symbols : ℕ} (rows : List (List (Option (Fin symbols × Turing.Dir × Fin states)))) :
            Machine states symbols

            Build a Machine states symbols from a list of per-state transition rows.

            Equations
            Instances For

              A Turing machine over symbols tape symbols bundled with its non-zero state count.

              • states : ℕ

                The number of control states.

              • neZeroStates : NeZero self.states
              • toMachine : Machine self.states symbols

                The transition table with this state count.

              Instances For
                @[reducible, inline]
                abbrev ConjectureMachines.Machine.bundle {states symbols : ℕ} (M : Machine (states + 1) symbols) :

                Bundle a Machine (states + 1) symbols into a BundledMachine symbols.

                Equations
                • M.bundle = { states := states + 1, neZeroStates := ⋯, toMachine := M }
                Instances For
                  @[reducible, inline]
                  abbrev ConjectureMachines.BundledMachine.Halts {symbols : ℕ} [NeZero symbols] (M : BundledMachine symbols) :

                  M halts when started in state 0 on the all-blank tape.

                  Equations
                  Instances For

                    Rows of the 25-state machine of Yijun Leng, from the upstream baseline table.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      Rows of the 21-state machine of Maxence Faldor and Moritz Firsching.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def ConjectureMachines.run {states symbols : ℕ} [NeZero states] [NeZero symbols] (M : Machine states symbols) (n : ℕ) :
                        Option (Cfg states symbols)

                        The configuration n steps in from init, or none once M has halted.

                        Equations
                        Instances For
                          def ConjectureMachines.Runs {states symbols : ℕ} [NeZero states] [NeZero symbols] (M : Machine states symbols) (n : ℕ) :

                          M, started in state 0 on the all-blank tape, has not halted within n steps.

                          Equations
                          Instances For
                            @[instance_reducible]
                            instance ConjectureMachines.instDecidableRuns {states symbols : ℕ} [NeZero states] [NeZero symbols] (M : Machine states symbols) (n : ℕ) :
                            Equations