skip to main content
research-article
Open Access

A Theory of Slicing for Imperative Probabilistic Programs

Published:17 April 2020Publication History
Skip Abstract Section

Abstract

Dedicated to the memory of Sebastian Danicic.

We present a theory for slicing imperative probabilistic programs containing random assignments and “observe” statements for conditioning. We represent such programs as probabilistic control-flow graphs (pCFGs) whose nodes modify probability distributions. This allows direct adaptation of standard machinery such as data dependence, postdominators, relevant variables, and so on, to the probabilistic setting. We separate the specification of slicing from its implementation:

(1) first, we develop syntactic conditions that a slice must satisfy (they involve the existence of another disjoint slice such that the variables of the two slices are probabilistically independent of each other);

(2) next, we prove that any such slice is semantically correct;

(3) finally, we give an algorithm to compute the least slice.

To generate smaller slices, we may in addition take advantage of knowledge that certain loops will terminate (almost) always.

Our results carry over to the slicing of structured imperative probabilistic programs, as handled in recent work by Hur et al. For such a program, we can define its slice, which has the same “normalized” semantics as the original program; the proof of this property is based on a result proving the adequacy of the semantics of pCFGs w.r.t. the standard semantics of structured imperative probabilistic programs.

References

  1. Torben Amtoft. 2008. Slicing for modern program structures: A theory for eliminating irrelevant loops. Inf. Proc. Lett. 106, 2 (Apr. 2008), 45--51. DOI:https://doi.org/10.1016/j.ipl.2007.10.002Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Torben Amtoft and Anindya Banerjee. 2016. A theory of slicing for probabilistic control flow graphs. In Proceedings of the 19th International Conference on Foundations of Software Science and Computation Structures (FoSSaCS’16) (Lecture Notes in Computer Science), Bart Jacobs and Christof Löding (Eds.), Vol. 9634. Springer-Verlag, 180--196. DOI:https://doi.org/10.1007/978-3-662-49630-5_11Google ScholarGoogle ScholarCross RefCross Ref
  3. Thomas Ball and Susan Horwitz. 1993. Slicing programs with arbitrary control flow. In Proceedings of the 1st International Workshop on Automated and Algorithmic Debugging (AADEBUG’93) (LNCS), Peter Fritzon (Ed.), Vol. 749. Springer-Verlag, London, UK, 206--222. DOI:https://doi.org/10.1007/BFb0019410Google ScholarGoogle ScholarCross RefCross Ref
  4. Richard W. Barraclough, David Binkley, Sebastian Danicic, Mark Harman, Robert M. Hierons, Ákos Kiss, Mike Laurence, and Lahcen Ouarbya. 2010. A trajectory-based strict semantics for program slicing. Theoret. Comput. Sci. 411, 11 (2010), 1372--1386. DOI:https://doi.org/10.1016/j.tcs.2009.10.025Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Benjamin Bichsel, Timon Gehr, and Martin Vechev. 2018. Fine-grained semantics for probabilistic programs. In Programming Languages and Systems (ESOP’18) (LNCS), Amal Ahmed (Ed.), Vol. 10801. Springer International Publishing, Cham, 145--185. DOI:https://doi.org/10.1007/978-3-319-89884-1_6Google ScholarGoogle Scholar
  6. Sandrine Blazy, Andre Maroneze, and David Pichardie. 2015. Verified validation of program slicing. In Proceedings of the Conference on Certified Programs and Proofs (CPP’15). ACM, New York, NY, 109--117. DOI:https://doi.org/10.1145/2676724.2693169Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Olivier Bouissou, Eric Goubault, Sylvie Putot, Aleksandar Chakarov, and Sriram Sankaranarayanan. 2016. Uncertainty propagation using probabilistic affine forms and concentration of measure inequalities. In Proceedings of the 22nd International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS’16) (LNCS), Marsha Chechik and Jean-François Raskin (Eds.), Vol. 9636. Springer Berlin, 225--243. DOI:https://doi.org/10.1007/978-3-662-49674-9_13Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Aleksandar Chakarov and Sriram Sankaranarayanan. 2013. Probabilistic program analysis with martingales. In Computer Aided Verification, Natasha Sharygina and Helmut Veith (Eds.). Lecture Notes in Computer Science, Vol. 8044. Springer Berlin, 511--526. DOI:https://doi.org/10.1007/978-3-642-39799-8_34Google ScholarGoogle Scholar
  9. Sebastian Danicic, Richard W. Barraclough, Mark Harman, John D. Howroyd, Ákos Kiss, and Michael R. Laurence. 2011. A unifying theory of control dependence and its application to arbitrary program structures. Theoret. Comput. Sci. 412, 49 (Nov. 2011), 6809--6842. DOI:https://doi.org/10.1016/j.tcs.2011.08.033Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Luis María Ferrer Fioriti and Holger Hermanns. 2015. Probabilistic termination: Soundness, completeness, and compositionality. In Proceedings of the 42ndACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’15). 489--501. DOI:https://doi.org/10.1145/2676726.2677001Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Andrew D. Gordon, Thomas A. Henzinger, Aditya V. Nori, and Sriram K. Rajamani. 2014. Probabilistic programming. In Proceedings of the International Conference on Software Engineering (ICSE), Future of Software Engineering Track (FOSE’14), Matthew B. Dwyer and James Herbsleb (Eds.). ACM, New York, NY, 167--181. DOI:https://doi.org/10.1145/2593882.2593900Google ScholarGoogle Scholar
  12. Friedrich Gretz, Joost-Pieter Katoen, and Annabelle McIver. 2014. Operational versus weakest pre-expectation semantics for the probabilistic guarded command language. Perf. Eval. 73 (Mar. 2014), 110--132. DOI:https://doi.org/10.1016/j.peva.2013.11.004Google ScholarGoogle Scholar
  13. Chung-Kil Hur, Aditya V. Nori, Sriram K. Rajamani, and Selva Samuel. 2014. Slicing probabilistic programs. In Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’14), Keshav Pingali (Ed.). ACM, New York, NY, 133--144. DOI:https://doi.org/10.1145/2594291.2594303Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Benjamin Lucien Kaminski and Joost-Pieter Katoen. 2015. On the hardness of almost— termination. In Proceedings of the 40th International Symposium on Mathematical Foundations of Computer Science (MFCS’15) Proceedings, Part I, Giuseppe F. Italiano, Giovanni Pighizzini, and Donald T. Sannella (Eds.). Springer Berlin, 307--318. DOI:https://doi.org/10.1007/978-3-662-48057-1_24Google ScholarGoogle Scholar
  15. Benjamin Lucien Kaminski, Joost-Pieter Katoen, Christoph Matheja, and Federico Olmedo. 2016. Weakest precondition reasoning for expected run-times of probabilistic programs. In Proceedings of the 25th European Symposium on Programming (ESOP'16), Peter Thiemann (Ed.). Lecture Notes in Computer Science, vol. 9632. 364–389. https://doi.org/10.1007/978-3-662-49498-1_15Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Dexter Kozen. 1981. Semantics of probabilistic programs. J. Comput. Syst. Sci. 22 (1981), 328--350. DOI:https://doi.org/10.1016/0022-0000(81)90036-2Google ScholarGoogle ScholarCross RefCross Ref
  17. Dexter Kozen. 1985. A probabilistic PDL. J. Comput. Syst. Sci. 30, 2 (Apr. 1985), 162--178. DOI:https://doi.org/10.1016/0022-0000(85)90012-1Google ScholarGoogle ScholarCross RefCross Ref
  18. Jean-Christophe Léchenet, Nikolai Kosmatov, and Pascale Le Gall. 2016. Cut branches before looking for bugs: Sound verification on relaxed slices. In Proceedings of the Fundamental Approaches to Software Engineering Conference (FASE’16) (LNCS), Vol. 9633. Springer Verlag, 179--196. DOI:https://doi.org/10.1007/978-3-662-49665-7_11Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Annabelle McIver, Carroll Morgan, Benjamin Lucien Kaminski, and Joost-Pieter Katoen. 2018. A new proof rule for almost-sure termination. In Proceedings of the ACM on Programming Languages 2, POPL (2018), 33:1–33:28. DOI:https://doi.org/10.1145/3158121Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. David Monniaux. 2001. An abstract analysis of the probabilistic termination of programs. In Proceedings of the 8th International Static Analysis Symposium (SAS’01) (Lecture Notes in Computer Science), Vol. 2126. Springer Verlag, 111--126. DOI:https://doi.org/10.1007/3-540-47764-0_7Google ScholarGoogle ScholarCross RefCross Ref
  21. Federico Olmedo, Friedrich Gretz, Nils Jansen, Benjamin Lucien Kaminski, Joost-Pieter Katoen, and Annabelle McIver. 2018. Conditioning in probabilistic programming. ACM Trans. Prog. Lang. Syst. 40, 1, Article 4 (Jan. 2018), 50 pages. DOI:https://doi.org/10.1145/3156018Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Prakash Panangaden. 2009. Labelled Markov Processes. Imperial College Press.Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Andy Podgurski and Lori A. Clarke. 1990. A formal model of program dependences and its implications for software testing, debugging, and maintenance. IEEE Trans. Softw. Eng. 16, 9 (Sept. 1990), 965--979. DOI:https://doi.org/10.1109/32.58784Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Venkatesh Prasad Ranganath, Torben Amtoft, Anindya Banerjee, John Hatcliff, and Matthew B. Dwyer. 2007. A new foundation for control dependence and slicing for modern program structures. ACM Trans. Prog. Lang. Syst. 29, 5, Article 27 (Aug. 2007). DOI:https://doi.org/10.1145/1275497.1275502Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. David A. Schmidt. 1986. Denotational Semantics, a Methodology for Language Development. Allyn and Bacon, Boston.Google ScholarGoogle Scholar
  26. Frank Tip. 1995. A survey of program slicing techniques. J. Prog. Lang. 3 (1995), 121--189.Google ScholarGoogle Scholar
  27. Daniel Wasserrab. 2010. From Formal Semantics to Verified Slicing. Ph.D. Dissertation. Karlsruher Institut für Technologie.Google ScholarGoogle Scholar
  28. Mark Weiser. 1984. Program slicing. IEEE Trans. Softw. Eng. 10, 4 (July 1984), 352--357. DOI:https://doi.org/10.1109/TSE.1984.5010248Google ScholarGoogle Scholar
  29. Glynn Winskel. 1993. The Formal Semantics of Programming Languages. The MIT Press.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A Theory of Slicing for Imperative Probabilistic Programs

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in

          Full Access

          • Published in

            cover image ACM Transactions on Programming Languages and Systems
            ACM Transactions on Programming Languages and Systems  Volume 42, Issue 2
            June 2020
            286 pages
            ISSN:0164-0925
            EISSN:1558-4593
            DOI:10.1145/3395960
            Issue’s Table of Contents

            Copyright © 2020 ACM

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 17 April 2020
            • Accepted: 1 October 2019
            • Revised: 1 July 2019
            • Received: 1 October 2017
            Published in toplas Volume 42, Issue 2

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • research-article
            • Research
            • Refereed

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader

          HTML Format

          View this article in HTML Format .

          View HTML Format
          About Cookies On This Site

          We use cookies to ensure that we give you the best experience on our website.

          Learn more

          Got it!