skip to main content
research-article
Open access

A Theory of Slicing for Imperative Probabilistic Programs

Published: 17 April 2020 Publication History

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.

Formats available

You can view the full content in the following formats:

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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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_15
[16]
Dexter Kozen. 1981. Semantics of probabilistic programs. J. Comput. Syst. Sci. 22 (1981), 328--350.
[17]
Dexter Kozen. 1985. A probabilistic PDL. J. Comput. Syst. Sci. 30, 2 (Apr. 1985), 162--178.
[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.
[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.
[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.
[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.
[22]
Prakash Panangaden. 2009. Labelled Markov Processes. Imperial College Press.
[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.
[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).
[25]
David A. Schmidt. 1986. Denotational Semantics, a Methodology for Language Development. Allyn and Bacon, Boston.
[26]
Frank Tip. 1995. A survey of program slicing techniques. J. Prog. Lang. 3 (1995), 121--189.
[27]
Daniel Wasserrab. 2010. From Formal Semantics to Verified Slicing. Ph.D. Dissertation. Karlsruher Institut für Technologie.
[28]
Mark Weiser. 1984. Program slicing. IEEE Trans. Softw. Eng. 10, 4 (July 1984), 352--357.
[29]
Glynn Winskel. 1993. The Formal Semantics of Programming Languages. The MIT Press.

Cited By

View all
  • (2025)A Fixed Point Iteration Technique for Proving Correctness of Slicing for Probabilistic ProgramsLanguages, Compilers, Analysis - From Beautiful Theory to Useful Practice10.1007/978-3-032-08187-2_6(101-113)Online publication date: 25-Nov-2025
  • (2025)Slicing of Probabilistic Programs: A Review of Existing ApproachesACM Computing Surveys10.1145/376458158:3(1-40)Online publication date: 28-Aug-2025
  • (2025)Program Defect Detection Using Sensitive Slice Semantics with Control Flow Variable DependencyRecent Advances in Computer Science and Communications10.2174/012666255832126724072609322818:4Online publication date: Apr-2025
  • Show More Cited By

Recommendations

Comments