A Theory of Slicing for Imperative Probabilistic Programs

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.

[1]  Chung-Kil Hur,et al.  Slicing probabilistic programs , 2014, PLDI.

[2]  Nikolai Kosmatov,et al.  Cut Branches Before Looking for Bugs: Sound Verification on Relaxed Slices , 2016, FASE.

[3]  Mark Harman,et al.  A unifying theory of control dependence and its application to arbitrary program structures , 2011, Theor. Comput. Sci..

[4]  Daniel Wasserrab From formal semantics to verified slicing: a modular framework with applications in language based security , 2011 .

[5]  Dexter Kozen,et al.  Semantics of probabilistic programs , 1979, 20th Annual Symposium on Foundations of Computer Science (sfcs 1979).

[6]  Mark Harman,et al.  A trajectory-based strict semantics for program slicing , 2010, Theor. Comput. Sci..

[7]  David Pichardie,et al.  Verified Validation of Program Slicing , 2015, CPP.

[8]  G. Winskel The formal semantics of programming languages , 1993 .

[9]  Holger Hermanns,et al.  Probabilistic Termination , 2015, POPL.

[10]  Torben Amtoft,et al.  Slicing for modern program structures: a theory for eliminating irrelevant loops , 2008, Inf. Process. Lett..

[11]  Frank Tip,et al.  A survey of program slicing techniques , 1994, J. Program. Lang..

[12]  Timon Gehr,et al.  Fine-Grained Semantics for Probabilistic Programs , 2018, ESOP.

[13]  Annabelle McIver,et al.  Conditioning in Probabilistic Programming , 2015, MFPS.

[14]  Matthew B. Dwyer,et al.  A new foundation for control dependence and slicing for modern program structures , 2005, TOPL.

[15]  Thomas Ball,et al.  Slicing Programs with Arbitrary Control-flow , 1993, AADEBUG.

[16]  David Monniaux An Abstract Analysis of the Probabilistic Termination of Programs , 2001, SAS.

[17]  Lori A. Clarke,et al.  A Formal Model of Program Dependences and Its Implications for Software Testing, Debugging, and Maintenance , 1990, IEEE Trans. Software Eng..

[18]  Sriram Sankaranarayanan,et al.  Probabilistic Program Analysis with Martingales , 2013, CAV.

[19]  David W. Binkley,et al.  Program slicing , 2008, 2008 Frontiers of Software Maintenance.

[20]  Torben Amtoft,et al.  A Theory of Slicing for Probabilistic Control Flow Graphs , 2016, FoSSaCS.

[21]  Annabelle McIver,et al.  A new proof rule for almost-sure termination , 2017, Proc. ACM Program. Lang..

[22]  Joost-Pieter Katoen,et al.  On the Hardness of Almost-Sure Termination , 2015, MFCS.

[23]  Sriram Sankaranarayanan,et al.  Uncertainty Propagation Using Probabilistic Affine Forms and Concentration of Measure Inequalities , 2016, TACAS.

[24]  Yue Yang,et al.  The Global Interests in the Process of Globalization , 2010 .

[25]  Prakash Panangaden,et al.  Labelled Markov Processes , 2009 .

[26]  Annabelle McIver,et al.  Operational versus weakest pre-expectation semantics for the probabilistic guarded command language , 2014, Perform. Evaluation.

[27]  David A. Schmidt,et al.  Denotationaisemantics: a methodology for language development , 1986 .

[28]  Dexter Kozen,et al.  A probabilistic PDL , 1983, J. Comput. Syst. Sci..

[29]  Joost-Pieter Katoen,et al.  Weakest Precondition Reasoning for Expected Run-Times of Probabilistic Programs , 2016, ESOP.

[30]  Thomas A. Henzinger,et al.  Probabilistic programming , 2014, FOSE.