Documentation

DescriptiveComplexity.Problems.Machine.Membership

Machine acceptance is existential second-order definable #

The membership half of the machine bridge: NTMAccept is Σ₁-definable, hence in NP. This is Fagin's tableau argument, and – unlike the certificate of a weighted problem – it needs no arithmetic at all: one existential block guesses the run, and a first-order kernel checks it clause by clause.

What is guessed #

Three relation variables, indexed by the positions, which are simultaneously the tape cells and the time steps:

That the guess is a run is exactly DescriptiveComplexity.TMData.RelWalk, and DescriptiveComplexity.TMData.exists_relWalk_iff_exists_walk together with DescriptiveComplexity.TMData.accepts_iff_exists_walk is what connects it back to acceptance. So this file is a transcription: every clause below mirrors one field of RelWalk or one conjunct of DescriptiveComplexity.TMData.WellFormed, and each has its own realization lemma. Nothing here does mathematics; the mathematics is in DescriptiveComplexity.Problems.Machine.Walk.

The clauses #

Seventeen of them, conjoined into DescriptiveComplexity.tqKernel: four saying the order is linear, four more for the remaining promises of WellFormed, six for the functionality of the guess, then the initial clause, the step clause and the accepting clause. The step clause is the largest formula in the library – an existential over a transition element with seven conjuncts, against a stutter alternative – and is kept manageable by parameterizing its body (DescriptiveComplexity.tqStepBodyF) over the three variables it reads, so that no Sum nesting goes deeper than two levels.

The order predicates #

MinPos, MaxPos and SuccPos are relativized to the positions, so they are not the ordered-structure guards of DescriptiveComplexity.OrderWalk but formulas over the instance's own le and posn symbols, defined here as DescriptiveComplexity.tqMinPosF and friends.

The block #

The relation variables of the certificate: the state, the head and the tape of the configuration at each time.

  • state : TMIdx

    The state at a time.

  • head : TMIdx

    The head cell at a time.

  • tape : TMIdx

    The tape contents at a time.

Instances For
    Dependency graph
    @[instance_reducible]
    Equations
    Dependency graph
    @[instance_reducible]
    Equations
    • One or more equations did not get rendered due to their size.
    Dependency graph

    The single existential block: the run, guessed as a state, a head position and a tape contents for each time.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      Dependency graph
      Dependency graph
      Dependency graph
      Dependency graph
      @[reducible, inline]

      The vocabulary of the kernel: machine instances together with the guessed run.

      Equations
      Instances For
        Dependency graph
        @[reducible, inline]

        The position symbol in the kernel's vocabulary.

        Equations
        Instances For
          Dependency graph
          @[reducible, inline]

          The transition symbol in the kernel's vocabulary.

          Equations
          Instances For
            Dependency graph
            @[reducible, inline]

            The start-state symbol in the kernel's vocabulary.

            Equations
            Instances For
              Dependency graph
              @[reducible, inline]

              The accepting-state symbol in the kernel's vocabulary.

              Equations
              Instances For
                Dependency graph
                @[reducible, inline]

                The blank symbol in the kernel's vocabulary.

                Equations
                Instances For
                  Dependency graph
                  @[reducible, inline]

                  The move-right symbol in the kernel's vocabulary.

                  Equations
                  Instances For
                    Dependency graph
                    @[reducible, inline]

                    The order symbol in the kernel's vocabulary.

                    Equations
                    Instances For
                      Dependency graph
                      @[reducible, inline]

                      The transition-source symbol in the kernel's vocabulary.

                      Equations
                      Instances For
                        Dependency graph
                        @[reducible, inline]

                        The transition-read symbol in the kernel's vocabulary.

                        Equations
                        Instances For
                          Dependency graph
                          @[reducible, inline]

                          The transition-destination symbol in the kernel's vocabulary.

                          Equations
                          Instances For
                            Dependency graph
                            @[reducible, inline]

                            The transition-write symbol in the kernel's vocabulary.

                            Equations
                            Instances For
                              Dependency graph
                              @[reducible, inline]

                              The input symbol in the kernel's vocabulary.

                              Equations
                              Instances For
                                Dependency graph
                                @[reducible, inline]

                                The guessed-state symbol in the kernel's vocabulary.

                                Equations
                                Instances For
                                  Dependency graph
                                  @[reducible, inline]

                                  The guessed-head symbol in the kernel's vocabulary.

                                  Equations
                                  Instances For
                                    Dependency graph
                                    @[reducible, inline]

                                    The guessed-tape symbol in the kernel's vocabulary.

                                    Equations
                                    Instances For
                                      Dependency graph

                                      Formula builders #

                                      Dependency graph
                                      Dependency graph
                                      Dependency graph

                                      x is an accepting state, as a formula.

                                      Equations
                                      Instances For
                                        Dependency graph
                                        Dependency graph
                                        Dependency graph
                                        Dependency graph
                                        Dependency graph

                                        The transition x applies in the state y, as a formula.

                                        Equations
                                        Instances For
                                          Dependency graph

                                          The transition x reads the symbol y, as a formula.

                                          Equations
                                          Instances For
                                            Dependency graph

                                            The transition x moves to the state y, as a formula.

                                            Equations
                                            Instances For
                                              Dependency graph

                                              The transition x writes the symbol y, as a formula.

                                              Equations
                                              Instances For
                                                Dependency graph
                                                Dependency graph
                                                Dependency graph
                                                Dependency graph
                                                Dependency graph
                                                noncomputable def DescriptiveComplexity.tqMinPosF {α : Type} (x : α) :

                                                x is the lowest position, as a formula.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  Dependency graph
                                                  noncomputable def DescriptiveComplexity.tqMaxPosF {α : Type} (x : α) :

                                                  x is the highest position, as a formula.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    Dependency graph
                                                    noncomputable def DescriptiveComplexity.tqSuccPosF {α : Type} (x y : α) :

                                                    y is the position immediately above x, as a formula.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      Dependency graph
                                                      noncomputable def DescriptiveComplexity.tqMoveF {α : Type} (t t' : α) (dir : Bool) :

                                                      The head moves from its cell at t to its cell at t', in the direction dir.

                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        Dependency graph
                                                        noncomputable def DescriptiveComplexity.tqStepBodyF {α : Type} (t t' τ : α) :

                                                        The step body: the transition τ takes the configuration at t to the one at t'. Its seven conjuncts are those of DescriptiveComplexity.TMData.RelStep.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          Dependency graph
                                                          noncomputable def DescriptiveComplexity.tqStutterBodyF {α : Type} (t t' : α) :

                                                          The stutter body: an accepting configuration repeated.

                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            Dependency graph
                                                            noncomputable def DescriptiveComplexity.tqInitTapeF {α : Type} (x y : α) :

                                                            The cell x may initially hold y: the input where it is defined, the blank elsewhere.

                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For
                                                              Dependency graph

                                                              Realization of the builders #

                                                              @[simp]
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqTrF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (x : α) :
                                                              (tqTrF x).Realize v TMTr (v x)
                                                              Dependency graph
                                                              Dependency graph
                                                              @[simp]
                                                              Dependency graph
                                                              Dependency graph
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqLeF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (x y : α) :
                                                              (tqLeF x y).Realize v TMLe (v x) (v y)
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqEqF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (x y : α) :
                                                              (tqEqF x y).Realize v v x = v y
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqSrcF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (x y : α) :
                                                              (tqSrcF x y).Realize v TMSrc (v x) (v y)
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqReadF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (x y : α) :
                                                              (tqReadF x y).Realize v TMRead (v x) (v y)
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqDstF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (x y : α) :
                                                              (tqDstF x y).Realize v TMDst (v x) (v y)
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqWriteF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (x y : α) :
                                                              (tqWriteF x y).Realize v TMWrite (v x) (v y)
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqInpF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (x y : α) :
                                                              (tqInpF x y).Realize v TMInp (v x) (v y)
                                                              Dependency graph
                                                              @[simp]
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqHeadF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (x y : α) :
                                                              (tqHeadF x y).Realize v ρ TMIdx.head ![v x, v y]
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqTapeF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (x y z : α) :
                                                              (tqTapeF x y z).Realize v ρ TMIdx.tape ![v x, v y, v z]
                                                              Dependency graph
                                                              Dependency graph
                                                              Dependency graph
                                                              @[simp]
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqInitTapeF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (x y : α) :
                                                              (tqInitTapeF x y).Realize v TMInp (v x) (v y) (∀ (b : A), ¬TMInp (v x) b) TMBlank (v y)
                                                              Dependency graph
                                                              @[simp]
                                                              theorem DescriptiveComplexity.realize_tqMoveF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (t t' : α) (dir : Bool) :
                                                              (tqMoveF t t' dir).Realize v ∀ (p p' : A), ρ TMIdx.head ![v t, p]ρ TMIdx.head ![v t', p']if dir = true then SuccPos TMLe TMPosn p p' else SuccPos TMLe TMPosn p' p
                                                              Dependency graph
                                                              theorem DescriptiveComplexity.realize_tqStepBodyF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (t t' τ : α) :
                                                              (tqStepBodyF t t' τ).Realize v TMTr (v τ) (∀ (q : A), ρ TMIdx.state ![v t, q]TMSrc (v τ) q) (∀ (p a : A), ρ TMIdx.head ![v t, p]ρ TMIdx.tape ![v t, p, a]TMRead (v τ) a) (∀ (q : A), ρ TMIdx.state ![v t', q]TMDst (v τ) q) (∀ (p a : A), ρ TMIdx.head ![v t, p]ρ TMIdx.tape ![v t', p, a]TMWrite (v τ) a) (∀ (p a : A), ¬ρ TMIdx.head ![v t, p] → (ρ TMIdx.tape ![v t, p, a] ρ TMIdx.tape ![v t', p, a])) ((TMRight (v τ) ∀ (p p' : A), ρ TMIdx.head ![v t, p]ρ TMIdx.head ![v t', p']SuccPos TMLe TMPosn p p') ¬TMRight (v τ) ∀ (p p' : A), ρ TMIdx.head ![v t, p]ρ TMIdx.head ![v t', p']SuccPos TMLe TMPosn p' p)
                                                              Dependency graph
                                                              theorem DescriptiveComplexity.realize_tqStutterBodyF {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) {α : Type} (v : αA) (t t' : α) :
                                                              (tqStutterBodyF t t').Realize v (∀ (q : A), ρ TMIdx.state ![v t, q]TMAcc q) (∀ (q : A), ρ TMIdx.state ![v t', q] ρ TMIdx.state ![v t, q]) (∀ (p : A), ρ TMIdx.head ![v t', p] ρ TMIdx.head ![v t, p]) ∀ (p a : A), ρ TMIdx.tape ![v t', p, a] ρ TMIdx.tape ![v t, p, a]
                                                              Dependency graph

                                                              The clauses of the kernel #

                                                              Each mirrors one field of DescriptiveComplexity.TMData.RelWalk.

                                                              Dependency graph

                                                              There is only one state at each time.

                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                Dependency graph
                                                                Dependency graph

                                                                The head is in only one place at each time.

                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  Dependency graph

                                                                  Every cell holds a symbol at each time.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    Dependency graph

                                                                    Every cell holds only one symbol at each time.

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For
                                                                      Dependency graph

                                                                      Consecutive times are related by a step or by an accepting stutter.

                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For
                                                                        Dependency graph

                                                                        At the lowest time the configuration is initial.

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For
                                                                          Dependency graph
                                                                          Dependency graph

                                                                          The order is transitive.

                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          Instances For
                                                                            Dependency graph

                                                                            The order is antisymmetric.

                                                                            Equations
                                                                            • One or more equations did not get rendered due to their size.
                                                                            Instances For
                                                                              Dependency graph
                                                                              Dependency graph
                                                                              Dependency graph

                                                                              The input is functional.

                                                                              Equations
                                                                              • One or more equations did not get rendered due to their size.
                                                                              Instances For
                                                                                Dependency graph
                                                                                Dependency graph

                                                                                There is only one blank symbol.

                                                                                Equations
                                                                                • One or more equations did not get rendered due to their size.
                                                                                Instances For
                                                                                  Dependency graph

                                                                                  At the highest time the state is accepting.

                                                                                  Equations
                                                                                  • One or more equations did not get rendered due to their size.
                                                                                  Instances For
                                                                                    Dependency graph

                                                                                    The kernel: well-formedness of the instance, then that the guess is a run – the six functionality clauses, the initial clause, the step clause and the accepting clause.

                                                                                    Equations
                                                                                    • One or more equations did not get rendered due to their size.
                                                                                    Instances For
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      theorem DescriptiveComplexity.realize_tqInitClause {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) :
                                                                                      A tqInitClause ∀ (t : A), MinPos TMLe TMPosn t(∀ (q : A), ρ TMIdx.state ![t, q]TMStart q) (∀ (p : A), ρ TMIdx.head ![t, p]MinPos TMLe TMPosn p) ∀ (p a : A), ρ TMIdx.tape ![t, p, a]TMInp p a (∀ (b : A), ¬TMInp p b) TMBlank a
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      Dependency graph
                                                                                      theorem DescriptiveComplexity.realize_tqStepClause {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) :
                                                                                      A tqStepClause ∀ (t t' : A), SuccPos TMLe TMPosn t t'(∃ (τ : A), TMTr τ (∀ (q : A), ρ TMIdx.state ![t, q]TMSrc τ q) (∀ (p a : A), ρ TMIdx.head ![t, p]ρ TMIdx.tape ![t, p, a]TMRead τ a) (∀ (q : A), ρ TMIdx.state ![t', q]TMDst τ q) (∀ (p a : A), ρ TMIdx.head ![t, p]ρ TMIdx.tape ![t', p, a]TMWrite τ a) (∀ (p a : A), ¬ρ TMIdx.head ![t, p] → (ρ TMIdx.tape ![t, p, a] ρ TMIdx.tape ![t', p, a])) ((TMRight τ ∀ (p p' : A), ρ TMIdx.head ![t, p]ρ TMIdx.head ![t', p']SuccPos TMLe TMPosn p p') ¬TMRight τ ∀ (p p' : A), ρ TMIdx.head ![t, p]ρ TMIdx.head ![t', p']SuccPos TMLe TMPosn p' p)) (∀ (q : A), ρ TMIdx.state ![t, q]TMAcc q) (∀ (q : A), ρ TMIdx.state ![t', q] ρ TMIdx.state ![t, q]) (∀ (p : A), ρ TMIdx.head ![t', p] ρ TMIdx.head ![t, p]) ∀ (p a : A), ρ TMIdx.tape ![t', p, a] ρ TMIdx.tape ![t, p, a]
                                                                                      Dependency graph
                                                                                      theorem DescriptiveComplexity.realize_tqKernel {A : Type} [FirstOrder.Language.turing.Structure A] (ρ : tmGuessBlock.Assignment A) :
                                                                                      A tqKernel (tmData A).WellFormed (tmData A).RelWalk (fun (t q : A) => ρ TMIdx.state ![t, q]) (fun (t p : A) => ρ TMIdx.head ![t, p]) fun (t p a : A) => ρ TMIdx.tape ![t, p, a]

                                                                                      The kernel says exactly what it should: the instance is well formed and the guessed relations are a run.

                                                                                      Dependency graph

                                                                                      The definability theorems #

                                                                                      Machine acceptance is Σ₁-definable: one existential block guesses the run – the state, the head cell and the tape contents at each time – and the first-order kernel checks that it is one.

                                                                                      Dependency graph

                                                                                      Machine acceptance is in NP.

                                                                                      Dependency graph