Manuscript Offprint
arXiv:2610.09434Optimal (Parallel) Spooky Pebbling on Binary Trees
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
Pebble games model computations under a fixed space budget. Spooky pebbling allows quantum memory to be released by measurement, with the resulting phases corrected later. We study two-input computations with binary-tree dependencies and determine the optimal work and parallel depth for complete binary trees. Our key idea is to clean up the tree in blocks, reducing repeated recomputation of intermediate values. For the complete tree with vertices and every space budget , we give an algorithm with asymptotically optimal work . At the minimum budget , this improves the bound of Kornerup, Sadun, and Soloveichik to , resolving their time-optimality question.
We also construct a parallel schedule with optimal depth
Our lower bounds hold for every full binary tree. We also show that achieving optimal parallel depth can require asymptotically more work than minimizing work alone. Applying our schedule to the RNS point-addition trees in the public implementation of Chevignard, Fouque, and Schrottenloher reduces their Toffoli/AND gate count by 20.86% for a P-224 instance and 22.66% for a P-256 instance, using the same arithmetic circuits and peak workspace.
1 Introduction
Consider a quantum out-of-place operation f with k inputs:
This operation must act coherently on superpositions of inputs. When the output of one operation serves as an input to another, the intermediate value must be stored in a quantum register until it is used. Repeatedly combining pairs of values forms a binary tree of computations when each value is used as an input at most once. Such a structure appears when adding elliptic-curve points [CFS26], as we discuss in section 6.
Once an intermediate value is no longer needed, we would like to clear its register to save space. We can do this by reversing the operation that produced the value, but this requires its inputs to remain available. If their registers have already been cleared, those inputs must be computed again. Keeping intermediate values therefore uses more memory, while clearing them early may require more computation.
Pebble games describe this tradeoff between memory and computation [Ben89]. Each vertex represents a value, and its predecessors represent the inputs needed to compute it. A pebble indicates that the value is stored in a register. Placing a pebble corresponds to computing the value, and removing it with its inputs available corresponds to uncomputing it.
Measurement offers another way to release a quantum register. Instead of uncomputing its value, we can measure the register in the Hadamard basis and free it immediately. This reduces the quantum memory in use, but leaves a phase that must be corrected later. Suppose the measured register holds x, and let denote the state of the remaining registers. A measurement outcome m leaves
where is computed modulo two and the measured register has been discarded. The factor may change the relative phases of the remaining state and therefore affect interference in subsequent quantum operations.
In the pebble game, we represent this pending phase correction by a ghost. Unlike a pebble, a ghost does not occupy a quantum register. The measurement outcome is stored classically. Correcting the phase is called exorcising the ghost. Once the required inputs are available, we can do this by recomputing x and applying Z to each qubit whose corresponding measurement outcome is one. We obtain
We can then uncompute x to clear its register without leaving a phase.
This extension of the pebble game, introduced by Gidney, is called spooky pebbling [Gid19]. It allows us to release quantum memory before the inputs needed for uncomputation are available, at the cost of correcting the resulting phases later. A successful strategy must produce the desired output and clear all other pebbles and ghosts. Figure 1 illustrates a configuration of the spooky pebble game on a binary tree.
On more general dependency graphs, KSS studied the hardness of minimizing pebble space. Quist and Laarman proved PSPACE-completeness results and developed SAT-based methods to find spooky pebbling strategies with small quantum space, classical space, or execution time [QL25]. Our focus is on explicit strategies and matching bounds for binary trees.
Another way to reduce execution time is to perform independent operations in parallel. To formalize this in reversible computing, Blocki, Holman, and Lee introduced parallel reversible pebbling [BHL22]. Combining this framework with spooky pebbling, Kahanamoku-Meyer, Ragavan,

quantum registers pending phase corrections
Figure 1: Illustration of spooky pebbling on a binary tree. Pebbles represent values stored in quantum registers, and ghosts represent pending phase corrections. Vertices with neither a pebble nor a ghost are empty. The configuration shown here occupies 7 quantum registers. Pebbling or unpebbling an internal vertex requires pebbles on both children. The goal is to leave only the root pebbled, with all other vertices empty.
and Van Kirk (KMRV) introduced parallel spooky pebbling, which also allows registers to be released by measurement [KMRV26]. In their model, operations are executed in synchronous rounds: the number of rounds determines the depth, while the total number of computations and uncomputations determines the work. Performing multiple operations in a single round can therefore reduce depth without increasing total work.
KMRV studied a linear chain with a fixed initial pebble and additional vertices. They showed that visiting the terminal vertex and then clearing these additional vertices takes an optimal rounds using pebbles [KMRV26]. They also applied their construction to reduce the depth of arithmetic in Regev's factoring algorithm.
These results leave the tradeoffs on binary trees open. Independent subtrees can be computed in parallel, but both child values must be available to compute or uncompute their parent. Under a fixed space budget, a schedule must decide which subtrees to process concurrently and which values to retain for cleanup. We ask what work and depth are optimal at each space budget, and whether a single strategy can minimize both.
1.2 Main results
Let be the complete binary tree of height , where height counts vertices on a longest root-to-leaf path. Then has vertices. Write and for the minimum sequential and parallel work with space at most , and for the minimum parallel depth. Also write , where is the number of iterated binary logarithms needed to reach a value at most one.
Theorem 1.1 (Informal, optimal space-work tradeoffs and parallel depth, see theorems 3.4, 3.8, 4.3 and 5.1). For every integer ,
The optimal parallel depth is
Work and depth are minimized separately. All implicit constants are absolute and uniform over the entire feasible interval.
At the minimum budget , a single parallel construction attains
The work bound improves the KSS bound by a factor of and resolves their question about time-optimality on complete binary trees. At space , linear work and depth are attainable.
Our algorithms reduce repeated reconstruction during cleanup through block cleanup. We retain the values along a block's boundary while computing and uncomputing the intermediate vertices above it. For parallel execution, we also overlap independent boundary computations and the cleanup of disjoint subtrees.
For an associative operation, we can change the parenthesization without changing the input order or the result. Each parenthesization gives an evaluation tree. We therefore ask which tree shape minimizes work and parallel depth at a common space budget.
A full binary tree has exactly two children at each internal vertex. Our lower bounds hold for every such tree, including unbalanced trees, by accounting for the recomputation and storage required during cleanup. Our complete-tree constructions attain these bounds, yielding the following optimality result at a common space budget.
Theorem 1.2 (Optimality over tree shapes). Let , and let contain all ordered full binary trees with leaves. At every common budget , a complete balanced tree minimizes sequential work, parallel work, and parallel depth up to constant factors over .
Work and depth can require different strategies. At , the minimum work is , while the minimum depth is . Every strategy attaining this depth performs work, and our construction attains that work bound. Thus a strategy that minimizes depth in this regime must do asymptotically more work than one that minimizes work alone.
We also apply our cleanup strategy to a fixed point-addition tree in the public implementation of Chevignard, Fouque, and Schrottenloher [CFS26]. Their computation uses a residue number system (RNS), evaluating the point-addition formulas modulo several small primes. With the same tree and arithmetic circuits, our strategy reduces per-prime Toffoli/AND gate count by 20.86% for a P-224 instance and 22.66% for the primary P-256 instance, with unchanged peak workspace. These measurements use the costs of the individual circuits rather than unit costs for tree operations. Section 6 gives the comparison.
2 Pebbling models
2.1 Fixed dependency trees
A rooted full binary tree has either zero or two children at each vertex. Edges point from children to their parent, so the root is the unique sink. We write for the children of , and for its parent, when it exists. The height is the number of vertices on a longest leaf-to-root path. We fix the dependency tree . The complete binary tree has vertices and leaves. All logarithms are binary unless stated otherwise.
An internal vertex v computes a function from its two child values using an out-of-place unitary satisfying
Applying uncomputes this value when both child values are available. Leaf values have no dependencies and can be loaded and erased at any time during the computation. The functions may differ between vertices and need not be associative or invertible. When every internal vertex applies the same associative operation, we may choose the evaluation tree before the computation while preserving the leaf order. Each strategy then follows that fixed tree.
2.2 Configurations and actions
A configuration is a pair of disjoint subsets of V. Vertices in P have pebbles, representing values stored in quantum registers. Vertices in G have ghosts, representing pending phase corrections. All other vertices are empty. We allow three actions:
| Action | Condition | New configuration | Work |
|---|---|---|---|
| Pebble(v) | , | 1 | |
| Unpebble(v) | 1 | ||
| Ghost(v) | 0 |
When , Pebble( ) also applies the single-qubit phase corrections specified by the stored measurement outcome, clearing the ghost.
The initial configuration is , and the goal is : retain the root value and clear every other pebble and every ghost.
2.3 Execution and cost metrics
A sequential strategy executes one action at a time. Each Pebble, Unpebble, or Ghost action is one step.
A parallel strategy executes actions in rounds with two phases, following the execution rule of KMRV [KMRV26, Section 2.1]. In the first phase, Pebble and Unpebble actions may run simultaneously if their active sets
are pairwise disjoint. Their preconditions are checked at the beginning of that phase. In the second phase, Ghost may be applied to any set of currently pebbled vertices.
Parallel depth is the number of rounds. When operations on disjoint logical registers can run concurrently without additional hardware constraints, parallel depth models execution time more directly than the sequential step count.
Each pebble occupies one register, which may contain multiple qubits. We assume equal register widths and measure space by counting pebbles, including those on leaves. Ghosts occupy no quantum space. Sequential space is the maximum number of pebbles present at any step. For a parallel strategy , let be the pebble set after round , and let be its pebble set after the first phase, before ghosting. We count every register occupied during a round:
Here is cumulative storage. External input registers and temporary registers used inside an action are accounted for separately in circuit resource estimates. Classical storage and control are unrestricted.
Work counts function computations and uncomputations: . Ghost releases a register by measurement without evaluating a vertex function, so it contributes no work.
Let denote the total number of pebble placements in a complete strategy. Every placed pebble except the final root must eventually be removed by Unpebble or Ghost, so there are removals. The total action count is therefore , giving
KSS [KSS25] count ghosting as a step, whereas KMRV [KMRV26] count only computations and uncomputations. The two conventions differ by at most a factor of two, so our asymptotic work bounds are unchanged.
For a dependency tree and an integer space budget , let and denote the minimum sequential and parallel work, and let denote the minimum parallel depth. If no valid strategy exists within space , the corresponding value is .
For complete binary trees with , computing the root requires at least pebbles even when measurement-assisted register release is permitted [Coo73; KSS25]. A budget of pebbles allows the entire tree to be held in memory. We therefore study the feasible interval
Any parallel strategy can be serialized by executing each round's actions in order: first Unpebble, then Pebble, and finally Ghost. Pairwise disjoint active sets preserve the preconditions, and every intermediate pebble configuration stays within . Conversely, each sequential step can be executed as a single-action parallel round. Both conversions preserve work and respect the same space budget, so
3 Our algorithms
The computation has two parts: compute the root value from the bottom, then clear every other vertex while retaining the root. With space , we can hold all vertex values at once. Pebbling the tree bottom-up and unpebbling every non-root vertex top-down uses work. Under a smaller space budget, values must be released before the cleanup that needs them, and recovering those values requires additional work.
The bottom-up fast_pebble routine of KSS, which we call SequentialPebble, computes the root with work using the minimum feasible pebbles, but leaves ghosts below it. KSS gave an -step strategy to clear these ghosts at the same minimum budget [KSS25, Theorem 5.5]. The additional work comes from reconstructing child values during cleanup. We reduce this recomputation through block cleanup, introduced in section 3.2. For parallel execution, we also overlap independent computations and cleanup jobs to reduce depth. Dividing the space budget among jobs can require additional recomputation, leading to the work–depth tradeoff examined in section 5.3.
3.1 Bottom-up root calculation
For a complete subtree rooted at with , SequentialPebble( ) computes its children recursively, pebbles , and releases the children afterward. An internal child is ghosted because its own children have already been released. For a pebbled vertex , let Release( ) mean Unpebble( ) if is a leaf, and Ghost( ) otherwise.
Algorithm 1 Bottom-up root computation SequentialPebble(T)
Input: A complete subtree T rooted at v, with every vertex initially empty or ghosted.
Output: The root v is pebbled. Every other internal vertex of T is ghosted, and every other leaf is empty.
1: if T consists of one vertex then 2: Pebble(v); return 3: end if 4: Run SequentialPebble() and SequentialPebble() on the child subtrees 5: Pebble(v) 6: for each child root u of v do 7: Release(u) 8: end for
Every vertex is pebbled once, and every leaf other than the root is unpebbled once. Thus SequentialPebble(T) uses work. From an empty tree, this is optimal up to constants for root computation because every vertex must be computed at least once. Space usage peaks at pebbles for , or one pebble for a leaf.
3.2 Block cleanup
Our key idea is to clean up the tree in blocks. Starting at a subtree's root, we extend a block downward as far as the space budget permits. Its bottom vertices form the boundary . Holding their values lets us compute and uncompute the vertices above without repeatedly reconstructing intermediate values. After releasing , we recursively clean the subtrees rooted there.
For a complete subtree of height , algorithm 2 constructs a balanced boundary of vertices, where . Its vertices lie at depths or . We prepare their values with SequentialPebble, processing the tallest boundary subtrees first.
Algorithm 2 Constructing a balanced boundary Boundary(T, m)
Input: A complete subtree T rooted at v with , and a desired boundary size satisfying .
Output: A set of exactly vertices forming a balanced boundary of .
1: if then 2: return {v} 3: end if 4: 5: 6: return
The one-block operation clears the vertices above , retaining the root when , and returns for recursive cleanup. Its cost determines how large a boundary the budget permits.
Algorithm 3 One-block cleanup Contract(T, m, )
Input: A complete subtree T with . Its leaves are empty, and each internal vertex is either empty or ghosted.
Input: A boundary size m satisfying , and a flag indicating whether to retain the root of T.
Output: The boundary F is returned, and all ghosts in the block above F are exorcised. Within T, only its root remains pebbled when , and no pebbles remain there when . Any remaining ghosts lie in the subtrees rooted at F.
1:
2: Compute and retain F using SequentialPebble, tallest subtrees first
3: Pebble the vertices above F bottom-up
4: Unpebble them top-down, except the root when
5: Apply Release(u) to each
6: return F
Lemma 3.1 (Cost of one-block cleanup). For and , Contract( ) has peak space and work
Contract(T, m, 1) retains the root, reducing the work by one without changing the peak space.
Proof. The boundary F has m vertices, and the block above it has m - 1 vertices. At the end of the upward pebbling pass, all 2m - 1 vertices are pebbled.
The other possible space peak occurs while preparing . Put . Its boundary subtrees have height or , and we compute the taller ones first. A balanced boundary has at least two height- subtrees. Thus a taller computation starts with at most roots retained and uses at most pebbles. The final height- computation starts with roots retained and uses pebbles if , or if . Together with the top-block peak, this gives equation (12).
For work, each of the vertices is pebbled once. The leaves are unpebbled once, as are the m-1 vertices above F. All other removals are ghostings. Since work counts only pebbling and unpebbling,
The top vertices are unpebbled while their children are present. Keeping the output root skips one unpebbling.
For an equal-depth boundary with b registers allocated to the current block, the space conditions become
3.3 Sequential work analysis
We now combine one-block cleanup into a recursive algorithm and bound its total work. The matching lower bound is proved in section 4.
At a height-r cleanup call with budget b, choose the largest m satisfying . Since is nondecreasing in m, we find this value by binary search. The following proposition justifies this rule within the balanced recursive scheme using SequentialPebble.
Proposition 3.2 (Boundary choice for FastClean). For complete trees with unit action costs, the largest feasible boundary minimizes work among the balanced recursive contractions defined in section 3.2, using SequentialPebble at a fixed cleanup budget b. The same rule applies to the output-producing block with budget s and cleanup budget s - 1.
Proof. Let be the minimum cleanup work in this family at budget , starting with internal ghosts and empty leaves, so . Restrict a strategy to either child subtree, still within budget . It either performs block cleanup there directly or first computes and releases that child's root. In both cases the child contributes at least . The parent is also pebbled and unpebbled, giving
Expanding a shallowest boundary vertex of height into its children adds one unit to the current block's work by equation (13), but replaces the later cost by . The total change is
Since algorithm 2 obtains successive sizes by these expansions and is nondecreasing, every expansion up to the largest feasible boundary reduces total work. For the output block, use the descendant budget in . Retaining the root saves one unpebbling for every boundary choice and leaves the comparison unchanged.
The procedure FastClean combines one-block cleanup with recursive calls on the boundary subtrees. Its initial call is FastClean( ), with to retain the root.
Algorithm 4 Complete-tree block cleanup FastClean(T, b, )
Input: A complete subtree T with , no pebbles, and no ghosts on leaves.
Input: A space budget for ( for a leaf), and a flag indicating whether to retain the root of T.
Output: Exorcise T and clear all its pebbles, retaining the root when .
1: if then
2: Pebble the root if ; return
3: end if
4: Choose the largest with
5:
6: For each , run FastClean( ) sequentially
Each recursive call starts with internal ghosts and empty leaves. Since each boundary subtree has height at most , the remaining budget is feasible. For analysis, we write for the budget available below the output.
Each block costs constant work per leaf, so we bound how many blocks contain a given leaf. Because a balanced boundary may span two adjacent depths, we introduce , the largest feasible equal-depth cut depth, to bound the height decrease along every branch.
Lemma 3.3 (Stage bound for block cleanup). Suppose and . At each height with , let be the largest cut depth satisfying equation (14). Any sequence that decreases by at least at each stage reaches in stages.
Proof. Put . This gap increases as the remaining height decreases. The two cut conditions in equation (14) become
Choose maximally with . Since the subtree does not fit in , we have , and both cut conditions hold. Hence, for an absolute constant ,
Each cut reduces r, and thus increases a, by at least .
Once , every nonterminal cut removes levels. The remaining height is at most , so there are such cuts. If , the initial gap already exceeds . Otherwise . Since every cut removes at least one level, at most cuts are needed to reach this threshold.
Theorem 3.4 (Work analysis of FastClean). For and , algorithm 4 uses at most pebbles and work .
Proof. After the first call to Contract, which costs work, the remaining task is to clean boundary subtrees of height at most using budget . For any subsequent height-r subtree with , the largest feasible balanced boundary contains at least vertices, so every recursive branch loses at least levels.
We count the remaining work by distributing each Contract call's cost equally among the leaves of its subtree:
• By equation (13), each leaf is charged work per call.
• By lemma 3.3, each leaf participates in calls, including at most one final call once its remaining subtree fits within b.
• Thus each leaf is charged work in total.
There are leaves. Adding the first call's work gives
where , , and because .
The space bound follows from equation (12).
3.4 Parallel depth upper bound
In this section, we construct and analyze a parallel spooky pebbling algorithm for complete binary trees at every feasible space budget. We parallelize boundary preparation and the cleanup of independent subtrees. Equal-depth boundaries give the resulting subtrees a common height and schedule. Once block cleanup has made them small enough, we divide the space among jobs and process them in parallel batches. At the minimum budget , our schedule achieves depth . The matching lower bound in equation (35) establishes asymptotic optimality.
For the initial root computation and boundary preparation, we use ParallelPebble, a parallel counterpart of SequentialPebble.
Lemma 3.5 (Depth analysis of ParallelPebble). For a complete subtree T of height q and space budget , a procedure ParallelPebble( ) computes and retains its root in depth
Starting from and arbitrary , each vertex is pebbled once. Every non-root vertex is ghosted after use.
Proof. A leaf needs one round and one register. If , compute levelwise and ghost each level after use. If , follow the depth-first order of SequentialPebble, replacing removals by ghosting. This uses at most registers and rounds. Hence assume .
For , choose the largest power of two and put , , and . Compute the bottom height- subtrees levelwise, starting one every second advancement round and ghosting its previous level. After advances, a job's old and new levels use registers during the round. The unfinished jobs therefore occupy at most
Combine adjacent equal-height roots by pebbling their parent and ghosting both children, as in a binary counter's carries. Pause the unfinished jobs during these rounds. The retained roots represent the power-of-two blocks of the completed prefix. Before the last completion, there are popcount(j) ≤ d such roots after j completions. Including an incoming root and temporary parent, the total space is at most
There are advancement rounds and combinations. Since , the depth is .
For , put , , and . Process the bottom subtrees one at a time, using the same binary carries. Before job , the retained stack has popcount( ) roots, leaving local budget
Use the preceding construction, including its base cases, when , and the ghosting depth-first order otherwise. The combinations fit in registers. If jobs require depth-first order, then popcount( ) > , so
The other jobs have and take rounds each, while a depth-first job takes rounds. Summing these depths and the root combinations gives
Indeed, relative to , the extra terms are bounded by and , which are uniformly bounded because .
Every vertex is pebbled once and every non-root value is ghosted after use. Simultaneous actions lie in disjoint bottom subtrees, and root combinations run separately.
For parallel block cleanup, choose a cut of depth , giving boundary subtrees of height . We prepare it with ParallelPebble and process the top block levelwise, since vertices on a common level have disjoint active sets. The same feasibility conditions in equation (14) apply.
Lemma 3.6 (Work and depth of block cleanup using ParallelPebble). For every cut satisfying equation (14), a height-r subtree with no pebbles and arbitrary ghosts can be reduced to its m boundary subtrees with work, space at most b, and depth
The block finishes with no pebbles, and all remaining ghosts lie in the boundary subtrees.
Proof. First prepare the boundary roots with ParallelPebble. If , give each job registers and run them concurrently. By lemma 3.5, this takes rounds.
Otherwise reserve registers for completed roots and give each active job registers. The cut conditions imply , so a batch can contain
jobs. Each batch takes rounds by lemma 3.5 and uses at most registers. The batches therefore take rounds, since . Both preparations use work within budget , retaining all boundary roots.
The levels above the boundary take rounds to pebble and rounds to unpebble, using work and at most registers. Release the boundary in one further round, adding at most work. Substituting and gives the bounds.
To process smaller subtrees together, give each height-r job enough space for one block to take rounds. By equation (16), a local budget of order suffices. We use
The routine Resolve uses this nondecreasing budget to process equal-height jobs in batches, repeating on the smaller subtrees left by each stage.
Lemma 3.7 (Costs of parallel forest cleanup). If , a procedure Resolve(A, r, b) clears A disjoint height-r subtrees containing ghosts but no pebbles, with space at most b, work , and depth
Proof. Let and be the number and height of the subtrees at the current stage. Put , twice the number of their leaves. Initially . A block replaces one height- subtree by height- subtrees with , so is unchanged between stages.
For , choose
Then , so and . Both cut conditions hold with the local budget . By lemma 3.6, one job takes rounds and work.
Run at most disjoint jobs concurrently, keeping their total assigned budget within . Monotonicity of ensures that at least one job fits at every stage. The batches take altogether
rounds and work. Each batch leaves no pebbles, so its registers can be reused. After processing all a jobs, replace by . At , each subtree fits within : pebble it bottom-up and unpebble it top-down using the same batches. This also clears any leaf ghosts.
For , the height update satisfies . Thus the heights over all stages sum to . Moreover, for , so there are stages. Summing equation (20) gives rounds. Each stage costs work, giving the work bound.
We now combine these routines into our parallel pebbling algorithm. First, ParallelPebble computes and retains the root. Using the remaining budget , we apply block cleanup to one subtree at a time. Once , Resolve clears the remaining forest.
Algorithm 5 Parallel spooky pebbling on complete binary trees
Input: An empty complete binary tree of height , and a total space budget satisfying .
Output: All ghosts in are exorcised, leaving its root pebbled and every other vertex empty.
1: Run ParallelPebble( ) and retain the root; set
2: Start with the two child subtrees:
3: while do
4: Choose the largest satisfying equation (14)
5: Clear that block in each subtree using lemma 3.6, one subtree at a time
6: Replace the pending forest by its boundary subtrees:
7: end while
8: Run Resolve( ) on the pending forest
Theorem 3.8 (Work and depth of our parallel algorithm). For and , algorithm 5 uses at most pebbles and achieves
Proof. Throughout cleanup, the number and height of the pending subtrees satisfy . In the first part, implies both and . Hence the depth of one block, , is . Processing all blocks of that height takes
rounds and work. The largest feasible cut is used at each stage, so lemma 3.3 bounds their number by .
At the transition, lemma 3.7 adds rounds and work. The initial root computation takes rounds and n work. Adding these costs and using proves the bounds. The space bound follows from the budgets in lemmas 3.5 to 3.7.
The two work terms reflect the cleanup stages: large subtrees contribute work, and repeated batched cleanup contributes . Running more jobs concurrently leaves less space for each job and can require more cleanup stages. Section 5.3 shows that additional work is necessary for optimal depth at certain budgets.
At , this extra work can be avoided by a direct block schedule. A feasible equal-depth boundary with roots leaves subtrees of constant height. We prepare the boundary with ParallelPebble, compute and uncompute the top block while retaining the output, and fully clean the remaining subtrees in parallel batches. The resulting schedule uses work and has depth .
We have combined ParallelPebble, block cleanup, and Resolve into a complete parallel pebbling algorithm and established work and depth bounds for every feasible space budget. Section 5 proves that this algorithm achieves asymptotically optimal depth.
4 Work lower bounds and optimality
In this section, we establish work optimality for through a lower bound valid for every full binary tree, including unbalanced trees. We count the recomputation forced by the space budget in a sequential strategy and extend the result to the parallel model by serialization.
4.1 Recomputation intervals
In this section, we follow a vertex through the computation to define intervals for counting recomputation and storage. Its value may be computed, used, and released, then computed again when it is needed later. Every other vertex except the root must eventually end empty.
Now consider the last action on a non-root vertex, which must end empty. It cannot be a Ghost action, because clearing the resulting ghost would require pebbling the vertex again. Thus its final removal must be an Unpebble action. Write for the step of this final removal in a sequential strategy, or its round in a parallel strategy. A parent must have both children pebbled when it is uncomputed, so their final uncomputations occur later. In parallel execution, overlapping active sets also prohibit these actions from sharing a round. Hence, for every non-root v and its descendant u,
For a nonempty connected subtree C of T, let root(C) denote the vertex of C nearest the root r of T.
We partition C into smaller connected subtrees, called pieces. For a piece Q, uncomputing par(root(Q)) requires a pebble on root(Q). If Q contains no pebbles, its values must first be recomputed. Since at most s pieces can contain pebbles at once, we seek comparable sizes to limit the vertices covered by occupied pieces and prevent rapid shrinkage under recursive partitioning.
Lemma 4.1 (Partitioning a connected region). Let be a connected subtree of with vertices. For any , we can partition into connected pieces satisfying .
Proof. We repeatedly split pieces larger than , keeping at least a quarter of the vertices in each part. For a piece with vertices, choose a centroid . Removing leaves at most three components. Each component has at most vertices, and their sizes sum to . The largest therefore has at least vertices. Cutting its edge to gives two connected parts of sizes between and . For or , any edge gives these bounds.
The pieces become smaller after each split, so eventually all have size at most . Each final piece was formed by splitting a piece with vertices. Hence .
We now use these pieces to count the recomputation or cumulative storage required between final uncomputations. The next lemma defines the counting intervals and shows that no contribution is counted twice.
Lemma 4.2 (Recomputation and storage). Fix a successful strategy and recursively partition a connected subtree of T excluding r. For each piece Q of a subtree C, write . For pieces with p strictly below root(C), the interval starts immediately after the final uncomputation of root(C) and ends at the final uncomputation of p:
If contains no pebbles after some step or complete round with , then at least placements occur in during . Otherwise, in a parallel execution, contributes at least to during this interval. The sets are pairwise disjoint across the recursive partition.
Proof. Uncomputing requires a pebble on root(Q). Suppose contains no pebbles after time with . Following the child dependencies within shows that every vertex of must be pebbled after and before to supply its root. Ghosts cannot supply these inputs. Thus at least placements occur in .
Otherwise, in parallel execution, for every . Since ,
Finally, consider two distinct pairs and . If , their vertex-time sets are disjoint. Otherwise, exchange the pairs if necessary so that . By equation (23),
Their intervals are therefore disjoint. In either case,
4.2 Work lower bound
In this section, we prove a lower bound on work by counting the recomputation forced by the space budget. We choose piece sizes so that a constant fraction of each subtree lies in pieces containing no pebbles when its root is finally uncomputed. The lower bound on piece size lets us repeat this argument across many partition levels.
Theorem 4.3 (Work lower bound). Every sequential strategy on a full binary tree with n vertices and space at most s has
Proof. If is bounded, suffices. Otherwise, let be the larger child subtree of . Then , and every vertex of has a final uncomputation.
Partition each subtree of size using lemma 4.1 with . Each piece satisfies
Immediately after root(C) is finally uncomputed, exclude its own piece and all pieces containing pebbles. Let contain the remaining pieces. Since at most pieces are excluded,
The children of root(C) remain pebbled after its uncomputation. Thus each has par(root(Q)) strictly below root(C). By lemma 4.2, it requires at least placements during .
Recurse inside every piece until its size is at most . Let be the family of subtrees that are partitioned. By equation (26), each partition reduces size by a factor less than . Hence every satisfies
The placements counted by lemma 4.2 are disjoint, so
The serialization in section 2.3 preserves placements and space. Therefore the same placement lower bound holds for parallel strategies. Since , it is also a work lower bound in either execution model.
For , , so this matches theorem 3.4 and establishes optimal work in both models. We next use the same interval argument to bound cumulative storage and parallel depth.
5 Parallel depth and its work cost
In this section, we prove a parallel depth lower bound for every full binary tree and show that our algorithm for matches it at each feasible space budget. Together with the work lower bound, this establishes optimality over tree shapes. We then show that attaining optimal depth can require asymptotically more work than minimizing work alone at the same space budget.
5.1 Cumulative storage and depth lower bounds
In this section, we use the interval argument of lemma 4.2 to bound cumulative storage and obtain a parallel depth lower bound.
Computing the root requires at least rounds. Each placement occupies a register during its round, and at most s registers are occupied in each round. Thus
Together with theorem 4.3, this gives . To obtain a stronger bound, we should count how long pebbles remain in memory.
Theorem 5.1 (Storage and recomputation). There is a constant c > 0 such that every parallel strategy on a full binary tree with n vertices satisfies
Proof. We first prove the bound for sufficiently large . Let be the larger child subtree of . Its size is . Recursively partition every piece larger than .
For a subtree C of size , choose
By lemma 4.1, each piece satisfies . We count pieces whose roots are at distance at least from root(C). Fewer than vertices lie at smaller distances. Since each piece contains at most vertices, the other pieces cover at most
vertices. The counted pieces therefore cover at least 3m/4.
For each counted piece Q, lies at least edges below root(C). By equation (23),
By lemma 4.2, either Q requires at least placements during this interval or it contributes at least to cumulative storage. Thus these pieces contribute at least to .
We recurse inside every piece, including those omitted from the current count. For sufficiently large L, each piece satisfies
The last inequality follows from the monotonicity of and , which give
Each partition therefore decreases the iterated logarithm of the piece size by at most two.
Initially, . When the recursion stops, the value is at most . Every initial vertex therefore belongs to subtrees that are partitioned. By lemma 4.2, no placement or storage contribution is counted twice. Hence
For below the fixed threshold required by these estimates, . Thus proves the bound after decreasing if necessary.
Because , the theorem implies , and hence . Combining this with the dependency bound and theorem 4.3 gives
For , and , so equation (35) matches theorem 3.8. Together with work optimality from theorems 3.4 and 4.3, this proves theorem 1.1.
5.2 Optimality over tree shapes
In this section, we combine the universal lower bounds with our algorithm for to prove optimality over tree shapes.
Proof of theorem 1.2. Fix a space budget . Every ordered full binary tree with leaves has vertices and height at least . Thus and .
By theorem 4.3, every successful sequential or parallel strategy on T with space at most s has
By equation (35), every such parallel strategy also has
The complete tree has the same number of leaves and is feasible at this budget. By theorem 1.1, it attains both bounds up to constant factors, with work and depth minimized separately. Hence choosing another tree shape cannot improve the asymptotic order of either quantity.
Keeping the two terms separate in equation (28) will also let us bound the work of a depth-optimal strategy.
5.3 Work needed for optimal depth
In this section, we show that attaining optimal parallel depth can require more work than minimizing work alone. By equations (27) and (28),
At a fixed space budget, reducing depth therefore increases this lower bound on work.
Consider . By equations (4) and (5),
The following theorem shows that attaining this depth requires work.
Theorem 5.2 (Work at optimal depth). For complete trees and budgets , every family of strategies with space at most s and depth has work . Algorithm 5 achieves this bound.
Proof. Set . Since , the space and depth bounds give . Thus
for sufficiently large L. For bounded L, the same bound follows from .
For the construction, gives . By theorem 3.8, our algorithm has work and depth . It therefore attains the claimed work bound at optimal depth.
At some space budgets, our algorithm achieves optimal work and depth simultaneously. This holds when , since the additional work does not change the asymptotic work bound. The minimum budget satisfies this condition.
6 Application to RNS point-addition trees
In this section, we apply block cleanup to the RNS point-addition trees of Chevignard, Fouque, and Schrottenloher (CFS) [CFS26] to reduce repeated computations under the same workspace budget.
For a fixed RNS prime , each intermediate value is a coordinate triple . Leaves load precomputed triples selected by window indices. At a non-root internal vertex, the circuit combines its two child triples using the projective point-addition formulas evaluated modulo . Denoting this binary operation by , the circuit performs
Each stored triple corresponds to a pebble, and uncomputing it requires both child triples. The root computation updates the output accumulators, after which all temporary values and pending measurement phases must be cleared. These dependencies and cleanup requirements give a spooky pebbling problem.
We adapt block cleanup to the public circuits, choosing boundaries within the recursive scheme according to their circuit costs and workspace requirements. At the top of a cleanup block, the public phase-correction circuit replaces a pebble-unpebble pair when both child values are available.
We compare block cleanup with the public CFS schedule using the same tree, input order, arithmetic circuits, root operation, and workspace budget. Table 1 shows the circuit-call counts for P-256 at RNS prime 521177. The savings come from fewer leaf lookups and point-addition computations, while the required phase corrections, internal uncomputations, and root operation remain unchanged.
| Operation | CFS schedule | Block cleanup |
|---|---|---|
| Leaf lookup | 82 | 57 |
| Leaf uncomputation | 82 | 57 |
| computation | 46 | 35 |
| uncomputation | 7 | 7 |
| Direct phase correction | 10 | 10 |
| Root operation | 1 | 1 |
Table 1: Circuit-call counts for P-256 at RNS prime 521177.
To quantify the circuit savings, we weight each call by its Toffoli/AND gate count under the public CFS cost model, counting each Toffoli gate and temporary logical-AND computation as one unit. Table 2 reports the total per RNS prime. Block cleanup reduces this cost by 20.86% for P-224 and approximately 22.6% for P-256, with unchanged peak qubits.
| Curve | Leaves | RNS prime | CFS schedule | Block cleanup | Reduction | Qubits Peak / cap |
|---|---|---|---|---|---|---|
| P-224 | 17 | 262139 | 9,306,464 | 7,365,187 | 20.86% | 1165 / 1165 |
| P-256 | 19 | 521177 | 11,559,064 | 8,939,833 | 22.66% | 1303 / 1325 |
| P-256 | 19 | 499979 | 11,640,184 | 9,007,225 | 22.62% | 1303 / 1325 |
Table 2: Toffoli/AND counts per RNS prime. Both schedules have the reported Qarton peak qubits and satisfy the same conservative workspace cap including circuit scratch.
The public model assigns zero gate cost to inverse dummy lookups. The cryptographic-size estimates use the public implementation’s symbolic lookup and arithmetic shortcuts.
We checked output values, relative phases, and complete cleanup using basis and superposition simulations. Thus fewer recomputations yield lower circuit costs under the same workspace and cleanup requirements. Implementation and reproduction details will be provided at https://github.com/red1108/pebble.
7 Discussion
When space is limited, cleanup is the work bottleneck on complete binary trees. Our key idea is to clean up the connected groups of vertices together to reduce repeated computation. It gives asymptotically optimal work at every feasible space budget. For associative operations, we also proved that a complete balanced tree is asymptotically optimal for work and parallel depth among all full binary trees.
For parallel spooky pebbling, we divide the space budget among independent jobs and run them concurrently. This gives asymptotically optimal depth, but each job has less space for cleanup and may require more recomputation. We also prove that this extra work is unavoidable at some space budgets.
During the computation, if sharing intermediate values is allowed, the dependencies can form a general DAG. Our lower-bound argument relies on each non-root vertex having a single parent, so it does not directly extend to this setting. Extending our algorithms and establishing tight work and depth bounds for these graphs remain open. For complete binary trees, the full work–depth tradeoff at a fixed space budget also remains open.
Acknowledgements
This work was supported by the National Research Foundation of Korea (NRF) through a grant funded by the Ministry of Science and ICT (Grant No. RS-2025-00515537), the Institute for Information and Communications Technology Promotion (IITP) grant funded by the Korean government (MSIP) (Grant Nos. RS-2019-II190003 and RS-2025-02304540), the National Research Council of Science and Technology (NST) (Grant No. GTL25012-401), and the Korea Institute of Science and Technology Information (Grant No. P26028).
AI disclosure
The lower-bound proofs were developed through iterative exchanges with GPT-6 Astra and GPT-6.1 Sol. We also used these models to polish the text, search for applications, and assist with the code and computational experiments. The authors are responsible for the proofs, code, and results presented in this paper.
References
[Ben89] C. H. Bennett. "Time/Space Trade-Offs for Reversible Computation". In: SIAM Journal on Computing 18.4 (1989), pp. 766–776. DOI: 10.1137/0218053.
[BHL22] J. Blocki, B. Holman, and S. Lee. "The Parallel Reversible Pebbling Game: Analyzing the Post-Quantum Security of iMHFs". In: Theory of Cryptography—TCC 2022. Springer, 2022, pp. 52–79.
[CFS26] C. Chevignard, P.-A. Fouque, and A. Schrottenloher. Reducing the Number of Qubits in Quantum Discrete Logarithms on Elliptic Curves. Cryptology ePrint Archive, Paper 2026/280. Minor revision of the EUROCRYPT 2026 publication. 2026. IACR: 2026/280.
[Coo73] S. A. Cook. “An Observation on Time-Storage Trade Off”. In: Proceedings of the Fifth Annual ACM Symposium on Theory of Computing. ACM, 1973, pp. 29–33.
[Gid19] C. Gidney. Spooky Pebble Games and Irreversible Uncomputation. Online technical article. 2019. URL: https://algassert.com/post/1905.
[KMRV26] G. D. Kahanamoku-Meyer, S. Ragavan, and K. Van Kirk. "Parallel Spooky Pebbling Makes Regev Factoring More Practical". In: Advances in Cryptology—EUROCRYPT 2026. We use arXiv version 3, revised July 3, 2026. Springer, 2026. DOI: 10.1007/978-3-032-25291-3_14. arXiv: 2510.08432.
[KSS25] N. Kornerup, J. Sadun, and D. Soloveichik. "Tight Bounds on the Spooky Pebble Game: Recycling Qubits with Measurements". In: Quantum 9 (2025), p. 1636. DOI: 10.22331/q-2025-02-18-1636. arXiv: 2110.08973 [quant-ph].
[QL25] A.-J. Quist and A. Laarman. “Trade-offs between Classical and Quantum Space Using Spooky Pebbling”. In: Logical Methods in Computer Science 21.4 (2025), 29:1–29:26. DOI: 10.46298/LMCS-21(4:29)2025. arXiv: 2401.10579.