Published June 5, 2024 | Version V1.0.0
Software Open

Story of Your Lazy Function's Life: A Bidirectional Demand Semantics for Mechanized Cost Analysis of Lazy Programs (Artifact)

  • 1. ROR icon Portland State University
  • 2. ROR icon University of Toronto
  • 3. ROR icon Chalmers University of Technology
  • 4. ROR icon University of Pennsylvania

Description

The Coq formalization of paper "Story of Your Lazy Function’s Life: A Bidirectional Demand Semantics for Mechanized Cost Analysis of Lazy Programs".

Original abstract of the paper:

Lazy evaluation is a powerful tool that enables better compositionality and potentially better performance in functional programming, but it is challenging to analyze its computation cost. Existing works either require manually annotating sharing, or rely on separation logic to reason about heaps of mutable cells. In this paper, we propose a bidirectional demand semantics that allows for reasoning about the computation cost of lazy programs without relying on special program logics. To show the effectiveness of our approach, we apply the demand semantics to a variety of case studies including insertion sort, selection sort, Okasaki's banker's queue, and the implicit queue. We formally prove that the banker's queue and the implicit queue are both amortized and persistent using the Rocq Prover (formerly known as Coq). We also propose the reverse physicist's method, a novel variant of the classical physicist's method, which enables mechanized, modular and compositional reasoning about amortization and persistence with the demand semantics.

Files

README.md

Files (2.1 GB)

Name Size Download all
md5:f686bb641d99f6e650638528e705ed01
93.4 kB Download
md5:3cc2f4997b505fb2c51c2435d4eec555
11.6 kB Preview Download
md5:d810640ef9e053a5f43236f7e2783a1c
2.1 GB Download

Additional details

Funding

SHF: Small: Mechanized reasoning for functional programs 2006535
National Science Foundation
REU Site: Research Experience for undergraduates in Programming Languages (REPL) 2244494
National Science Foundation

Software