paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Formal Semantics and Program Logics for a Fragment of OCaml

OCaml 一个片段的 формальная 语义与程序逻辑
ICFP 9(ICFP)2025匹配度 3/10 · 论文属于OCaml片段的形式语义与程序逻辑,落在形式化验证/程序语言理论方向,但未涉及用户核心关注的LLM/Agent与静态分析/形式化验证的交叉,也未覆盖浮点或贝叶斯程序分析。引用 4 inbox
Remy Seassau, Irene Yoon, Jean-Marie Madiot, François Pottier
crossref: 2026-09-10

AI 速览

一句话:为 OCaml 的一个含效应处理器的顺序片段建立形式语义与两种程序逻辑。

本文是迈向 OCaml 形式化定义与基础程序验证环境的第一步。作者定义了 OLang——OCaml 的一个非平凡顺序片段,涵盖一等函数、普通与可扩展代数数据类型、模式匹配、引用、异常以及效应处理器。其动态语义被定义为一个单子解释器:计算在自定义单子内部表示为操作树,并配备小步语义,从而在解释器与操作语义之间建立联系。在此基础上,论文给出两种程序逻辑:一种无状态 Hoare 逻辑用于推理所谓“纯”程序,另一种基于 Iris 的分离逻辑用于推理任意程序。文章详细描述了两种逻辑的构造,并给出若干使用示例,展示了该片段在形式化验证方面的可用性。

问题
OCaml 缺乏覆盖效应处理器等现代特性的形式化语义与基础程序验证环境。
方法
定义 OLang 片段,以操作树单子解释器给出动态语义,并构造无状态 Hoare 逻辑与 Iris 分离逻辑。
评估
通过若干使用示例说明两种程序逻辑在纯程序与任意程序上的可用性,属于方法与形式化定义的展示。
原文摘要(Abstract)

This paper makes a first step towards a formal definition of OCaml and a foundational program verification environment for OCaml. We present a formal definition of OLang, a nontrivial sequential fragment of OCaml, which includes first-class functions, ordinary and extensible algebraic data types, pattern matching, references, exceptions, and effect handlers. We define the dynamic semantics of OLang as a monadic interpreter. This interpreter runs atop a custom monad where computations are internally represented as trees of operations and equipped with a small-step semantics. We define two program logics for OLang. A stateless Hoare Logic allows reasoning about so-called “pure” programs; an Iris-based Separation Logic allows reasoning about arbitrary programs. We present the construction of the two logics as well as some examples of their use.

链接与引用

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

BibTeX
@article{paperbot3041,
  title = {Formal Semantics and Program Logics for a Fragment of OCaml},
  author = {Remy Seassau and Irene Yoon and Jean-Marie Madiot and François Pottier},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {9},
  number = {ICFP},
  year = {2025},
  doi = {10.1145/3747509}
}