paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Modular, compositional, and executable formal semantics for LLVM IR

LLVM IR 的模块化、组合式且可执行的形式语义
ICFP 5(ICFP)2021匹配度 3/10 · 论文属于 LLVM IR 的形式语义与 Coq 定理证明基础设施,与用户核心关注的静态分析、LLM/Agent 与形式化验证交叉、浮点程序分析或贝叶斯程序分析没有直接关联。其可执行形式语义可能间接服务于程序分析与验证,但未涉及 AI/LLM 或用户点名的交叉方向。引用 48 inbox
Yannick Zakowski, Calvin Beck, Irene Yoon, Ilia Zaichuk, Vadim Zaliva, Steve Zdancewic
crossref: 2026-09-10

AI 速览

一句话:用 Coq 中 interaction trees 的单子解释为 LLVM IR 大型顺序子集建立模块化、可组合且可执行的形式语义。

本文为 LLVM IR 的一个大型顺序子集提出一种在 Coq 中机器化的新形式语义。与以往基于关系式操作语义的做法不同,该语义采用 interaction trees 的单子解释,从而在保持可提取可执行解释器的同时,获得更具组合性的语言语义定义方式。语义以事件处理器的方式模块化构造,能够处理 LLVM IR 的诸多非平凡语言特性,包括规约中的非确定性。作者扩展了 interaction trees 的弱互模拟等式理论以更好地处理非确定性,并据此得到组合式推理原则,进而证明所提取的参考解释器忠实精化语义模型。最后通过在单元测试及 HELIX 生成的 LLVM IR 程序上的评估验证了语义的正确性。

问题
以往 LLVM IR 形式语义多采用关系式操作语义,难以组合式地定义与推理,且不易直接获得可执行解释器。
方法
基于 interaction trees 的单子解释构造语义,以事件处理器模块化处理非平凡语言特性与非确定性,并扩展弱互模拟等式理论支持组合推理。
评估
证明提取出的参考解释器精化语义模型,并在单元测试与 HELIX 生成的 LLVM IR 程序上进行验证。
原文摘要(Abstract)

This paper presents a novel formal semantics, mechanized in Coq, for a large, sequential subset of the LLVM IR. In contrast to previous approaches, which use relationally-specified operational semantics, this new semantics is based on monadic interpretation of interaction trees, a structure that provides a more compositional approach to defining language semantics while retaining the ability to extract an executable interpreter. Our semantics handles many of the LLVM IR's non-trivial language features and is constructed modularly in terms of event handlers, including those that deal with nondeterminism in the specification. We show how this semantics admits compositional reasoning principles derived from the interaction trees equational theory of weak bisimulation, which we extend here to better deal with nondeterminism, and we use them to prove that the extracted reference interpreter faithfully refines the semantic model. We validate the correctness of the semantics by evaluating it on unit tests and LLVM IR programs generated by HELIX.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1125,
  title = {Modular, compositional, and executable formal semantics for LLVM IR},
  author = {Yannick Zakowski and Calvin Beck and Irene Yoon and Ilia Zaichuk and Vadim Zaliva and Steve Zdancewic},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {5},
  number = {ICFP},
  year = {2021},
  doi = {10.1145/3473572}
}