Abstract
Compiler optimizations significantly alter program structure, complicating the formal verification of property preservation. This paper introduces Temporal Transformation Logic (TTL), a novel framework that leverages boolean matrix algebra to correlate temporal logic formulas between an original program and its transformed counterpart. By decomposing complex optimizations into sequences of "small-step" primitive transformations, TTL facilitates the step-by-step deductive verification of compiler correctness.
Introduction
When a compiler performs optimizations—such as removing redundant calculations or reordering code—it must ensure that the program's original semantics are preserved. Formal verification typically models programs as Kripke structures and uses temporal logic (specifically Computational Tree Logic with branching past, or CTLbp) to express dataflow properties. However, standard temporal logic is designed for single-model evaluation. Proving transformation correctness requires correlating properties across two distinct models: the input program and the transformed program. Existing systems struggle with formulas interpreted across different models. Temporal Transformation Logic (TTL) addresses this gap by providing a formal bridge between program versions.
Methodology: Boolean Matrix Algebra and Primitive Transformations
The core innovation of TTL lies in its use of boolean matrix algebra to formalize both program structure and logic semantics. Instead of traditional set-theoretic relations, control flow graphs (CFGs) are represented as boolean adjacency matrices. Transformations are defined by "correspondence matrices" that map nodes from the new graph back to the original.
To manage complexity, the authors break down large "big-step" optimizations into a sequence of primitive, "small-step" transformations. These primitives include operations such as node splitting, node merging, edge addition, and edge deletion.
By defining temporal logic operators through matrix multiplication and fixed-point operations, TTL provides specific inference rules for each primitive. For instance, an "edge deletion" transformation, which removes paths without adding new ones, is shown to preserve universal future properties. This algebraic approach allows for succinct equations that can be directly evaluated or implemented in theorem provers, replacing verbose relational definitions.
Results and Applications
The authors established the soundness of TTL inference rules across seven primitive graph transformations by constructing simulation and weak bisimulation relations. To demonstrate real-world utility, the logic was applied to verify Common Subexpression Elimination (CSE), a standard compiler optimization.
Beyond CSE, TTL has been integrated into the PVS theorem prover to verify other classical optimizations, including lazy code motion and dead code elimination. This modular approach—verifying a sequence of small, orthogonal steps—makes the proof process for large-scale optimizations significantly more manageable and reusable.
Conclusion and Future Work
TTL provides a powerful, constructive framework for correlating temporal properties across program versions. Currently, the logic is restricted to intra-procedural analysis, focusing on properties within individual functions. Future research aims to extend TTL to inter-procedural settings, which will require more expressive models like recursive state machines or pushdown systems to handle nested function calls and returns. Additionally, the authors plan to explore the logical completeness of TTL and its extension to more complex logics such as CTL* and the modal mu-calculus.
Summary updated