arXiv Science⌕ Search

arXiv · 2611.36994

Semantics-Preserving Compilers via Operadic Algebras and Factorization Algebras

Abstract

We investigate an operadic approach to semantics-preserving translation from a well-defined subset of C++ to Lean. The proposed development has three components. First, it organizes program constructors and their interpretations using colored operads and their algebras. We give sufficient conditions for a correspondence on fundamental types and basic operations to induce a semantically faithful compiler, and prove that such a compiler extends through finite products and recursion. Second, we use a factorization algebra to describe how the semantics of a program is assembled from its function fragments. The local data include the embedding of each fragment algebra into the program's semantic algebra. We prove that, for a cover by function fragments, the images of these embeddings generate that algebra. Third, we propose a compiler architecture based on the factorization algebra of program fragments and implement it for translation from C++ to Lean. The compiler records each function as a fragment, translates each fragment using the correspondence on types and operations, and assembles the resulting definitions according to their call dependencies. We compile and verify the Milnor multiplication program used by Lin, Wang, and Xu in their computations for the Kervaire invariant one problem in dimension 126. After repairing an uninitialized read, we verify that the translated program computes the product specified by the formalized Milnor coproduct for every ordered basis pair of combined degree at most 180. As another application, we rewrite a Lean-verified algorithm for ML-KEM polynomial multiplication in the Lean fragment accepted by our compiler. We prove in Lean that the two formulations agree on all canonical inputs and compile the rewritten definition to C++. On an Apple M4, the generated C++ code ran 6.1 times as fast as the native Lean version of the same definition.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Yuwen Gu. 2026-11-27. Semantics-Preserving Compilers via Operadic Algebras and Factorization Algebras. https://arxiv.science/abs/2611.36994

Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite arXiv Science by Indiciae: BibTeX · RIS.

KEEP EXPLORING

Related papers

An answer to the Whitehead asphericity question

The Whitehead asphericity problem, regarded as a problem of combinatorial group theory, asks whether any subpresentation of an aspherical group presentation is also aspherical. We give a positive answer to this question by proving that if $\cP=(\mathbf{x}, \mathbf{r})$ is an aspherical presentation of the trivial group, and $r_{0} \in \mathbf{r}$ a fixed relation, then $\cP_{1}=(\mathbf{x}, \mathbf{r}_{1})$ is aspherical where $\mathbf{r}_{1}=\mathbf{r} \setminus \{r_{0}\}$.

math.AT↗

Two-Sided Dimension Bounds for the Peterson Hit Problem via Projections and Matrix Minors

Let $\mathcal P_k=\mathbb F_2[x_1,\ldots,x_k]$, with $°x_i=1$, be the polynomial algebra equipped with the standard unstable action of the mod-$2$ Steenrod algebra $\mathcal A$. The Peterson hit problem asks for a minimal homogeneous set of $\mathcal A$-generators for $\mathcal P_k$, or equivalently for a homogeneous basis of the cohit space $Q\mathcal P_k=\mathcal P_k/\mathcal A^+\mathcal P_k = \mathbb F_2\otimes_{\mathcal A}\mathcal P_k$, where $\mathcal A^+ $ denotes the augmentation ideal of $\mathcal A$. The dimension of $(Q\mathcal P_k)_d$ therefore gives the number of generators required in positive degree $d$. Although solved in every degree $d$ for $k\leq 4,$ the problem remains open in general. As the number of variables $k$ and degrees $d$ increase, exact calculations involve increasingly large systems of Steenrod relations. As a partial quantitative contribution to this open problem, we establish explicit upper and lower bounds for $\dim_{\mathbb F_2}(Q\mathcal P_k)_d$ for arbitrary positive integers $k$ and $d$, determining the exact dimension whenever these bounds coincide. Our method combines binary combinatorics and linear algebra with graph-theoretic and simplicial structures in the matrix of the generating Steenrod squares. The results have also been independently and formally verified in Lean 4.

math.AT↗