Interaction Trees: Representing Recursive and Impure Programs in Coq
Li-yao Xia, Yannick Zakowski, Paul He, Chung-Kil Hur, Gregory Malecha,, Benjamin C. Pierce, Steve Zdancewic

TL;DR
Interaction trees (ITrees) are a versatile coinductive data structure in Coq for modeling recursive, impure, and nonterminating programs with formal semantics, enabling executable interpreters and verified compilers.
Contribution
The paper introduces ITrees as a new coinductive structure for representing complex program behaviors, along with a Coq library and a verified compiler correctness proof.
Findings
ITrees can represent nonterminating, impure recursive computations.
The Coq library mechanizes key semantic theories and supports reasoning.
A verified compiler from a simple language to assembly is demonstrated.
Abstract
"Interaction trees" (ITrees) are a general-purpose data structure for representing the behaviors of recursive programs that interact with their environments. A coinductive variant of "free monads," ITrees are built out of uninterpreted events and their continuations. They support compositional construction of interpreters from "event handlers", which give meaning to events by defining their semantics as monadic actions. ITrees are expressive enough to represent impure and potentially nonterminating, mutually recursive computations, while admitting a rich equational theory of equivalence up to weak bisimulation. In contrast to other approaches such as relationally specified operational semantics, ITrees are executable via code extraction, making them suitable for debugging, testing, and implementing software artifacts that are amenable to formal verification. We have implemented ITrees…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
