arXiv:2610.09434cs.CCOct 2026

Manuscript Offprint

arXiv:2610.09434

Optimal (Parallel) Spooky Pebbling on Binary Trees

Mingyu Lee, Sanghyun Lee, Kabgyun Jeong

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 BhB_h with n=2h−1n = 2^h - 1 vertices and every space budget h+1≤s≤nh + 1 \leq s \leq n, we give an algorithm with asymptotically optimal work Θ(nh/log⁡(s+1))\Theta(nh/\log(s+1)). At the minimum budget s=h+1s = h + 1, this improves the O(nlog⁡n)O(n \log n) bound of Kornerup, Sadun, and Soloveichik to Θ(nlog⁡n/log⁡log⁡n)\Theta(n \log n/\log \log n), resolving their time-optimality question.

We also construct a parallel schedule with optimal depth

Θ(h+nsmax⁡{hlog⁡(s+1),1+log⁡∗h}).\Theta\left(h+\frac{n}{s}\max\left\{\frac{h}{\log(s+1)},1+\log^{*}h\right\}\right).

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:

∣a1⟩⋯∣ak⟩∣0⟩⟼∣a1⟩⋯∣ak⟩∣f(a1,…,ak)⟩.(1)|a_{1}\rangle\cdots|a_{k}\rangle|0\rangle\longmapsto|a_{1}\rangle\cdots|a_{k}\rangle|f(a_{1},\ldots,a_{k})\rangle. \tag{1}

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 ∣ψx⟩|\psi_x\rangle denote the state of the remaining registers. A measurement outcome m leaves

∑xαx∣ψx⟩∣x⟩⟼∑xαx(−1)m⋅x∣ψx⟩,(2)\sum_{x}\alpha_{x}|\psi_{x}\rangle|x\rangle\longmapsto\sum_{x}\alpha_{x}(-1)^{m\cdot x}|\psi_{x}\rangle, \tag{2}

where m⋅xm \cdot x is computed modulo two and the measured register has been discarded. The factor (−1)m⋅x(-1)^{m \cdot x} 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

∑xαx(−1)m⋅x∣ψx⟩∣x⟩→⊗jZmj∑xαx∣ψx⟩∣x⟩.(3)\sum_{x}\alpha_{x}(-1)^{m\cdot x}|\psi_{x}\rangle|x\rangle\xrightarrow{\otimes_{j}Z^{m_{j}}}\sum_{x}\alpha_{x}|\psi_{x}\rangle|x\rangle. \tag{3}

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.