Abstract
This article investigates the semantic intricacies of conditioning, a main feature in probabilistic programming. Our study is based on an extension of the imperative probabilistic guarded command language pGCL with conditioning. We provide a weakest precondition (wp) semantics and an operational semantics. To deal with possibly diverging program behavior, we consider liberal preconditions. We show that diverging program behavior plays a key role when defining conditioning. We establish that weakest preconditions coincide with conditional expected rewards in Markov chains—the operational semantics—and that the wp-semantics conservatively extends the existing semantics of pGCL (without conditioning). An extension of these results with nondeterminism turns out to be problematic: although an operational semantics using Markov decision processes is rather straightforward, we show that providing an inductive wp-semantics in this setting is impossible. Finally, we present two program transformations that eliminate conditioning from any program. The first transformation hoists conditioning while updating the probabilistic choices in the program, while the second transformation replaces conditioning—in the same vein as rejection sampling—by a program with loops. In addition, we present a last program transformation that replaces an independent identically distributed loop with conditioning.
Highlights
Probabilistic programs support random choices like “execute program c1 with probability 1/3 and program c2 with probability 2/3"
This paper presented an in–depth study of the notion of conditioning in a simple imperative probabilistic programming language
The semantics have been used to prove the correctness of three program transformations, two of which remove conditioning, while one replaces a loop by an observe
Summary
Probabilistic programs support random choices like “execute program c1 with probability 1/3 and program c2 with probability 2/3". Note that programs with (probabilistic) assertions must be loop–free to avoid similar problems [48]; other approaches insist on the absence of diverging loops [13] While in this sample program it is immediate to see that the event to which we condition has probability zero, in general it might be highly non–trivial to identify this. Contributions of This Paper This paper provides a semantics of pGCL with conditioning This includes probabilistic choice, abortion and conditioning by means of observe statements. The model presented captures the essence of our operational semantics in a faithful and comprehensive manner
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
More From: ACM Transactions on Programming Languages and Systems
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.