Documentation

DescriptiveComplexity.Problems.Pcp.Hardness.ConfigWord

Configurations as words: the rewriting system of a machine #

The middle layer of the RE-hardness of DescriptiveComplexity.PCP: a machine on the unbounded tape of DescriptiveComplexity.MachinesUnbounded accepts exactly when the string-rewriting system read off its transition table derives the halting word from the start word (DescriptiveComplexity.HaltPcp.acceptsU_iff_derives). Composed with DescriptiveComplexity.Pcp.History.hasMatch_iff one file up, this makes the domino system of the machine decide its acceptance; the sibling Interp file draws that domino system as a first-order interpretation.

The words #

A configuration is written as a word over DescriptiveComplexity.HaltPcp.TapeLetter: a left endmarker, the symbols of a finite window of consecutive tape cells with the state letter wedged in front of the head's cell, and a right endmarker (DescriptiveComplexity.HaltPcp.Represents). The window must contain the head and every non-blank cell, and may contain any amount of blank padding beyond them – a configuration has many words, which is what lets the rules extend the window on demand.

The format is kept strict: the state letter always has a symbol letter to its right (the cell the head is on). Each rule of DescriptiveComplexity.HaltPcp.MRule preserves strictness on its own – the boundary variants of the two moves extend the window by one blank cell in the same rewriting step – so every word of a derivation between the boot and the halting letter is a configuration word, and the backward reading of a derivation is a plain case analysis on the rule applied.

The rules #

No letter of a configuration word is a boot or halting letter, so the boot rule fires only on the start word and the erasers only after an accepting state was seen: the phases of a derivation cannot mix.

The alphabet #

The alphabet configurations are written in: the two endmarkers of the window, the boot letter standing in the state slot of the start word, the halting letter, and a symbol letter and a state letter per element of the machine.

  • lft {A : Type} : TapeLetter A

    The left endmarker of the window.

  • rgt {A : Type} : TapeLetter A

    The right endmarker of the window.

  • boot {A : Type} : TapeLetter A

    The boot letter, in the state slot of the start word.

  • halt {A : Type} : TapeLetter A

    The halting letter, the one-letter word a derivation must reach.

  • sym {A : Type} : A → TapeLetter A

    The contents of a tape cell.

  • state {A : Type} : A → TapeLetter A

    The current state, wedged before the head's cell.

Instances For
    Dependency graph

    Being a state letter, as a Boolean – the alphabet has no decidable equality to offer, but the constructor is decidable on its own.

    Equations
    Instances For
      Dependency graph
      theorem DescriptiveComplexity.HaltPcp.TapeLetter.absurd_of_ne {A : Type} {P : Prop} {a b : TapeLetter A} (h : a = b) (hne : a ≠ b := by simp) :
      P

      A letter of the words below is never a boot or halting letter; this is the shape the case analyses need.

      Dependency graph

      The rules #

      The rewriting system of a machine: the two moves with their boundary variants, the boot rule, and the halting rule with its erasers. The transition performing a move is existentially quantified in the side condition, since its attributes are relations rather than functions; the letters of the rule are the attribute values themselves.

      Instances For
        Dependency graph

        The order of the cells #

        The cells ℤ × A are ordered lexicographically – pages first, the machine's order on the offsets inside a page – and one DescriptiveComplexity.TMData.SuccCell step increases that order strictly. This is what makes a window a duplicate-free list and puts a cell entering it outside of it.

        The strict lexicographic order on cells.

        Equations
        Instances For
          Dependency graph
          theorem DescriptiveComplexity.HaltPcp.CellLt.trans {A : Type} {M : TMData A} (hlin : IsLinOrd M.Le) {x y z : ℤ × A} (hxy : CellLt M x y) (hyz : CellLt M y z) :
          CellLt M x z
          Dependency graph
          theorem DescriptiveComplexity.HaltPcp.CellLt.ne {A : Type} {M : TMData A} {x y : ℤ × A} (h : CellLt M x y) :
          x ≠ y
          Dependency graph

          Every cell has a next one and a previous one #

          On a well-formed machine with at least one position, the strip of pages is unbounded in both directions: the mirror-image lemmas of DescriptiveComplexity.exists_predPos supply the missing successor facts.

          Configuration words #

          A configuration is written as a window of consecutive cells: the symbols they hold, with the state letter wedged before the head's cell and an endmarker at each end. The window contains the head and every non-blank cell over a position; it may contain blank padding beyond them, so a configuration has many words.

          The symbol letters of a list of cells.

          Equations
          Instances For
            Dependency graph
            Dependency graph
            @[simp]
            theorem DescriptiveComplexity.HaltPcp.cellSyms_cons {A : Type} (c : ConfigU A) (x : ℤ × A) (l : List (ℤ × A)) :
            Dependency graph
            @[simp]
            theorem DescriptiveComplexity.HaltPcp.cellSyms_append {A : Type} (c : ConfigU A) (l l' : List (ℤ × A)) :
            cellSyms c (l ++ l') = cellSyms c l ++ cellSyms c l'
            Dependency graph

            Letters of a configuration word #

            A configuration word carries no boot and no halting letter, and exactly one state letter; these two facts drive the case analysis on a rewriting step.

            Dependency graph
            Dependency graph
            Dependency graph
            Dependency graph
            Dependency graph
            Dependency graph
            Dependency graph
            Dependency graph
            Dependency graph

            Reading a rewriting step off a configuration word #

            The inversion at the heart of the backward direction: a rewriting step on a configuration word either simulates one machine step or fires the halting rule on the current – hence accepting – state. Each move rule carries exactly one state letter on its left-hand side, and a configuration word carries exactly one, so the rule can only apply at the head.

            Writing a machine step as a rewriting step #

            The forward direction: one machine step is one rewriting step – the boundary variants of the moves extend the window in the same stroke, so no separate padding step is ever needed.

            Whole runs, and the halting phase #

            The start word #

            The start word writes the input page between the endmarkers, with the boot letter in the state slot; the boot rule turns it into a word of an initial configuration. The page is read along an enumeration of the positions in the machine's order.

            ps enumerates the positions, in the machine's order.

            Equations
            Instances For
              Dependency graph

              The start word of an input page: endmarkers, the boot letter, and the symbols of the page.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Dependency graph
                theorem DescriptiveComplexity.HaltPcp.IsPosEnum.ne_nil {A : Type} {M : TMData A} (hwf : M.WellFormed) {ps : List A} (hps : IsPosEnum M ps) :
                ps ≠ []

                A machine with a position has a nonempty enumeration.

                Dependency graph
                theorem DescriptiveComplexity.HaltPcp.IsPosEnum.isChain {A : Type} {M : TMData A} (hlin : IsLinOrd M.Le) {ps : List A} (hps : IsPosEnum M ps) :

                Consecutive entries of an enumeration are consecutive positions.

                Dependency graph

                The equivalence #

                Acceptance is derivability: the machine accepts exactly when the rewriting system derives the halting word from the start word.

                Dependency graph

                Acceptance is having a match: the domino system of the machine's rewriting rules has a match exactly when the machine accepts.

                Dependency graph