Correctness by construction for probabilistic programs

07/30/2020
βˆ™
by   Annabelle McIver, et al.
βˆ™
0
βˆ™

The "correct by construction" paradigm is an important component of modern Formal Methods, and here we use the probabilistic Guarded-Command Language 𝑝𝐺𝐢𝐿 to illustrate its application to π‘π‘Ÿπ‘œπ‘π‘Žπ‘π‘–π‘™π‘–π‘ π‘‘π‘–π‘ programming. 𝑝𝐺𝐢𝐿 extends Dijkstra's guarded-command language 𝐺𝐢𝐿 with probabilistic choice, and is equipped with a correctness-preserving refinement relation (βŠ‘) that enables compact, abstract specifications of probabilistic properties to be transformed gradually to concrete, executable code by applying mathematical insights in a systematic and layered way. Characteristically for "correctness by construction", as far as possible the reasoning in each refinement-step layer does not depend on earlier layers, and does not affect later ones. We demonstrate the technique by deriving a fair-coin implementation of any given discrete probability distribution. In the special case of simulating a fair die, our correct-by-construction algorithm turns out to be "within spitting distance" of Knuth and Yao's optimal solution.

READ FULL TEXT

Please sign up or login with your details

Forgot password? Click here to reset