Documentation

Atlas.TheoryOfComputation.code.Tableau

@[reducible, inline]

A cell symbol that may appear in a single cell of a Cook-Levin tableau: either a tape symbol γ ∈ Γ (representing tape contents) or a state q ∈ Q (marking the head position together with the current state).

Instances For
    def TuringMachine.encodeConfigRow {Q Γ : Type} (c : Config Q Γ) (width : ) :
    Fin widthCellSymbol Q Γ

    Encode a TM configuration c as one row of a tableau of given width: position j holds the state c.state (as Sum.inl) if the head is over cell j, and otherwise the tape symbol c.tape j (as Sum.inr).

    Instances For
      def TuringMachine.IsLegalWindow {Q Γ : Type} (M : NTM Q Γ) (a b c d e f : CellSymbol Q Γ) :

      IsLegalWindow M a b c d e f says that the 2 × 3 window

      a b c
      d e f
      

      is consistent with one step of the NTM M: the top row (a, b, c) is the parent and the bottom row (d, e, f) is the child. There are two cases:

      1. No head in the top window. If none of a, b, c is a state symbol, then the cell directly below b must equal b (the tape doesn't change away from the head).
      2. Head at the centre. If b = ⟨q⟩ for some state q and the tape symbol above b is γ, then there must be some transition (q', γ', dir) ∈ M.δ q γ consistent with the bottom row, or the window may alternatively show no change (e = γ).

      This is the local-consistency predicate used in the Cook-Levin tableau argument.

      Instances For
        @[reducible, inline]
        abbrev TuringMachine.IsLegalSextuple {Q Γ : Type} (M : NTM Q Γ) (a b c d e f : CellSymbol Q Γ) :

        Alternative name for IsLegalWindow: a legal 6-tuple (a, b, c, d, e, f) describing a 2×3 window.

        Instances For
          structure TuringMachine.Tableau {Q Γ : Type} (M : NTM Q Γ) (w : List Γ) :

          An (accepting) tableau for NTM M on input w. Following Sipser, this is an nᵏ × nᵏ table (where n = |w|) of CellSymbols representing a computation history on some accepting branch of M's nondeterministic computation:

          • k — the polynomial exponent giving the table's side length.
          • cell i j — the contents of row i, column j.
          • size_pos — the side length nᵏ is positive.
          • start — row 0 is the encoding of the initial configuration of M on w.
          • accept — the last row contains the accept state somewhere.
          • move — every interior 2 × 3 window is a legal window (IsLegalWindow M …), enforcing that consecutive rows describe valid computation steps of M.

          The existence of such a tableau is the central object in the Cook-Levin proof that SAT (and 3SAT) are NP-complete.

          Instances For