Circuit value problem 2026-10-07
Given a finite acyclic Boolean circuit and its input assignment, determine the output bit. Topological gate evaluation places the problem in P; it is a standard P-complete problem under logspace many-one reductions. Boolean circuit evaluation is different from Circuit satisfiability problem, which asks whether some assignment succeeds.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 59 2 b Solution Created 2026-10-03 Updated 2026-10-07
Here a directed cycle has at least one edge. If zero-length paths were treated as cycles, an edgeless one-vertex graph would already satisfy the predicate; that convention would give the trivial nonempty-graph predicate instead of the intended directed cycle detection problem.
For NL membership, guess a starting vertex , follow a guessed directed walk for between one and edges, and accept if it returns to . Store only the start, current vertex and step counter. A graph with a nonempty closed walk contains a simple directed cycle of at most edges, including a self-loop if present. Thus the algorithm uses logarithmic space and is complete for the predicate.
For hardness, reduce the directed graph reachability problem to cycle detection. Form and add the single backward arcAll layering arcs advance exactly one layer, including the waiting arcs , so the layered graph alone is a Directed acyclic graph. Any cycle in the augmented graph must contain the backward arc and therefore contains a path from to .
If is reachable from in , use a simple path of length at most and pad it with waits to exactly steps. It becomes the required layered path and closes to a cycle. Conversely, projecting such a layered path and deleting waits gives a walk from to in . This includes the case , where reachability has a zero-length witness but the augmented graph has a genuinely positive-length cycle.
There are vertices and polynomially many arcs. A transducer enumerates pairs/layers and checks old adjacency by scanning its input, using only bits. Hence this is a logspace many-one reduction, proving
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 59 3 c Solution Created 2026-10-03 Updated 2026-10-07
The AND-NOT circuit value problem belongs to P: validate the Boolean circuit and evaluate its gates in a topological ordering. Evaluation takes polynomial time even if its description is not already in a topological ordering.
For P-completeness we use logspace many-one reductions. Start from the supplied circuit value problem over the usual AND (logical conjunction), OR (logical disjunction) and NOT (negation) basis. Retain AND and NOT gates, and replace every OR gate by the De Morgan's laws gadgetThis adds only a constant number of gates per old gate, preserves its truth value for all inputs and keeps the Boolean circuit acyclic. If the format includes constant source nodes, replace them by additional input nodes assigned fixed bits zero and one; these are inputs, not disallowed gates. Larger fan-in gates can first be replaced by binary trees of their inputs.
To output the new description, keep the old gate index and a constant-size gadget position, rescan old references when necessary, and assign consistent new indices to each gadget's terminal output. These counters and references occupy bits; the input assignment is copied with any constant-source bits appended. Thus the construction is a logspace many-one reduction preserving acceptance. Since Boolean circuit Value is P-complete under such reductions,
P-completeness 2026-10-07
A language in P to which every P language has a logspace many-one reduction. The reduction strength matters: using arbitrary polynomial-time reductions instead would make completeness trivial for nontrivial P decision problems.