Composition within small space #
If f and g are computable within space sf and sg, then g ∘ f is computable within space
O(sf a + sg (f a) + log |a| + log |f a|), without ever writing down f a: a multi-pass fold over
the input simulates the machine of g on descriptions, and whenever it needs the symbol of f a
under the input head of g, it simulates the machine of f from the start, reading a in place
and counting down its emitted symbols to the one needed.
Main results #
Turing.MultiTapeTM.ComputableInTimeAndSpace.comp_space: composition within small space.Turing.MultiTapeTM.ComputableInTimeAndSpace.comp_logSpace: logarithmic space is closed under composition.Turing.MultiTapeTM.Universal.computableTidily_compose: the composition, on descriptions, as a multi-pass fold.
Halting and space #
The output at the first halt is the computed output.
The first halt is no later than the time bound.
A space bound bounds the space of every run.
Reading bits in place #
The translator whose events are the bits.
Instances For
Counting down emitted symbols #
The control of the composition #
The control state: the description and configuration of the outer machine g and of the
inner machine f, and the countdown over the symbols emitted by f to the one under the input
head of g.
Instances For
The symbol under the input head of g, once f has halted.
Instances For
What a step of the composition emits: the bit emitted by g, if any.
Instances For
The initial control state.
Instances For
The composition after q steps of g and r ≤ uf steps of f, where f halts after
uf steps with the output y.
What the composition emits after q steps of g and r ≤ uf steps of f: the bit g
emits, once f has halted.
The output of the composition after ug steps of g: the bits g emits.
The fold #
The state of the fold: the control state, and the countdown over the input of f.
Instances For
The symbol under the input head of f, at the end of a pass.
Instances For
The end of a pass: a step of the composition, and the countdown reset to the new input head
of f.
Instances For
The passes are the steps of the composition.
The parts of the fold, within bounds in the length of the state #
A step of f, with the symbol found by the countdown over the input.
The size of the states #
The size of the states of the composition.
The composition as a fold #
The composition, on given descriptions. If the machine described by df halts on the
bits of every input after uf steps with the symbols y, which are bits, and the machine
described by dg halts on y after ug steps with the encoded value of h, then h is tidily
computable in space linear in composeSpace.
Machines #
Composition within small space. If f and g are computable within the time bounds
tf, tg and the space bounds sf, sg, then g ∘ f is computable within space linear in
sf a + sg (f a) plus the logarithms of the lengths of the input and of the intermediate value,
without ever writing down the intermediate value. Its time is polynomial in the time bounds, the
length of the input and the space bound.
Logarithmic space is closed under composition. If f and g are computable in space
logarithmic in the lengths of their inputs, and f takes inputs of length n to values of length
less than (n + 1) ^ d, then g ∘ f is computable in space logarithmic in the length of its
input.