Documentation

Complexitylib.Models.TuringMachine.Deterministic

Deterministic NTMs → DTMs #

An NTM whose two transition functions coincide is deterministic: its trace is independent of the choice sequence and coincides with the run of the DTM NTM.toTM obtained by keeping the false transition function. This lets the multi-tape → single-tape NTM simulation (NTM.singleTapeSim) be reused for deterministic machines:

An NTM is deterministic when its two transition functions coincide. The ∀ b form (rather than δ true = δ false) rewrites uniformly under any choice bit.

Equations
Instances For
    theorem Complexity.NTM.Deterministic.δ_eq {n : } {N : NTM n} (hdet : N.Deterministic) (b : Bool) :
    N.δ b = N.δ false

    Unfolded form of Deterministic, usable as a rewrite rule.

    def Complexity.NTM.toTM {n : } (N : NTM n) :
    TM n

    Convert an NTM back to a DTM by keeping the false transition function. For a Deterministic machine this is a semantics-preserving inverse of TM.toNTM.

    Equations
    Instances For
      theorem Complexity.NTM.Deterministic.trace_congr_choices {n : } {N : NTM n} (hdet : N.Deterministic) (T : ) (c : Cfg n N.Q) (ch₁ ch₂ : Fin TBool) :
      N.trace T ch₁ c = N.trace T ch₂ c

      For a deterministic NTM, the trace is independent of the choice sequence (mirror of TM.toNTM_trace_choice_irrel).

      theorem Complexity.NTM.Deterministic.toTM_reachesIn_trace {n : } {N : NTM n} (hdet : N.Deterministic) (T : ) (choices : Fin TBool) (c : Cfg n N.Q) :
      tT, N.toTM.reachesIn t c (N.trace T choices c)

      Step-exact correspondence. The toTM run reaches the deterministic NTM's trace configuration within the trace length.

      def Complexity.NTM.RejectsWithZero {n : } (N : NTM n) (L : Language) (T : ) :

      On every rejected input, every length-T(|x|) computation path ends with 0 at output cell 1. NTM.DecidesInTime encodes rejection only as ¬acceptance (cell ≠ 1, e.g. possibly blank), but TM.DecidesInTime demands the cell be exactly 0; this is the missing output discipline, satisfied by every machine arising from a DTM decider.

      Equations
      Instances For
        theorem Complexity.NTM.toTM_decidesInTime {n : } {N : NTM n} (hdet : N.Deterministic) {L : Language} {T : } (h : N.DecidesInTime L T) (hrej : N.RejectsWithZero L T) :

        Deterministic NTM decider → DTM decider, same time bound. The toTM run is step-exact with the (choice-irrelevant) trace; acceptance transfers from the deciding hypothesis and rejection output from RejectsWithZero.

        A DTM's NTM embedding is deterministic: both transition functions are tm.δ.

        theorem Complexity.TM.toNTM_rejectsWithZero {n : } {M : TM n} {L : Language} {T : } (h : M.DecidesInTime L T) :

        A DTM decider's NTM embedding rejects with output 0: its trace freezes at the DTM's halting configuration, whose rejection cell is 0.

        Padding a 0-work-tape machine with a dummy work tape preserves determinism: pad0's transition threads the choice bit only into N.δ.

        theorem Complexity.NTM.pad0_rejectsWithZero {N : NTM 0} {L : Language} {T : } (hrej : N.RejectsWithZero L T) :

        Padding preserves the zero-on-rejection output discipline (the padded machine's output tape tracks the original's verbatim).

        The single-tape simulator of a deterministic machine is deterministic: the simulator's transition consults the choice bit only at the GATHER sentinel step, where it feeds it to N.δ.

        theorem Complexity.NTM.singleTapeSim_rejectsWithZero {k : } {N : NTM k} (hk : 1 k) {L : Language} {T : } (hN : N.AllPathsHaltIn T) (hrej : N.RejectsWithZero L T) :

        The single-tape simulator inherits the zero-on-rejection output discipline: the simulator's output tape tracks N's exactly (Corr.outputEq).

        theorem Complexity.TM.exists_singleTape_decidesInTime {k : } (M : TM k) {L : Language} {T : } (h : M.DecidesInTime L T) :
        ∃ (M₁ : TM 1), M₁.DecidesInTime L (NTM.singleTapeSimTime k T)

        Single-tape reduction for DTMs. Every language decidable by a k-work-tape DTM in time T is decidable by a single-work-tape DTM within the quadratic overhead bound singleTapeSimTime k T = fun n => 16 * (k + 1) * (T n + n + 1) ^ 2. Chain: embed (toNTM), simulate (singleTapeSim, or pad0 for k = 0), convert back (toTM) via determinism.