Independent scholarship · Open accessThe monthly digest

Editorially reviewed

Coherent Specialization on GraalVM

We model Truffle partial evaluation as restriction along static contexts and prove residualization, coherent refinement, and descent results. A GraalVM library compiles filter banks, decision trees, and two quantum evolutions. Time sweeps from the compiled kernels show free-electron spreading and compare an interacting fermion field with a matched control.

Anonymous author← All research

Specialization and coherent refinement

Let $t:S\times D\to Y$ be a typed first-order algorithm with static context $S$ and dynamic input context $D$. Terms and simultaneous substitutions form a finite-product category. For an assignment $a:A\to S$, the residualizer produces syntax $r_a(t)$ with denotation $t\circ(a\times\mathrm{id}_D)$. The structural proof treats variables, total primitives, conditional selection, and lexical let binding. Restricting again along $u:A'\to A$ agrees in denotation with direct restriction along $au$. Signed word operations take place modulo $2^{64}$. The binary64 extension preserves the order of rounded operations.

To retain correctness witnesses, let $K_a$ be the groupoid completion of the category of residual terms and sound rewrite sequences at $a$. For compatible assignments $a\le b$, restriction sends a rewrite to the corresponding rewrite of its substitution. A trace $p_a:t[a]\to r_a(t)$ supplies the comparison $p_b\circ k_{a,b}^{*}(p_a)^{-1}$ between restricting $r_a(t)$ and specializing directly at $b$. These comparisons fit into a coherent family over the static-assignment poset.

For an $\infty$-topos $\mathcal X$, let $R$ be a presheaf of candidate implementations on $\mathcal X_{/S}$ with a denotation map to $H(A)=\operatorname{Map}_{\mathcal X}(A\times D,Y)$. The specification determines a section $s_F:1\to H$. Certified implementations form the homotopy pullback $C_F=R\times_H 1$. For an effective-epimorphism cover $U\to A$, if $R$ satisfies descent along its Čech nerve, so does $C_F$. Indeed, $H(A)\simeq\operatorname{Map}_{\mathcal X}(A,Y^D)$ carries the Čech colimit to a limit, and the homotopy pullback commutes with limits. A map $S^2\to K(\mathbb Z,2)$ representing the cohomology generator gives local trivializations with an obstruction to a global certificate. Guarded dispatch has a separate proof, using branch certificates and a checkpoint condition for the generic continuation.

Compiled examples

CatPE parses typed specifications, binds static data, and lowers residual programs to Truffle ASTs. GraalJS and GraalPy call the same executable values. Filter banks and decision-tree ensembles agree with independent implementations on 12,288 input tuples. The Graal log records tier-2 compilation for the word kernels and the quantum output rows.

For a Hermitian finite-dimensional Hamiltonian $H$, the exact time evolution is $U(t)=\exp(-itH)$. Realification maps $U=A+iB$ to the paired real action $(x,y)\mapsto (Ax-By,Bx+Ay)$. The library binds the coefficients and compiles these forms to Truffle binary64 kernels. The free electron uses the periodic second-difference Hamiltonian on a 12-site ring. The field uses the two-particle sector of a four-site spinless fermion Hamiltonian with hopping, onsite energies, and a nearest-neighbor density interaction.

Figures and numerical evidence

The revised paper includes two vector figures driven by 303 compiled state evaluations at 101 times from $t=0$ to $t=4$. Each time specializes an absolute-time propagator and applies it to the original state. The free-electron figure shows the time-by-site probability and three spatial snapshots. The interacting-field figure shows six occupation-basis probabilities and compares the probability of adjacent occupancy at $v=1.25$ with a matched $v=0$ control. At $t=2.76$, the adjacent-pair probabilities are $0.847$ and $0.566$. At $t=4$ they are $0.721$ and $0.816$. The manuscript derives the short-time difference $t^4/60+O(t^6)$ for the fixture.

The largest amplitude-component error over the sweeps against the Fourier and Taylor references was $2.40\times10^{-15}$. The largest squared-norm discrepancy was $1.78\times10^{-15}$ and the largest energy discrepancy was $1.55\times10^{-15}$. Exact unitarity follows from Hermiticity, while the implemented evolution is subject to binary64 rounding. The paper explains the compatibility of independently sampled observations under restriction and gives a separate trajectory-local bound for repeated rounded steps.

Reproducibility and attribution

The PDF presents the definitions, proofs, execution evidence, figures, and limitations. The reproducibility archive contains the compiler, guest examples, Java exporter, CSVs, figure renderer, vector figures, split LaTeX sources, and traces. The uncompressed LaTeX attachment provides the full manuscript text for indexing. The correctness proofs reach the interpretation of lowered terms. Machine code and foreign execution rely on the GraalVM implementation and were exercised by tests. The manuscript and software were prepared with AI assistance for drafting, implementation, and verification. The responsible submitter uses an anonymous public byline.

Reproducibility artifacts

coherent-specialization-on-graalvm.pdf · 457,010 bytes · Download
SHA-256 e1a143951591ac0f68d0304de2a3b95af189b73752460b345de56538d5fdac65

catpe-graalvm-0.1.0.zip · 314,588 bytes · Read in browser · Download
SHA-256 89f9d4a1f60c454e25050c715237b7aff7717a6b9d90719eeaf6cfa49bacdf7d

coherent-specialization-on-graalvm.tex · 66,007 bytes · Browser edition: failed · View status · Download
Text indexing selected · View indexed source
SHA-256 ef8a7cabf8de86ac759ebcfac901ba61375b6be4d5a2428a94d80e09a8606378

Discussion

Open a careful, constructive conversation about this note.

Comments appear after editorial approval.