Documentation

Atlas.TheoryOfComputation.code.Complexity

def TuringMachine.NTM.step {Q Γ : Type} [DecidableEq Q] (M : NTM Q Γ) (c₁ c₂ : Config Q Γ) :

A single nondeterministic step of M: c₂ is a possible successor of c₁, selected from the set of transitions δ c₁.state (read symbol). Halting configurations are fixed points.

Instances For
    def TuringMachine.NTM.accepts {Q Γ : Type} [DecidableEq Q] (M : NTM Q Γ) (w : List Γ) :

    NTM acceptance: M accepts w iff there is some finite computation branch of length n + 1 starting from M.initConfig w, with each step a valid nondeterministic transition, ending in an accepting configuration.

    Instances For
      def TuringMachine.NTM.language {Q Γ : Type} [DecidableEq Q] (M : NTM Q Γ) :
      Set (List Γ)

      The language recognized by NTM M: the set of strings it accepts.

      Instances For
        def TuringMachine.NTM.isDecider {Q Γ : Type} [DecidableEq Q] (M : NTM Q Γ) :

        An NTM is a decider if every computation branch on every input halts in finitely many steps.

        Instances For
          def TuringMachine.NTM.decides {Q Γ : Type} [DecidableEq Q] (M : NTM Q Γ) (A : Set (List Γ)) :

          M decides A iff it is a decider and its language equals A.

          Instances For
            def TuringMachine.TM.runsInTime {Q Γ : Type} [DecidableEq Q] (M : TM Q Γ) (t : ) :

            A deterministic TM runs in time t if it halts on every input w within t (|w|) steps.

            Instances For
              def TuringMachine.NTM.runsInTime {Q Γ : Type} [DecidableEq Q] (M : NTM Q Γ) (t : ) :

              An NTM runs in time t if every branch of length at most t (|w|) reaches a halting configuration on input w.

              Instances For
                def TuringMachine.IsBigO (f g : ) :

                f = O(g): there exist constants c > 0 and n₀ such that f n ≤ c · g n for all n ≥ n₀.

                Instances For
                  def TuringMachine.InTIME (t : ) {Γ : Type} (A : Set (List Γ)) :

                  A ∈ TIME(t): some deterministic TM decides A in time O(t).

                  Instances For
                    def TuringMachine.InNTIME (t : ) {Γ : Type} (A : Set (List Γ)) :

                    A ∈ NTIME(t): some nondeterministic TM decides A in time O(t).

                    Instances For
                      def TuringMachine.InP {Γ : Type} (A : Set (List Γ)) :

                      The complexity class P: A ∈ P iff A ∈ TIME(n^k) for some k.

                      Instances For
                        def TuringMachine.InNP {Γ : Type} (A : Set (List Γ)) :

                        The complexity class NP: A ∈ NP iff A ∈ NTIME(n^k) for some k.

                        Instances For
                          def TuringMachine.InEXPTIME {Γ : Type} (A : Set (List Γ)) :

                          The complexity class EXPTIME: deciders running in time 2^{n^k} for some k.

                          Instances For

                            A function f : Σ* → Σ* is polynomial-time computable: there exists a deterministic TM F that, on input w, halts within |w|^k steps with f w written on the prefix of its tape.

                            Instances For
                              def TuringMachine.PolyReducible {Γ : Type} (A B : Set (List Γ)) :

                              Polynomial-time mapping reducibility A ≤ₚ B: there is a polynomial-time computable f with w ∈ A ↔ f w ∈ B.

                              Instances For

                                Notation A ≤ₚ B for polynomial-time mapping reducibility.

                                Instances For
                                  def TuringMachine.InCoNP {Γ : Type} (A : Set (List Γ)) :

                                  The complexity class coNP: A ∈ coNP iff Aᶜ ∈ NP.

                                  Instances For
                                    theorem TuringMachine.IsBigO.trans {f g h : } (hfg : IsBigO f g) (hgh : IsBigO g h) :
                                    IsBigO f h

                                    O(·) is transitive: if f = O(g) and g = O(h) then f = O(h).

                                    noncomputable def TuringMachine.composedTM {Γ Q_F Q_B : Type} [DecidableEq Q_F] [DecidableEq Q_B] (F : TM Q_F Γ) (M_B : TM Q_B Γ) :
                                    TM ((Q_F Q_B) Fin 2) Γ

                                    Sequential composition of TMs: run F to completion, then transfer control to M_B, finally collapsing M_B's accept/reject states to fresh accept/reject states of the composed machine. Used to reduce one decision problem to another.

                                    Instances For
                                      theorem TuringMachine.inP_preimage_of_isPolyTimeComputableFunction {Γ : Type} (f : List ΓList Γ) (B : Set (List Γ)) (hf : IsPolyTimeComputableFunction f) (hB : InP B) :
                                      InP {w : List Γ | f w B}

                                      If f is polynomial-time computable and B ∈ P, then {w | f w ∈ B} ∈ P. This is the key technical lemma behind A ≤ₚ B ∧ B ∈ P → A ∈ P.

                                      theorem TuringMachine.inP_of_polyReducible_inP {Γ : Type} {A B : Set (List Γ)} (hAB : PolyReducible A B) (hB : InP B) :
                                      InP A

                                      Sipser, Lecture 14. If A ≤ₚ B and B ∈ P, then A ∈ P.

                                      def TuringMachine.IsNPHard {Γ : Type} (B : Set (List Γ)) :

                                      B is NP-hard: every A ∈ NP polynomial-time reduces to B.

                                      Instances For

                                        B is NP-complete: B ∈ NP and B is NP-hard.

                                        Instances For