一句话:通过组合可复用的程序逻辑片段,实现跨语言及语言内模块化定义并证明程序逻辑。
程序逻辑是验证复杂程序的有效手段,但定义新程序逻辑时,语义与证明规则通常必须从头构建,难以复用已有语言或语言内相似原语的成果。本文提出“程序逻辑 à la carte”:将共享状态、并发、非确定性等语言效应封装为可复用、可组合的程序逻辑片段,按需组合以模块化地定义复杂程序逻辑并证明其可靠性。理论上以 ITrees 表达语言语义,以 Iris 作为底层分离逻辑,形成统一组合框架。该工作已在 Coq 证明助手中机械化,展示了跨语言及语言内部复用证明规则与语义的可行性。
Program logics have proven a successful strategy for verification of complex programs. By providing local reasoning and means of abstraction and composition, they allow reasoning principles for individual components of a program to be combined to prove guarantees about a whole program. Crucially, these components and their proofs can be reused . However, this reuse is only available once the program logic has been defined. It is a frustrating fact of the status quo that whoever defines a new program logic must establish every part, both semantics and proof rules, from scratch. In spite of programming languages and program logics typically sharing many core features, reuse is generally not available across languages. Even inside one language, if the same underlying operation appears in multiple language primitives, reuse is typically not possible when establishing proof rules for the program logic. To enable reuse across and inside languages when defining complex program logics (and proving them sound), we serve program logics à la carte by combining program logic fragments for the various effects of the language. Among other language features, the menu includes shared state, concurrency, and non-determinism as reusable, composable blocks that can be combined to define a program logic modularly. Our theory builds on ITrees as a framework to express language semantics and Iris as the underlying separation logic; the work has been mechanized in the Coq proof assistant.