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 #
Transfer of termination along one pop #
The machine cycle #
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 decrease both lexicographic inductions fall back on.
Dependency graph
The two directions #
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.