Skip to main content
QUICK REVIEW

[Paper Review] Agda files for LMCS paper "What monads can and cannot do with a few extra pages"

Rasmus Ejlers Møgelberg, Maaike Zwart|arXiv (Cornell University)|Nov 27, 2023
Logic, programming, and type systemsComputer Science20 references1 citations
TL;DR

This paper presents a systematic study of combining the delay monad—both coinductive and guarded recursive variants—with various computational effects via distributive laws. It establishes that sequential lifting yields distributive laws for monads with balanced equations, while parallel lifting works up to weak bisimilarity for non-drop equations, offering a foundation for reasoning about general recursion and effects in type theory.

ABSTRACT

The delay monad provides a way to introduce general recursion in type theory. To write programs that use a wide range of computational effects directly in type theory, we need to combine the delay monad with the monads of these effects. Here we present a first systematic study of such combinations. We study both the coinductive delay monad and its guarded recursive cousin, giving concrete examples of combining these with well-known computational effects. We also provide general theorems stating which algebraic effects distribute over the delay monad, and which do not. Lastly, we salvage some of the impossible cases by considering distributive laws up to weak bisimilarity.

Motivation & Objective

  • To develop a formal framework for combining the delay monad with computational effects in type theory.
  • To investigate which monads can and cannot distribute over the delay monad using distributive laws.
  • To extend existing theory of monad compositions to include the delay monad’s unique algebraic structure.
  • To explore the role of guarded recursion in enabling stronger monad compositions than coinductive approaches.
  • To address limitations in distributive laws for idempotent or non-balanced equations, and propose alternatives using weak bisimilarity.

Proposed method

  • Formalizing the coinductive and guarded recursive delay monads in Clocked Cubical Type Theory (CCTT).
  • Defining two lifting strategies—sequential and parallel—for distributing monadic operations over delay steps.
  • Proving that sequential lifting yields a distributive law for monads presented by algebraic theories with balanced equations.
  • Demonstrating that parallel lifting defines a distributive law up to weak bisimilarity for monads with non-drop equations.
  • Using guarded recursion to ensure productivity and causality in recursive constructions.
  • Leveraging the fixed point operator in the guarded variant to support higher-order recursion directly in type theory.

Experimental results

Research questions

  • RQ1Which monads admit distributive laws over the delay monad, and under what algebraic conditions?
  • RQ2Why do distributive laws fail for monads with idempotent or unbalanced equations, such as the finite powerset monad?
  • RQ3Can parallel lifting be salvaged as a distributive law when standard laws fail, and under what equivalence relation?
  • RQ4How does guarded recursion improve the expressivity of monad compositions compared to coinductive delay?
  • RQ5To what extent can results over the guarded delay monad be transferred to the coinductive setting in Set?

Key findings

  • Sequential lifting of operations provides a valid distributive law for monads with balanced equations, such as lists, trees, and multisets.
  • No distributive law exists for monads with a commutative and idempotent binary operation (e.g., finite powerset) over the guarded delay monad Dκ.
  • Parallel lifting does not yield a standard distributive law but defines one up to weak bisimilarity for monads with non-drop equations.
  • The guarded delay monad supports a fixed point operator of type ((X → DκY) → (X → DκY)) → (X → DκY), enabling direct embedding of higher-order recursive languages.
  • The coinductive delay monad lacks such a fixed point operator and requires continuity assumptions or iteration operators, imposing a burden on higher-order programming.
  • The results can be transferred to Set for some cases (e.g., Proposition 6.3 and Example 6.5), but full transfer requires re-proving productivity using guarded recursion.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.