Book contents
- Frontmatter
- Contents
- List of Contributors
- Preface
- 1 Semantics of Probabilistic Programming: A Gentle Introduction
- 2 Probabilistic Programs as Measures
- 3 Application ofComputable Distributions to the Semantics of Probabilistic Programs
- 4 On Probabilistic λ-Calculi
- 5 Probabilistic Couplings from Program Logics
- 6 Expected Runtime Analyis by Program Verification
- 7 Termination Analysis of Probabilistic Programs with Martingales
- 8 Quantitative Analysis of Programs with Probabilities and Concentration of Measure Inequalities
- 9 The Logical Essentials of Bayesian Reasoning
- 10 Quantitative Equational Reasoning
- 11 Probabilistic Abstract Interpretation: Sound Inference and Application to Privacy
- 12 Quantitative Information Flow with Monads in Haskell
- 13 Luck: A Probabilistic Language for Testing
- 14 Tabular: Probabilistic Inference from the Spreadsheet
- 15 Programming Unreliable Hardware
13 - Luck: A Probabilistic Language for Testing
Published online by Cambridge University Press: 18 November 2020
- Frontmatter
- Contents
- List of Contributors
- Preface
- 1 Semantics of Probabilistic Programming: A Gentle Introduction
- 2 Probabilistic Programs as Measures
- 3 Application ofComputable Distributions to the Semantics of Probabilistic Programs
- 4 On Probabilistic λ-Calculi
- 5 Probabilistic Couplings from Program Logics
- 6 Expected Runtime Analyis by Program Verification
- 7 Termination Analysis of Probabilistic Programs with Martingales
- 8 Quantitative Analysis of Programs with Probabilities and Concentration of Measure Inequalities
- 9 The Logical Essentials of Bayesian Reasoning
- 10 Quantitative Equational Reasoning
- 11 Probabilistic Abstract Interpretation: Sound Inference and Application to Privacy
- 12 Quantitative Information Flow with Monads in Haskell
- 13 Luck: A Probabilistic Language for Testing
- 14 Tabular: Probabilistic Inference from the Spreadsheet
- 15 Programming Unreliable Hardware
Summary
Property-based random testing á la QuickCheck requires building efficient generators for well-distributed random data satisfying complex logical predicates, but writing these generators can be difficult and error prone. This chapter introduces a probabilistic domain-specific language in which generators are conveniently expressed by decorating predicates with lightweight annotations to control both the distribution of generated values and the amount of constraint solving that happens before each variable is instantiated. This language, called Luck, makes generators easier to write, read and maintain. We give Luck a probabilistic formal semantics and prove several fundamental properties, including the soundness and completeness of random generation with respect to a standard predicate semantics. We evaluate Luck on common examples from the property-based testing literature and on two significant case studies, showing that it can be used in complex domains with comparable bug-finding effectiveness and a significant reduction in testing code size compared to handwritten generators.
Keywords
- Type
- Chapter
- Information
- Foundations of Probabilistic Programming , pp. 449 - 488Publisher: Cambridge University PressPrint publication year: 2020
- Creative Commons
- This content is Open Access and distributed under the terms of the Creative Commons Attribution licence CC-BY 4.0 https://creativecommons.org/cclicenses/