Documentation

DescriptiveComplexity.Problems.Machine.HaltHard.SimNorm

The dispatch phase of the simulation #

The first half of the simulation of Turing.ToPartrec.step by the machine of Table.lean: from the dispatch of a code at the separator mid, the machine reaches the resting configuration of the Turing.ToPartrec.Cfg that Turing.ToPartrec.stepNormal computes – in the positioned form DescriptiveComplexity.HaltHard.pStepNormal, whose projection to the library semantics is DescriptiveComplexity.HaltHard.pStepNormal_toCont.

The tape regions are described by DescriptiveComplexity.HaltHard.valR/midL/restCfg/atMid, and the frame region by the relation DescriptiveComplexity.HaltHard.FrameSeg, which spells a continuation as frames separated by arbitrary blank gaps. One lemma per code shape moves the machine from the dispatch at mid to the next dispatch (for the four node shapes, having pushed the frame) or back to rest (for the three leaves, having transformed the value); DescriptiveComplexity.HaltHard.sim_norm chains them by induction on the size of the dispatched code.

The tape regions #

@[reducible, inline]

The value-region strip right of mid: the inner gap – never empty, so a separator can always be closed next to an empty value – the mirrored value, the right marker and the trailing blanks.

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

    The left context of a head sitting on mid: the frame region, the left marker, the left blanks.

    Equations
    Instances For
      Dependency graph
      @[reducible, inline]
      abbrev DescriptiveComplexity.HaltHard.atMid {c : Turing.ToPartrec.Code} (Q : SimQ c) (g : ) (fr : List (SimSym c)) (v : List ) (j t : ) :

      The configuration at the dispatch point: head on mid.

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

        The resting configuration between abstract steps: head on endL in the seek state.

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

          The frame region of a continuation: the frames in order, top first, separated by arbitrary blank gaps. A cons₁ frame stores its value straight, a cons₂ frame mirrored.

          Instances For
            Dependency graph

            The letters a frame region can hold.

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

              What a frame letter is not: none of the markers, none of the primes.

              Dependency graph

              Pass lemmas #

              Each walk state passes every letter but its stop letter; the catch-all rows of the table make these case bashes.

              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph
              Dependency graph
              theorem DescriptiveComplexity.HaltHard.Reach.cast {c : Turing.ToPartrec.Code} {x x' y y' : LCfg c} (hx : x = x') (hy : y = y') (h : Reach x' y') :
              Reach x y

              Reachability transported along equalities of the two configurations.

              Dependency graph

              Gluing the letter behind the head back onto a run of its own kind – the shape the region equalities take after a walk re-crosses a run it wrote.

              Dependency graph

              Hand-over walks #

              Each phase of a dispatch is one step that hands over to a walk state, followed by the walk itself: the combinators below package the two, so that an empty walked run – the hand-over landing directly on the stop letter – needs no case split at the use sites.

              theorem DescriptiveComplexity.HaltHard.reach_step_walkR {c : Turing.ToPartrec.Code} {q q' : SimQ c} {P : SimSym cProp} {s σ' : SimSym c} (hs : simStep q s = some (σ', q', true)) (hq : ∀ (σ : SimSym c), P σsimStep q' σ = some (σ, q', true)) (w : List (SimSym c)) (hw : σw, P σ) (L : List (SimSym c)) (t : SimSym c) (R : List (SimSym c)) :
              Reach { q := q, L := L, s := s, R := w ++ t :: R } { q := q', L := w.reverse ++ σ' :: L, s := t, R := R }

              A rightward hand-over step, then a rightward walk to the stop letter.

              Dependency graph
              theorem DescriptiveComplexity.HaltHard.reach_step_walkL_map {c : Turing.ToPartrec.Code} {q q' : SimQ c} {P : SimSym cProp} {f : SimSym cSimSym c} {s σ' : SimSym c} (hs : simStep q s = some (σ', q', false)) (hq : ∀ (σ : SimSym c), P σsimStep q' σ = some (f σ, q', false)) (w : List (SimSym c)) (hw : σw, P σ) (t : SimSym c) (L R : List (SimSym c)) :
              Reach { q := q, L := w ++ t :: L, s := s, R := R } { q := q', L := L, s := t, R := (List.map f w).reverse ++ σ' :: R }

              A leftward hand-over step, then a leftward walk to the stop letter, rewriting each crossed letter by f.

              Dependency graph
              theorem DescriptiveComplexity.HaltHard.reach_step_walkL {c : Turing.ToPartrec.Code} {q q' : SimQ c} {P : SimSym cProp} {s σ' : SimSym c} (hs : simStep q s = some (σ', q', false)) (hq : ∀ (σ : SimSym c), P σsimStep q' σ = some (σ, q', false)) (w : List (SimSym c)) (hw : σw, P σ) (t : SimSym c) (L R : List (SimSym c)) :
              Reach { q := q, L := w ++ t :: L, s := s, R := R } { q := q', L := L, s := t, R := w.reverse ++ σ' :: R }

              A leftward hand-over step, then a leftward walk to the stop letter.

              Dependency graph

              The positioned stepNormal #

              @[irreducible]

              Turing.ToPartrec.stepNormal, over positions: the continuation and value of the configuration the dispatched code immediately becomes – stepNormal always returns a Cfg.ret, so a pair suffices.

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

                The positioned stepNormal projects onto the library's.

                Dependency graph

                The leaf dispatches #

                theorem DescriptiveComplexity.HaltHard.norm_zero' {c : Turing.ToPartrec.Code} {p : CPos c} (h : codeAt p = Turing.ToPartrec.Code.zero') {Q : SimQ c} (hQ : simStep Q SimSym.mid = some (dispatch p)) (g : ) {fr : List (SimSym c)} (hfr : σfr, FrameSym σ) (v : List ) (j t : ) :
                Reach (atMid Q g fr v j t) (restCfg g fr (0 :: v) j (t - 1))

                zero': walk to endR, append a separator, return to rest. The value gains a 0 in front – a separator at the right end of the mirrored region.

                Dependency graph
                theorem DescriptiveComplexity.HaltHard.norm_comp {c : Turing.ToPartrec.Code} {p : CPos c} {f g₂ : Turing.ToPartrec.Code} (h : codeAt p = f.comp g₂) {Q : SimQ c} (hQ : simStep Q SimSym.mid = some (dispatch p)) (g : ) {fr : List (SimSym c)} (hfr : σfr, FrameSym σ) (v : List ) (j t : ) :
                Reach (atMid Q g fr v j t) (atMid (SimQ.nSeekR (c₂ p)) (g - 1) (SimSym.hComp (c₁ p) :: fr) v j t)

                comp push: walk left over the frames to endL, write the comp header over it, re-write endL one cell into the left blanks, and walk back to mid to dispatch the second child: the frame region gains a bare header, the left blanks lose a cell.

                Dependency graph
                theorem DescriptiveComplexity.HaltHard.norm_succ {c : Turing.ToPartrec.Code} {p : CPos c} (h : codeAt p = Turing.ToPartrec.Code.succ) {Q : SimQ c} (hQ : simStep Q SimSym.mid = some (dispatch p)) (g : ) {fr : List (SimSym c)} (hfr : σfr, FrameSym σ) (v : List ) (j t : ) :
                ∃ (j' : ) (t' : ), Reach (atMid Q g fr v j t) (restCfg g fr [v.headI.succ] j' t')

                succ: append a digit at endR – a fresh separator and a digit, if the value was empty – then walk back over the head block and erase every letter between it and mid: the value becomes the singleton successor of its head, the erased blocks joining the inner gap.

                Dependency graph
                theorem DescriptiveComplexity.HaltHard.norm_tail {c : Turing.ToPartrec.Code} {p : CPos c} (h : codeAt p = Turing.ToPartrec.Code.tail) {Q : SimQ c} (hQ : simStep Q SimSym.mid = some (dispatch p)) (g : ) {fr : List (SimSym c)} (hfr : σfr, FrameSym σ) (v : List ) (j t : ) :
                ∃ (t' : ), Reach (atMid Q g fr v j t) (restCfg g fr v.tail j t')

                tail: walk to endR, erase it, and look at the last letter of the value – a blank for an empty value, restored after a probe step to its right; a lone separator, consumed; a digit, starting an erasure of the head block down to its separator – then re-write endR and return to rest.

                Dependency graph
                theorem DescriptiveComplexity.HaltHard.norm_case_zero {c : Turing.ToPartrec.Code} {p : CPos c} {f g₂ : Turing.ToPartrec.Code} (h : codeAt p = f.case g₂) {Q : SimQ c} (hQ : simStep Q SimSym.mid = some (dispatch p)) (g : ) {fr : List (SimSym c)} (_hfr : σfr, FrameSym σ) {v : List } (hv : v.headI = 0) (j t : ) :
                ∃ (t' : ), Reach (atMid Q g fr v j t) (atMid (SimQ.nSeekL (c₁ p)) g fr v.tail j t')

                case, zero or empty head: walk to endR, look left of it – a blank for an empty value, restored after a probe step to its right, or the head block's separator, consumed – re-write endR and walk back to mid to dispatch the first child on the tail of the value.

                Dependency graph
                theorem DescriptiveComplexity.HaltHard.norm_case_succ {c : Turing.ToPartrec.Code} {p : CPos c} {f g₂ : Turing.ToPartrec.Code} (h : codeAt p = f.case g₂) {Q : SimQ c} (hQ : simStep Q SimSym.mid = some (dispatch p)) (g : ) {fr : List (SimSym c)} (_hfr : σfr, FrameSym σ) {v : List } {y : } (hv : v.headI = y + 1) (j t : ) :
                ∃ (t' : ), Reach (atMid Q g fr v j t) (atMid (SimQ.nSeekL (c₂ p)) g fr (y :: v.tail) j t')

                case, positive head: walk to endR, find a digit left of it – the head block is nonempty – consume it as endR and walk back to mid to dispatch the second child on the decremented head.

                Dependency graph
                theorem DescriptiveComplexity.HaltHard.norm_fix {c : Turing.ToPartrec.Code} {p : CPos c} {f : Turing.ToPartrec.Code} (h : codeAt p = f.fix) {Q : SimQ c} (hQ : simStep Q SimSym.mid = some (dispatch p)) (g : ) {fr : List (SimSym c)} (hfr : σfr, FrameSym σ) (v : List ) (j t : ) :
                Reach (atMid Q g fr v j t) (atMid (SimQ.nSeekR (c₁ p)) (g - 1) (SimSym.hFix (c₁ p) :: fr) v j t)

                fix push: walk left over the frames to endL, write the fix header over it, re-write endL one cell into the left blanks, and walk back to mid to dispatch the body: the frame region gains a bare header, the left blanks lose a cell.

                Dependency graph