Coalescing and annihilating particle systems — simulation and verification code
Abstract
The ghostsim package accompanies the papers: "Exact determinant formulas for coalescing particle systems" (Piotr Śniady and Ákos Urbán, https://arxiv.org/abs/2602.10782) and "Determinant and Pfaffian formulas for particle annihilation" (Piotr Śniady, https://arxiv.org/abs/2602.13183). Version 1.2.0 adds the empty-interval Pfaffian formula of a third paper of the series, "Pfaffian structure of basin walls for coalescing particles" (Piotr Śniady, https://arxiv.org/abs/2602.22885). The deposit contains the Python package ghostsim (standard library only), two C++ engines as a speed path, a unit-test suite, and a short expository note (ghostsim-note.pdf) explaining the main ideas of the two central papers. All arithmetic is exact — integer path counts or rational probabilities — with no floating point anywhere. The package: enumerates coalescing particle systems (heirs and ghosts) and annihilating particle systems (ghost pairs) exactly, by dynamic programming over weighted states; verifies the papers' formulas against this independent enumeration (python3 -m ghostsim verify): the coalescence determinant with ghosts, the ghost-free coalescence determinant, the annihilation determinant with formal variables, and the Pfaffian pairwise coalescence formula, including boundary cases; verifies the empty-interval Pfaffian formula for basin walls (new in 1.2.0, check B1): the probability that a family of intervals contains no wall — no boundary between the basins of attraction of the surviving particles — equals the Pfaffian of the matrix of pairwise coalescence probabilities. Checked on the checkerboard walk and on a parity-lazy walk where three or more particles can meet at one site; certifies the negative result on prescribed annihilation (Appendix of the annihilation paper) by exact rank computations over the rationals; includes the formula-discovery machinery with which the formulas were originally found: exact enumeration data, linear systems over the rationals, exact solving (python3 -m ghostsim discover); supports pluggable walk models beyond the papers' checkerboard lattice — notably a parity-lazy walk on which three or more particles can meet at one site — in both a combinatorial (counting) and a probabilistic weight regime; the verification suite confirms that the formulas continue to hold there. Code comments cite the papers by their stable LaTeX labels (for example \cref{thm:coalescence}), so the code and the papers can be read side by side; README.md contains the full verification list (14 checks) and a paper-to-code map. Requirements: Python 3.10 or later (standard library only; pytest for the test suite); optionally any C++17 compiler for the speed-path engines. Tested on macOS with Apple clang; nothing is platform-specific. Two further deposits belong to the same series. The discrete results of the coalescence paper are formalized in the Lean 4 proof assistant; that formalization with its Python prototype is a separate deposit (https://doi.org/10.5281/zenodo.21037520), whose guarantee is a machine-checked proof rather than exact tests on instances. The coloring coefficients of the cumulant formula of the basin-walls paper — finite combinatorial objects, with no particle system in them — are computed in a third deposit (https://doi.org/10.5281/zenodo.21627943). The present deposit is the empirical one: it covers all three papers' particle-system formulas, models beyond the checkerboard, and the discovery machinery.
Publication details
- Journal / source
- Zenodo (CERN European Organization for Nuclear Research)
- Publication date
- 28 July 2026