Case distinction #
If c, f and g are tidily computable from a common input, so is
fun x => if c x then f x else g x, within the bounds of c plus those of the branch taken.
iteTM tmc tm₁ tm₂ runs tmc with its output written to a new work tape, runs tm₁ if that word
is non-empty and tm₂ otherwise (Turing.MultiTapeTM.branch), and clears the tape. The condition
c may be computed with any encoding of Bool: a finite-state transducer turns its output into a
word that is empty exactly for false.
Main definitions #
Turing.MultiTapeTM.iteTM: the machine for a case distinction.
Main results #
Turing.MultiTapeTM.ComputesTidilyInTimeAndSpace.ite: the machine-level case distinction.Turing.MultiTapeTM.ComputableTidilyInTimeAndSpace.ite: case distinctions are tidily computable; each branch need only be computable on the inputs where it is taken.
A function tidily computable on all inputs is tidily computable on the inputs satisfying p, by
the same machine.
Case distinctions are tidily computable: if c is tidily computable, f on the inputs where
c holds and g on the others, then fun x => if c x then f x else g x is tidily computable,
within the bounds of c plus those of the branch taken, up to a constant. The condition may be
computed with any encoding of Bool.