Machines that diverge on a verdict #
A machine computing a total function can compute a partial one: let the first symbol it emits be a
verdict. tm.partialize runs tm, but reads the first emitted symbol as a verdict instead of
emitting it. After the verdict true it emits nothing, and once tm halts it loops forever in a
state of its own; after the verdict false it emits the rest of the output of tm and halts with
tm. So if tm halts with the output encPartial r on an input, encoding the divergence
r = none as [true] and an output r = some o as false :: o, then tm.partialize diverges
on that input when r = none and halts with output o when r = some o
(Turing.MultiTapeTM.Computes.partialize).
The proof is a step-by-step correspondence: the configurations of tm.partialize are images of the
configurations of tm under a map commuting with the steps
(Turing.MultiTapeTM.Partialize.step_liftCfg), so its runs are the images of the runs of tm
(Turing.MultiTapeTM.runFrom_partialize).
Main definitions #
Turing.MultiTapeTM.partialize: the machine diverging on the verdicttrue.Turing.MultiTapeTM.encPartial: partial results as words.
Main results #
Turing.MultiTapeTM.runFrom_partialize: the runs oftm.partialize.Turing.MultiTapeTM.Computes.partialize,Turing.MultiTapeTM.Computes.halts_partialize:tm.partializecomputes the partial result encoded by the output oftm.
References #
The state of tm.partialize for a state of tm and a verdict: a running state is kept with
the verdict; once tm halts, the verdict true loops in the state (none, some true) and every
other verdict halts.
Instances For
tm.partialize runs tm, reading the first symbol it emits as a verdict. After the verdict
true it emits nothing, and once tm halts it loops forever in the state (none, some true).
After the verdict false it emits the rest of the output of tm and halts with tm. The second
component of a state is the verdict read so far.
Instances For
The configuration of tm.partialize corresponding to a configuration of tm: the state
carries the verdict of the output, and the output keeps what follows the verdict false.
Instances For
The runs of tm.partialize are the images of the runs of tm.
tm.partialize computes the partial result encoded by the output of tm: if tm halts
with output encPartial r, then tm.partialize halts with output o exactly when r = some o,
and diverges when r = none.
If tm halts with output encPartial r, then tm.partialize halts exactly when r is a
result.