Error Credits: Resourceful Reasoning about Error Bounds for Higher-Order Probabilistic Programs

Alejandro Aguirre,Philipp G. Haselwarter,Markus de Medeiros,Kwing Hei Li,Simon Oddershede Gregersen,Joseph Tassarotti,Lars Birkedal
2024-04-22
Abstract:Probabilistic programs often trade accuracy for efficiency, and are thus only approximately correct. It is important to obtain precise error bounds for these approximations, but existing approaches rely on simplifications that make the error bounds excesively coarse, or only apply to first-order programs. In this paper we present Eris, a higher-order separation logic for probabilistic programs written in an expressive higher-order language.
Logic in Computer Science,Programming Languages
What problem does this paper attempt to address?
The main problem that this paper attempts to solve is: **How to provide accurate error bounds for high - order probability programs**. Specifically, existing methods have two main problems when dealing with error bounds: 1. **Error bounds are too coarse**: Existing methods rely on simplifying assumptions, resulting in inaccurate error bounds. 2. **Only applicable to first - order programs**: Existing methods cannot be directly applied to more complex high - order programs. To solve these problems, the author proposes a new logical framework named **Eris**. Eris is a separation logic for high - order probability programs. It manages error bounds as resources by introducing the concept of "error credits". This method not only improves the accuracy of error bounds but also supports modular and compositional reasoning, so that errors in high - order programs can be processed more delicately. ### Main Contributions 1. **Eris Logical Framework**: - Proposed the first separation logic for high - order probability programs, which can handle random high - order programs written in the λrand_ref language. - Introduced "error credits" as resources, allowing more accurate calculation of error bounds and supporting value - dependent and expectation - preserving compositional reasoning. 2. **Modular Reasoning**: - Eris supports modular specification for high - order functions, making the reasoning of complex programs more concise and intuitive. 3. **Amortized Error Bounds**: - By treating error bounds as resources, Eris supports amortized error analysis for operations on random data structures, hiding implementation details and providing a unified error cost. 4. **Almost - Sure Termination**: - Eris also supports proving the almost - sure termination of Las Vegas algorithms through error credits, that is, the program terminates with probability 1. 5. **Formal Verification**: - All results have been mechanically verified in the Coq proof assistant, using the Iris separation logic framework and the Coquelicot real - analysis library. ### Example A specific example given in the paper is the specification of the List.iter function. By introducing error credits, Eris can allocate corresponding error credits for the processing of each list element and ensure that the overall error is within an acceptable range. This allows us to analyze and verify the behavior of probability programs more accurately. ### Summary The core objective of this paper is to provide a more accurate and modular error - bounds reasoning method for high - order probability programs by introducing the new logical framework Eris and the concept of "error credits", thereby increasing the trust and reliability of these programs.