Documentation

DescriptiveComplexity.Problems.Machine.HaltHard.Bridge

The simulating machine as rewriting, and the transport to a drawn machine #

Two bridges. The first identifies runs of the zipper semantics (DescriptiveComplexity.HaltHard.lstep) with derivations of the rewriting system DescriptiveComplexity.HaltPcp.MRule of the machine packaged as a DescriptiveComplexity.TMData (DescriptiveComplexity.HaltHard.simTM, over the three-block universe DescriptiveComplexity.HaltHard.SimU – states, symbols, and one transition per applicable state–symbol pair; the machine is deterministic, so the pair is the transition). A zipper configuration is a configuration word (DescriptiveComplexity.HaltHard.wordOf), one lstep is one rewriting step, and the boot and halting phases close the two ends: DescriptiveComplexity.HaltHard.derives_startWord_iff_evalDom states the result directly against Turing.ToPartrec.Cont.eval, through DescriptiveComplexity.HaltHard.reach_acc_iff_evalDom.

The second bridge is the rule-correspondence transport: a machine whose predicates are the images of simTM's along an injection (DescriptiveComplexity.HaltHard.TMEmbed – the shape of the machine the interpretation of Interp.lean draws, whose universe also carries the tape positions and the junk) derives the halting word from an image word exactly when simTM does from its preimage (DescriptiveComplexity.HaltHard.TMEmbed.derives_halt_iff). Together with DescriptiveComplexity.HaltPcp.acceptsU_iff_derives on the drawn side, this turns DescriptiveComplexity.TMData.AcceptsU of the drawn machine into termination of the abstract evaluation, with no tape-function bookkeeping.

The universe of the simulating machine #

@[reducible, inline]

The universe of the simulating machine as a DescriptiveComplexity.TMData: states, symbols, and one transition per state–symbol pair the table acts on.

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

    A state, as an element of the machine universe.

    Equations
    Instances For
      Dependency graph
      @[reducible, inline]

      A symbol, as an element of the machine universe.

      Equations
      Instances For
        Dependency graph
        @[reducible, inline]

        A transition – a state–symbol pair – as an element of the machine universe.

        Equations
        Instances For
          Dependency graph

          The simulating machine as machine data: one transition per pair on which the table acts, its attributes read off simStep. The position block is empty – the rewriting system of a machine never mentions positions, and the bridge to a drawn machine goes through words alone.

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

            Zipper configurations as words #

            The symbol letters of a run of tape letters.

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

              The word of a zipper configuration: the recorded cells left to right between the endmarkers, the state letter wedged before the head's cell.

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

                Locating the unique marked letter #

                theorem DescriptiveComplexity.HaltHard.eq_of_unique_marked {Γ : Type} {P : ΓProp} {A x : List Γ} {s s' : Γ} {B y : List Γ} :
                (∀ aA, ¬P a)(∀ aB, ¬P a)P s'A ++ s :: B = x ++ s' :: yA = x s = s' B = y

                Splitting a list at a marked letter when the reference decomposition has none on either side: the two decompositions coincide.

                Dependency graph
                Dependency graph
                Dependency graph
                Dependency graph

                Splitting the word of a configuration at a state letter: the state letter is the configuration's, and the two sides are its two half-tapes.

                Dependency graph

                Decoding the attributes of a transition #

                theorem DescriptiveComplexity.HaltHard.decode_attrs {c : Turing.ToPartrec.Code} {τ u a u' b : SimU c} (hsrc : (simTM c).Src τ u) (hread : (simTM c).Read τ a) (hdst : (simTM c).Dst τ u') (hwrite : (simTM c).Write τ b) :
                ∃ (q : SimQ c) (σ : SimSym c) (b₀ : SimSym c) (q₀ : SimQ c) (d : Bool), u = stq q a = sts σ simStep q σ = some (b₀, q₀, d) u' = stq q₀ b = sts b₀ ((simTM c).Right τ d = true)

                The attribute values of a transition of simTM all decode through one application of the table, and its direction is the Right predicate.

                Dependency graph

                One machine step is one rewriting step #

                Forward: one zipper step rewrites the word by one move rule.

                Dependency graph

                Backward: a rewriting step from a configuration word either performs the configuration's own machine step, or fires the halting rule – in which case the configuration accepts.

                Dependency graph

                Whole runs #

                A run of the machine is a derivation between the two words.

                Dependency graph

                From an accepting configuration the derivation closes: the state letter becomes the halting letter, which swallows the rest of the word.

                Dependency graph

                Backward: a derivation of the halting word from a configuration word yields an accepting run of the machine.

                Dependency graph

                The boot phase, and the abstract statement #

                Derivability from the start word is machine acceptance, at the zipper: the first step of any derivation is the boot rule, and boot lands the machine in the resting state at the left end of the spelled tape.

                Dependency graph

                The abstract bridge: the rewriting system of the simulating machine derives the halting word from the spelled resting configuration of k and v exactly when the abstract evaluation of k on v terminates.

                Dependency graph

                Transport along an injection #

                The machine the interpretation draws has the same states, symbols and transitions, embedded in a larger universe that also carries the tape positions and the junk. Its predicates are the images of the abstract ones, and derivations of the halting word correspond exactly.

                Dependency graph
                structure DescriptiveComplexity.HaltHard.TMEmbed {A B : Type} (f : AB) (M : TMData A) (N : TMData B) :

                A machine embedded in a larger universe: an injection under which every predicate of the target is the image of the corresponding predicate of the source.

                • The embedding is injective.

                • tr (b : B) : N.Tr b ∃ (a : A), b = f a M.Tr a

                  Transitions correspond.

                • start (b : B) : N.Start b ∃ (a : A), b = f a M.Start a

                  Start states correspond.

                • acc (b : B) : N.Acc b ∃ (a : A), b = f a M.Acc a

                  Accepting states correspond.

                • blank (b : B) : N.Blank b ∃ (a : A), b = f a M.Blank a

                  Blanks correspond.

                • right (b : B) : N.Right b ∃ (a : A), b = f a M.Right a

                  Directions correspond.

                • src (b b' : B) : N.Src b b' ∃ (a : A) (a' : A), b = f a b' = f a' M.Src a a'

                  Source states correspond.

                • read (b b' : B) : N.Read b b' ∃ (a : A) (a' : A), b = f a b' = f a' M.Read a a'

                  Read symbols correspond.

                • dst (b b' : B) : N.Dst b b' ∃ (a : A) (a' : A), b = f a b' = f a' M.Dst a a'

                  Destination states correspond.

                • write (b b' : B) : N.Write b b' ∃ (a : A) (a' : A), b = f a b' = f a' M.Write a a'

                  Written symbols correspond.

                Instances For
                  Dependency graph
                  theorem DescriptiveComplexity.HaltPcp.startWord_map {A B : Type} (f : AB) (inp : List A) :

                  The start word is mapped letterwise.

                  Dependency graph

                  Forward transport of a rule.

                  Dependency graph

                  Decomposing image words #

                  theorem DescriptiveComplexity.HaltHard.TMEmbed.cons_eq_map {α β : Type} {f : αβ} {x : β} {xs : List β} {l : List α} (h : x :: xs = List.map f l) :
                  ∃ (a : α) (l₀ : List α), l = a :: l₀ x = f a xs = List.map f l₀
                  Dependency graph
                  theorem DescriptiveComplexity.HaltHard.TMEmbed.nil_eq_map {α β : Type} {f : αβ} {l : List α} (h : [] = List.map f l) :
                  l = []
                  Dependency graph
                  theorem DescriptiveComplexity.HaltHard.TMEmbed.append_eq_map {α β : Type} {f : αβ} {x y : List β} {l : List α} :
                  x ++ y = List.map f l∃ (lx : List α) (ly : List α), l = lx ++ ly x = List.map f lx y = List.map f ly
                  Dependency graph
                  Dependency graph
                  theorem DescriptiveComplexity.HaltHard.TMEmbed.eq_map_sym {A B : Type} {f : AB} {a : HaltPcp.TapeLetter A} {q : B} (h : HaltPcp.TapeLetter.sym q = HaltPcp.TapeLetter.map f a) :
                  ∃ (q₀ : A), a = HaltPcp.TapeLetter.sym q₀ q = f q₀
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  Dependency graph
                  theorem DescriptiveComplexity.HaltHard.TMEmbed.mRule_inv {A B : Type} {f : AB} {M : TMData A} {N : TMData B} (h : TMEmbed f M N) {l' r' : List (HaltPcp.TapeLetter B)} (hrule : HaltPcp.MRule N l' r') {l : List (HaltPcp.TapeLetter A)} (hl : l' = List.map (HaltPcp.TapeLetter.map f) l) :

                  Backward transport of a rule: a target rule whose left side is an image has an image right side, and comes from a source rule.

                  Dependency graph

                  Forward transport of a rewriting step.

                  Dependency graph

                  Backward transport of a rewriting step: from an image word, every step lands on an image word, by the image step.

                  Dependency graph

                  Forward transport of a derivation.

                  Dependency graph

                  Backward transport of a derivation of the halting word.

                  Dependency graph
                  Dependency graph

                  The whole bridge, for a drawn machine: a machine whose predicates are the images of simTM's derives the halting word from the image of the spelled resting configuration exactly when the abstract evaluation terminates.

                  Dependency graph