Documentation

Complexitylib.Interop.Cslib.MultiTape.Defs

Simulating Complexitylib machines on CSLib multi-tape machines #

This file defines a CSLib multi-tape machine (Turing.MultiTapeTM) over the binary alphabet that simulates a Complexitylib machine tm : TM n step for step.

The two models differ in four ways, and the simulator handles each:

Main definitions #

A head direction as a CSLib head movement.

Equations
Instances For

    Read a binary CSLib cell as one of our symbols, with CSLib's blank as □.

    Equations
    Instances For

      Store a writable symbol in a binary CSLib cell, with □ as CSLib's blank.

      Equations
      Instances For

        Where the simulated input head is, as far as the simulator's finite control knows.

        • left : InputZone

          On the left-end marker.

        • inner : InputZone

          Past the left-end marker.

        • probe : InputZone

          Just moved left from within the input: on ▷ exactly when the input symbol now read is blank.

        Instances For
          @[instance_reducible]
          Equations

          Whether the input head is on the left-end marker, given the zone flag and the CSLib input symbol under the head.

          Equations
          Instances For

            The states of the simulator for a machine with states Q.

            Instances For
              def Complexity.TM.instDecidableEqMultiTapeState.decEq {Q✝ : Type} [DecidableEq Q✝] (x✝ x✝¹ : MultiTapeState Q✝) :
              Decidable (x✝ = x✝¹)
              Equations
              Instances For
                @[reducible, inline]

                The number of CSLib work tapes simulating a machine with n work tapes: a data tape and a marker tape for each of our n + 1 read-write tapes, and the input overshoot counter.

                Equations
                Instances For
                  def Complexity.TM.dataIdx {n : ℕ} (i : Fin (n + 1)) :

                  CSLib data tape of our read-write tape i; tape Fin.last n is our output tape.

                  Equations
                  Instances For
                    def Complexity.TM.markIdx {n : ℕ} (i : Fin (n + 1)) :

                    CSLib marker tape of our read-write tape i.

                    Equations
                    Instances For

                      CSLib work tape counting how far the input head is past the input.

                      Equations
                      Instances For
                        def Complexity.TM.tapeLayout {n : ℕ} {α : Type u_1} (data mark : Fin (n + 1) → α) (over : α) :
                        Fin (simTapes n) → α

                        Assemble per-tape actions into CSLib's tape order.

                        Equations
                        Instances For
                          def Complexity.TM.simRead {n : ℕ} (w : Fin (simTapes n) → Option Bool) (i : Fin (n + 1)) :

                          Our symbol under the head of simulated tape i, from the CSLib symbols w under all heads.

                          Equations
                          Instances For

                            The CSLib head move simulating move d on a one-sided tape. On ▷ (cell 0) a left move stays put, matching Tape.move.

                            Equations
                            Instances For

                              The CSLib write simulating a write of w on a one-sided tape. On ▷ (cell 0) the write is dropped, matching Tape.write.

                              Equations
                              Instances For

                                The moves simulating an input-head move d: the CSLib input head move, the overshoot counter move, and the next zone. atLeft says the head is on ▷, i is the CSLib input symbol, and ov is the counter tape's symbol, which is 1 exactly when the counter is zero.

                                Equations
                                Instances For

                                  The simulator's transition function.

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

                                    The CSLib multi-tape machine simulating tm. Our work tape i and our output tape (i = n) each use a data tape and a marker tape, and the last tape counts input-head overshoot. It emits the single bit true to accept and false to reject.

                                    Equations
                                    Instances For

                                      The transition function of the function-computing simulator: the decision simulator's, except that the final state copies the simulated output cell under the head to CSLib's output and moves right, halting at the first blank.

                                      Equations
                                      Instances For

                                        The CSLib multi-tape machine computing the function tm computes: it simulates tm, rewinds the simulated output tape, and copies the output string to CSLib's output.

                                        Equations
                                        Instances For