Program Analysis with Prophecy and History Variables in the Nexis Compiler

📅 2026-07-25
📈 Citations: 0
✨ Influential: 0
📄 PDF
🤖 AI Summary
Traditional program analysis relies on control flow graphs and separate forward or backward data-flow analyses, resulting in complex structures that are difficult to formally verify. This work proposes a forward-directed formal method based on prophecy and history variables, tightly integrating program analysis into operational semantics and establishing correctness and optimality of transformations via subset-inclusion constraints. We present the first machine-verified framework supporting prophecy and history variables, eliminating the need for explicit control flow graphs, abstraction/concretization functions, and Galois connections. By extending the operational semantics of a domain-specific language and employing forward simulation, we implement formally verified program transformations within the Nexis compiler. This approach yields the first machine-checked proofs of both correctness and optimality for dead code elimination and lazy code motion optimizations.
📝 Abstract
We present prophecy variables for forward formulations of program analysis problems that require information about the future execution of the program. We specify prophecy and history variables via a domain specific language that augments the step rules of the base operational semantics with subset inclusion constraints over the prophecy and history variables. This tight coupling between the prophecy and history variable specification and the operational semantics promotes the construction of correctness and optimality proofs for program transformations, with the proofs structured as forward simulations between the original and transformed versions of the program. In comparison with traditional dataflow approaches, this approach eliminates mechanisms such as explicit control flow graphs, abstraction functions, concretization functions, Galois connections, and separate backward and forward analyses. We present a verified implementation of prophecy and history variables and use the implementation to prove correctness and optimality properties of two classic transformations, partial dead code elimination and lazy code motion, that use both prophecy and history variables. To the best of our knowledge, these proofs are the first machine checked correctness and optimality proofs for these transformations.
Problem

Research questions and friction points this paper is trying to address.

program analysis
prophecy variables
history variables
correctness proof
optimality proof
Innovation

Methods, ideas, or system contributions that make the work stand out.

prophecy variables
history variables
forward simulation
verified program analysis
operational semantics