Skip to content

Where can a collision store its energy?

Can a correction near two colliding walkers complete the energy assigned to them in free flight? Four waves test that idea. An ideal material meter and a field that acts back on its source give two further energy balances with explicit assumptions.

A pulse that the collision cannot see

Imagine assigning an energy to each isolated walker and adding an interaction term only while two walkers are close. That prescription works for many ordinary particles. We tested it on the six-stage walk with the same phase applied whenever two bosons meet. An exact interference experiment exposes a problem. There are incoming waves whose amplitudes cancel at every collision site. The proposed energy acts differently on the contributing waves and destroys that cancellation. No correction confined to the collision region can restore the proposed conservation law. The result holds however small or large the contact phase is, apart from a whole number of turns. Definition of the walk and the contact

The result extends beyond the original sine proposal. Assume that the energy of an isolated walker is a single continuous real function of its phase per tick. Allow a translation-invariant two-particle correction that has finite range in the motion of the pair’s center and is confined near coincidence in both its input and its output. Then the only exactly conserved assignment of this kind gives every isolated walker the same energy. The theorem also covers kernels absolutely summable in these three translation-reduced indices. It concerns a specified discrete update and a proposed way of reading energy from it. Material degrees of freedom can carry information absent from that update.

Why different shares of the same phase matter

Write W for the one-particle tick, U0 for its two-particle free action, and P for the projection onto particles on the same site. The interacting tick is U = [I + (eig − 1)P]U0. At a fixed total momentum and total tick phase, consider finite superpositions of free plane waves. Their amplitudes at coincidence form a three-component vector, one component for each symmetric spin state. Call the map taking the waves to that vector L. Every wave in the kernel of L is an exact eigenwave of the interacting tick at that phase.

Let X be the sum of the two proposed free energies and let D be a local correction. Suppose X + D is conserved. For a collision-dark eigenwave ψ of eigenvalue λ, the vector (λ − U0)Dψ is supported at coincidence. Testing against three free eigenwaves whose collision spinors span the triplet forces that vector to vanish. The free tick on the shells used below has no square-summable eigenvector at λ. Thus Dψ = 0 and LXψ = 0. For the summable kernels stated above the correction sends plane waves to summable vectors. For a continuous free-phase function, plane-wave evaluations can equivalently be obtained using smooth momentum packets approaching each chosen momentum.

It follows that LX = M L for some three-by-three matrix M on this shell. Every incoming pair has a nonzero contact spinor, and its additive energy must be an eigenvalue of M. As the momenta vary continuously along a connected path, that energy must stay constant. A finite matrix has only finitely many eigenvalues. The accompanying four-wave example exhibits a dark superposition directly for both the signed sine charge and its positive magnitude. Four-wave calculation and scattering proof

Which continuous functions of the tick phase survive?

Parameterize a one-particle eigenvalue as exp(−iθ), and call its assigned energy f(θ). Fix any mean positive phase 0 < m < π and sharing range 0 < δ < min(m, π − m). There is a connected family at total momentum (2δ,0,0) having one-particle phases m + t and m − t for every 0 ≤ t ≤ δ. Therefore f(m + δ) + f(m − δ) = 2f(m). This midpoint identity and continuity imply that f is affine throughout (0,π).

Construction of the energy-sharing path and the three tests

Choose momenta (δ + x, y, 0) and (δ − x, −y, 0). Set cos x cos y = cos m cos t/cos δ and sin x cos y = sin m sin t/sin δ. The sum of the squared right sides rises from cos²m/cos²δ to one, so real solutions exist continuously. At m = π/2 use x = π/2 and cos y = sin t/sin δ. For the three tests, the opposite axial momenta give the symmetric mixed-spin state in the x-spin basis. Two equal-sharing pairs in the xy and xz planes give independent combinations of the two aligned-spin states. Their coefficients have nonzero magnitudes (1 ± tan δ cot m)/2. Finally the free matrix at identical momenta (δ,0,0) has eigenvalues 1 and exp(±2iδ), which differ from exp(−2im). The free determinant at the chosen phase is a nonzero trigonometric polynomial, so its zero set has measure zero and supplies no square-summable eigenstate.

One more test fixes the slope. At zero total momentum take two positive-branch walkers of phase m, on opposite axial momenta. Another pair has signed phases m − π on the negative branch. They have the same total phase per tick and the same symmetric spin amplitude at coincidence. Their difference is dark, so f(m) = f(m − π). The phase is a circle. Continuity at phase zero identifies the limiting values at the two ends of the affine interval and forces its slope to vanish. Assigning the principal signed phase as an unwrapped real energy also fails this last pair test directly, by 2π in the summed energy. A total phase modulo 2π remains meaningful throughout.

How a finite simulation can hide the missing energy

Put the walk on a periodic cube of side L coarse sites with L divisible by four. For the signed sine charge a correction supported within relative distance R in each coordinate is impossible if 2R + 5 ≤ L. At total momentum zero the momenta ±π/2 on the three axes supply three spanning contact tests at pair eigenvalue −1. Shifting both momenta by π along z preserves the free pair tick and reverses the signed sine charge. The dark difference is sent to a state with a nonzero contact amplitude. A putative corrected eigenvector supported in the radius-R box could be extended by zero to the infinite lattice: a free tick moves the relative coordinate by at most two sites, so all shifted sites still fit into the box of side 2R + 5 before periodic identifications. There is no nonzero finitely supported free eigenvector at −1. For example, on side 32 an exact correction would need radius at least 14. This is a lower bound.

Approximate conservation is easier. Start with the two-particle signed sine charge X and average its Heisenberg evolution over ticks 0 through T − 1. The averaged operator differs from X only within relative distance 2T − 1. Its one-tick drift in operator norm is at most 4/T in walk units: the average telescopes, and the original pair charge has norm at most two. Thus a test can look increasingly conserved as its spatial range and observation time increase. This construction supplies neither an exactly localized energy nor a lower bound on the best attainable drift for a fixed radius.

The smallest commensurate cube gives a concrete warning. In a periodic 4³ box, prepare a translation-invariant superposition of coincident pairs with symmetric spin (↑↓ + ↓↑)/√2. At zero total momentum half the relative momenta carry the negative free-tick sign for this spin and half the positive sign. After two interacting ticks the initial packet returns with just the collision phase. For a π contact, the squared drift of the time-averaged charge on this one packet at T = 1, 2, 3, 4 is respectively 0, 2, 8/9, 0. A four-tick check would find a perfect revival on this input. The infinite-volume and finite-radius tests explain why that observation cannot establish an energy law.

A conserved local energy with different detector predictions

There is a concrete alternative if the six-stage tick is an approximation to an underlying clock. Take the finite-range hopping matrix F = (W† − W)/(2i). Give the bosons the time-independent Hamiltonian

H = E0N + ε dΓ(F) + (u/2) Σx nx(nx − 1).

Here N is particle number, dΓ(F) sums the native hopping over particles, ε sets the energy unit, and u is the cost of a same-site pair. Choose ε > 0, u ≥ 0 and E0 ≥ ε. The Hamiltonian is bounded below and its total energy is exactly conserved. The continuous propagation is generated by this full Hamiltonian at all times. A local energy density can assign half of each hopping term to each endpoint and include the onsite terms in full. Its time derivative is a sum of the commutators with neighboring densities, giving a local energy balance.

For a direct energy-exchange example, prepare an equal coherent superposition of two spin-up bosons at the origin and one at the origin with the other one site along positive z. In the convention where the forward spin-up hopping matrix element is +iε/2, the initial rate of change of the contact energy is −uε/(√2 ℏ). The hopping energy increases at the same rate in magnitude. The off-diagonal matrix element between the normalized configurations is +iε/√2. Both the hopping coefficient and the specified preparation phase enter this prediction.

Measure the radius as well as the angle

Calibrate one tick to ℏ/ε at small momentum. Ignoring the common carrier, the free one-particle phases in the Hamiltonian model are ±sin Ω. The discrete walk has phases ±Ω. Their low-momentum slopes agree. The group velocities of the Hamiltonian model equal the walk velocities multiplied by cos Ω. For a one-site launch and an equal spin mixture this leaves the long-time angular probabilities unchanged: the two band signs are equally likely, and the zero-speed surfaces have momentum measure zero. A face-to-body count ratio alone cannot distinguish the clocks.

The radius gives a different answer. For each axis the walk’s velocity obeys sin Ω · vx = sin kx cos ky cos kz. Squaring and averaging over uniform momentum gives 1/8. Consequently the mean-square displacement along that axis per tick count squared drops by exactly 1/8 in the Hamiltonian model. Its limiting value is approximately 0.03294742, compared with 0.15794742 in the walk. The corresponding root-mean-square radii per tick are 0.31439 and 0.68836 coarse cells. Original velocity and variance calculation

A one-tick preparation gives a larger contrast. Restrict transverse momentum to zero, localize the particle in x, and prepare positive x spin. The discrete tick moves it exactly one coarse site forwards. For the Hamiltonian, Fourier transformation of exp(−i sin kx) gives the Bessel amplitudes. The probability of staying at the initial x is J0(1)² = 58.55275%. This is a transversely uniform input on a periodic array, or the large-aperture limit of a collimated preparation. The competing update clocks and the onsite repulsion are model choices. A measurement of the actual apparatus can select between their predictions. Neither choice by itself fixes how energy gravitates.

Can a collision store the missing sine charge?

Sections in this chapter

For the six-stage walk with a spin-independent phase every time two bosons occupy the same site, a bounded correction confined to the collision region cannot make the additive sine charge exactly conserved. The obstruction holds at every nontrivial contact phase, including a phase of π. It also applies if each separated boson is assigned the positive charge |sin Ω|. Four waves on the positive band already give the contradiction.

What counts as a local correction

Use one coarse cell for length and one full tick for time. Write the one-particle tick as W(k) = XYZ²YX, with X = exp(−ikₓσₓ/2) and the corresponding y and z matrices. Its positive-band eigenvalue is exp(−iΩ), where cos Ω = cos kₓ cos kᵧ cos k_z and 0 < Ω < π. On two bosons the free unitary is U₀ = W ⊗ W restricted to the exchange-symmetric space. If P projects onto two bosons at the same site, the contacted tick is U = U₀(I + cP), with c = exp(ig) − 1. The proof assumes c ≠ 0. Onsite spin-independent contact has three spin components, the onsite triplet.

Let F = (W† − W)/(2i). The free two-particle charge X is F ⊗ I + I ⊗ F, or the same sum with |F| in place of F. A proposed conserved charge is X + D. A strictly local D acts only when the relative separation lies within a fixed radius on the input and output. A broader condition is that, at each conserved total momentum K, D is a compact operator on the relative-coordinate Hilbert space, up to a set of K of measure zero. A bounded finite-range collision correction, or its operator-norm limit, satisfies this broader condition. Both proofs below use the infinite lattice.

Four free waves at the same phase

Set the total momentum to (K,0,0) with K = π/3, and set the total positive-band phase s = π/2. For a symmetrized pair of free Bloch waves h, let v = Ph be its spin vector at coincident positions, with the common center-of-mass Bloch phase suppressed. Let q be the eigenvalue of X on h. Both proposed charges have q = sin Ω₁ + sin Ω₂ on this band.

The axial pair has momenta (5π/12,0,0) and (−π/12,0,0). Put y = arccos √(2/3). The two transverse pairs have momenta (π/6,±y,0) and (π/6,0,±y), respectively. Each pair has total phase s. Its two-particle charge is √(3/2) for the axial pair and √2 for each transverse pair.

The three contact spin vectors form a basis. For the axial pair the two spins are opposite x eigenstates, giving the symmetric triplet with x spin projection zero. The two spins of a transverse pair have the same x polarization β = 1/√3 and opposite transverse polarizations. In the x-spin basis their symmetrized product is proportional to a superposition of |++⟩ and |−−⟩ with coefficient magnitudes (1+β)/2 and (1−β)/2. Rotating the transverse direction from y to z reverses the relative sign of these coefficients. Both are nonzero, so those two vectors span the complement of the axial vector.

A fourth pair interpolates between the axial and first transverse pair. Let h denote the one-particle phase difference in the following formulas and take 0 ≤ h ≤ K.

tan x = tan(s/2) tan(h/2) / tan(K/2)
cos y = cos(s/2) cos(h/2) / [cos(K/2) cos x]
p₁ = (K/2+x, y,0),    p₂ = (K/2−x,−y,0)
Ω₁ = (s+h)/2,          Ω₂ = (s−h)/2
q(h) = 2 sin(s/2) cos(h/2).

These follow by taking the sum and difference of cos Ω₁ and cos Ω₂. The squared cosine of y increases from 2/3 to 1, so the full curve consists of real momenta. At h = K/2 the fourth charge is (1+√3)/2, strictly between the two charges of the basis waves. A symmetrized product of two nonzero spinors always has nonzero coincident spin vector.

All four waves lie on regular patches of the fixed-momentum, fixed-phase surface. On the axial ray the derivative of the phase sum with respect to relative axial momentum is 2. At the other three points both one-particle cosines along x are positive and the derivative with respect to the transverse displacement of momentum is nonzero. The implicit function theorem continues these four patches to a common open set of nearby total momenta and phases. Spin-basis independence and the gaps to the fourth charge persist there. This supplies a positive-measure set for the scattering argument.

Why a finite correction fails

Fix total momentum and phase in this set. On finite sums of generalized free pair waves at that phase, L takes the coincident spin amplitude. If Lψ = 0, the contact phase acts trivially and Uψ = U₀ψ = zψ with z = exp(−is). If X + D is conserved, its value on ψ must obey the same eigenvalue equation. Since X commutes with U₀,

(z − U₀) Dψ = c U₀ P(Xψ + Dψ).

For a correction with finite relative support, Dψ has finite support and can be paired with every free on-shell plane wave. The left side of this equation then vanishes under the pairing. On the right each test yields the inner product of its coincident spin vector with P(Xψ+Dψ), times the nonzero factor cz. The three spanning tests force P(Xψ+Dψ) = 0. Thus Dψ is a square-summable free eigenstate at z.

There is no such eigenstate. At relative momentum zero the two momenta both equal (π/6,0,0). The free pair phases there are 0 and ±π/3, all different from s = π/2. This separation persists on the open set used above. The determinant of z − U₀ in relative momentum is a nonzero trigonometric polynomial, whose zero set has Lebesgue measure zero. A square-summable free eigenstate would have its Fourier transform supported on that set. Hence Dψ = 0, and LXψ = 0 for every such ψ in ker L.

This imposes a three-dimensional linear-algebra test. Since L is onto the triplet, the implication Lψ = 0 ⇒ LXψ = 0 gives a matrix M on that triplet with LX = ML. Each coincident vector v must therefore obey Mv = qv. The first three waves fix a basis of eigenvectors, with eigenvalues √(3/2), √2 and √2. The fourth nonzero vector would need a further eigenvalue. This contradicts conservation for every c ≠ 0. The calculation also applies to a decaying kernel if it maps the generalized waves to absolutely summable vectors and the equation above holds on those waves.

The checker multiplies the six one-link matrices and constructs a four-wave input by solving the contact cancellation in the first three spin vectors. With the fourth coefficient set to one and the spin conventions specified in the code, the contact amplitude has numerical norm below 3 × 10⁻¹⁶ before charge weighting and about 0.0755315183 afterwards. This is a matrix-element illustration on generalized waves. The exact conclusion follows from the charge gap and triplet dimension.

Corrections that vanish at large separation

For a compact relative-coordinate correction, general Bloch waves need not belong to its domain of action as distributions. One can instead work with square-integrable scattering packets. At fixed K the contact changes U₀ by finite rank, so the incoming and outgoing wave operators exist and are complete on the absolutely continuous subspaces. On a free absolutely continuous packet f, U₀ⁿf tends weakly to zero at both signs of infinite time by the Riemann–Lebesgue lemma. Compactness gives ‖D U₀ⁿf‖ → 0. Exact conservation then intertwines X with X + D through each wave operator. In particular X must commute with the scattering matrix S. The unitary scattering framework and the on-shell transition formula are given by Tiedra de Aldecoa and Bisio, Mosco and Perinotti, equations 6–7.

At fixed K and almost every s in the open set above, L is now the operator integrating the contact spin vector against a packet on the free phase shell with its spectral measure. Up to the positive spectral normalization, LL† is the three-dimensional density matrix of the free spectral measure at the contact. It is positive definite because the three regular, spanning spin neighborhoods give positive measure to every nonzero contact direction. For the spin-independent contact the exact shell scattering matrix S − I is a nonzero scalar multiple of L† T L, with

B(w) = P(w − U₀)⁻¹ U₀ P   on the contact triplet,
T = [c⁻¹ I − B(z+)]⁻¹,   z+ = lim(r↓1) r exp(−is).

This follows by solving the finite-rank Lippmann–Schwinger equation. The matrix C(w) = I + 2B(w) is the compressed unitary Cayley transform. Its Hermitian real part outside the circle is the Poisson integral of the contact spectral measure. The finite radial boundary values exist at almost every angle and Re C(z+) is a positive multiple of LL†. Since Re(c⁻¹) = −1/2 for every real nontrivial g, the Hermitian real part of c⁻¹I − B(z+) is −Re C(z+)/2, which is negative definite here. Thus T is invertible, including when g = π. Other open channels add a positive semidefinite contribution to the density. A bound state outside the tested continuum does not alter this argument.

It follows that ker(S − I) = ker L on that shell. Since X commutes with S, it preserves ker L. The same factorization LX = ML forces Mv = qv at almost every point on each positive-band patch, and hence at its center by continuity. The four-wave contradiction therefore rules out a compact relative correction as well.

Uniform localization also covers bounded corrections that vary with the position of the apparatus. If Π_R cuts off relative separations greater than R and ‖D−Π_R D Π_R‖ tends to zero, average translates of D over increasing cubes of simultaneous spatial translations. A weak-operator cluster point commutes with those translations, preserves the conservation equation for X+D, and obeys the same cutoff bound. Its relative-momentum fibers, with total momentum fixed, are norm limits of finite-rank operators. This reduces the uniform inhomogeneous case to the preceding contradiction.

Scope of the test

The separated-particle charge is prescribed on both incoming and outgoing scattering states. Matching only the incoming asymptote allows the ordinary incoming-wave-operator dressing. Global functions of the interacting tick, conserved particle number and charges assigned to bound states lie outside the asserted obstruction. A one-sided definition of energy, a persistent field that stores charge when the walkers are far apart, or a different contact rule would need its own test. If the tick is written with the contact factor on the left, conjugation by U₀ relates the two orders and preserves all the stated localization classes.

For signed sine there is an additional shortcut. Shifting each one-particle momentum by π along z changes W to −W and reverses the sign of F. Shifting both momenta leaves the pair tick and total momentum unchanged. Subtracting these two pair waves removes their contact amplitude, although charge weighting adds their coincident vectors. Absolute sine is invariant under that shift, which is why the positive-band energy-sharing test above uses four distinct input waves.

A finite material meter for a two-walker collision

Sections in this chapter

A pair can give energy to a small material register during a collision. What the register measures depends on which free-walk observable sets its level spacing and couples to it. This example gives three different register histograms for the same incoming walkers and the same bare contact. Measuring both outgoing spins supplies a second check on what the register did to the pair.

Input and contact

Use a periodic four-site lattice in each direction and the palindromic walk W = X Y Z² Y X, where X = exp(−i kₓ σₓ/2) and Y and Z use their corresponding components. Wave numbers are multiples of π/2. Define F = (W† − W)/(2i) = b·σ. Its components are

b = (sin kₓ cos kᵧ cos k_z, sin kᵧ cos k_z, sin k_z). cos Ω(k) = cos kₓ cos kᵧ cos k_z, 0 ≤ Ω ≤ π.

Prepare two identical bosons in momentum k₀ = (0,0,π/2) with both spins up along z. Their total momentum is K = (0,0,π). At fixed K a normalized symmetric wavefunction can use ordered labels (k,K−k). Summing those ordered probabilities gives one. The spin-independent onsite phase Cφ = I + (exp(iφ)−1)D uses the same-site projector D, which uniformly averages the 64 relative momenta separately for each spin component. The bare outgoing spinor at k is [δ(k,k₀) + (exp(iφ)−1)/64]|↑↑⟩.

Three candidate energy spectra

Choose ε > 0. For the first assignment take Hpair = ε(Q+2I), Q = F₁+F₂. The offset makes the energy nonnegative and leaves transfer gaps unchanged. The second assignment takes the positive magnitude on each walker, Hpair = ε(|F₁|+|F₂|). The third uses positive phase magnitude, Hpair = (2ε/π)(Ω₁+Ω₂). The normalization sets the single input mode's positive phase and sine magnitudes equal. Changing the calibration changes the physical energy unit. W alone does not select a physical Hamiltonian among these assignments.

Bare contact φ = π, initially sharp registerGain 0Gain 2εGain 4ε
Signed sine with positive offset491/51210/51211/512
Positive sine magnitude127/1281/1280
Positive phase magnitude100

For this K, b(K−k) = b(k). Sixteen momenta have b along +z, sixteen along −z, twenty-four in the equatorial plane and eight have b = 0. A pair of z-up spins measured along an equatorial axis has charge +2, 0, −2 with weights 1/4, 1/2, 1/4. The eight zero momenta account for the entire positive-sine transfer. The phase-magnitude pair energy is constant because Ω(K−k) = π−Ω(k). For the signed assignment the register gains mean ε/8 and variance 13ε²/32. Every nonzero-gain probability scales as sin²(φ/2). Bypassing the contact gives a certain zero gain. All outgoing bands are included.

An energy-conserving finite gate

For the signed assignment label the pair sectors j = (Q+2)/2 by 0, 1, 2 and their projectors by Pⱼ. Material energy levels |n⟩ have energies 2εn for n = 0,…,L. In total-energy shell t = j+n define the isometry

J_t ψ = Σⱼ Pⱼ ψ ⊗ |t−j⟩.

Every sector occurs for 2 ≤ t ≤ L. Use J_t Cφ J_t† on each such complete shell and the identity on the incomplete shells. This finite, unitary extension commutes with total energy. Its interaction-picture generator is proportional to the direct sum of J_t D J_t† over complete shells, with the sign and integrated strength chosen for φ. This defines a time-independent interaction during the collision dwell. Its implementation would require a physical coupling to the relevant energy sectors. Spatial locality of the joint register interaction remains open.

The top-energy pair and sharp ground register occupy t=2. Three material rungs spanning 4ε suffice to resolve all three transfers. Every occupied branch obeys j+n=2. A coherent preparation β on the lowest M rungs requires two vacant guard rungs above its support for this gate. Writing S for upward translation of the zero-padded input, the output in the interaction picture is Σⱼ Pⱼ Cφ|in⟩ ⊗ S^(2−j)β. The construction never wraps the finite ladder. It deliberately fixes the incomplete edge shells, which can act differently on other inputs.

A detector that sees the cost of the record

Select outgoing momentum pairs with equatorial b and immediately measure both z spins, or first undo a calibrated free propagation. At φ = π the selection probability is 3/128. In the doubly-down outcome the three sector amplitudes have relative coefficients 1, −2, 1. With c_d = ⟨β|S^d|β⟩ the conditional probability is

P(↓↓ | equatorial) = (3 − 4 Re c₁ + Re c₂)/8 = ‖(I−S)²β‖²/16.

A sharp ground register gives 3/8 conditional, or 9/1024 per incoming pair. The unmetered spin-independent contact gives zero. Making an initial projective energy measurement of a coherent register would erase the phase correlations used in this comparison. Energy-resolved runs and coherence-preserving runs require distinct preparations.

For any packet spanning M consecutive rungs, the path adjacency operator (S+S†)/2 bounds Re c₁ by cos[π/(M+1)]. In the Fourier representation, the inequality ⟨|1−exp(iq)|⁴⟩ ≥ ⟨|1−exp(iq)|²⟩² then gives P ≥ [1−cos(π/(M+1))]²/4. For M ≥ 2 the normalized packet β(j−1) = √[8/(3(M+1))] sin²[πj/(M+1)], j = 1,…,M, gives exactly

P(↓↓ | equatorial) = M sin⁴[π/(M+1)] / [3(M+1)].

Thus the best attainable error for this detector and this class of finite registers scales as M⁻⁴. The displayed packet has initial mean energy (M−1)ε, in addition to the capacity of the two guard rungs. Generic gate errors need their own error metric. Broader results on energy-conserving implementations and finite coherent batteries appear in Chiribella, Yang and Renner, Physical Review X (2021).

What can be measured

Independent spectroscopy must establish the register gap, the walker level differences and which material degrees of freedom take up any mismatch. With that calibration held fixed, the joint outgoing momenta, spin measurements and register populations test the predictions above. Engineering a different meter separately for each assignment demonstrates the corresponding implementation. It leaves the physical energy of an uninstrumented walker undetermined.

Bouton and colleagues used spin-changing collisions between a single Cs atom and an Rb reservoir in a real quantum heat engine. Magnetic fields set the atomic Zeeman splittings and spin-state populations provided an energy record. Different magnetic responses also allow energy to enter motion. Their experiment demonstrates a material collision readout. It did not use this cubic walk or test the histograms or finite-register bounds here. Bouton et al., Nature Communications (2021).

The accompanying meter.py uses Python's standard library. It checks full finite-shell unitarity and conservation on a seeded random state, incomplete-shell behavior, the charge–register correlations, the three gain histograms and coherent spin readout for finite packets.

Can a stationary interaction supply a contact-walk tick?

Sections in this chapter

Equal-length directed links and static spin mixers supply a natural time of flight, L/vL/v. Two distinguishable signals arriving together can then meet in the same gate region. The conditional two-photon phase requires a separate interaction. Its dependence on the relative arrival time changes a measurable interference fringe.

The co-propagating envelope

Take two right-moving channels with the same speed vv, negligible dispersion, and no loss. Set X=(x1+x2)/2X=(x_1+x_2)/2, r=x1−x2r=x_1-x_2. With a compact midpoint profile gg, the two-body envelope Hamiltonian H/ℏ=−iv∂X+g(X)f(r)H/\hbar=-iv\partial_X+g(X)f(r) preserves rr. After both packets have passed, the interaction acts as $Senvψ=e−iθf(r)ψ,θ=v−1∫g(X)dX. S_{\rm env}\psi=e^{-i\theta f(r)}\psi,\qquad \theta=v^{-1}\int g(X)\,dX . For For f=\mathbf1_{|r|\le R}anenvelopeentirelyinsidethewindowreceivesphase an envelope entirely inside the window receives phase -\theta.Shapingthemidpointdependencematters.Auniforminteraction. Shaping the midpoint dependence matters. A uniform interaction g_0when*both*photonsoccupyasegment when *both* photons occupy a segment [0,L]insteadproducesphase instead produces phase -g_0(L-|r|)_+/v$, since the time spent together depends on their separation.

Interfere the contact branch with a matched bypass, and leave the arrival times unresolved. With in-window probability PP, the complex fringe coefficient is M=1−P+Pe−iθM=1-P+Pe^{-i\theta} and the visibility is |M||M|. For independent incoming photons choose spectral amplitudes proportional to e−τ(ω−ωc)e^{-\tau(\omega-\omega_c)} for ω≥ωc>0\omega\ge\omega_c>0 and zero below. Their individual arrival intensities are Cauchy densities with scale τ\tau. The relative arrival time has scale 2τ2\tau. For delay δ\delta and T=R/vT=R/v, $P(δ)={arctan[(T−δ)/(2τ)]+arctan[(T+δ)/(2τ)]}/π. P(\delta)=\{\arctan[(T-\delta)/(2\tau)]+\arctan[(T+\delta)/(2\tau)]\}/\pi . With With T=2\tauand and \theta=\pi,thepointwiseenvelopemodelpredictszerovisibilityatsynchronyand, the pointwise envelope model predicts zero visibility at synchrony and 0.704833at at \delta=4\tau$. This timing curve tests that effective model. A causal material response introduces further optical modes or noise in common traveling-wave implementations. He, Lin and Simon, 2011 · Shapiro, 2006

Positive-frequency obstruction

For photons with k1,k2≥0k_1,k_2\ge0, condition on total wave number K=k1+k2K=k_1+k_2. Relative momentum p=(k1−k2)/2p=(k_1-k_2)/2 lies in [−K/2,K/2][-K/2,K/2]. At almost every KK the relative wavefunction is entire in rr, because it is a Fourier integral over this bounded interval. Suppose both the incoming and outgoing functions have positive photon frequencies and the outgoing function equals the incoming one outside a finite relative interval. Their difference vanishes on an open set and is entire, hence vanishes everywhere. A pointwise phase differing from identity on an interval therefore cannot map any nonzero such state to another positive-frequency state. This argument allows entangled inputs. A physical interaction localized in a device may still produce an outgoing scattering kernel with long relative-time tails.

An energy-preserving completion

Let ΠK\Pi_K project onto the allowed relative momenta, let χR=1|r|≤R\chi_R=\mathbf1_{|r|\le R} and define CK=ΠKχRΠKC_K=\Pi_K\chi_R\Pi_K on that band. Its momentum kernel is sin[R(p−p′)]/[π(p−p′)]\sin[R(p-p')]/[\pi(p-p')]. The unitary SK=exp(−iθCK)S_K=\exp(-i\theta C_K) acts separately at each total energy ℏvK\hbar vK. In the relative coordinate the projection has sinc kernel sin[K(r−r′)/2]/[π(r−r′)]\sin[K(r-r')/2]/[\pi(r-r')]. A nonzero change therefore extends outside the window. An eigenpacket of CKC_K with eigenvalue λ\lambda receives phase −θλ-\theta\lambda. For finite K,RK,R any such eigenvalue lies strictly between zero and one, since a nonzero band-limited packet has norm both inside and outside the window. This construction specifies an effective scattering operator. A microscopic stationary implementation would have to produce its kernel and its channel phases.

There is a quantitative regime where the intended phase is accurate. Since 0≤CK≤10\le C_K\le1, the spectral theorem gives $|(SK−e−iθ)ψ|2≤θ2⟨1−CK⟩=θ2(1−P). \|(S_K-e^{-i\theta})\psi\|^2\le\theta^2\langle1-C_K\rangle =\theta^2(1-P). Foranormalizedtriangularrelative−momentumamplitudeproportionalto For a normalized triangular relative-momentum amplitude proportional to (1-|p|/B)_+,, B\le K/2,thespatialdensityis, the spatial density is (3B/4\pi)\operatorname{sinc}^4(Br/2),with, with \operatorname{sinc}u=\sin u/u.Integratingits. Integrating its r^{-4}upperboundgives upper bound gives 1-P\le8/[\pi(BR)^3].At. At BR=10,\theta=\pithetarget−referencedfringequadrature the target-referenced fringe quadrature \Re[e^{i\theta}\langle S_K\rangle]isatleast is at least 1-4\pi/1000=0.9874336.Thecheckerobtains. The checker obtains 0.99880and and 0.99878withtwofinitemomentummeshes.Theinequalityisindependentofthatquadrature.Anormalizabletotal−energypacketcanusethesamerelativeprofileacrossanypermittedintervalof with two finite momentum meshes. The inequality is independent of that quadrature. A normalizable total-energy packet can use the same relative profile across any permitted interval of K\ge2B$.

A two-color interference test

On a ring of circumference LL, take two positive harmonics ni≥1n_i\ge1 with n1+n2=3n_1+n_2=3. The alternatives |1,2⟩|1,2\rangle and |2,1⟩|2,1\rangle label the frequencies in the two distinguishable channels. For R=L/4R=L/4 the concentration matrix is C=I/2+X/πC=I/2+X/\pi, where XX exchanges the two basis states. Integrating the relative Fourier modes gives this matrix directly. At θ=π\theta=\pi, $S=−icos(1)I−sin(1)X. S=-i\cos(1)I-\sin(1)X . Forinput For input |1,2\rangle,theeffectiveunitarypredictsfrequency−labelexchangeprobability, the effective unitary predicts frequency-label exchange probability 0.708073,matched−bypassvisibility, matched-bypass visibility 0.540302,andabright−portprobability, and a bright-port probability 0.770151atreferencephase at reference phase +\pi/2.Bothoutputcolorsstayintheallowedfixed−energysector.Applyingthepointwisephasefirstandthendiscardingforbiddenmodesgivesthedifferentoperator. Both output colors stay in the allowed fixed-energy sector. Applying the pointwise phase first and then discarding forbidden modes gives the different operator I-2C=-2X/\pi,survival, survival 4/\pi^2=0.405285$ and zero bypass overlap. The ring is a finite-mode comparison with a specified interferometric readout. Its numbers are predictions for these operators, rather than measurements of a photonic material.

Run the standard-library checker with python3 clock.py.

What real two-excitation trajectories measure

Sections in this chapter

On a ring of 24 superconducting qubits, two initially neighboring microwave excitations remained neighbors in 53.66% of the shots that still contained two excitations after 30 cycles. An ideal calculation using the same hopping and zero interaction phase gives 14.27%. The measured rate falls below the 64.03% predicted by the ideal interacting circuit. This comparison tests a concrete consequence of the phase acquired by neighboring excitations. A material energy-transfer record would require a separate measurement.

The measured observable

Morvan and colleagues implemented a one-dimensional periodically stepped circuit. In each cycle two layers of fSim gates cover alternating bonds. On a bond with one excitation, the gate mixes the two possible positions with hopping angle θ. A bond with both sites occupied accumulates a conditional phase φ. For their trajectory measurement θ = π/6 and φ = 2π/3. Each qubit can hold one computational excitation. A pair can occupy neighboring sites, while double occupation of a single site is outside this circuit's computational space. Primary paper, Eqs. 1–2 and Fig. 2.

We used the depths of supplementary Fig. S7 and the zero-cycle preparation control. For each of the 24 starting bonds at each depth, the deposited trajectory file contains counts totaling 10,000 shots. First retain output bitstrings with exactly two set bits. Then count how often those bits are neighbors, including the bond that closes the ring. Divide by the retained count for that starting bond, then average the 24 fractions with equal weight. The reported shot standard error propagates independent conditional binomial counts. The across-start standard deviation describes the spread over the 24 physical starting bonds. Readout bias, decoherence and calibration drift can exceed the shot error. Published checkpoint choices, Figs. S6–S7 · Deposited counts and analysis notebook.

CyclesTwo retained / 240,000 shotsAdjacent among retained, measuredShot SEAcross-start SDIdeal φ = 2π/3Ideal φ = 0
0195,8980.9725860.0003650.0316311.0000001.000000
3185,8840.6245500.0011150.0624690.6356050.156902
30116,1010.5366050.0014620.0291800.6402960.142686
6074,4250.4282770.0018130.0213670.6408460.151924

The two rightmost columns come from applying each 4-by-4 gate to the complete 276-state two-excitation sector. Translation by two sites leaves the ideal circuit invariant, so equal averaging over its two starting-bond parities covers all 24 starts. The sole change between the calculations is φ. The deposited trajectory CSV contains the interacting acquisition. No experimental interaction-off series enters this comparison. A second check is the geometrical probability for a uniformly sampled pair, 24/276 = 2/23. At 60 cycles the experiment remains above both the ideal zero-phase trajectory and the uniform-pair baseline. Only 31.01% of the shots survive the two-excitation filter at that depth. Adjacency alone does not project onto a bound eigenstate. The primary paper also reports phase-sensitive spectroscopy.

What this tells us about a collision meter

The benchmark resolves persistent spatial correlations caused by a conditional phase in an apparatus with two genuine excitations. It does not distinguish the proposed signed sine, positive sine-magnitude and positive quasiphase energy assignments for the cubic walk. That discrimination requires the outgoing pair and an independently calibrated material register, with the register's gain counted in each shot. The ring measured output occupation. Its nearest-neighbor interaction, initial localized pair and one-dimensional circuit also differ from the onsite cubic collision and incoming plane mode in the meter calculation.

A more direct calibration of an atomic contact phase came from Mandel and colleagues. State-dependent transport brought adjacent rubidium wavepackets into spatial overlap. Collective Ramsey fringe visibility fell to about 5% at 210 μs, assigned a phase of π, and recovered to 55% at 450 μs near 2π. Those are material dwell times. They do not measure where energy went during the encounter. Controlled atomic collisions, Figs. 2–3.

For propagating optical pairs, Firstenberg and colleagues measured the phase as a function of the photons' time separation with polarization tomography. At 9 MHz detuning their equal-time nonlinear phase was (−0.32 ± 0.02)π, at roughly 50% linear transmission. That phase and transmission characterize the Rydberg medium. Even a measured optical phase of exactly π would leave the three cubic energy assignments unresolved. Two-photon correlators and conditional phase, Figs. 2–3.

Reproduce the reduction

Run python3 empirical.py offline to recompute the probabilities, errors and ideal circuits from the bundled per-start counts. Run python3 empirical.py --fetch to download the publisher-deposited CSV in memory, or python3 empirical.py --csv PATH with a local copy. Both full-data modes check the file's SHA-256 and rederive every bundled count. The raw aggregate-count CSV has 17,145,777 bytes and 1,010,115 data rows. Its SHA-256 is 14167d9ec4461941e45003fc199482439c6540d80e8da22de93e84e600b8daeb. The download stays optional. Morvan and Andersen, deposited dataset.

A quadrupole that both drives and feels the field

Sections in this chapter

A compact material mode can exchange energy with a linear gravitational field without an externally prescribed motion. In the example below, an incoming plus-polarized standing wave starts a stationary oscillator. Reversing the preparation and displacing the oscillator drives that same field mode. The two cross coefficients agree exactly. A second test compares the stiffness inferred from a static load with the stiffness seen before the field has time to move.

An autonomous source

Use unit fine spacing. Write DiD_i for commuting skew-adjoint spatial differences, and use the scalar and vector constraints C[h]=DiDjhij−D2hiiC[h]=D_iD_jh_{ij}-D^2h_{ii} and Mi[p]=−2DjpijM_i[p]=-2D_jp_{ij}. The finite differences can be the centered staggered differences or the alternating walk's filtered native differences. Define $Sij=δixδjxQ,Aij=Sij−12δijtrS. S_{ij}=\delta_{ix}\delta_{jx}Q,\qquad A_{ij}=S_{ij}-\tfrac12\delta_{ij}\operatorname{tr}S . Forthecenteredradius−onetest, For the centered radius-one test, Q=\epsilon\delta_0.Aninternalcoordinate. An internal coordinate qdescribesasmallredistributionoffixedtotalenergybetweenthecenterandthetwoneighboringsites.Itsrelativedensity,currentandstressare describes a small redistribution of fixed total energy between the center and the two neighboring sites. Its relative density, current and stress are δρ=qDx2Q,jx=−q˙DxQ,τxx=q¨Q. \delta\rho=qD_x^2Q,\qquad j_x=-\dot qD_xQ,\qquad \tau_{xx}=\ddot qQ . Bothsourceconservationlawsfollowbydifferentiation.Onepositivereferencedistributionhasenergy Both source conservation laws follow by differentiation. One positive reference distribution has energy \epsilonatthecenterand at the center and \epsilon/2ateachendpoint.Then at each endpoint. Then |q|<1/2keepsallthreesiteenergiespositive.Thereference′scommonfieldandanyequilibriumbiasaresubtracted.Forthenativestenciluse keeps all three site energies positive. The reference's common field and any equilibrium bias are subtracted. For the native stencil use Q\mapsto L_x^2Qbeforetakingitsderivatives.Thisappliestheknown before taking its derivatives. This applies the known L_0^2,L_0L_x,L_x^2$ filters to the centered density, current and stress respectively. Free walk stress and the finite filters

Let (s,p)(s,p) be the source-free gravitational canonical pair, with bracket normalization w>0w>0, and let (q,P)(q,P) have an ordinary unit bracket. Impose C[s]=M[p]=0C[s]=M[p]=0. The metric and its extrinsic momentum are $h=s+wqA,π=p+w2q˙S. h=s+wqA,\qquad \pi=p+\tfrac w2\dot q S . Thus Thus C[h]=w\delta\rhoand and M[\pi]=wj.Thespatialinnerproduct. The spatial inner product \langle\ ,\ \ranglesumsoversitesandbothtensorindices.With sums over sites and both tensor indices. With h_t=\operatorname{tr}hand and v_i=D_jh_{ij},definethelinearspatialEinsteintensor, define the linear spatial Einstein tensor Eij[h]=12[−D2hij−DiDjht+Divj+Djvi−δijC[h]],V[h]=12⟨h,E[h]⟩. E_{ij}[h]=\tfrac12[-D^2h_{ij}-D_iD_jh_t+D_iv_j+D_jv_i-\delta_{ij}C[h]], \qquad V[h]=\tfrac12\langle h,E[h]\rangle. Thisoperatorisself−adjointanddivergence−free.TakethelocalquadraticHamiltonian This operator is self-adjoint and divergence-free. Take the local quadratic Hamiltonian H=⟨p,p⟩−|trp|2/2+cT2V[h]w+P22m+κq22. \mathcal H=\frac{\langle p,p\rangle-\|\operatorname{tr}p\|^2/2+c_T^2V[h]}{w} +\frac{P^2}{2m}+\frac{\kappa q^2}{2}. Thefieldandoscillatorequationsare The field and oscillator equations are s˙=2p−Itrp,p˙=−cT2E[h],q˙=P/m,P˙=−κq−cT2⟨A,E[h]⟩. \dot s=2p-I\operatorname{tr}p,\quad \dot p=-c_T^2E[h],\qquad \dot q=P/m,\quad \dot P=-\kappa q-c_T^2\langle A,E[h]\rangle . Thephysicalmomentumequationcontains The physical momentum equation contains +w\tau/2because because \piincludes includes \dot qS.Thetwohomogeneousconstraintspropagatesince. The two homogeneous constraints propagate since D_jE_{ij}=0and and \dot C[s]=-D_iM_i[p].Analternativecanonicalchartusesthephysicalmetric. An alternative canonical chart uses the physical metric h,, p,, q,and, and P_c=P-\langle p,A\rangle.Itsmaterialkinetictermis. Its material kinetic term is (P_c+\langle p,A\rangle)^2/(2m)$. Treating all reconstructed variables as independent canonical coordinates would lose this derivative coupling.

In synchronous coordinates the material equation is equivalently $(m+w|Q|2/4)q¨+κq=12⟨S,h¨⟩=−∑xQ(x)R0x0x(x). (m+w\|Q\|^2/4)\ddot q+\kappa q =\tfrac12\langle S,\ddot h\rangle =-\sum_x Q(x)R_{0x0x}(x). $ A changing tidal curvature therefore drives the oscillator. A uniform static metric perturbation has zero drive. Dynamical quadrupoles coupled to a tidal field also appear in continuum effective-action models. Steinhoff, Hinderer, Buonanno and Taracchini, 2016

A reciprocal drive and a closed energy budget

Use a periodic 636^3 cell with m=w=κ=1m=w=\kappa=1, cT=1/2c_T=1/2 and ε=2\epsilon=2. Prepare a standing wave at kz=π/3k_z=\pi/3 with plus amplitude sxx−syy=Hcos(kzz)s_{xx}-s_{yy}=H\cos(k_z z). The numbers below are per unit amplitude and scale to arbitrarily weak fields. The mixed derivative of H\mathcal H with respect to HH and qq is K=cT2dz2Qˆ/4K=c_T^2d_z^2\widehat Q/4. The checker computes it independently in the two orders from the real-space force operator. A cross-polarized wave on zz, or a TT wave on the xx source axis, has zero drive. The cosine coordinate has effective mass 63/(8w)=276^3/(8w)=27.

QuantityCentered stencilFiltered native stencil
Cross coefficient KK1/81/89/81929/8192
Initial q¨\ddot q from unit HH−1/8-1/8−9/8192-9/8192
Initial H¨\ddot H of the source-free coordinate from unit qq−1/216-1/216−1/24576-1/24576
First material energy gain, unit tick1/1281/12881/13421772881/134217728
Total staggered energy, both before and after transfer27/827/881/12881/128

Time stepping uses a simultaneous local force kick followed by a drift. The autonomous continuous Hamiltonian is conserved. For the kick–drift integrator the exactly conserved energy uses half-tick momenta and ⟨hn+1,E[hn]⟩/2\langle h_{n+1},E[h_n]\rangle/2 and qn+1qn/2q_{n+1}q_n/2 in its two potential terms. Pairing successive updates gives the identity by self-adjointness. The checker evolves all six tensor components and the oscillator without a transverse projector. At each of four ticks it verifies both sourced constraints, the physical momentum update, and exact energy balance. The first material gain equals the loss from the field plus interaction. In a finite periodic cell the energy can return.

Static stability and finite-frequency response

After fixing the homogeneous modes and reducing the gauge directions, write γk=cT2|d|2\gamma_k=c_T^2|\mathbf d|^2, xk=dx2/|d|2x_k=d_x^2/|\mathbf d|^2 and Vb=63V_b=6^3. Sums below omit derivative zeros. The scalar constraint lowers the static spring by a positive amount. The TT component of AA has squared norm |Qˆ|2(1−xk)2/2|\widehat Q|^2(1-x_k)^2/2. Completing the square in each TT coordinate gives $κcrit=w4Vb∑kγk|Qˆ|2xk2,μk=wγk4Vb|Qˆ|2(1−xk)2,κstatic=κ−κcrit. \kappa_{\rm crit}=\frac{w}{4V_b}\sum_k\gamma_k|\widehat Q|^2x_k^2,\qquad \mu_k=\frac{w\gamma_k}{4V_b}|\widehat Q|^2(1-x_k)^2,\qquad \kappa_{\rm static}=\kappa-\kappa_{\rm crit}. ThereducedHamiltonianispositiveonthenonzerophysicalmodesif The reduced Hamiltonian is positive on the nonzero physical modes if m>0and and \kappa>\kappa_{\rm crit}.Atequalityazero−frequencymaterialmodeappears.Belowthresholdthequadraticexpansionhasanegativemode.Thespringfeltwith. At equality a zero-frequency material mode appears. Below threshold the quadratic expansion has a negative mode. The spring felt with sinitiallyheldfixedis initially held fixed is \kappa_{\rm sudden}=\kappa_{\rm static}+\sum\mu_k.Foranexternalforceconjugateto. For an external force conjugate to q,eliminatingthefreefieldcoordinatesgivestheinversesusceptibilityat, eliminating the free field coordinates gives the inverse susceptibility at z=\omega^2:: χ−1(z)=κstatic−mz−∑kμkzγk−z. \chi^{-1}(z)=\kappa_{\rm static}-mz-\sum_k\frac{\mu_k z}{\gamma_k-z}. Itsderivativeisstrictlynegativebetweenthefrequencieswithnonzeroweight.Anegativestaticspringthereforegivesanunstablepoleat Its derivative is strictly negative between the frequencies with nonzero weight. A negative static spring therefore gives an unstable pole at z<0$. The same nonnegative weights govern the difference between the slow and sudden spring measurements.

Exact cell resultCenteredNative
κcrit\kappa_{\rm crit}16301/7128016301/7128022111513/2536715059222111513/25367150592
κsudden−κ\kappa_{\rm sudden}-\kappa1/21/2−104339/134217728-104339/134217728
∑μk\sum\mu_k51941/7128051941/712801195721/126835752961195721/12683575296
Distinct field frequencies with nonzero weight123

The exact spectra put every coupled eigenvalue inside the unit-tick stability interval 0<z<40<z<4 for the parameters tested. Setting κ=κcrit/2\kappa=\kappa_{\rm crit}/2 instead produces a negative eigenvalue in both cells. These statements concern the specified finite cell, filters, and unit choices.

The modeled receiver measures the calibrated redistribution coordinate qq; the transmitter is that same material mode prepared with a displacement. Neither its readout noise nor a physical force scale is calibrated here. The field force, constituent profile, spring and localization of the support are inputs. Net material momentum for the balanced motion is zero, and its linear local stress obeys the momentum Ward identity. The conserved combined Hamiltonian includes the quadratic oscillator and field energies. Feeding all of those energies and field momentum back into the gravitational source would require second-order stress, support dynamics and nonlinear gravity. No microscopic realization in the native walk or physical detector measurement is assumed.

Run the standard-library checker with python3 reciprocity.py.

Programs and transcript

The native Tally program records 22 completed assertions. Seven Python checks run offline, including the reconstruction from published counts. The offline study archive includes the manuscripts, programs, transcript and replay instructions.

Complete Tally transcript
✓ three test spinors span the onsite triplet at total phase pi/2  (by cross-pairing plus and minus sides; derived)
✓ energy sharing on one phase shell changes the positive sine pair charge  (by cross-pairing plus and minus sides; derived)
✓ one tick separates the two relative momentum groups in phase  (by cross-pairing plus and minus sides; derived)
✓ two ticks return the same-site packet with the contact phase  (by cross-pairing plus and minus sides; derived)
✓ two- and three-tick averaging leave calculable drift on this packet  (by cross-pairing plus and minus sides; derived)
✓ the bright packet has an exact four-tick revival in the small box  (by cross-pairing plus and minus sides; derived)
✓ the signed-energy material meter resolves all three deposits  (by cross-pairing plus and minus sides; derived)
✓ the three signed-energy deposit channels exhaust the outcomes  (by cross-pairing plus and minus sides; derived)
✓ mean and variance of the signed-energy deposit  (by cross-pairing plus and minus sides; derived)
✓ the positive sine magnitude assignment has just one nonzero deposit channel  (by cross-pairing plus and minus sides; derived)
✓ resolving the energy record creates a double-spin-flip probability  (by cross-pairing plus and minus sides; derived)
✓ source and receiver yield the same mixed stiffness in both stencils  (by cross-pairing plus and minus sides; derived)
✓ the mechanical energy gained at the first kick equals the measured first-step amount  (by cross-pairing plus and minus sides; derived)
✓ centered static and sudden stiffness differ by the positive spectral weight  (by cross-pairing plus and minus sides; derived)
✓ native static and sudden stiffness obey the same susceptibility sum rule  (by cross-pairing plus and minus sides; derived)
✓ the interior ray is real and has the prescribed first walker phase  (by cross-pairing plus and minus sides; derived)
✓ the second walker phase construction also works across the cosine sign change  (by cross-pairing plus and minus sides; derived)
✓ unequal sharing lowers the positive sine pair energy on the same phase shell  (by cross-pairing plus and minus sides; derived)
✓ a half-overlap arrival gate gives a pi fringe null and half squared visibility at a quarter turn  (by cross-pairing plus and minus sides; derived)
✓ alternating Bessel sums bound the autonomous clock's one-tick return probability  (by cross-pairing plus and minus sides; derived)
✓ uniform momentum averages of the three independent squared factors fix the radial variance difference  (by cross-pairing plus and minus sides; derived)
✓ bosonic enhancement gives the squared unit contact-energy exchange rate  (by cross-pairing plus and minus sides; derived)
Native Tally source
# Native rational checks on collision energy, an explicit meter, and the coupled field.
ratchet 16 step
import "atom"
let zero = whole(0 trial)
let one = whole(1 trial)
let two = whole(2 trial)
let four = whole(4 trial)
let half = fraction(1 trial,2 trial)
let quarter = fraction(1 trial,4 trial)

# Native dark-pair shell: cos²(s/2)=1/2 and cos²(K/2)=3/4.
let cs2 = half
let ck2 = fraction(3 trial,4 trial)
let beta_sq = share(one+flip(ck2),ck2)*share(cs2,one+flip(cs2))
check beta_sq==fraction(1 trial,3 trial) and one+flip(beta_sq)==fraction(2 trial,3 trial) "three test spinors span the onsite triplet at total phase pi/2"
let axial_sq = four*(one+flip(cs2))*ck2
let shared_sq = four*(one+flip(cs2))
check axial_sq==fraction(3 trial,2 trial) and shared_sq==two "energy sharing on one phase shell changes the positive sine pair charge"

# Two-group native 4^3 torus: (a,b) are relative amplitudes on the half-grids.
fn a_after(a,b,g)
  return flip(a)+half*(g+flip(one))*(b+flip(a))
end
fn b_after(a,b,g)
  return b+half*(g+flip(one))*(b+flip(a))
end
let g = flip(one)
let a1 = a_after(one,one,g)
let b1 = b_after(one,one,g)
let a2 = a_after(a1,b1,g)
let b2 = b_after(a1,b1,g)
check a1==flip(one) and b1==one "one tick separates the two relative momentum groups in phase"
check a2==g and b2==g "two ticks return the same-site packet with the contact phase"
let gap = g+flip(one)
check share(two*gap*gap,four)==two and share(two*gap*gap,whole(9 trial))==fraction(8 trial,9 trial) "two- and three-tick averaging leave calculable drift on this packet"
let b4 = b_after(a_after(a2,b2,g),b_after(a2,b2,g),g)
check b4==one "the bright packet has an exact four-tick revival in the small box"

# Actual finite material register after a pi contact, one incoming axial momentum.
let p = fraction(1 trial,1024 trial)
let forward = power(fraction(31 trial,32 trial),2 trial)
let equatorial = whole(24 trial)*p
let p0 = forward+whole(15 trial)*p+quarter*equatorial
let p2 = whole(8 trial)*p+half*equatorial
let p4 = whole(16 trial)*p+quarter*equatorial
check p0==fraction(491 trial,512 trial) and p2==fraction(10 trial,512 trial) and p4==fraction(11 trial,512 trial) "the signed-energy material meter resolves all three deposits"
check p0+p2+p4==one "the three signed-energy deposit channels exhaust the outcomes"
let mean = two*p2+four*p4
check mean==fraction(1 trial,8 trial) and four*p2+four*four*p4+flip(mean*mean)==fraction(13 trial,32 trial) "mean and variance of the signed-energy deposit"
check whole(8 trial)*p==fraction(1 trial,128 trial) "the positive sine magnitude assignment has just one nonzero deposit channel"
check equatorial*fraction(3 trial,8 trial)==fraction(9 trial,1024 trial) "resolving the energy record creates a double-spin-flip probability"

# Reciprocity: the matter mass is one; the calibrated standing mode has mass 27.
let mode_mass = whole(27 trial)
let centered = fraction(1 trial,8 trial)
let native = fraction(9 trial,8192 trial)
check share(centered,mode_mass)==fraction(1 trial,216 trial) and share(native,mode_mass)==fraction(1 trial,24576 trial) "source and receiver yield the same mixed stiffness in both stencils"
check half*centered*centered==fraction(1 trial,128 trial) and half*native*native==fraction(81 trial,134217728 trial) "the mechanical energy gained at the first kick equals the measured first-step amount"
check half+fraction(16301 trial,71280 trial)==fraction(51941 trial,71280 trial) "centered static and sudden stiffness differ by the positive spectral weight"
check flip(fraction(104339 trial,134217728 trial))+fraction(22111513 trial,25367150592 trial)==fraction(1195721 trial,12683575296 trial) "native static and sudden stiffness obey the same susceptibility sum rule"
# Rational interior point on a fixed total-phase path, including the negative cosine branch.
let cm = fraction(3 trial,5 trial)
let sm = fraction(4 trial,5 trial)
let cd = fraction(12 trial,13 trial)
let sd = fraction(5 trial,13 trial)
let ct = fraction(99 trial,101 trial)
let st = fraction(20 trial,101 trial)
let u = share(cm*ct,cd)
let v = share(sm*st,sd)
let cy_sq = u*u+v*v
check cy_sq<=one and cy_sq>zero and cd*u+flip(sd*v)==cm*ct+flip(sm*st) "the interior ray is real and has the prescribed first walker phase"
check cd*flip(u)+sd*v==flip(cm)*ct+sm*st "the second walker phase construction also works across the cosine sign change"
check sm*ct+sm*ct<sm+sm "unequal sharing lowers the positive sine pair energy on the same phase shell"
fn mode_overlap_sq(window,cosine)
  let outside=one+flip(window)
  return outside*outside+window*window+two*outside*window*cosine
end
check mode_overlap_sq(half,flip(one))==zero and mode_overlap_sq(half,zero)==half "a half-overlap arrival gate gives a pi fringe null and half squared visibility at a quarter turn"
# Autonomous comparison: evaluate the one-tick, no-displacement Bessel amplitude.
fn bessel_center(terms)
  let term=one
  let total=term
  repeat j from 1 trial to terms
    let term=flip(share(term,four*whole(j)*whole(j)))
    let total=total+term
  end
  return total
end
let lower=bessel_center(7 trial)
let upper=bessel_center(8 trial)
check lower*lower>fraction(58552749 trial,100000000 trial) and upper*upper<fraction(58552751 trial,100000000 trial) "alternating Bessel sums bound the autonomous clock's one-tick return probability"
check half*half*half==fraction(1 trial,8 trial) "uniform momentum averages of the three independent squared factors fix the radial variance difference"
check two*quarter==half "bosonic enhancement gives the squared unit contact-energy exchange rate"

Python checks and replay

alternative.py
"""Checks for an autonomous local Hamiltonian with a conserved contact energy."""
from fractions import Fraction as F
from itertools import product
from math import acos,cos,sin,sqrt,isclose,factorial


def bessel_bounds(n,terms=14):
    # Alternating series for J_n(1) with decreasing positive term magnitudes.
    def term(j):
        return F((-1)**j,2**(2*j+n)*factorial(j)*factorial(n+j))
    value=sum(term(j) for j in range(terms))
    return sorted((value,value+term(terms)))


def interaction_current():
    # Normalized ordered-particle components of (|2 at 0> + |1 at 0,1 at z>)/sqrt(2).
    origin,above=(0,0,0),(0,0,1)
    psi={(origin,0,origin,0):1/sqrt(2),
         (origin,0,above,0):.5,(above,0,origin,0):.5}
    blocks = [(d,0,1j*d[0]/8) for d in product((-1,1), repeat=3)]
    blocks += [((0,y,z),1,1j*y/4) for y,z in product((-1,1),repeat=2)]
    blocks += [((0,0,z),2,1j*z/2) for z in (-1,1)]
    kinetic={}
    for (p,s,q,t),weight in psi.items():
        for axis_particle in (0,1):
            pos,spin=(p,s) if axis_particle==0 else (q,t)
            for d,axis,coeff in blocks:
                dest=tuple(x+dx for x,dx in zip(pos,d))
                out=spin if axis==2 else 1-spin
                spin_phase=(1,1j*(1-2*spin),1-2*spin)[axis]
                key=(dest,out,q,t) if axis_particle==0 else (p,s,dest,out)
                kinetic[key]=kinetic.get(key,0j)+weight*coeff*spin_phase
    potential={k:v for k,v in psi.items() if k[0]==k[2]}
    keys=kinetic.keys()|potential.keys()
    derivative={k:-1j*(kinetic.get(k,0)+potential.get(k,0)) for k in keys}
    def rate(applied):
        return 2*sum(v.conjugate()*derivative[k] for k,v in applied.items()).real
    assert isclose(rate(potential),-1/sqrt(2),abs_tol=1e-14)
    assert isclose(rate(kinetic),1/sqrt(2),abs_tol=1e-14)
    return rate(potential),rate(kinetic)


def main():
    # Keep one site-localized source along x, uniformly polarized in +x;
    # uniform transverse preparation sets k_y=k_z=0.
    for n in (0,1,2):
        a,b=bessel_bounds(n)
        assert 0<a<=b and b*b-a*a<F(1,10**24)
        print(f"axial output |x|={n}: per-site probability {float(a*a):.12f}")
    a,b=bessel_bounds(0)
    assert F(58552749,10**8)<a*a<b*b<F(58552751,10**8)

    # Trapezoidal sampling integrates these degree-two products exactly;
    # rational table contains sin² and cos² at k=j*pi/2.
    s=(0,1,0,1)
    mean=F(sum(s[i]*(1-s[j])*(1-s[k]) for i,j,k in product(range(4),repeat=3)),64)
    assert mean==F(1,8)
    for k in ((.21,.34,.55),(1.2,-.3,1.94),(2.3,.61,-.77)):
        def omega(q):return acos(cos(q[0])*cos(q[1])*cos(q[2]))
        om=omega(k);delta=1e-6
        for axis in range(3):
            plus=list(k);minus=list(k)
            plus[axis]+=delta;minus[axis]-=delta
            vwalk=(omega(plus)-omega(minus))/(2*delta)
            vh=(sin(omega(plus))-sin(omega(minus)))/(2*delta)
            assert isclose(vh,cos(om)*vwalk,abs_tol=1e-9)
    rates=interaction_current()
    print('Cartesian ballistic variance decrement = 1/8; initial contact and hopping rates:',rates)


if __name__=="__main__":
    main()
clock.py
"""Timing visibility and a positive-frequency two-channel contact model.

Python 3 standard library. The continuum error bound and the finite-ring
expressions are analytic. The continuum matrix quadratures are convergence
checks, not a rigorous spectral discretization error estimate.
"""

from cmath import exp
from math import atan, cos, pi, sin, sqrt


def simpson(function, a, b, intervals=4096):
    assert intervals % 2 == 0
    h = (b-a)/intervals
    odd = sum(function(a + j*h) for j in range(1, intervals, 2))
    even = sum(function(a + j*h) for j in range(2, intervals, 2))
    return h*(function(a) + 4*odd + 2*even + function(b))/3


def cauchy_delay(delay, window, tau):
    width = 2*tau
    probability = (atan((window-delay)/width) + atan((window+delay)/width))/pi
    density = lambda t: width/(pi*((t-delay)**2 + width**2))
    assert abs(simpson(density, -window, window) - probability) < 1e-13
    return probability


def apply_phase(apply_concentration, vector, theta):
    """Apply the exponential by its power series; the operators have norm <= 1."""
    value = list(vector)
    term = list(vector)
    for n in range(1, 50):
        term = [(-1j*theta/n)*v for v in apply_concentration(term)]
        value = [a + b for a, b in zip(value, term)]
    return value


def ring():
    # L=1 and R=L/4; p-p' is zero or +/-2*pi and both photon energies are positive.
    r = 0.25
    diagonal = simpson(lambda x: 1.0, -r, r)
    offdiag = simpson(lambda x: cos(2*pi*x), -r, r)
    assert abs(diagonal - 0.5) < 1e-14 and abs(offdiag - 1/pi) < 1e-13

    def c(v):
        return [diagonal*v[0]+offdiag*v[1], offdiag*v[0]+diagonal*v[1]]
    state = [1.0, 0.0]
    out = apply_phase(c, state, pi)
    assert abs(out[0] + 1j*cos(1)) < 1e-12
    assert abs(out[1] + sin(1)) < 1e-12
    assert abs(sum(abs(v)**2 for v in out) - 1) < 1e-12
    exchanged = abs(out[1])**2
    bright = (1 + (1j*out[0]).real)/2
    # Compressing the discontinuous pointwise phase *after* applying it differs
    # from exponentiating C. The discarded norm is a projection loss.
    compressed_mask = [a - 2*b for a, b in zip(state, c(state))]
    survival = sum(abs(v)**2 for v in compressed_mask)
    assert abs(compressed_mask[0]) < 1e-13 and abs(survival-4/pi**2) < 1e-13
    for phase in (0, pi/3, pi/2, pi):
        incident = [1/sqrt(2), exp(1j*phase)/sqrt(2)]
        result = apply_phase(c, incident, pi)
        overlap = sum(a.conjugate()*b for a, b in zip(incident, result))
        assert abs(overlap - (-1j*cos(1) - cos(phase)*sin(1))) < 1e-12
    return abs(out[0]), exchanged, bright, survival


def continuum(BR, nodes):
    # At B=1 use a midpoint quadrature of the sinc kernel on relative
    # momentum [-1,1]. Its diagonal is the removable limit R/pi.
    step = 2/nodes
    p = [-1 + (j+0.5)*step for j in range(nodes)]
    initial = [1-abs(x) for x in p]
    norm = sqrt(sum(x*x for x in initial))
    initial = [x/norm for x in initial]
    kernel = [BR*step/pi]
    kernel.extend(sin(BR*j*step)/(pi*j) for j in range(1, nodes))
    def c(vector):
        return [sum(kernel[abs(i-j)]*a for j, a in enumerate(vector))
                for i in range(nodes)]
    result = apply_phase(c, initial, pi)
    overlap = sum(a*b for a, b in zip(initial, result))
    return -overlap.real


if __name__ == "__main__":
    P = cauchy_delay(0, 2, 1)
    assert abs(P - 0.5) < 1e-14
    P_delayed = cauchy_delay(4, 2, 1)
    assert P_delayed < P
    print(f"pointwise pi phase: synchronized visibility {abs(1-2*P):.9f}, "
          f"delay 4*tau visibility {abs(1-2*P_delayed):.9f}")
    visibility, exchange, bright, survival = ring()
    print(f"positive two-mode ring: visibility {visibility:.9f}, "
          f"exchange {exchange:.9f}, phase-scanned bright port {bright:.9f}; "
          f"compressed-mask survival {survival:.9f}")

    BR = 10
    def sinc4(x):
        return (sin(x)/x)**4 if x else 1.0
    probability = (3/pi)*simpson(sinc4, 0, BR/2)
    assert 0 < 1-probability < 8/(pi*BR**3)
    certified = 1 - 4*pi/BR**3
    q1 = continuum(BR, 80)
    q2 = continuum(BR, 160)
    assert q2 >= certified and abs(q2-q1) < 0.00005
    print(f"triangle BR=10: in-window probability {probability:.9f}, "
          f"certified target quadrature >= {certified:.9f}, "
          f"midpoint estimates {q1:.9f}, {q2:.9f}")
dressing.py
"""Four positive-band Bose waves testing a local dressing of the sine charge.

Run python3 dressing.py. The checks use the six one-link Pauli matrices, and
construct the actual linear combination whose contact amplitude cancels.
The mathematical obstruction and its operator hypotheses are in dressing.md.
"""
from cmath import exp
from fractions import Fraction
from math import acos, atan, cos, isclose, pi, sin, sqrt, tan


PAULI = (((0, 1), (1, 0)), ((0, -1j), (1j, 0)), ((1, 0), (0, -1)))
IDENTITY = ((1, 0), (0, 1))


def multiply(a, b):
    return tuple(tuple(sum(row[k] * b[k][j] for k in range(2))
                       for j in range(2)) for row in a)


def walk(p):
    u = IDENTITY
    for axis in (0, 1, 2, 2, 1, 0):
        c, s = cos(p[axis] / 2), -1j * sin(p[axis] / 2)
        step = tuple(tuple(c * IDENTITY[i][j] + s * PAULI[axis][i][j]
                           for j in range(2)) for i in range(2))
        u = multiply(step, u)
    return u


def norm(v):
    return sqrt(sum(abs(x)**2 for x in v))


def positive_spin(p):
    u = walk(p)
    omega = acos(((u[0][0] + u[1][1]) / 2).real)
    plus, minus = exp(-1j * omega), exp(1j * omega)
    candidates = [tuple(u[i][j] - minus * IDENTITY[i][j] for i in range(2))
                  for j in range(2)]
    v = max(candidates, key=norm)
    scale = norm(v)
    v = tuple(a / scale for a in v)
    assert max(abs(sum(u[i][j] * v[j] for j in range(2)) - plus * v[i])
               for i in range(2)) < 2e-14
    return omega, v


def contact(pair):
    (o1, v), (o2, w) = map(positive_spin, pair)
    # Symmetric-spin coordinates at coincidence, in the standard z basis;
    # all spatial wave normalizations are taken equal.
    c = (sqrt(2) * v[0] * w[0], v[0] * w[1] + v[1] * w[0],
         sqrt(2) * v[1] * w[1])
    return o1 + o2, sin(o1) + sin(o2), c


def pair_at(k, s, h, transverse):
    # k is the total axial momentum, s the pair phase, h the phase difference.
    if h == k:
        return ((k + s) / 2, 0, 0), ((k - s) / 2, 0, 0)
    x = atan(tan(s / 2) * tan(h / 2) / tan(k / 2))
    y = acos(cos(s / 2) * cos(h / 2) / (cos(k / 2) * cos(x)))
    a, b = [k / 2 + x, 0, 0], [k / 2 - x, 0, 0]
    a[transverse], b[transverse] = y, -y
    return tuple(a), tuple(b)


def det(columns):
    a, b, c = columns
    return (a[0] * (b[1] * c[2] - b[2] * c[1])
            - b[0] * (a[1] * c[2] - a[2] * c[1])
            + c[0] * (a[1] * b[2] - a[2] * b[1]))


def site_witness(k, s, report=False):
    waves = [pair_at(k, s, h, axis) for h, axis in ((k, 1), (0, 1), (0, 2), (k / 2, 1))]
    evaluated = [contact(pair) for pair in waves]
    assert all(abs(phase - s) < 2e-14 for phase, _, _ in evaluated)
    charges = [q for _, q, _ in evaluated]
    c = [v for _, _, v in evaluated]
    determinant = det(c[:3])
    assert abs(determinant) > 0.1
    # Express the fourth contact vector in the basis made by the first three.
    coeff = []
    for j in range(3):
        cols = c[:3]
        cols[j] = c[3]
        coeff.append(-det(cols) / determinant)
    coeff.append(1)
    initial = [sum(a * v[i] for a, v in zip(coeff, c)) for i in range(3)]
    weighted = [sum(a * q * v[i] for a, q, v in zip(coeff, charges, c)) for i in range(3)]
    assert norm(initial) < 2e-14
    assert norm(weighted) > 0.001
    assert charges[0] < charges[3] < charges[1]
    assert isclose(charges[1], charges[2], abs_tol=2e-14)
    # The entire interpolation has the prescribed phase and positive band:
    # q = 2 sin(s/2) cos(h/2).
    for j in range(13):
        h = k * j / 12
        if j == 12:
            h = k
        phase, q, _ = contact(pair_at(k, s, h, 1))
        assert abs(phase - s) < 2e-14
        assert abs(q - 2 * sin(s / 2) * cos(h / 2)) < 2e-14
    if report:
        print(f"contact basis determinant magnitude {abs(determinant):.12f}")
        print("sine charges (axial, transverse y, transverse z, intermediate)")
        print(" ", tuple(round(q, 12) for q in charges))
        print(f"contact-cancelled input norm {norm(initial):.3g}; "
              f"after charge weighting {norm(weighted):.12f}")


def main():
    # The squared reference charges are 3/2 and 2. At h=k/2 the squared
    # charge is (2+sqrt(3))/2, strictly between them since 1<sqrt(3)<2.
    exact_values = (sqrt(6) / 2, sqrt(2), (1 + sqrt(3)) / 2)
    for h, expected in zip((pi / 3, 0, pi / 6), exact_values):
        _, measured, _ = contact(pair_at(pi / 3, pi / 2, h, 1))
        assert isclose(measured, expected, rel_tol=0, abs_tol=2e-14)
    # det squared of the three spin vectors at K=pi/3, s=pi/2 equals
    # (1-beta^2)^2 for the above unnormalized local spin convention.
    _, _, ax = contact(pair_at(pi / 3, pi / 2, pi / 3, 1))
    _, _, ay = contact(pair_at(pi / 3, pi / 2, 0, 1))
    _, _, az = contact(pair_at(pi / 3, pi / 2, 0, 2))
    assert isclose(abs(det([ax, ay, az]))**2, float((1 - Fraction(1, 3))**2),
                   abs_tol=2e-14)
    site_witness(pi / 3, pi / 2, report=True)
    for k, s in ((0.90, 1.48), (1.13, 1.64)):
        site_witness(k, s)
    print("Sine and absolute sine agree on all four positive-band input waves.")
    # Signed sine also has an exact opposite-charge alias on the full walk.
    p = (0.22, -0.75, 0.53)
    u, alias = walk(p), walk((p[0], p[1], p[2] + pi))
    assert max(abs(u[i][j] + alias[i][j]) for i in range(2) for j in range(2)) < 2e-14
    print("The third-axis pi shift negates the one-particle tick, as required.")


if __name__ == "__main__":
    main()
empirical.py
"""Reanalyse the deposited counts for Morvan et al., Nature 612, 240 (2022).

Python 3.10+ and standard library only. Default (offline): replay the reduced
integer counts embedded below. --csv PATH or --fetch: rederive and verify all
those counts against the SHA-256-pinned 17 MB public, aggregate-count CSV.
"""
import argparse
import cmath
import csv
import hashlib
import io
import math
import statistics
import urllib.request
from collections import defaultdict
from itertools import combinations
from pathlib import Path

SITES = 24
DEPTHS = (0, 3, 30, 60)  # preparation plus the authors' Figure S7 checkpoints
FILE = "bound_state_trajectories_nphotons_2.csv"
URL = "https://zenodo.org/records/6981407/files/" + FILE
SHA256 = "14167d9ec4461941e45003fc199482439c6540d80e8da22de93e84e600b8daeb"
# One line per starting bitstring. At each depth the packed columns are
# total shots / shots with exactly two excitations / adjacent two-excitation shots.
REDUCED = """
3 10000/8250/8184 10000/7757/4483 10000/4588/2418 10000/3025/1319
6 10000/8181/8112 10000/7689/5182 10000/4668/2293 10000/3021/1223
12 10000/8067/7489 10000/7922/4473 10000/4876/2470 10000/3172/1358
24 10000/7989/7389 10000/7961/5445 10000/4539/2296 10000/3059/1241
48 10000/8229/8151 10000/7878/4748 10000/4601/2438 10000/3151/1307
96 10000/8182/8106 10000/7864/5609 10000/4633/2280 10000/3094/1283
192 10000/8165/8074 10000/7793/4724 10000/4694/2461 10000/3012/1299
384 10000/7961/7828 10000/7540/5003 10000/4746/2454 10000/2992/1207
768 10000/7598/6798 10000/7310/3689 10000/4704/2448 10000/2863/1141
1536 10000/7842/7072 10000/7532/4939 10000/4811/2499 10000/3076/1309
3072 10000/8272/8172 10000/7781/4200 10000/4913/2657 10000/3130/1280
6144 10000/8161/8079 10000/7912/5487 10000/5085/2723 10000/3236/1450
12288 10000/8209/8099 10000/7847/4407 10000/5013/2833 10000/2969/1330
24576 10000/8316/8241 10000/7984/5448 10000/4913/2634 10000/3167/1345
49152 10000/8244/8172 10000/7913/4714 10000/5054/2990 10000/3155/1446
98304 10000/8247/8170 10000/7825/5398 10000/5102/2847 10000/3202/1359
196608 10000/8229/8136 10000/7603/4376 10000/5140/2911 10000/3251/1441
393216 10000/8217/8136 10000/7330/5080 10000/4752/2495 10000/3078/1408
786432 10000/8248/7709 10000/7606/4110 10000/5017/2903 10000/3218/1453
1572864 10000/8326/8258 10000/7552/5146 10000/4825/2761 10000/3095/1322
3145728 10000/8183/7713 10000/7663/4518 10000/4970/2912 10000/3193/1488
6291456 10000/8257/8175 10000/7889/5343 10000/4800/2696 10000/3139/1433
8388609 10000/8336/8261 10000/7807/5213 10000/4846/2490 10000/3048/1237
12582912 10000/8189/8099 10000/7926/4398 10000/4811/2472 10000/3079/1218
"""


def adjacent(bits):
    """Call only for two-excitation 24-bit strings. Include the last/first bond."""
    return bool((bits & (bits >> 1)) or (bits & 1 and bits & (1 << (SITES-1))))


def compact_counts():
    summary = {}
    for line in REDUCED.strip().splitlines():
        start, *cells = line.split()
        assert len(cells) == len(DEPTHS)
        for depth, cell in zip(DEPTHS, cells):
            summary[int(start), depth] = tuple(map(int, cell.split("/")))
    return summary


def raw_counts(payload):
    if hashlib.sha256(payload).hexdigest() != SHA256:
        raise ValueError("CSV SHA-256 differs from the published analysis input")
    summary = defaultdict(lambda: [0, 0, 0])
    rows = csv.DictReader(io.StringIO(payload.decode("ascii")))
    assert rows.fieldnames == ["input", "depth", "output", "count"]
    for row in rows:
        start, depth, output, count = (int(row[key]) for key in rows.fieldnames)
        if depth not in DEPTHS:
            continue
        assert start.bit_count() == 2 and adjacent(start)
        bins = summary[start, depth]
        bins[0] += count
        if output.bit_count() == 2:
            bins[1] += count
            if adjacent(output):
                bins[2] += count
    return {key: tuple(value) for key, value in summary.items()}


def model(phi, start):
    """Direct two-excitation fSim on the occupation basis; no fitted parameters."""
    theta = math.pi/6
    stay = math.cos(theta)
    hop = 1j*math.sin(theta)
    pair_phase = cmath.exp(1j*phi)
    masks = [(1 << a) | (1 << b) for a,b in combinations(range(SITES), 2)]
    index = {bits:i for i,bits in enumerate(masks)}
    state = [0j]*len(masks)
    state[index[start]] = 1
    # Gate updates act on disjoint 2x2 subspaces and single |11> components.
    layers = []
    for parity in (0,1):
        gates = []
        for a in range(parity,SITES,2):
            b = (a+1) % SITES
            left, right = 1 << a, 1 << b
            pair = left | right
            swap_pairs = [(i, index[bits ^ pair]) for i,bits in enumerate(masks)
                          if bits & pair == left]
            gates.append((index[pair], swap_pairs))
        layers.append(gates)
    result = {}
    for depth in range(max(DEPTHS)+1):
        if depth in DEPTHS:
            assert abs(sum(abs(v)**2 for v in state)-1) < 1e-12
            result[depth] = sum(abs(v)**2 for bits,v in zip(masks,state) if adjacent(bits))
        if depth == max(DEPTHS):
            break
        for gates in layers:
            for both, swap_pairs in gates:
                state[both] *= pair_phase
                for i,j in swap_pairs:
                    x,y = state[i],state[j]
                    state[i],state[j] = stay*x+hop*y, hop*x+stay*y
    return result


def summarize(rows):
    observed = [a/t for _,t,a in rows]
    n = len(rows)
    shot_se = math.sqrt(sum(p*(1-p)/t for p,(_,t,_) in zip(observed,rows)))/n
    spread = statistics.stdev(observed)
    total,two,adj = map(sum,zip(*rows))
    return statistics.mean(observed), shot_se, spread, (total,two,adj)


def run():
    parser = argparse.ArgumentParser(description=__doc__)
    source = parser.add_mutually_exclusive_group()
    source.add_argument("--csv", type=Path, help="verify the original local Zenodo CSV")
    source.add_argument("--fetch", action="store_true", help="download and verify the original CSV in memory")
    args = parser.parse_args()
    measured = compact_counts()
    if args.csv or args.fetch:
        if args.csv:
            data = args.csv.read_bytes()
        else:
            req = urllib.request.Request(URL+"?download=1", headers={"User-Agent":"collision-study/1.0"})
            with urllib.request.urlopen(req,timeout=120) as response:
                data = response.read()
        if raw_counts(data) != measured:
            raise ValueError("Counts differ from embedded reduction")
        print(f"Verified {len(data)} original bytes, SHA-256 {SHA256}.")
    expected_starts = {(1 << i) | (1 << ((i+1) % SITES)) for i in range(SITES)}
    assert all({i for i,t in measured if t == d} == expected_starts for d in DEPTHS)
    model_results = {name:[model(phi,start) for start in (3,6)]
                     for name,phi in (("on",2*math.pi/3),("off",0.0))}
    print("depth total retained adjacent retained/all P(adj|two) shot_SE across_start_SD ideal_on ideal_off")
    for d in DEPTHS:
        values = [value for (start,t),value in measured.items() if t == d]
        p,se,sd,(n,k,a) = summarize(values)
        ranges = []
        for outcomes in model_results.values():
            parities = [row[d] for row in outcomes]
            ranges.append(f"{statistics.mean(parities):.6f}")
        print(f"{d:2d} {n} {k} {a} {k/n:.6f} {p:.6f} {se:.6f} {sd:.6f} " + " ".join(ranges))
    print(f"Uniform fixed-number adjacency probability: {SITES/math.comb(SITES,2):.6f}")


if __name__ == "__main__":
    run()
meter.py
"""Two-boson contact with a quantized material energy register on a 4^3 torus.

Run with Python 3 and its standard library. Energies in the firing histogram
are in units of epsilon. A battery rung in this total-momentum sector is 2 epsilon.
The outgoing momentum/spin labels are ordered slots for a symmetric input.
"""
from cmath import exp
from fractions import Fraction
from itertools import product
from math import cos, pi, sin, sqrt
from random import Random

MOMENTA = list(product(range(4), repeat=3))  # quarter-turn units
INPUT = (0, 0, 1)
DIM = len(MOMENTA)*4
S, C = (0, 1, 0, -1), (1, 0, -1, 0)


def axis(k):
    x, y, z = k
    return (S[x]*C[y]*C[z], S[y]*C[z], S[z])


AXES = [axis(k) for k in MOMENTA]


def sigma(spin, components, bit):
    """Apply the signed Pauli operator on tensor index 'bit' (2 or 1)."""
    x, y, z = components
    return [(z*spin[i] + (x-1j*y)*spin[i^bit]) if i & bit == 0
            else (-z*spin[i] + (x+1j*y)*spin[i^bit]) for i in range(4)]


def split(field):
    """Orthogonal sectors j=0,1,2 represent pair sine charge -2,0,+2."""
    sectors = [[0j]*DIM for _ in range(3)]
    for k, direction in enumerate(AXES):
        start = 4*k
        u = field[start:start+4]
        if not any(direction):
            sectors[1][start:start+4] = u
            continue
        a, b = sigma(u, direction, 2), sigma(u, direction, 1)
        ab = sigma(a, direction, 1)
        for i in range(4):
            sectors[0][start+i] = (u[i]-a[i]-b[i]+ab[i])/4
            sectors[1][start+i] = (u[i]-ab[i])/2
            sectors[2][start+i] = (u[i]+a[i]+b[i]+ab[i])/4
    return sectors


def contact(field, phase):
    # At fixed total momentum the same-site projector uniformly averages the
    # relative momentum, separately for every pair of spin indices.
    means = [sum(field[i::4])/64 for i in range(4)]
    return [v + (phase-1)*means[i%4] for i,v in enumerate(field)]


def material_gate(state, phase=-1):
    """Conjugate the contact into complete energy shells; identity at edges."""
    top = len(state)-1
    shells = [[0j]*DIM for _ in range(top+3)]
    for n, field in enumerate(state):
        for j, piece in enumerate(split(field)):
            shells[n+j] = [a+b for a,b in zip(shells[n+j],piece)]
    out = [[0j]*DIM for _ in state]
    for total, shell in enumerate(shells):
        if 2 <= total <= top:
            shell = contact(shell, phase)
        for j, piece in enumerate(split(shell)):
            n = total-j
            if 0 <= n <= top:
                out[n] = [a+b for a,b in zip(out[n],piece)]
    return out


def hamiltonian(state):
    result = []
    for n, field in enumerate(state):
        parts = split(field)
        result.append([sum(2*(n+j)*x for j,x in enumerate(v)) for v in zip(*parts)])
    return result


def distance(a,b):
    return max(abs(v-w) for row,col in zip(a,b) for v,w in zip(row,col))


def mass(field):
    return sum(v.real*v.real + v.imag*v.imag for v in field)


def input_field(k=INPUT):
    state = [0j]*DIM
    state[4*MOMENTA.index(k)] = 1
    return state


def dressed_input(packet):
    # Two vacant rungs above the support permit every downward-energy branch.
    field = input_field()
    return [[a*v for v in field] for a in list(packet)+[0,0]]


def spin_detector(state):
    # Equatorial momenta have an x or y Pauli axis. Sum probabilities over
    # both momentum orderings and all material outcomes before conditioning.
    all_eq = down = 0.0
    for field in state:
        for i,(x,y,_) in enumerate(AXES):
            if x or y:
                all_eq += mass(field[4*i:4*i+4])
                down += abs(field[4*i+3])**2
    return all_eq, down


def overlap(packet, offset):
    return sum(a.conjugate()*b for a,b in zip(packet[offset:],packet))


def exact_meter():
    for k, direction in zip(MOMENTA, AXES):
        x,y,z = k
        partner = (-x%4, -y%4, (2-z)%4)
        assert axis(partner) == direction
        assert C[x]*C[y]*C[z] == -C[partner[0]]*C[partner[1]]*C[partner[2]]
    assert sorted(sum(v[i] != 0 for v in AXES) for i in range(3)) == [8,16,32]
    field = input_field()
    for phase in (1, 1j, -1):
        output = material_gate(dressed_input([1]), phase)
        probabilities = [Fraction(mass(row)) for row in output]
        scale = (1-Fraction(phase.real))/2
        expected = [1-scale*Fraction(21,512), scale*Fraction(10,512),
                    scale*Fraction(11,512)]
        assert probabilities == expected
        # The final pair-energy and material-energy records sum to 4 epsilon
        # on every occupied branch separately.
        for n, row in enumerate(output):
            for j, sector in enumerate(split(row)):
                if n+j != 2:
                    assert mass(sector) == 0
        if phase == -1:
            mean = sum(2*n*p for n,p in enumerate(probabilities))
            var = sum((2*n-mean)**2*p for n,p in enumerate(probabilities))
            assert (mean,var) == (Fraction(1,8),Fraction(13,32))
            eq,down = spin_detector(output)
            assert eq==3/128 and down==9/1024 and down/eq==3/8
            print(f"Signed sine, gains (0,2,4): {probabilities}; mean={mean}, variance={var}")
    scattered = contact(field, -1)
    zero_modes = sum(mass(scattered[4*i:4*i+4]) for i,d in enumerate(AXES) if not any(d))
    assert zero_modes == 1/128
    print("Magnitude sine, gains (0,2,4): (127/128,1/128,0); positive phase magnitude: (1,0,0).")


def unitary_controls():
    rng = Random(829)
    state = [[complex(rng.random()-.5,rng.random()-.5) for _ in range(DIM)] for _ in range(6)]
    phase = exp(.73j)
    forward = material_gate(state,phase)
    assert distance(material_gate(forward,phase.conjugate()),state) < 3e-15
    assert distance(hamiltonian(forward),material_gate(hamiltonian(state),phase)) < 3e-14
    assert abs(sum(map(mass,forward))-sum(map(mass,state))) < 1e-10
    # An empty-battery, lowest-energy pair belongs to an incomplete shell.
    edge = [[0j]*DIM for _ in range(5)]
    edge[0] = input_field((0,0,3))
    assert distance(material_gate(edge),edge) == 0


def coherence_controls():
    for m in (2,4,8,16):
        theta = pi/(m+1)
        for power in (1,2):
            packet = [sin(j*theta)**power for j in range(1,m+1)]
            norm = sqrt(mass(packet))
            packet = [v/norm for v in packet]
            eq,dd = spin_detector(material_gate(dressed_input(packet)))
            p = dd/eq
            c1,c2 = (overlap(packet,j).real for j in (1,2))
            assert abs(eq-3/128)<1e-14
            assert abs(p-(3-4*c1+c2)/8)<1e-14
            assert p+1e-14 >= (1-cos(theta))**2/4
            if power == 1:
                assert abs(c1-cos(theta))<1e-14
            else:
                assert abs(p-m*sin(theta)**4/(3*(m+1)))<1e-14
                print(f"M={m:2}: adjacent overlap={c1:.8f}, conditional double flip={p:.9f}")
    random_phase = [exp(1j*q)/2 for q in (0,.4,1.3,-.6)]
    eq,dd = spin_detector(material_gate(dressed_input(random_phase)))
    assert abs(dd/eq-(3-4*overlap(random_phase,1).real+overlap(random_phase,2).real)/8)<1e-14


if __name__ == "__main__":
    exact_meter()
    unitary_controls()
    coherence_controls()
range.py
"""Exact finite-torus controls for a collision-local energy correction.

Momenta in the four-cell periodic box are multiples of pi/2. All one-body
Pauli blocks then have Gaussian-integer entries. The fixed total momentum is
zero. A dictionary contains the two spin amplitudes in the ordered basis at
each of the 64 relative momenta (four components including both spin labels).
"""
from fractions import Fraction as F
from itertools import product
from math import isclose, cos, sin, acos, atan2, pi, sqrt

GRID = list(product(range(4),repeat=3))
C = (1,0,-1,0)
S = (0,1,0,-1)
Z = (0,0)


def plus(a,b):
    return a[0]+b[0], a[1]+b[1]


def times(a,b):
    return a[0]*b[0]-a[1]*b[1], a[0]*b[1]+a[1]*b[0]


def scale(a,x):
    return a[0]*x,a[1]*x


def pauli(spin,axis):
    if axis==0: return 1-spin,(1,0)
    if axis==1: return 1-spin,(0,1-2*spin)
    return spin,(1-2*spin,0)


def block(k):
    x,y,z = k
    b = (S[x]*C[y]*C[z],S[y]*C[z],S[z])
    for i,sign in enumerate(b):
        if sign: return i,sign
    return None,0


def free(vec):
    result = {}
    for k,row in vec.items():
        axis,_ = block(k)
        if axis is None:
            result[k] = row
            continue
        out=[Z]*4
        for i,v in enumerate(row):
            l,a=pauli(i//2,axis)
            r,b=pauli(i%2,axis)
            out[2*l+r]=times(times(a,b),v)
        result[k]=out
    return result


def charge(vec):
    result={}
    for k,row in vec.items():
        axis,sign=block(k)
        out=[Z]*4
        if axis is not None:
            for i,v in enumerate(row):
                l,a=pauli(i//2,axis)
                r,b=pauli(i%2,axis)
                out[2*l+i%2]=plus(out[2*l+i%2],scale(times(a,v),sign))
                out[2*(i//2)+r]=plus(out[2*(i//2)+r],scale(times(b,v),-sign))
        result[k]=out
    return result


def tick(vec,phase):
    assert phase[0]**2+phase[1]**2==1
    vec=free(vec)
    avg=[(F(sum(row[j][0] for row in vec.values()),64),
          F(sum(row[j][1] for row in vec.values()),64)) for j in range(4)]
    delta=[times(plus(phase,(-1,0)),a) for a in avg]
    return {k:[plus(v,d) for v,d in zip(row,delta)] for k,row in vec.items()}


def norm2(vec):
    # The initial spin vector (up down + down up) has norm sqrt(2).
    return sum(a*a+b*b for row in vec.values() for a,b in row)/F(128)


def diff(a,b):
    return {k:[plus(v,scale(w,-1)) for v,w in zip(a[k],b[k])] for k in a}


def torus(phase):
    initial={k:[Z,(1,0),(1,0),Z] for k in GRID}
    original=charge(initial)
    v=initial
    q=original
    assert norm2(initial)==1 and norm2(original)==2
    for t in range(1,9):
        v=tick(v,phase)
        q=tick(q,phase)
        gap=norm2(diff(charge(v),q))/t**2
        # The bright same-site triplet gains one phase per two ticks.
        # Its charged partner is a contact-dark singlet on the z-type momenta.
        factor=(1,0)
        for _ in range(t//2): factor=times(factor,phase)
        squared=2*((factor[0]-1)**2+factor[1]**2)/F(t*t)
        assert gap==squared and norm2(v)==1
        if t==2:
            predicted={k:[times(phase,v0) for v0 in row] for k,row in initial.items()}
            assert norm2(diff(v,predicted))==0
        if phase==(-1,0) and t in (1,2,3,4):
            print(f"T={t}: squared change of averaged charge on this packet = {gap}")


def interpolation(m,delta):
    # p1,2=(delta +/- x, +/- y, 0). Check both energies directly even
    # when cos(m)<0 or vanishes, and check rank of the three onsite tests.
    beta=sin(delta)*cos(m)/(cos(delta)*sin(m))
    assert abs(beta)<1
    for step in range(51):
        t=delta*step/50
        u=cos(m)*cos(t)/cos(delta)
        v=sin(m)*sin(t)/sin(delta)
        cy=min(1.,sqrt(u*u+v*v))
        x=atan2(v,u) if abs(u)+abs(v)>1e-14 else pi/2
        y=acos(cy)
        w1=acos(max(-1.,min(1.,cos(delta+x)*cos(y))))
        w2=acos(max(-1.,min(1.,cos(delta-x)*cos(y))))
        assert isclose(w1,m+t,abs_tol=1e-10) and isclose(w2,m-t,abs_tol=1e-10)
    # At equal sharing, two test triplets have independent +- combinations
    # of |++> and |--> in the x-spin basis. The axial ray supplies m_x=0.
    assert (1-beta*beta)/2>0


if __name__=="__main__":
    torus((-1,0))
    torus((F(3,5),F(4,5)))
    for m in (pi/12,pi/4,pi/2,2*pi/3,11*pi/12):
        interpolation(m,min(m,pi-m)/3)
    print("Both exact torus phase controls and all five energy-sharing paths passed.")
reciprocity.py
"""Reciprocal gravitational quadrupole: exact 6^3 finite-cell tests.

Run with Python 3 standard library. Coordinates in sparse fields are doubled
so the same map supports vertex, link and face quantities. Sums run over one
periodic cell. No transverse projection is used in the time evolution.
"""

from collections import defaultdict
from fractions import Fraction as F
from itertools import product

N = 6
VOL = N**3
C2 = F(1, 4)
EPS = 2
CS = (F(1), F(1, 2), F(-1, 2), F(-1), F(-1, 2), F(1, 2))
ORIGIN = (0, 0, 0)
UNIT = {ORIGIN: 1}


def add(*fields):
    result = {}
    for field in fields:
        for location, value in field.items():
            result[location] = result.get(location, 0) + value
    return {p: v for p, v in result.items() if v}


def times(field, factor):
    return {p: factor * v for p, v in field.items() if factor * v}


def sub(first, second):
    return add(first, times(second, -1))


def stencil(field, axis, terms):
    """Apply sum c*f(x+s) at all sites, pairing each field with its stagger."""
    parts = []
    for offset, coefficient in terms:
        shifted = {}
        for point, value in field.items():
            dest = list(point)
            dest[axis] -= offset
            shifted[tuple(dest)] = coefficient * value
        parts.append(shifted)
    return add(*parts)


def centered(field, axis):
    return stencil(field, axis, [(1, 1), (-1, -1)])


def average(field, axis, radius):
    half = F(1, 2)
    return stencil(field, axis, [(radius, half), (-radius, half)])


def native(field, axis):
    quarter = F(1, 4)
    field = stencil(field, axis, [(4, quarter), (-4, -quarter)])
    for j in range(axis + 1, 3):
        field = average(field, j, 4)
    return field


def filters(field, axes):
    for i in axes:
        field = average(average(field, i, 1), i, 2)
        for j in range(i + 1, 3):
            field = average(field, j, 4)
    return field


PAIRS = tuple((i, j) for i in range(3) for j in range(i, 3))


def component(tensor, i, j):
    return tensor[min(i, j), max(i, j)]


def divergence(tensor, derivative):
    return [add(*(derivative(component(tensor, i, j), j) for j in range(3)))
            for i in range(3)]


def spatial_einstein(tensor, derivative):
    trace = add(*(tensor[i, i] for i in range(3)))
    div = divergence(tensor, derivative)
    curvature = sub(add(*(derivative(div[i], i) for i in range(3))),
                    add(*(derivative(derivative(trace, i), i) for i in range(3))))
    force = {}
    for i, j in PAIRS:
        lap = add(*(derivative(derivative(tensor[i, j], k), k) for k in range(3)))
        ddtrace = derivative(derivative(trace, j), i)
        force[i, j] = times(sub(add(derivative(div[j], i), derivative(div[i], j)),
                                add(lap, ddtrace, curvature if i == j else {})),
                            F(1, 2))
    return curvature, force



def fold(field):
    output = {}
    for point, value in field.items():
        dest = tuple(x % (2 * N) for x in point)
        output[dest] = output.get(dest, 0) + value
    return {p: v for p, v in output.items() if v}


def inner(left, right):
    return sum((v * right.get(p, 0) for p, v in left.items()), F(0))


def tensor_inner(left, right):
    return sum((1 if i == j else 2) * inner(left[i, j], right[i, j])
               for i, j in PAIRS)


def empty():
    return {ij: {} for ij in PAIRS}


def diagonal_metric(s, q, profile):
    h = dict(s)
    for i, sign in enumerate((1, -1, -1)):
        h[i, i] = add(s[i, i], times(profile, sign*q/2))
    return h


def norm_kinetic(p):
    trace = add(*(p[i, i] for i in range(3)))
    return tensor_inner(p, p) - inner(trace, trace)/2


def spectrum(use_native):
    """Eliminate only the constrained scalar for the independent spectral test."""
    crit = F(0)
    snap_shift = F(0)
    weights = defaultdict(F)
    for ks in product(range(N), repeat=3):
        qsq = [2-2*CS[k] for k in ks]
        fsq = [(1+CS[k])*CS[k]**2/2 for k in ks]
        for i in range(3):
            for j in range(i+1, 3):
                fsq[i] *= CS[2*ks[j] % N]**2
        dsq = [q*f for q, f in zip(qsq, fsq)] if use_native else qsq
        d2 = sum(dsq)
        if not d2:
            continue
        Q2 = EPS**2 * (fsq[1]*fsq[2])**2 if use_native else F(EPS**2)
        x = dsq[0]/d2
        gamma = C2*d2
        crit += gamma*Q2*x**2 / (4*VOL)
        mu = gamma*Q2*(1-x)**2 / (4*VOL)
        if mu:
            weights[gamma] += mu
        snap_shift += gamma*Q2*(1-2*x) / (4*VOL)
    expected = ((F(22111513, 25367150592), -F(104339, 134217728))
                if use_native else (F(16301, 71280), F(1, 2)))
    assert (crit, snap_shift) == expected
    assert snap_shift + crit == sum(weights.values())
    def inverse_chi(z, spring):
        return spring - crit - z - sum(mu*z/(g-z) for g, mu in weights.items())
    # Its derivative is strictly negative between poles. These signs prove
    # positive normal frequencies and the unit-tick upper stability bound.
    assert inverse_chi(F(0), F(1)) > 0
    assert max(weights) < 4 and inverse_chi(F(4), F(1)) < 0
    # With half the critical restoring spring there is a negative omega^2.
    assert inverse_chi(F(0), crit/2) < 0 < inverse_chi(F(-4), crit/2)
    return crit, snap_shift, sum(weights.values()), len(weights)


def run_feedback(use_native, steps=4):
    # m=w=kappa=dt=1. The input is a plus wave on z with hxx-hyy=cos(k_z z).
    def derivative(field, axis):
        return fold((native if use_native else centered)(field, axis))

    def filtered(field, factors):
        return fold(filters(field, factors)) if use_native else fold(field)

    profile = filtered(times(UNIT, EPS), (1, 2, 1, 2))
    rho_profile = filtered({(-2, 0, 0): EPS, (2, 0, 0): EPS, ORIGIN: -2*EPS},
                           (0, 1, 2, 0, 1, 2))
    j_profile = filtered({(-1, 0, 0): -EPS, (1, 0, 0): EPS},
                         (0, 1, 2, 1, 2))
    # Independent variation of V at fixed material displacement: a TT wave
    # traveling on x, or a cross-polarized wave traveling on z, has no drive.
    def drive(force):
        contrast = sub(force[0, 0], add(force[1, 1], force[2, 2]))
        return C2*inner(profile, contrast)/2

    positions = list(product(range(N), repeat=3))
    def wave(axis):
        return {tuple(2*x for x in p): CS[p[axis]] for p in positions}
    axial_null = empty()
    axial_null[1, 1] = times(wave(0), F(1, 2))
    axial_null[2, 2] = times(wave(0), F(-1, 2))
    assert drive(spatial_einstein(axial_null, derivative)[1]) == 0
    cross_null = empty()
    # An xy face is half-shifted along x,y only for the centered stencil.
    offset = 0 if use_native else 1
    cross_null[0, 1] = {(2*x+offset, 2*y+offset, 2*z): CS[z]
                         for x, y, z in positions}
    assert drive(spatial_einstein(cross_null, derivative)[1]) == 0

    # Check the mixed derivative in both directions. The plane wave is
    # normalized by physical cosine amplitude, so its effective mass is V/8.
    wave_shape = empty()
    wave_shape[0, 0] = times(wave(2), F(1, 2))
    wave_shape[1, 1] = times(wave(2), F(-1, 2))
    shape_metric = diagonal_metric(empty(), F(1), profile)
    _, force_in = spatial_einstein(wave_shape, derivative)
    _, force_out = spatial_einstein(shape_metric, derivative)
    k_in = drive(force_in)
    k_out = C2*tensor_inner(wave_shape, force_out)
    expected_k = F(9, 8192) if use_native else F(1, 8)
    assert k_in == k_out == expected_k
    mode_mass = F(VOL, 8)
    expected_transmitter_acceleration = -F(1, 24576) if use_native else -F(1, 216)
    assert -k_out/mode_mass == expected_transmitter_acceleration

    s = wave_shape
    p = empty()
    q, P = F(0), F(0)
    initial = C2*tensor_inner(s, force_in)/2
    assert initial == (F(81, 128) if use_native else F(27, 8))
    previous_pp = p
    history = []
    for step in range(steps):
        h = diagonal_metric(s, q, profile)
        curvature, force = spatial_einstein(h, derivative)
        assert not any(divergence(force, derivative))
        assert curvature == times(rho_profile, q)
        # Reconstruct the physical momentum on the incoming half slice.
        pp = dict(p)
        pp[0, 0] = add(p[0, 0], times(profile, P/2))
        assert [times(v, -2) for v in divergence(pp, derivative)] == [
            times(j_profile, P), {}, {}]
        if step:
            for ij in PAIRS:
                assert pp[ij] == previous_pp[ij]
        next_p = {ij: sub(p[ij], times(force[ij], C2)) for ij in PAIRS}
        next_P = P - q - drive(force)
        # Check the physical momentum equation with the mechanical acceleration.
        previous_pp = {ij: sub(pp[ij], times(force[ij], C2)) for ij in PAIRS}
        previous_pp[0, 0] = add(previous_pp[0, 0],
                                times(profile, (next_P-P)/2))
        trace = add(*(next_p[i, i] for i in range(3)))
        next_s = {(i, j): sub(add(s[i, j], times(next_p[i, j], 2)),
                              trace if i == j else {}) for i, j in PAIRS}
        next_q = q + next_P
        h_after = diagonal_metric(next_s, next_q, profile)
        mechanic = (next_P**2 + q*next_q)/2
        field = norm_kinetic(next_p) + C2*tensor_inner(h_after, force)/2
        assert mechanic + field == initial
        if not step:
            assert next_P == -expected_k
            assert mechanic == expected_k**2/2 and initial-field == mechanic
        history.append((next_q, mechanic))
        s, p, q, P = next_s, next_p, next_q, next_P
    return k_in, initial, history


if __name__ == "__main__":
    for use_native in (False, True):
        label = "native" if use_native else "centered"
        crit, snap, total_mu, count = spectrum(use_native)
        coupling, initial, history = run_feedback(use_native)
        print(f"{label}: critical spring {crit}, sudden shift {snap}, "
              f"radiative weight {total_mu}, {count} bright frequencies")
        print(f"  reciprocal cross coefficient {coupling}, initial energy {initial}, "
              f"first material energy {history[0][1]}")
        print(f"  four-step displacement {history[-1][0]}, "
              f"total energy and both Gauss laws exact")
replay.py
"""Replay the collision-energy study using standard Python and a pinned Tally runtime."""
import argparse
import hashlib
from pathlib import Path
import shutil
import subprocess
import sys
import tempfile
from zipfile import ZipFile

ROOT = Path(__file__).resolve().parent
RUNTIME_SHA = "1fb281c0ef55314ec68de024ac27da152ff00739607cbbdc408eeee82ab5b193"
ATOM_SHA = "4c08a122480cb2d6c1efb48b9e868b5b45432d78dc40b339dbe9db7ebdacf02d"


def checked(path, expected):
    data = path.read_bytes()
    if hashlib.sha256(data).hexdigest() != expected:
        raise ValueError(f"SHA-256 mismatch for {path.name}")
    return data


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("runtime", type=Path, help="published Tally 0.3.0 runtime ZIP")
    args = parser.parse_args()
    checked(args.runtime, RUNTIME_SHA)
    lib = ROOT / "lib/atom.tly"
    if not lib.is_file():
        lib = ROOT.parent / "walk-clock-recoil/tally/lib/atom.tly"
    atom = checked(lib, ATOM_SHA)
    python = [sys.executable, "-E", "-s", "-B", "-X", "utf8"]
    for script in ("range", "dressing", "alternative", "meter", "clock", "reciprocity", "empirical"):
        subprocess.run([*python, str(ROOT / (script + ".py"))], check=True)

    with tempfile.TemporaryDirectory() as work_path:
        work = Path(work_path)
        with ZipFile(args.runtime) as runtime:
            runtime.extractall(work)
        tally = work / "Tally-0.3.0"
        (tally / "lib/atom.tly").write_bytes(atom)
        shutil.copyfile(ROOT / "energy.tly", work / "energy.tly")
        result = subprocess.run([*python, str(tally / "tally.py"), "energy.tly"], cwd=work,
                                stdout=subprocess.PIPE, check=True)
        actual = result.stdout.decode("utf-8").splitlines()
        expected = (ROOT / "energy.out").read_text(encoding="utf-8").splitlines()
        if actual != expected or sum(line.startswith("✓") for line in actual) != 22:
            raise ValueError("Tally output differs from the 22 published checks")
    print("All seven offline checks and the complete 22-assertion Tally transcript passed.")


if __name__ == "__main__":
    main()
Back to contents ↑

Independent research by Anthony Michael Collado.
Energy in the interacting walk · 1 December 2026

The pair-detector study → · Study sources (ZIP) ↓