School of Computer Science and Engineering
UNSW,
Sydney 2052, Australia
The “correct by construction” paradigm can be applied to the development of probabilistic programs; here we use the well known semantics for pGCL, the probabilistic guarded-command language, to illustrate it. That languageās refinement relation enables compact, abstract specifications of probabilistic properties to be transformed gradually to concrete, executable code by applying mathematical insights in a systematic, layered way — and as far as possible, the reasoning in each 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 constructed algorithm is “within spitting distance” of Knuth and Yao's optimal solution.
@inproceedings{McIver_Morgan_20, paperurl = {https://trustworthy.systems/publications/papers/McIver_Morgan_20.pdf}, doi = {10.1007/978-3-030-61362-4\_12}, publisher = {Springer}, volume = {12476}, editor = {Tiziana Margaria and Bernhard Steffen}, series = {Lecture Notes in Computer Science}, booktitle = {Leveraging Applications of Formal Methods, Verification and Validation: Verification Principles---9th International Symposium on Leveraging Applications of Formal Methods, ISoLA 2020, Rhodes, Greece, October 20-30, 2020, Proceedings, Part {I}}, title = {Correctness by Construction for Probabilistic Programs}, pages = {216--239}, author = {Annabelle McIver and Carroll Morgan}, year = {2020}, url = {https://doi.org/10.1007/978-3-030-61362-4\_12} }