Streaming a list of values at successive indices #
Polynomially many values of a function on unary parameters can be tabulated using a binary index. Each round emits its output directly to the write-only output tape. The fixed parameters fit in logarithmic space when encoded in binary. Recomputing the symbols of their unary forms lets the emitter accept the ordinary unary encodings, even for tuples of parameters in nested tables.
Main definitions #
UnaryTupleEncodingspecifies a unary number or a fixed tuple built from framed pairs.
Main results #
ComputableInLogSpace.map_rangetabulates a logspace function over a variable range.ComputableInLogSpace.flatMap_rangeemits word chunks indexed by a compact parameter and a binary counter.ComputableInLogSpace.toUnary_of_polyBoundedexpands a binary result of polynomial value on the write-only output tape.
Binary-to-unary conversion can emit its entire output with workspace linear in the number of binary input digits.
A binary natural with polynomially bounded value can be emitted in unary within logarithmic workspace on the original input.
Tabulate a binary-indexed emitter in logspace. The parameter carried between emissions fits in logarithmic space, and each round may write a word longer than its own workspace. The count is supplied in unary by a logspace computation.
Encodings made from unary natural numbers and framed pairs. Each leaf can be retained on a work tape in binary while processing a table indexed by the tuple.
- unary : UnaryTupleEncoding encUnary
One unary natural number.
- pair {α β : Type} {e : α ↪ List Bool} {e' : β ↪ List Bool} : UnaryTupleEncoding e → UnaryTupleEncoding e' → UnaryTupleEncoding (encPair e e')
A framed pair of recursively encoded tuples.
Tabulate a logspace computation on a fixed tuple of unary parameters paired with each of
the first r a indices. The number of entries is itself supplied in unary in logspace.