A Theory of Slicing for Probabilistic Control Flow Graphs

  • Torben AmtoftEmail author
  • Anindya Banerjee
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9634)


We present a theory for slicing probabilistic imperative programs—containing random assignment and “observe” statements—represented as control flow graphs whose nodes transform probability distributions. We show that such a representation allows direct adaptation of standard machinery such as data and control dependence, postdominators, relevant variables, etc. to the probabilistic setting. We separate the specification of slicing from its implementation: first we develop syntactic conditions that a slice must satisfy; next we prove that any such slice is semantically correct; finally we give an algorithm to compute the least slice. A key feature of our syntactic conditions is that they involve two disjoint slices such that the variables of one slice are probabilistically independent of the variables of the other. This leads directly to a proof of correctness of probabilistic slicing.



Thanks to Gordon Stewart for comments on earlier drafts.


  1. 1.
    Amtoft, T.: Slicing for modern program structures: a theory for eliminating irrelevant loops. Inf. Process. Lett. 106(2), 45–51 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Amtoft, T., Banerjee, A.: A theory of slicing for probabilistic control flow graphs. Technical Report CIS TR 2015-1, Kansas State University, July 2015.
  3. 3.
    Ball, T., Horwitz, S.: Slicing programs with arbitrary control flow. In: Fritzson, P.A. (ed.) AADEBUG 1993. LNCS, vol. 749, pp. 206–222. Springer, Heidelberg (1993)CrossRefGoogle Scholar
  4. 4.
    Blazy, S., Maroneze, A., Pichardie, D.: Verified validation of program slicing. In: Proceedings of the 2015 Conference on Certified Programs and Proofs, CPP 2015, pp. 109–117. ACM, New York (2015)Google Scholar
  5. 5.
    Danicic, S., Barraclough, R.W., Harman, M., Howroyd, J.D., Kiss, Á., Laurence, M.R.: A unifying theory of control dependence and its application to arbitrary program structures. Theor. Comput. Sci. 412(49), 6809–6842 (2011)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Gordon, A.D., Henzinger, T.A., Nori, A.V., Rajamani, S.K.: Probabilistic programming. In: Dwyer, M.B., Herbsleb, J. (eds.) ICSE, Future of Software Engineering track, FOSE 2014, pp. 167–181. ACM, New York (2014)Google Scholar
  7. 7.
    Hur, C.-K., Nori, A.V., Rajamani, S.K., Samuel, S.: Slicing probabilistic programs. In: Pingali, K. (ed.) Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2014, pp. 133–144. ACM, New York (2014)Google Scholar
  8. 8.
    Kozen, D.: Semantics of probabilistic programs. J. Comput. Syst. Sci. 22, 328–350 (1981)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Panangaden, P.: Labelled Markov Processes. Imperial College Press, London (2009)CrossRefzbMATHGoogle Scholar
  10. 10.
    Podgurski, A., Clarke, L.A.: A formal model of program dependences and its implications for software testing, debugging, and maintenance. IEEE Trans. Softw. Eng. 16(9), 965–979 (1990)CrossRefGoogle Scholar
  11. 11.
    Ranganath, V.P., Amtoft, T., Banerjee, A., Hatcliff, J., Dwyer, M.B.: A new foundation for control dependence and slicing for modern program structures. ACM Trans. Program. Lang. Syst. (TOPLAS), 29(5), Aug 2007. (A special issue with extended versions of selected papers from the 14th European Symposium on Programming (ESOP’05))Google Scholar
  12. 12.
    Tip, F.: A survey of program slicing techniques. J. Program. Lang. 3, 121–189 (1995)Google Scholar
  13. 13.
    Wasserrab, D.: From Formal Semantics to Verified Slicing. Ph.D. thesis, Karlsruher Institut für Technologie (2010)Google Scholar
  14. 14.
    Weiser, M.: Program slicing. IEEE Trans. Softw. Eng. 10(4), 352–357 (1984)CrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2016

Authors and Affiliations

  1. 1.Kansas State UniversityManhattanUSA
  2. 2.IMDEA Software InstituteMadridSpain

Personalised recommendations