The assembled simulation #
The dispatch phase (DescriptiveComplexity.HaltHard.sim_norm) and the six
pops of SimRet.lean assemble into the correctness statement of the
simulating machine: from the resting configuration of a continuation k and
value v, the machine reaches an accepting configuration exactly when the
abstract evaluation Turing.ToPartrec.Cont.eval of k on v terminates
(DescriptiveComplexity.HaltHard.reach_acc_iff_evalDom).
The two directions meet at DescriptiveComplexity.HaltHard.popTarget, the
continuation and value the machine rests at after one pop –
Turing.ToPartrec.stepRet, one frame at a time. The machine side is
DescriptiveComplexity.HaltHard.cycle_counted: a counted run from rest to
the rest of the pop target. Its count is positive whenever the pop dispatches
a code – the run factors through a dispatch configuration whose state is not
the resting state – and the two pops that may in principle be silent
(cons₂, and fix on a zero flag) shrink the continuation instead, so both
directions recurse along the lexicographic order on (steps, continuation
size): forward on the abstract step count, since those two pops do not
consume an abstract step, and backward on the machine step count, split along
the cycle by determinism (DescriptiveComplexity.HaltHard.stepsTo_det). The
abstract side of each pop is DescriptiveComplexity.HaltHard.stepRet_popTarget,
and termination of the abstract machine is traded for termination of
Turing.ToPartrec.Cont.eval through Turing.ToPartrec.stepRet_eval.
The pop target #
The pop target: the continuation and value the machine rests at after
popping the top frame of k with value v – Turing.ToPartrec.stepRet, one
frame at a time, with the dispatches it triggers carried out by
DescriptiveComplexity.HaltHard.pStepNormal. On the empty continuation the
machine accepts instead, so that case is junk.
Equations
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.HaltHard.popTarget DescriptiveComplexity.HaltHard.PCont.halt x✝ = (DescriptiveComplexity.HaltHard.PCont.halt, x✝)
- DescriptiveComplexity.HaltHard.popTarget (DescriptiveComplexity.HaltHard.PCont.cons₁ p as k) x✝ = DescriptiveComplexity.HaltHard.pStepNormal p (DescriptiveComplexity.HaltHard.PCont.cons₂ x✝ k) as
- DescriptiveComplexity.HaltHard.popTarget (DescriptiveComplexity.HaltHard.PCont.cons₂ ns k) x✝ = (k, ns.headI :: x✝)
- DescriptiveComplexity.HaltHard.popTarget (DescriptiveComplexity.HaltHard.PCont.comp p k) x✝ = DescriptiveComplexity.HaltHard.pStepNormal p k x✝
Instances For
Dependency graph
One abstract step reaches the pop target: Turing.ToPartrec.stepRet on
k and v is either the Turing.ToPartrec.Cfg.ret of the pop target – when
the pop dispatches a code – or, for the two silent pops, definitionally the
stepRet of the pop target, whose continuation is then smaller.
Dependency graph
Termination of the abstract machine, as counted runs #
Counted runs of the abstract machine Turing.ToPartrec.step.
Equations
- DescriptiveComplexity.HaltHard.ASteps 0 x✝¹ x✝ = (x✝¹ = x✝)
- DescriptiveComplexity.HaltHard.ASteps n.succ x✝¹ x✝ = ∃ (d : Turing.ToPartrec.Cfg), Turing.ToPartrec.step x✝¹ = some d ∧ DescriptiveComplexity.HaltHard.ASteps n d x✝
Instances For
Dependency graph
A counted abstract run, extended by one step at its end.
Dependency graph
An abstract reachability is a counted run of some length.
Dependency graph
Termination of Turing.ToPartrec.Cont.eval yields a counted abstract run
from the return configuration to a halting configuration.
Dependency graph
Transfer of termination along one pop #
Termination of Turing.ToPartrec.Cont.eval is termination of the
sequential run from the return configuration.
Dependency graph
Peeling the one step a return configuration always makes.
Dependency graph
Termination transfers along one pop: the abstract evaluation of a nonempty continuation terminates exactly when that of its pop target does.
Dependency graph
The machine cycle #
Accepting configurations are terminal.
Dependency graph
The counted machine cycle: from the resting configuration of a nonempty continuation, a counted run to the resting configuration of the pop target. The count is zero only if the pop was silent, in which case the continuation shrank – the escape hatch both lexicographic inductions use.
Dependency graph
The two directions #
Forward simulation: if the abstract machine halts from the return
configuration of k and v in N steps, the simulating machine accepts
from the resting configuration of any frame region of k, by lexicographic
recursion on (N, sizeOf k) – the two silent pops keep N and shrink k.
Dependency graph
Backward simulation: if the simulating machine accepts from the
resting configuration of k and v in N steps, the abstract evaluation of
k on v terminates, by lexicographic recursion on (N, sizeOf k) – the
counted cycle is split off the accepting run by determinism, and a silent
cycle shrinks k.
Dependency graph
The correctness statement #
Correctness of the simulating machine: from the resting configuration
of a continuation k and value v, the machine reaches an accepting
configuration exactly when Turing.ToPartrec.Cont.eval of k on v
terminates.