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 #
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
The left context of a head sitting on mid: the frame region, the left
marker, the left blanks.
Equations
Instances For
Dependency graph
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
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.
- halt
{c : Turing.ToPartrec.Code}
: FrameSeg PCont.halt []
The empty continuation has an empty frame region.
- gap
{c : Turing.ToPartrec.Code}
{k : PCont c}
{w : List (SimSym c)}
: FrameSeg k w → FrameSeg k (SimSym.bk :: w)
A blank gap may precede the frames.
- cons₁
{c : Turing.ToPartrec.Code}
{p : CPos c}
{as : List ℕ}
{k : PCont c}
{w : List (SimSym c)}
: FrameSeg k w → FrameSeg (PCont.cons₁ p as k) (SimSym.hCons₁ p :: (encVal as ++ w))
A
cons₁frame: header, then the stored value, straight. - cons₂
{c : Turing.ToPartrec.Code}
{ns : List ℕ}
{k : PCont c}
{w : List (SimSym c)}
: FrameSeg k w → FrameSeg (PCont.cons₂ ns k) (SimSym.hCons₂ :: ((encVal ns).reverse ++ w))
A
cons₂frame: header, then the stored value, mirrored. - comp
{c : Turing.ToPartrec.Code}
{p : CPos c}
{k : PCont c}
{w : List (SimSym c)}
: FrameSeg k w → FrameSeg (PCont.comp p k) (SimSym.hComp p :: w)
A
compframe: a bare header. - fix
{c : Turing.ToPartrec.Code}
{p : CPos c}
{k : PCont c}
{w : List (SimSym c)}
: FrameSeg k w → FrameSeg (PCont.fix p k) (SimSym.hFix p :: w)
A
fixframe: a bare header.
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
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.
A rightward hand-over step, then a rightward walk to the stop letter.
Dependency graph
A leftward hand-over step, then a leftward walk to the stop letter,
rewriting each crossed letter by f.
Dependency graph
A leftward hand-over step, then a leftward walk to the stop letter.
Dependency graph
The positioned stepNormal #
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 #
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
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
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
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
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
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
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.