Interaction Trees: Representing Recursive and Impure Programs in Coq (Work In Progress)

05/31/2019
by   Li-yao Xia, et al.
0

We present "interaction trees" (ITrees), a general-purpose data structure in Coq for formalizing the behaviors of recursive programs that interact with their environment. ITrees are built of uninterpreted events and their continuations—a coinductive variant of a "free monad". We study the compositional properties of interpreters built from "event handlers" and show how to use them to implement a general mutual recursion operator. The resulting theory enables equational reasoning about ITrees up to weak bisimulation. Using this theory, we prove the termination-sensitive correctness of a compiler from a simple imperative source language to an assembly-like target whose meanings are given as an ITree-based denotational semantics. Crucially, the correctness proof follows entirely by structural induction and the equational theory of combinators for control-flow graphs, which are built on top of the mutual recursion operator. ITrees are also executable, e.g. through extraction, making them suitable for debugging, testing, and implementing executable artifacts.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/13/2022

Choice Trees: Representing Nondeterministic, Recursive, and Impure Programs in Coq

This paper introduces Choice Trees (ctrees), a monad for modeling nondet...
research
03/14/2019

Mutual Coinduction

In this paper we present mutual coinduction as a dual of mutual inductio...
research
07/24/2021

Reasoning about Recursive Quantum Programs

Most modern (classical) programming languages support recursion. Recursi...
research
12/10/2021

Formalizing Higher-Order Termination in Coq

We describe a formalization of higher-order rewriting theory and formall...
research
09/17/2021

Fixpoint Semantics for Recursive SHACL

SHACL is a W3C-proposed language for expressing structural constraints o...
research
07/12/2017

Revisiting Elementary Denotational Semantics

Operational semantics have been enormously successful, in large part due...
research
01/08/2020

An Equational Theory for Weak Bisimulation via Generalized Parameterized Coinduction

Coinductive reasoning about infinitary structures such as streams is wid...

Please sign up or login with your details

Forgot password? Click here to reset