Compiler correctness can be established using operational semantics, which describe program execution, or denotational semantics, which assign programs mathematical meanings. This work investigates whether denotational methods can handle a difficult compiler transformation: closure conversion, which turns lexically scoped functions into code and explicit environments. The compiler translates FPC, a language with recursive types and functions, into a first-order low-level language. The authors prove that closure conversion preserves and reflects program meaning, with reflection ensuring that target behavior does not introduce meanings absent from the source. They provide the first such denotational reflection proofs for closure conversion in a Turing-complete language, using both a graph model and Scott domains. The graph-model proof introduces an approximant logical relation; the Scott-domain proof adapts a relation developed by John Reynolds.
To compare proof styles in practice, the authors mechanize correctness proofs for an eight-pass FPC compiler targeting a typed low-level intermediate language. They examine five semantic approaches: two denotational and three operational. No approach produces the shortest proof across all passes. Operational proof size tends to increase when source and target executions differ substantially. Denotational proofs are compact when a pass’s correctness follows directly from equality of meanings, but can become lengthy when they require a logical relation. The results frame semantics choice as a pass-by-pass tradeoff rather than a contest with one universally superior method.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.