The Memorist Tale: Every Thunk Every Cost All At Once

Read full text
Authors: Xing Li, Yao Li, Peter Schachte, Christine Rizkallah
Cited by: 1
References: 39

Abstract

Abstract 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.

Fields of Study & Subjects

Educational Leadership and Practices Rhetoric and Communication Studies Leadership and Management in Organizations

Publication details

Journal / source
Lecture notes in computer science
Publisher
Springer Nature Switzerland
Pages
463–492
Publication date
1 January 2026
Language
EN