Published January 23, 2026 | Version v1
Publication Open

The Memorist Tale: Every Thunk Every Cost All At Once (Extended Version)

  • 1. ROR icon University of Melbourne
  • 2. ROR icon Portland State University

Description

Lazy evaluation offers great flexibility by computing only what is necessary. However, analysing the cost of lazy programs is notoriously challenging, as computation occurs out of order and depends on future demands. Recent work has proposed alternative semantics for modelling lazy evaluation cost that avoid reasoning about program states. However, existing approaches either rely on nondeterminism or require complex bidirectional semantics. We present the Memorist Semantics, a novel semantics for analysing the cost of lazy programs by explicitly tracking the cost and dependencies of every subterm. Our semantics annotates components of a term with fine-grained cost and usage information, yielding a deterministic semantics that can be expressed through a simple monadic interface. We formalize the semantics in Rocq and verify
its soundness with respect to the existing Clairvoyance Semantics. Similar to prior formalized semantics, our semantics is defined for a total, typed language with built-in structural recursion and without support for first-class functions. We outline ideas for possible extensions.

 

This is an extended version with appendices of a publication accepted at the European Symposium on Programming 2026 (ESOP 2026), 

Files

paper-extended.pdf

Files (567.8 kB)

Name Size Download all
md5:4a650b7cfce897afcdf181b1e2698a65
567.8 kB Preview Download