Documentation

Complexity.Computability.Machines.Turing.MultiTape.Universal.Complexity

The cost of a step of the simulation #

States, symbols and moves are encoded in unary (Turing.MultiTapeTM.encUnary), head positions on the work tapes as integers (Turing.MultiTapeTM.encInt), the position of the input head in binary (Turing.MultiTapeTM.encNat), and a structure as the framed tuple of its fields.

Reading, writing and moving on a zipper are tidily computable in linear time and space. A step of the simulation (Turing.MultiTapeTM.Universal.step_inO) takes space linear in the length L of the encoded context (the description, the input and the configuration), and time (K + E + p + 1) * (L + 1) ^ 2 for K work tapes, E transitions and the input head at p: reading and changing a work tape is linear, comparing the key with a transition is quadratic, and finding the input symbol counts down from p.

Main definitions #

Main results #

Encodings #

Moves, by their sign.

Instances For
    @[reducible, inline]

    Symbols and blanks.

    Instances For

      Keys of transitions, as their fields.

      Instances For
        @[reducible, inline]

        An action on a work tape.

        Instances For

          The unit type, encoded by the empty word.

          Instances For
            @[reducible, inline]

            Actions on a work tape.

            Instances For

              Actions, as their fields.

              Instances For

                Descriptions, as their fields.

                Instances For
                  @[reducible, inline]

                  The fields of a work tape.

                  Instances For

                    Work tapes, as their fields.

                    Instances For
                      @[reducible, inline]

                      The fields of a configuration.

                      Instances For

                        Configurations, as their fields.

                        Instances For

                          The state of a configuration, in linear time.

                          Reading, writing and moving on a work tape, in linear time #

                          Applying actions to all work tapes #

                          One step of applying actions to the work tapes in order: the remaining actions, and the tapes done so far.

                          Instances For

                            Sizes #

                            All work tapes #

                            Applying actions to the work tapes, within time the number of work tapes times the length of the arguments, and linear space.

                            The symbols under the heads of the work tapes, within time the number of work tapes times their length, and linear space.

                            The input head #

                            The symbol at a position of the input, given in binary, within time the position times the square of the length of the arguments, and linear space.

                            Moving the input head, given in binary.

                            A step without the input #

                            @[reducible, inline]

                            The context of a step without the input: the description, the configuration and the symbol under the input head.

                            Instances For
                              @[reducible, inline]

                              The encoding of contexts without the input.

                              Instances For

                                The key of the transition to take.

                                Instances For

                                  The transition to take, if any.

                                  Instances For

                                    The default transition, never taken.

                                    Instances For

                                      The action of the transition to take.

                                      Instances For
                                        theorem Turing.MultiTapeTM.Universal.stepWith_eq (c : WCtx) :
                                        stepWith c.1.1 c.1.2 c.2 = if c.1.2.state.isSome = true then if (wFound c).isSome = true then ({ state := (wAct c).state, inputPos := moveInput c.1.2.inputPos c.2 (wAct c).inputTape, workTapes := applyTapes c.1.2.workTapes (wAct c).workTapes }, (wAct c).output) else ({ state := none, inputPos := c.1.2.inputPos, workTapes := c.1.2.workTapes }, none) else (c.1.2, none)

                                        The time bound of a step without the input: the number of work tapes and of transitions, times the square of the length of the context.

                                        Instances For

                                          One step of the simulation without the input, within the time wTime and linear space.

                                          A step #

                                          @[reducible, inline]

                                          The context of a step: the description, the input and the configuration.

                                          Instances For
                                            @[reducible, inline]

                                            The encoding of contexts.

                                            Instances For

                                              The time bound of a step: the number of work tapes, of transitions and the position of the input head, times the square of the length of the context.

                                              Instances For
                                                theorem Turing.MultiTapeTM.Universal.step_inO :
                                                ComputableTidilyInO (fun (c : Ctx) => step c.1.1 c.1.2 c.2) eCtx (encPair eCfg eSym) stepTime fun (c : Ctx) => (eCtx c).length

                                                One step of the simulation, on contexts, within the time stepTime and linear space: the symbol under the input head, and the step without the input.