Formal Semantics and Program Logics for a Fragment of OCaml

Research output: Contribution to journalArticlepeer-review

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.

Original languageEnglish
Pages (from-to)128-159
Number of pages32
JournalProceedings of the ACM on Programming Languages
Volume9
Issue numberICFP
DOIs
Publication statusPublished - 5 Aug 2025

Keywords

  • monadic interpreters
  • operational semantics
  • separation logic

Fingerprint

Dive into the research topics of 'Formal Semantics and Program Logics for a Fragment of OCaml'. Together they form a unique fingerprint.

Cite this