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). Its time bound separates the configuration length from description lookup and input scanning: for K work tapes, E transitions, description length D, encoded input length N, input position p and binary position length P, the bound is (K + E + 1) * (D + 1) * (L + 1) + (N + 1) * (P + 1) ^ 2. The first word in a transition comparison comes from the description, so its length is bounded by D, even when the simulated configuration is large. The input scanner streams the encoded list with a binary countdown, whose arithmetic is charged to P. The configuration is still copied each round; this bound does not implement the buffered Hennie–Stearns simulation.

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 #

                            Moving the input head, charging binary arithmetic only to the encoded position length.

                            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)

                                        A step without input lookup: tape passes and description comparisons are linear in context length; only binary input-head arithmetic is quadratic in its own encoded length.

                                        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 step bound separates linear configuration passes from a streaming input lookup with binary countdown arithmetic. In particular, the whole configuration length is never squared.

                                              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.