Lazy Intermediate Representations for Algebraic Effects
Simon Castellan, Hugo Paquet
摘要
A lazy program interpreter postpones computation until the result is actually needed. This is typically more efficient than an eager (or call-by-value) interpreter, but a concern is that the semantics is not generally preserved.
We propose a new semantic analysis of lazy evaluation that relies on a subtle combination of name generation and read-only state. Our perspective is that laziness arises from a hybrid evaluation strategy, in which only the name generation follows call-by-value.
This semantic model suggests better intermediate representations of sum and product types in a lazy interpreter, along with equations that justify further optimizations. We illustrate this with an implementation in OCaml. Our motivation is practical: the origin of this work is a realworld application of discrete probabilistic programming, in which large algebraic data types cause significant performance issues with a call-by-value interpreter. Our lazy semantics justifies better optimized representations, and provides principled foundations for other methods involving laziness in probabilistic programming.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
脉络
它引用的 Paper5
- Affine Monads and Lazy Structures for Bayesian ProgrammingSwaraj Dash, Younesse Kaddar, Hugo Paquet, Sam StatonPOPL 2023 · 12 次引用
- Adequacy for Algebraic Effects RevisitedG. A. KavvosOOPSLA 2025 · 6 次引用
- Roulette: A Language for Expressive, Exact, and Efficient Discrete Probabilistic ProgrammingCameron Moy, Jack Czenszak, John M. Li, Brianna Marshall 等PLDI 2025 · 3 次引用
- Stochastic Lazy Knowledge Compilation for Inference in Discrete Probabilistic ProgramsMaddy Bowers, Alexander K. Lew, Joshua B. Tenenbaum, Armando Solar-Lezama 等PLDI 2025 · 2 次引用
- Categorical Semantics of Probabilistic Symbolic ExecutionJohn M. Li, Jack Czenszak, Steven HoltzenPLDI 2026
相关 Paper
- Exact Recursive Probabilistic ProgrammingDavid Chiang, Colin McDonald, Chung-chieh ShanOOPSLA 2023 · 12 次引用
- Compiling Probabilistic Programs for Variable Elimination with Information FlowJianlin Li, Eric Wang, Yizhou ZhangPLDI 2024 · 6 次引用
- Exact Bayesian Inference for Loopy Probabilistic Programs using Generating FunctionsLutz Klinkenberg, Christian Blumenthal, Mingshuai Chen, Darion Haase 等OOPSLA 2024 · 11 次引用
- Probabilistic programming semantics for name generationMarcin Sabok, Sam Staton, Dario Stein, Michael WolmanPOPL 2021 · 2 次引用
- Semantics for variational Quantum programmingXiaodong Jia, Andre Kornell, Bert Lindenhovius, Michael W. Mislove 等POPL 2022 · 15 次引用
