Saved in:
Bibliographic Details
Main Authors: Hetzenberger, Matthias, Moser, Georg, Zuleger, Florian
Format: Preprint
Published: 2025
Subjects:
Online Access:https://arxiv.org/abs/2508.14249
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915452149563392
author Hetzenberger, Matthias
Moser, Georg
Zuleger, Florian
author_facet Hetzenberger, Matthias
Moser, Georg
Zuleger, Florian
contents Probabilistic programming and the formal analysis of probabilistic algorithms are active areas of research, driven by the widespread use of randomness to improve performance. While functional correctness has seen substantial progress, automated reasoning about expected runtime remains comparatively limited. In this work, we address this challenge by introducing a refinement-typed probability monad in Liquid Haskell. Our monad enables automated reasoning about expected values and costs by encoding probabilistic behaviour directly in types. Initially defined for discrete distributions over finite support, it is extended to support infinite distributions via an axiomatic approach. By leveraging Liquid Haskell's SMT-based refinement type checking, our framework provides a high degree of automation. We evaluate our approach through four case studies: meldable heaps, coupon collector, randomised quicksort, and zip trees. The first two demonstrate automation with minimal annotation overhead. The latter two showcase how our monad integrates with interactive proofs, including the first formal verification of the expected runtime of zip trees.
format Preprint
id arxiv_https___arxiv_org_abs_2508_14249
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle To Zip Through the Cost Analysis of Probabilistic Programs
Hetzenberger, Matthias
Moser, Georg
Zuleger, Florian
Logic in Computer Science
Probabilistic programming and the formal analysis of probabilistic algorithms are active areas of research, driven by the widespread use of randomness to improve performance. While functional correctness has seen substantial progress, automated reasoning about expected runtime remains comparatively limited. In this work, we address this challenge by introducing a refinement-typed probability monad in Liquid Haskell. Our monad enables automated reasoning about expected values and costs by encoding probabilistic behaviour directly in types. Initially defined for discrete distributions over finite support, it is extended to support infinite distributions via an axiomatic approach. By leveraging Liquid Haskell's SMT-based refinement type checking, our framework provides a high degree of automation. We evaluate our approach through four case studies: meldable heaps, coupon collector, randomised quicksort, and zip trees. The first two demonstrate automation with minimal annotation overhead. The latter two showcase how our monad integrates with interactive proofs, including the first formal verification of the expected runtime of zip trees.
title To Zip Through the Cost Analysis of Probabilistic Programs
topic Logic in Computer Science
url https://arxiv.org/abs/2508.14249