The Search for Constrained Random Generators

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Goldstein, Harrison, Peleg, Hila, Torczon, Cassia, Sainati, Daniel, Lampropoulos, Leonidas, Pierce, Benjamin C.
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866911590418219008
author Goldstein, Harrison
Peleg, Hila
Torczon, Cassia
Sainati, Daniel
Lampropoulos, Leonidas
Pierce, Benjamin C.
author_facet Goldstein, Harrison
Peleg, Hila
Torczon, Cassia
Sainati, Daniel
Lampropoulos, Leonidas
Pierce, Benjamin C.
contents Among the biggest challenges in property-based testing (PBT) is the constrained random generation problem: given a predicate on program values, randomly sample from the set of all values satisfying that predicate, and only those values. Efficient solutions to this problem are critical, since the executable specifications used by PBT often have preconditions that input values must satisfy in order to be valid test cases, and satisfying values are often sparsely distributed. We propose a novel approach to this problem using ideas from deductive program synthesis. We present a set of synthesis rules, based on a denotational semantics of generators, that give rise to an automatic procedure for synthesizing correct generators. Our system handles recursive predicates by rewriting them as catamorphisms and then matching with appropriate anamorphisms; this is theoretically simpler than other approaches to synthesis for recursive functions, yet still extremely expressive. Our implementation, Palamedes, is an extensible library for the Lean theorem prover. The synthesis algorithm itself is built on standard proof-search tactics, reducing implementation burden and allowing the algorithm to benefit from further advances in Lean proof automation.
format Preprint
id arxiv_https___arxiv_org_abs_2511_12253
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle The Search for Constrained Random Generators
Goldstein, Harrison
Peleg, Hila
Torczon, Cassia
Sainati, Daniel
Lampropoulos, Leonidas
Pierce, Benjamin C.
Programming Languages
Among the biggest challenges in property-based testing (PBT) is the constrained random generation problem: given a predicate on program values, randomly sample from the set of all values satisfying that predicate, and only those values. Efficient solutions to this problem are critical, since the executable specifications used by PBT often have preconditions that input values must satisfy in order to be valid test cases, and satisfying values are often sparsely distributed. We propose a novel approach to this problem using ideas from deductive program synthesis. We present a set of synthesis rules, based on a denotational semantics of generators, that give rise to an automatic procedure for synthesizing correct generators. Our system handles recursive predicates by rewriting them as catamorphisms and then matching with appropriate anamorphisms; this is theoretically simpler than other approaches to synthesis for recursive functions, yet still extremely expressive. Our implementation, Palamedes, is an extensible library for the Lean theorem prover. The synthesis algorithm itself is built on standard proof-search tactics, reducing implementation burden and allowing the algorithm to benefit from further advances in Lean proof automation.
title The Search for Constrained Random Generators
topic Programming Languages
url https://arxiv.org/abs/2511.12253