For canonical positive binary numeral system inputs, a logspace transducer can emit the canonical representation of their sum most significant digit first. Count the operand lengths, compute the final arithmetic carry to determine output length, and then compute each requested result digit by restarting the least-significant-first column recurrence. Each pass uses only a fixed number of -bit indices and one arithmetic carry. The binary-addition carry invariant proves correctness. Logspace composition by recomputation consequently permits any L property of the resulting digit string, including being a binary palindrome, to be tested without storing the sum.
Decide whether a finite directed graph has an even-length directed walk from a specified source to a specified target . Vertices may repeat and a zero-length walk is allowed. The NL-completeness proof uses the graph of pairs with tracking integer parity: every original edge flips , and acceptance means reaching from . At most steps are needed in the parity graph. For hardness, subdivide every edge of an ordinary reachability instance into two directed edges. Both constructions are computable by logspace transducers. Requiring a simple path in a graph in the original graph changes the question; deleting an odd closed portion need not preserve integer parity.
To simulate on the virtual input , store the simulated input-head position and rerun the logspace transducer for whenever an input symbol is requested. Count emitted symbols until the requested position is reached. The intermediate output has polynomial length, so its positions take bits, and the work space of is also . Storage used by successive recomputations is reused. This proves closure of logspace-computable functions under composition and transitivity of logspace many-one reductions.
A total function computed by a halting logspace transducer. Its output may be much longer than its work tapes. Logspace-computable functions compose using logspace composition by recomputation.
A logspace transducer is a deterministic Turing machine with a read-only input tape, read-write work space, and a write-only output tape. It emits symbols successively and cannot reread the output; that output is not charged as working memory. For a total function it must halt on every input. A logspace-computable function is a total function whose output is produced by such a logspace transducer on input .
A logspace many-one reduction is a logspace-computable function such that
for every string . The logarithmic space bound permits a polynomial-length output, even when that output does not fit in work space. Indeed, a halting logspace transducer cannot repeat its state, input-head position and work-tape contents and head positions: the unreadable output cannot affect its subsequent behaviour. There are only a polynomial number of such internal Turing machine configurations, hence a polynomial bound on the number of steps and output symbols.
To prove a formal language is NL-complete, first give an NL acceptance procedure for . Then show every has a logspace many-one reduction to . Alternatively, reduce one already NL-complete formal language to , using transitivity of logspace many-one reductions.
Transitivity requires logspace composition by recomputation, rather than storing the intermediate output. To compose with , simulate the logspace transducer for with a virtual input . Retain its virtual input-head position in bits. Whenever it asks for a symbol, rerun the logspace transducer for from the beginning and count its output symbols until that position is reached. Since is polynomial in , the simulated work space and all output-position counters are . Repeated runs reuse their storage. This proves closure under composition and explains why the hardness argument works.
Directed reachability is NL-complete under logspace many-one reductions. For membership, let be the number of vertices. Store a current vertex, initially , and a counter initially zero. Accept immediately if the current vertex is . Otherwise guess a next vertex, verify by scanning the input that the appropriate directed edge exists, move there and increment the counter. Reject a branch that has made steps without reaching .
Whenever a directed walk reaches , removing closed portions between repeated vertices produces a path in a graph with at most edges. Thus this bound preserves all yes-instances. The current and guessed vertices and the counter use bits, while adjacency checks only need repeated read-only input scans. All branches halt, so directed reachability belongs to NL.
For hardness, let and fix a Nondeterministic Turing machine accepting in work space. On input , construct its configuration graph . A vertex is a possible Turing machine configuration within the fixed work-space bound. Put a directed edge exactly when one legal transition of on changes into . Take the initial Turing machine configuration as source, and add a fresh target with an incoming edge from every accepting Turing machine configuration. Then
There are only a polynomial number of Turing machine configurations, by the count used in part (c). More importantly, their encodings have length . A logspace transducer can enumerate candidate encodings and pairs of candidate encodings with bits of counters. For each pair, it checks the finite transition rule, the scanned input symbol and the local work-tape change using work space. It emits the corresponding adjacency matrix entry or edge-list record. Invalid candidate encodings may be discarded or represented by isolated vertices.
The configuration graph is thus output by a logspace transducer, rather than stored in its work tapes. This supplies the required logspace many-one reduction from every and proves NL-completeness.
The printed question calls the route a path in a graph and writes , without specifying whether repeated vertices are allowed.[ref] Use the computational reachability convention that a permitted route is a directed walk: repeated vertices are allowed and length counts traversed edges with multiplicity. This matters for the integer parity restriction, because deleting a closed portion of odd length can change the integer parity. The proof below establishes the stated NL-completeness for this convention; it does not establish that claim for a simple path in a graph.
For membership of even-length directed reachability in NL, form the conceptual parity graph with vertex set
and directed edges
After a directed walk of length from , the second coordinate equals . Therefore there is an even-length directed walk from to in exactly when is reachable from in this parity graph. It has vertices. Guess successive edges while storing the original current vertex, one parity bit, and a counter bounded by . If the target pair is reachable, it has a simple path in a graph in this enlarged graph of at most edges. This is an NL procedure; the parity graph need not be materialized.
For NL-hardness, reduce directed reachability by subdividing each directed edge with its own new vertex :
Retain as the endpoints and add no other edges. Every original directed walk of length becomes a directed walk of even length . Conversely, a directed walk between original vertices in the new graph must alternate original and subdivision vertices. Compressing each two-edge segment recovers a directed walk in . Hence
A logspace transducer enumerates the original edges, labels each new vertex by its edge endpoints or its position in the input, and emits its two replacement edges. All labels and counters take bits, and the output is of polynomial size. Thus this is a logspace many-one reduction, proving
As in ordinary reachability, a zero-length directed walk is permitted, so is an immediate yes-instance. Both the membership procedure and the subdivision many-one reduction preserve that case.
The binary numeral system representation is taken to be canonical, with no leading zeroes, for each positive integer. Delimiters separate the components of a pair or triple. Syntax, positivity and this representation convention can all be checked in logarithmic space. The useful principle is that a large integer need not be stored in order to compute its digits one at a time.
First consider Add. Let denote the binary digits in position , counting from the least significant position and taking out-of-range digits to be zero. Count the component lengths, and let be their maximum. Start with arithmetic carry . For , compute
Reject if at any position. After the last position, reject if ; otherwise accept. The final arithmetic carry check prevents accepting a result with an omitted high digit, such as the false equality obtained by retaining only two binary digits.
The binary-addition carry invariant is
It holds initially and is preserved by the displayed one-column equations. At the end, it proves that the comparisons and the final arithmetic carry check succeed exactly when . Each requested binary digit is recovered by scanning the corresponding input field and counting to its position. The length counters, position and scan counters require bits, while and require constant space. Thus
For Pal-Add, construct a logspace transducer producing the canonical binary numeral system representation of . Put . One least-to-most-significant pass using the same recurrence determines the final arithmetic carry . Positivity and canonical representations imply that the sum's digit length is
Indeed, one summand is at least and both are less than . For each output position, from down to , recompute the required sum digit from scratch: reset the arithmetic carry to zero and run the column recurrence from position up to the requested position, reading input digits by scans. Positions beyond the summands use zero digits, so position correctly emits the possible final arithmetic carry. Emit only the requested digit, then reuse the work space for the next position.
This produces most-significant-first output with digits. It uses work space because it retains only a fixed number of digit indices, lengths, scan counters and one arithmetic carry; it never stores the whole sum. A direct implementation with repeated whole-input scans uses at most time complexity, which is sufficient here. Hence is a logspace-computable function.
Finally simulate the assumed L decider for binary palindrome on this virtual output, using logspace composition by recomputation from part (b). Whenever the simulated input head asks for a digit, rerun the addition logspace transducer until it emits that digit. The virtual input length is , so both its work space and the addition work space are . The simulation accepts exactly when the canonical representation of is a binary palindrome. Therefore
Equivalently, one could directly compare the sum digits in positions and , recomputing each digit by the same recurrence. This gives the same logarithmic space conclusion without ever writing the full sum on a work tape.