WorksMathematics
The stacking number of a tree
Abstract
Csernák and Soukup introduced the stacking number of a graph: the least integer such that every configuration of pebbles can be transformed by pebbling moves into a configuration supported on one vertex. They conjectured an explicit formula for the stacking number of a tree in terms of the degrees of its vertices and their distances from a chosen root. We prove this conjecture for every finite tree with at least two vertices. We also show that whether a configuration on a tree can be stacked at a given vertex is decided exactly by the sign of an integer score built from recursive branch messages; consequently, stackability can be tested with a linear number of arithmetic operations. The proof combines this criterion with an explicit zero-score obstruction and a weighted cancellation argument for arbitrary nonstackable configurations. The main theorem and the stackability criterion are formalized in Lean 4, and the main theorem has passed Palomar mechanical verification; it is publicly registered as PALOMAR-2026-09-25-000010.
Introduction
A pebbling move removes two pebbles from a vertex and puts one pebble on an adjacent vertex. Csernák and Soukup [3] introduced the stacking number: how many pebbles guarantee that all remaining pebbles can be brought to a single vertex, whose location may depend on the configuration? They conjectured an explicit formula for trees and verified it computationally for every tree of order at most seven.
For a finite tree and , put
Here denotes graph distance. We retain the source notation and ; our is its , and abbreviates its rooted estimator. Conjecture 10.3 of [3] asserts .
The definition of the stacking number minimizes over . Thus the one-vertex tree has stacking number 2, whereas the displayed estimator is 1. We state the conjecture with the explicit hypothesis ; this isolates a boundary convention in the definitions.
Theorem 1.1. For every finite tree with at least two vertices,
In a subsequent preprint [2], Csernák and Soukup prove the lower bound and derive the matching upper bound from their Almost Stacked Hypothesis. Theorem 1.1 shows that the equality holds unconditionally. That preprint also normalizes the estimator as ; with this convention the equality extends to the one-vertex tree.
The proof yields an exact criterion of independent interest. For a configuration and a vertex , § 3 defines an integer score by a recursion over the branches at , and Theorem 3.3 shows that can be stacked at if and only if . All the scores can be computed together with arithmetic operations (Corollary 3.5), so the stackability of a given configuration on a tree can be decided without any search over sequences of moves.
We prove the tree-stacking estimator conjecture of Csernák and Soukup for nontrivial trees. The proof has three structural ingredients. A branch sends an integer message across its boundary edge, recording the optimal gain or cost of clearing it. An empty branch is a separate state. These messages give an exact criterion for stacking a configuration at , including necessity for arbitrary move order. An explicit configuration of mass has every score zero. For the reverse bound, the nonnegative defects satisfy local two-sided edge equations. We assign the excess contributions to distinct endpoints and cancel them against weighted defects. A consolidation lemma then bounds the auxiliary height weights by distances from one root.
Classical graph pebbling prescribes a target vertex; see Chung [1] and Hurlbert [5]. Cover pebbling prescribes positive demands at all vertices. Sjöstrand’s theorem [6] reduces its universal threshold to distance potentials of configurations concentrated at one vertex. In stacking, every vertex outside the eventual target must be empty. The messages below account for this exact clearing condition.
Configurations and the estimator
All graphs in this paper are finite, simple and undirected. A tree is a nonempty connected acyclic graph. Unless expressly stated otherwise, has at least two vertices. We write for adjacency, and omit the subscript from degrees and distances when no confusion is possible. The natural numbers include zero.
A configuration is a function ; its mass is and its support is . The source writes for mass; we use . The move is legal when and . It replaces by and by . Reachability permits a finite sequence of legal moves, including the empty sequence. Each move decreases mass by one.
A configuration is stacked at when . Write if a configuration stacked at is reachable from . The configuration is stackable if this holds for some . In particular, the zero configuration is not stacked or stackable. The stacking number is the least integer for which every configuration of mass exactly is stackable. Our proof will also establish the existence of such an integer for trees.
Let be the number of degree-one vertices of . The estimator has the following useful form, uniform in the root:
If is internal, this follows directly from the definition. If is a leaf, its degree-one term in replaces the leaf omitted from . Also
Indeed, in the expansion , the root degree is at least one and each of the other vertices contributes at least one.
Branch messages and rooted stackability
For an oriented edge , let be the component containing after deleting . Its root is and its external boundary vertex is . The children are the branches with , . Call a branch occupied when its restriction of is nonzero.
Define the integer transfer function by
In particular, and . Messages take values in the disjoint union . For an empty branch put . For an occupied branch put
The recursion terminates because each child branch has fewer vertices. Only integer messages are summed. When writing a sum over all neighbours we use the numerical contribution , equal to on occupied branches and on empty branches. This convention for sums does not identify the states EMPTY and . The rooted score is
Theorem 3.1 (Exact boundary invariant). Let be occupied with message . Work on the subtree induced by , with initial configuration on $B and pebbles at . A positive stack at with empty is reachable if and only if . In that case the greatest possible final pile at is .
We prove necessity in a form that also applies when other branches interleave their moves at .
Lemma 3.2 (Boundary flux). Suppose a legal sequence clears . Let count its moves from to , and put . If the branch is occupied initially, then
If it is empty initially, then for some . Moves elsewhere in the tree are permitted.
Proof. The move counts satisfy, at every cleared vertex ,
For each initially occupied branch which is cleared, at least one move crosses its boundary outwards. Indeed, consider the move after which that branch becomes empty for the last time. An internal move leaves a pebble inside, and an inward move also does so. Thus this move is an outward boundary move. This observation applies to every occupied child branch, independently of the moves outside it.
First consider an initially empty branch. Sum (9) over its vertices. If is the number of internal moves and , , the result is . Hence its boundary flux is . It is divisible by three: give the boundary vertex sign and alternate signs along tree edges. The signed sum of the balance equations over the branch is congruent to minus its boundary flux modulo three, because each internal move contributes a multiple of three. The initial and final signed sums on the empty branch vanish. This proves the assertion for empty branches, even when they are used temporarily. For an occupied branch, induct on its size. By induction, each occupied child has flux with , and each empty child has flux . Put and , where the first sum runs over occupied children. At , equation (9) reads
For any integer , these conditions imply
To see this, the least possible is ; substituting this value gives precisely the three cases of (6). Any increase in lowers the flux by three.
The transfer function satisfies
For the inequality, the difference is 6 when , 6, 3, 3 at , respectively, and is 0 for odd and 3 for even . The congruence follows from each case in (6). Thus and . Apply (10) to finish the induction. □
Proof of Theorem 3.1. The final boundary pile in any allowed clearing sequence is , so Lemma 3.2 proves necessity and the upper bound. For attainment we induct on the branch size.
We use the following scheduling observation. Suppose disjoint occupied child branches have gains , and a vertex initially has pebbles. If , process branches with positive gain first, then those with zero gain, then those with negative gain. A positive-gain task has positive final pile even when begun at zero. Before a zero-gain task the pile is positive, since the total remaining gains are nonpositive and the final total is positive. During the negative-gain tasks the pile after each task is at least the final positive total. The inductive boundary invariant therefore realizes every task and leaves exactly . Tasks touch only their branch and the common boundary; no other task’s initial interior configuration is changed.
Let for the occupied children of . If , the observation clears the children and leaves at . For , make moves from to ; the final boundary pile is . For , make moves from to , leaving one pebble at . The assumption implies . One move followed by one move is therefore legal; it clears and leaves at .
If , put . The assumption implies . Make moves . The children’s effective total at is now . The observation clears them leaving two pebbles at , and one final move gives pile . These constructions also cover the case with no children and complete the induction. □
Theorem 3.3 (Exact rooted stackability). For every configuration on a finite tree and every vertex ,
Consequently is nonstackable if and only if all its scores are nonpositive.
Proof. If the score is positive, apply the scheduling observation to the occupied branches incident with , starting with pebbles. It gives a stack of size exactly at . Conversely, in any sequence ending in a stack at , every incident branch is cleared. Lemma 3.2 bounds the flux from each occupied branch by its message and from each empty branch by zero. The final pile is therefore at most , and it is positive. The final equivalence follows by quantifying over all targets. □
Remark 3.4. An occupied one-vertex branch containing three pebbles has message . It can be cleared to its boundary only when the boundary has a positive initial pile. An empty branch may be left alone even when that pile is zero. This is why the recursive state must retain EMPTY separately from the integer zero.
Corollary 3.5 (Computing stackability). Let be a tree with vertices and let be a configuration on . All messages and all scores , , can be computed with arithmetic operations. Consequently, arithmetic operations suffice to decide whether is stackable and to list every vertex at which it is stackable.
Proof. Fix a vertex and list the vertices of in breadth-first order from . Scanning this list backwards, determine for each , with parent , whether is occupied and, if it is, compute by (7). The inputs are and the states of the branches at the children of , all found earlier in the scan.
Next scan the list forwards. When a vertex is reached, the states of all branches with are known: those at the children of from the first scan, and the one at its parent earlier in this scan. Put
Let be a child of . The branch is occupied exactly when or is occupied for some neighbour of ; the number of such neighbours is if is occupied and otherwise. If is occupied, then (7) gives
At each vertex each scan uses arithmetic operations, so both scans together use . Finally by (8), and Theorem 3.3 converts the signs of the scores into the stated decisions. □
An extremal zero-score configuration
Fix and root the tree at . Define
For a nonroot vertex , write for its descendant subtree and put
These are positive integers, with closed form
For a leaf this is immediate. For a nonleaf , the number of children is . Substitution of the formula at its children gives
which is (14) at . Summing this closed form over the children of yields
Theorem 4.1. For the configuration ,
In particular, is nonstackable.
Proof. Every descendant branch is occupied, since it contains a leaf other than . The opposite side is occupied as well, since . Induction from the leaves gives upward messages : at a leaf this is ; at an internal nonroot vertex the effective input is , so its message is . Equation (15) implies .
Now suppose has score zero and is its child. Removing the contribution from its score gives effective input on the -side of , hence . If is a leaf, its score is . Otherwise let . Then , , and the score at is . Propagation away from proves the assertion at every vertex. Finally, the total mass is . Nonstackability follows from Theorem 3.3.
Corollary 4.2. There is a nonstackable configuration of mass whose score is zero at every vertex.
Proof. Choose a root maximizing and apply Theorem 4.1.
The arbitrary-defect upper bound
We now bound the mass of every configuration whose scores are all nonpositive. All degrees, paths and distances in this section belong to the original tree. In particular, the argument retains the empty branches: their contributions will be cancelled separately from the contributions of edges with occupied support on both sides.
Let be a finite tree with at least two vertices, and let satisfy for every . Set
If is identically zero the desired bound is immediate. Henceforth choose an occupied vertex , so that . This vertex is used to assign edge owners; the estimator root obtained at the end may be different.
Retained edges and the local defect equations
For adjacent vertices , write for the component containing after deleting . Call retained if both and contain an occupied vertex. Its two messages are then integers. For any edge, let
This notation records the numerical contribution of a message in a score; it does not identify the message EMPTY with the integer message zero. Thus
Lemma 5.1 (Support separation). The two sides of an edge partition . Every nonretained edge has exactly one empty side. A retained edge lies on a path between two occupied vertices, and every edge of a path between two occupied vertices is retained. More specifically, if is retained and is an occupied vertex in , every edge on the path from to is retained. If is retained and no other retained edge is incident with , then . Finally, an endpoint on the empty side of an edge is incident with no retained edge.
Proof. Deleting an edge of a tree produces exactly two components, giving the partition. Since , at least one component is occupied. If both are occupied, choose one occupied vertex in each; their unique path crosses the deleted edge. Conversely, deleting any edge on the path between two occupied vertices separates those vertices, so that edge is retained.
For the more specific assertion, choose an occupied vertex in . The path from to consists of the path from to , the edge , and the path from to . Every edge on its – segment is therefore retained. If is unoccupied, an occupied vertex on its side is distinct from , and the edge of that segment incident with is a retained edge other than . This proves the next assertion by contraposition.
For the last assertion, let be empty. The edge itself is nonretained. For every other neighbour of , the component lies inside and is empty. Hence is also nonretained.
For a retained edge , put and . Removing the opposite message from each endpoint score gives the two effective branch inputs. The message recursion therefore yields
These equations are only asserted for retained edges.
Lemma 5.2 (Classification of retained edge states). The solutions of (17) with have exactly the following forms, up to exchanging and :
(1) An oriented state, with
The latter alternative requires . We direct this edge .
(2) A two-negative state, with unique such that
Both messages cannot be nonnegative.
Proof. The definition of gives
Indeed, the first two statements use for ; the even positive and odd positive cases of give the third, including the unique preimage of zero.
If , then , so the second edge equation gives . Substituting this into the first equation and using the nonnegative preimages gives either , or the same left side equals with . These are exactly the two defect alternatives in (18). The case is symmetric.
If both messages are negative, the first two identities express them uniquely as and , with . Their unique preimages give and , proving (19). Conversely, substitution verifies every displayed state, subject to the stated restriction when .
Call an oriented state defective if its head defect is positive. Call a two-negative state defective if . The remaining two-negative state is the neutral state , with both endpoint defects zero. The defective retained edges form a forest, since they are a subset of the edges of .
Owners, orientations and auxiliary weights
Lemma 5.3 (Injective incident owners). For each edge , let be the endpoint farther from . Then is well defined and injective on . If is empty, then .
Proof. The unique path from crosses precisely when reaching the endpoint on the side not containing . Thus the endpoint distances differ by one. The owner is the more distant endpoint. Each vertex other than has exactly one neighbour preceding it on its unique path from ; consequently it owns exactly that predecessor edge. In particular two edges cannot share an owner. If is empty, the occupied vertex lies on the side, so is the farther endpoint. □
Define an auxiliary partial orientation of as follows. Keep the direction of every oriented state, including those with zero head defect. Direct each defective two-negative edge toward its owner. Leave neutral edges and nonretained edges unoriented. The classification ensures that no edge has both directions. Since has no undirected cycle, this directed graph has no directed cycle.
Let be the maximum length of a directed path ending at , allowing the path of length zero, and set
The maximum exists because a directed path has no repeated vertex. For an auxiliary arrow , a longest path ending at can be extended by this arrow: if it already contained , it would give a directed cycle. Hence
A vertex has positive height exactly when it has an incoming auxiliary arrow. Since every auxiliary arrow is retained, Lemma 5.1 also shows that the endpoint on the empty side of any edge has height zero and weight one.
Local charges and global defect cancellation
For an undirected edge , define its weighted message contribution by
Define two nonnegative charges, with disjoint conditions of application:
Lemma 5.4 (Retained-edge charge). For every retained edge ,
Proof. First consider an oriented state with parameter . By (18) and (21),
The excess is zero when the edge is nondefective. Otherwise either endpoint can pay it: the local defect relation gives , and doubling gives . Thus it is bounded by the charge at the prescribed owner, regardless of whether that owner is the tail or head.
For a defective two-negative state, name its endpoints so that the auxiliary direction is , with , and use the parameters in (19). Then
Here and justify the inequality. A neutral edge has and contributes exactly , completing the proof. □
Lemma 5.5 (Empty-side cancellation). If is empty, then
Proof. The message is literally EMPTY. At , the initial pile is zero, and every incident branch other than the side is empty. Consequently , where this last message is an integer because the side contains . Thus and , giving . By Lemma 5.3, is the owner. In addition , as observed above. No integer defect-state equations were applied to the empty message. □
Proposition 5.6 (Weighted cancellation). The auxiliary weighted mass satisfies
Proof. Grouping (16) by undirected edges gives the exact identity
Lemmas 5.4 and 5.5 give, uniformly over all ambient edges,
Each sum of the two charges is at most its one owner budget . Owners are injective on all edges, and every vertex budget is nonnegative, so
Substitution in (23) cancels the budgets. Finally, each vertex weight occurs once for each incident edge, so . □
Removing leaf weights
Let be the number of ambient vertices of degree one.
Lemma 5.7 (Ambient leaf slack). Every degree-one vertex with is occupied. Consequently
Proof. If , then , so there is an incoming auxiliary arrow at . Its underlying edge is retained. As has degree one, its side of that edge is the singleton ; retention implies . For any degree-one vertex, therefore,
:::`
if both sides are zero, and otherwise proves it. Since at every vertex, all configuration slack terms are nonnegative. Using Proposition 5.6,
The last equality uses that every vertex of a nontrivial tree has positive degree. Replacing by proves the claim. Thus occupied leaves pay the required slack, while unoccupied ambient leaves have unit weight and require no payment. □
Consolidation to one ambient root
We prove a pointwise statement about heights before applying the estimator. A set of vertices is called connected here if the unique tree path between any two of its vertices stays in the set. This agrees with connectedness of the induced subgraph, by uniqueness of paths in a tree.
Lemma 5.8 (Source partition). The vertices of can be partitioned into connected sets with vertices such that
Proof. For every of positive height, choose once and for all an incoming auxiliary arrow with . Such an arrow exists by taking the last edge of a longest directed path ending at : its prefix has length , and (21) at the level of heights prevents the height of its penultimate vertex from being larger.
Iterating decreases height by exactly one each time and ends at a vertex of height zero after steps. No vertex repeats, so this predecessor chain is the unique tree path from to and . Every vertex on the chain has the same terminal source, since its subsequent predecessor choices are fixed. Each nonempty fibre therefore contains and the full path from each of its vertices to . The path between two vertices of is contained in the union of their paths to , hence stays in . The nonempty fibres give the required connected partition. □
Lemma 5.9 (Merging height-dominated parts). Let be disjoint nonempty connected vertex sets joined by an edge , with and . Suppose , and satisfy
Then is connected, and one of satisfies the same domination on all of .
Proof. Paths within the two sets, together with , connect their union. If and , concatenate the path from to in , the edge , and the path from to in . Disjointness makes this a simple path, so it is the unique tree path and
Put and . If , then for every the triangle inequality and (25) give
The pre-existing domination on is unchanged, so works. Otherwise , which implies ; the same argument with the two sets exchanged shows that works. □
Proposition 5.10 (Height-dominating root). There exists a vertex such that
Proof. Begin with the connected source partition of Lemma 5.8; each part is height-dominated by its own source. If there is more than one part, connectedness of provides an edge joining two parts: for example, follow a path from a vertex in one part to a vertex outside it and take its first exit edge. Lemma 5.9, with , merges those two parts and supplies a root that height-dominates their union. The resulting sets are still a partition into connected, height-dominated parts. Each merge reduces the number of parts by one, so finitely many merges leave the whole vertex set and one dominating root. □
Theorem 5.11 (Arbitrary-defect upper bound). For every configuration on a finite tree with at least two vertices,
Proof. For , the bound follows from the positive estimator formula. Otherwise the preceding construction applies. Choose the root from Proposition 5.10. Since increases with , Lemma 5.7 gives
The final equality is the estimator identity (4). Every quantity in this calculation uses the ambient tree. □
Together with the exact score criterion (Theorem 3.3), Theorem 5.11 implies that every non-stackable configuration has mass at most , and hence every configuration of mass is stackable.
The stacking formula
One final point is required because the stacking number uses exact sizes.
Lemma 6.1. Let be a connected graph on vertices. If and every configuration of mass is stackable, then and every configuration of mass is stackable.
Proof. If , put one pebble on each of distinct vertices. This configuration admits no legal move and is not stacked, a contradiction. Now let . Since , some vertex has at least two pebbles. It has a neighbour by connectedness and . One legal move produces a configuration of mass , which is stackable by hypothesis. Prepend that move to a stacking sequence. □
Proof of Theorem 1.1. Theorem 5.11 implies that every configuration of mass is stackable. By (5), this is an admissible threshold at least two, so . On the other hand, Corollary 4.2 provides a nonstackable configuration of mass . If a universal exact size were smaller than , repeated application of Lemma 6.1 would make every configuration of mass stackable. This contradiction proves the reverse inequality. □
The proof also gives an exact extremal statement:
Corollary 6.2. For every nontrivial finite tree,
Proof. Every zero-score configuration is nonstackable by Theorem 3.3. The upper bound is Theorem 5.11, and the zero-score obstruction attains it. □
For the singleton tree, every positive configuration is already stacked. Consequently under the source threshold convention, while (1)–(3) give .
Formal verification and reproducibility
The complete theorem, including the message characterization, obstruction, weighted cancellation and exact-size threshold argument, has been formalized in Lean. The headline declaration is
TreeStack.stack_eq_estim_of_two_le_card.
Its hypothesis and conclusion are, respectively,
for a finite tree on . The formalization proves the result for arbitrary finite trees, without an order bound. Theorem 3.3 is the declaration
TreeStack.stackableAt_iff_score_pos.
Corollary 3.5 is an algorithmic consequence of that theorem and is not part of the formal development.
The source and reproduction instructions are available in the public repository [4]. The immutable formal-verification revision is
4d4969703a9f0ca7a51cbe7edf0f0338cc95cafb.
It pins Lean 4.35.0-rc2 and a specific Mathlib revision. The theorem-level audit records only the standard axioms propext, Quot.sound and Classical.choice. The proved declaration is separate from Palomar’s protected Challenge statement. Palomar mechanical verification succeeded, including comparison with that statement and independent NanoDa kernel replay. Its automated review identified no problems. The verified result is publicly registered in Palomar, version 1, under identifier PALOMAR-2026-09-25-000010. The public verification record is: https://palomar-registry.org/entry.html?id=PALOMAR-2026-09-25-000010&version=1. This is a record of mechanical verification, not human peer review.
The repository includes a theorem-to-source correspondence for this paper, the pinned dependency files, and commands for the Lean build and axiom audit. It also provides independent Python implementations of legal reachability and branch messages, and bounded regression checks. Those computations support reproduction and testing; the proofs above do not depend on finite enumeration. Later publication commits preserve the immutable verification revision.
Use of AI tools
Use of AI tools. This work was developed with extensive assistance from AI tools (OpenAI’s ChatGPT and Codex), under the direction of the author, including mathematical exploration, Lean development, proof auditing and preparation of the exposition. The author selected the problem and scope and directed validation. The proofs in this paper are written to be checked without the formal development; those of the main theorem were also cross-checked against the Lean declarations, and the main theorem is verified in Lean as described above. The author takes full responsibility for the content of the paper. This disclosure follows the development provenance recorded in the repository.
References
- [1]Fan R. K. Chung, Pebbling in hypercubes, SIAM Journal on Discrete Mathematics 2 (1989), no. 4, 467–472.
- [2]Tamás Csernák and Lajos Soukup, The Almost Stacked Hypothesis: a conjectural analogue of Sjöstrand’s cover pebbling theorem, 2026, arXiv:2610.09650.arxiv.org/abs/2610.09650
- [3]______, Stacking and clearing in group pebbling, 2026, arXiv:2604.22341.arxiv.org/abs/2604.22341
- [4]John Fairfax-Ball, TreeStack: Structural certificates for stacking on trees, GitHub repository, https://github.com/jfairfaxball-348/TreeStack-Structural-Certificates-for-Stacking-on-Trees, 2026, Lean formalization; revision 4d4969703a9f0ca7a51cbe7edf0f0338cc95cafb.
- [5]Glenn Hurlbert, A survey of graph pebbling, Congressus Numerantium 139 (1999), 41–64, arXiv:math/0406024.
- [6]Jonas Sjöstrand, The cover pebbling theorem, The Electronic Journal of Combinatorics 12 (2005), no. 1, N22, arXiv:math/0410129.DOI