Documentation

Atlas.TheoryOfComputation.code.NondeterministicTM

structure TuringMachine.NTM (Q Γ : Type) :

A Nondeterministic Turing Machine (NTM): like a deterministic TM but with transition function δ : Q × Γ → 𝒫(Q × Γ × {L,R}), so each state/symbol may have multiple possible next moves.

Instances For
    def TuringMachine.NTM.stepWith {Q Γ : Type} (_M : NTM Q Γ) (c : Config Q Γ) (choice : Q × Γ × Direction) :
    Config Q Γ

    Apply a specific nondeterministic choice = (q', b, d) to configuration c: write b, move the head in direction d, and transition to state q'.

    Instances For
      def TuringMachine.NTM.initConfig {Q Γ : Type} (M : NTM Q Γ) (w : List Γ) :
      Config Q Γ

      The starting configuration of NTM M on input w: state q₀, head at position 0, tape containing w followed by blanks.

      Instances For
        def TuringMachine.NTM.isAcceptConfig {Q Γ : Type} (M : NTM Q Γ) (c : Config Q Γ) :

        c is an accepting configuration of NTM M (state equals qAccept).

        Instances For
          def TuringMachine.NTM.isRejectConfig {Q Γ : Type} (M : NTM Q Γ) (c : Config Q Γ) :

          c is a rejecting configuration of NTM M (state equals qReject).

          Instances For
            def TuringMachine.NTM.isHaltConfig {Q Γ : Type} (M : NTM Q Γ) (c : Config Q Γ) :

            c is a halting configuration of NTM M: either accepting or rejecting.

            Instances For
              def TuringMachine.NTM.IsBranch {Q Γ : Type} (M : NTM Q Γ) (w : List Γ) (branch : Config Q Γ) :

              branch : ℕ → Config Q Γ is a valid computation branch of M on input w: it starts in initConfig w, stays put at halting configurations, and at each non-halting step picks some allowed nondeterministic transition.

              Instances For
                def TuringMachine.NTM.branchHaltsWithOutput {Q Γ : Type} (M : NTM Q Γ) (branch : Config Q Γ) (v : List Γ) :

                A branch halts with output v: it reaches an accepting configuration whose tape contents (from position 0) equal v, followed by blanks.

                Instances For
                  def TuringMachine.NTM.branchRejects {Q Γ : Type} (M : NTM Q Γ) (branch : Config Q Γ) :

                  A branch rejects: it reaches a rejecting configuration at some step n.

                  Instances For
                    def TuringMachine.NTMComputes {Q Γ : Type} (M : NTM Q Γ) (f : List ΓList Γ) :

                    NTM M computes the function f : Σ* → Σ* (Sipser, Lecture 20): on every input w, every branch either halts with f w on the tape or rejects, and at least one branch does not reject.

                    Instances For