a conditioned program slicer
play

A Conditioned Program Slicer Chris Fox, University of Essex 21st - PowerPoint PPT Presentation

Background Program Conditioning Examples of Conditioning Summary and Other Work A Conditioned Program Slicer Chris Fox, University of Essex 21st February 2005 Chris Fox, University of Essex A Conditioned Program Slicer Background Program


  1. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Another Example Consider: x := y; w := x; while (true) { w := 1; x := x + 1; } Slicing (backward) with respect to the value of w at the end of the program will give the code in red (the statements in gray can be “sliced away”.) Chris Fox, University of Essex A Conditioned Program Slicer

  2. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Another Example Consider: x := y; w := x; while (true) { w := 1; x := x + 1; } Slicing (backward) with respect to the value of w at the end of the program will give the code in red (the statements in gray can be “sliced away”.) This illustrates the impact that slicing can have on termination behaviour: it cannot be analysed as giving a simple projection of the (usual) semantics of the program. Chris Fox, University of Essex A Conditioned Program Slicer

  3. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Problematic Example There is a statement/line in the following program that is not involved in determining the final value of x in the following program. Chris Fox, University of Essex A Conditioned Program Slicer

  4. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Problematic Example There is a statement/line in the following program that is not involved in determining the final value of x in the following program. while (p(i)) { if (q(c)) { x := f(); c := g(); } ; i := h(i) } Chris Fox, University of Essex A Conditioned Program Slicer

  5. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Problematic Example There is a statement/line in the following program that is not involved in determining the final value of x in the following program. while (p(i)) { if (q(c)) { x := f(); c := g(); } ; i := h(i) } No conventional slicing algorithm can find it. Chris Fox, University of Essex A Conditioned Program Slicer

  6. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing is Not Trivial Chris Fox, University of Essex A Conditioned Program Slicer

  7. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing is Not Trivial Even just using statement deletion, slicing real programs is non-trivial: Chris Fox, University of Essex A Conditioned Program Slicer

  8. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing is Not Trivial Even just using statement deletion, slicing real programs is non-trivial: unstructured code ( breaks and returns ); 1 Chris Fox, University of Essex A Conditioned Program Slicer

  9. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing is Not Trivial Even just using statement deletion, slicing real programs is non-trivial: unstructured code ( breaks and returns ); 1 arrays, union types and pointers (& functions in C); 2 Chris Fox, University of Essex A Conditioned Program Slicer

  10. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing is Not Trivial Even just using statement deletion, slicing real programs is non-trivial: unstructured code ( breaks and returns ); 1 arrays, union types and pointers (& functions in C); 2 difficult to analyse with standard state-based semantics 3 Chris Fox, University of Essex A Conditioned Program Slicer

  11. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing is Not Trivial Even just using statement deletion, slicing real programs is non-trivial: unstructured code ( breaks and returns ); 1 arrays, union types and pointers (& functions in C); 2 difficult to analyse with standard state-based semantics 3 (non-termination behaviour changes); minimal slices are not computable. 4 Chris Fox, University of Essex A Conditioned Program Slicer

  12. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing is Not Trivial Even just using statement deletion, slicing real programs is non-trivial: unstructured code ( breaks and returns ); 1 arrays, union types and pointers (& functions in C); 2 difficult to analyse with standard state-based semantics 3 (non-termination behaviour changes); minimal slices are not computable. 4 How should we slice OO languages? Chris Fox, University of Essex A Conditioned Program Slicer

  13. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Varieties of Slicing Static Slicing compute the slice for all possible input values. Chris Fox, University of Essex A Conditioned Program Slicer

  14. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Varieties of Slicing Static Slicing compute the slice for all possible input values. Can be computed using a Program Dependence Graph, or by compositional analysis. Chris Fox, University of Essex A Conditioned Program Slicer

  15. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Varieties of Slicing Static Slicing compute the slice for all possible input values. Can be computed using a Program Dependence Graph, or by compositional analysis. Dynamic Slicing compute the slice for a completely specified input. Chris Fox, University of Essex A Conditioned Program Slicer

  16. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Varieties of Slicing Static Slicing compute the slice for all possible input values. Can be computed using a Program Dependence Graph, or by compositional analysis. Dynamic Slicing compute the slice for a completely specified input. Amorphous Slicing Allow more generic transformations. Chris Fox, University of Essex A Conditioned Program Slicer

  17. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Varieties of Slicing Static Slicing compute the slice for all possible input values. Can be computed using a Program Dependence Graph, or by compositional analysis. Dynamic Slicing compute the slice for a completely specified input. Amorphous Slicing Allow more generic transformations. Variable Dependence Extract relationships between input and output variables using a slicing algorithm. Chris Fox, University of Essex A Conditioned Program Slicer

  18. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Varieties of Slicing Static Slicing compute the slice for all possible input values. Can be computed using a Program Dependence Graph, or by compositional analysis. Dynamic Slicing compute the slice for a completely specified input. Amorphous Slicing Allow more generic transformations. Variable Dependence Extract relationships between input and output variables using a slicing algorithm. Conditioned Program Slicing (impose conditions on input variables, or program points, and use that information to decrease the size of a subsequent backward slice.) Chris Fox, University of Essex A Conditioned Program Slicer

  19. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Conditioning Conditioning = Chris Fox, University of Essex A Conditioned Program Slicer

  20. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Conditioning Conditioning = Symbolic Execution Chris Fox, University of Essex A Conditioned Program Slicer

  21. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Conditioning Conditioning = Symbolic Execution + Theorem Proving Chris Fox, University of Essex A Conditioned Program Slicer

  22. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Conditioning Conditioning = Symbolic Execution + Theorem Proving Symbolic Execution Chris Fox, University of Essex A Conditioned Program Slicer

  23. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Conditioning Conditioning = Symbolic Execution + Theorem Proving Symbolic Execution Ideally finds all the possible paths through a program, and the corresponding symbolic states Chris Fox, University of Essex A Conditioned Program Slicer

  24. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Conditioning Conditioning = Symbolic Execution + Theorem Proving Symbolic Execution Ideally finds all the possible paths through a program, and the corresponding symbolic states Theorem Proving Chris Fox, University of Essex A Conditioned Program Slicer

  25. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Conditioning Conditioning = Symbolic Execution + Theorem Proving Symbolic Execution Ideally finds all the possible paths through a program, and the corresponding symbolic states Theorem Proving Determines which of these paths are infeasible Chris Fox, University of Essex A Conditioned Program Slicer

  26. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Conditioning Conditioning = Symbolic Execution + Theorem Proving Symbolic Execution Ideally finds all the possible paths through a program, and the corresponding symbolic states Theorem Proving Determines which of these paths are infeasible, and hence which statements can be eliminated Chris Fox, University of Essex A Conditioned Program Slicer

  27. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Conditioning Conditioning = Symbolic Execution + Theorem Proving Symbolic Execution Ideally finds all the possible paths through a program, and the corresponding symbolic states Theorem Proving Determines which of these paths are infeasible, and hence which statements can be eliminated. Other kinds of reasoning and simplification are also possible (such as the simplification of expressions) Chris Fox, University of Essex A Conditioned Program Slicer

  28. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Conditioning Conditioning = Symbolic Execution + Theorem Proving Symbolic Execution Ideally finds all the possible paths through a program, and the corresponding symbolic states Theorem Proving Determines which of these paths are infeasible, and hence which statements can be eliminated. Other kinds of reasoning and simplification are also possible (such as the simplification of expressions) Conditioned Slicing Chris Fox, University of Essex A Conditioned Program Slicer

  29. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Conditioning Conditioning = Symbolic Execution + Theorem Proving Symbolic Execution Ideally finds all the possible paths through a program, and the corresponding symbolic states Theorem Proving Determines which of these paths are infeasible, and hence which statements can be eliminated. Other kinds of reasoning and simplification are also possible (such as the simplification of expressions) Conditioned Slicing program conditioning is combined with conventional backward slicing to give a conditioned-program slicer . Chris Fox, University of Essex A Conditioned Program Slicer

  30. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing and Conditioning Slicing Chris Fox, University of Essex A Conditioned Program Slicer

  31. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing and Conditioning Slicing We are only interested in the values of a subset of the program variables Chris Fox, University of Essex A Conditioned Program Slicer

  32. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing and Conditioning Slicing We are only interested in the values of a subset of the program variables; which parts of the program can safely be removed? Chris Fox, University of Essex A Conditioned Program Slicer

  33. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing and Conditioning Slicing We are only interested in the values of a subset of the program variables; which parts of the program can safely be removed? Conditioning Chris Fox, University of Essex A Conditioned Program Slicer

  34. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing and Conditioning Slicing We are only interested in the values of a subset of the program variables; which parts of the program can safely be removed? Conditioning We are only interested in a subset of the possible input values Chris Fox, University of Essex A Conditioned Program Slicer

  35. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing and Conditioning Slicing We are only interested in the values of a subset of the program variables; which parts of the program can safely be removed? Conditioning We are only interested in a subset of the possible input values; which parts of the program can safely be removed? Chris Fox, University of Essex A Conditioned Program Slicer

  36. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing and Conditioning Slicing We are only interested in the values of a subset of the program variables; which parts of the program can safely be removed? Conditioning We are only interested in a subset of the possible input values; which parts of the program can safely be removed? Conditioned Slicing Chris Fox, University of Essex A Conditioned Program Slicer

  37. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Slicing and Conditioning Slicing We are only interested in the values of a subset of the program variables; which parts of the program can safely be removed? Conditioning We are only interested in a subset of the possible input values; which parts of the program can safely be removed? Conditioned Slicing subsumes static and dynamic slicing. Chris Fox, University of Essex A Conditioned Program Slicer

  38. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Constraining the Context With conditioned slicing, we are interested in putting restrictions on possible input values. Chris Fox, University of Essex A Conditioned Program Slicer

  39. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Constraining the Context With conditioned slicing, we are interested in putting restrictions on possible input values. We could add conditions that quantify over the unique symbolic input values: Chris Fox, University of Essex A Conditioned Program Slicer

  40. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Constraining the Context With conditioned slicing, we are interested in putting restrictions on possible input values. We could add conditions that quantify over the unique symbolic input values: while ( p ) { . . . scanf("%d", &a); . . . } ; Chris Fox, University of Essex A Conditioned Program Slicer

  41. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Constraining the Context With conditioned slicing, we are interested in putting restrictions on possible input values. We could add conditions that quantify over the unique symbolic input values: ∀ n . ( a n > 0) while ( p ) { . . . scanf("%d", &a); . . . } ; Chris Fox, University of Essex A Conditioned Program Slicer

  42. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Constraining the Context With conditioned slicing, we are interested in putting restrictions on possible input values. We could add conditions that quantify over the unique symbolic input values: ∀ n . ( a n > 0) while ( p ) { . . . scanf("%d", &a); . . . } ; In our implementation, we adopt the simpler approach of using statements of the form assert( condition ) : Chris Fox, University of Essex A Conditioned Program Slicer

  43. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Constraining the Context With conditioned slicing, we are interested in putting restrictions on possible input values. We could add conditions that quantify over the unique symbolic input values: ∀ n . ( a n > 0) while ( p ) { . . . scanf("%d", &a); . . . } ; In our implementation, we adopt the simpler approach of using statements of the form assert( condition ) : while ( p ) { . . . scanf("%d", &a); . . . } Chris Fox, University of Essex A Conditioned Program Slicer

  44. Background Slicing Program Conditioning Conditioning Examples of Conditioning Slicing and Conditioning Summary and Other Work Constraining the Context Constraining the Context With conditioned slicing, we are interested in putting restrictions on possible input values. We could add conditions that quantify over the unique symbolic input values: ∀ n . ( a n > 0) while ( p ) { . . . scanf("%d", &a); . . . } ; In our implementation, we adopt the simpler approach of using statements of the form assert( condition ) : while ( p ) { . . . scanf("%d", &a); assert(a>0); . . . } Chris Fox, University of Essex A Conditioned Program Slicer

  45. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Chris Fox, University of Essex A Conditioned Program Slicer

  46. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source Chris Fox, University of Essex A Conditioned Program Slicer

  47. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z Chris Fox, University of Essex A Conditioned Program Slicer

  48. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z x 0 y 0 z 0 Chris Fox, University of Essex A Conditioned Program Slicer

  49. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z x 0 y 0 z 0 x := z; Chris Fox, University of Essex A Conditioned Program Slicer

  50. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z x 0 y 0 z 0 x := z; z 0 y 0 z 0 Chris Fox, University of Essex A Conditioned Program Slicer

  51. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z x 0 y 0 z 0 x := z; z 0 y 0 z 0 y := x + z; Chris Fox, University of Essex A Conditioned Program Slicer

  52. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z x 0 y 0 z 0 x := z; z 0 y 0 z 0 z 0 + z 0 y := x + z; z 0 z 0 Chris Fox, University of Essex A Conditioned Program Slicer

  53. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z x 0 y 0 z 0 x := z; z 0 y 0 z 0 z 0 + z 0 y := x + z; z 0 z 0 Theorem Proving Chris Fox, University of Essex A Conditioned Program Slicer

  54. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z x 0 y 0 z 0 x := z; z 0 y 0 z 0 z 0 + z 0 y := x + z; z 0 z 0 Theorem Proving Does y==2*z ? Chris Fox, University of Essex A Conditioned Program Slicer

  55. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z x 0 y 0 z 0 x := z; z 0 y 0 z 0 z 0 + z 0 y := x + z; z 0 z 0 Theorem Proving Does y==2*z ? From the symbolic state, this is true if: z 0 + z 0 = 2 z 0 Chris Fox, University of Essex A Conditioned Program Slicer

  56. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z x 0 y 0 z 0 x := z; z 0 y 0 z 0 z 0 + z 0 y := x + z; z 0 z 0 Theorem Proving Does y==2*z ? From the symbolic state, this is true if: z 0 + z 0 = 2 z 0 Is x < y ? Chris Fox, University of Essex A Conditioned Program Slicer

  57. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z x 0 y 0 z 0 x := z; z 0 y 0 z 0 z 0 + z 0 y := x + z; z 0 z 0 Theorem Proving Does y==2*z ? From the symbolic state, this is true if: z 0 + z 0 = 2 z 0 Is x < y ? True if z 0 < 2 z 0 . Chris Fox, University of Essex A Conditioned Program Slicer

  58. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Symbolic Execution and Theorem Proving “Execution” of the program, but where all unknown and input values are represented by symbolic values. Program Source x y z x 0 y 0 z 0 x := z; z 0 y 0 z 0 z 0 + z 0 y := x + z; z 0 z 0 Theorem Proving Does y==2*z ? From the symbolic state, this is true if: z 0 + z 0 = 2 z 0 Is x < y ? True if z 0 < 2 z 0 . What if z is negative? Chris Fox, University of Essex A Conditioned Program Slicer

  59. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Combining Symbolic States The symbolic executor finds a set of pairs of path conditions and symbolic states . Chris Fox, University of Essex A Conditioned Program Slicer

  60. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Combining Symbolic States The symbolic executor finds a set of pairs of path conditions and symbolic states . When encountering a condition if ( p ) s else t , each ( path = ⇒ state ) pair is replaced by the results of: Chris Fox, University of Essex A Conditioned Program Slicer

  61. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Combining Symbolic States The symbolic executor finds a set of pairs of path conditions and symbolic states . When encountering a condition if ( p ) s else t , each ( path = ⇒ state ) pair is replaced by the results of: symbolically execution s in the context of path ∪ { p } ; 1 Chris Fox, University of Essex A Conditioned Program Slicer

  62. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Combining Symbolic States The symbolic executor finds a set of pairs of path conditions and symbolic states . When encountering a condition if ( p ) s else t , each ( path = ⇒ state ) pair is replaced by the results of: symbolically execution s in the context of path ∪ { p } ; 1 symbolically execution t in the context of path ∪ {¬ p } ; 2 Chris Fox, University of Essex A Conditioned Program Slicer

  63. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Combining Symbolic States The symbolic executor finds a set of pairs of path conditions and symbolic states . When encountering a condition if ( p ) s else t , each ( path = ⇒ state ) pair is replaced by the results of: symbolically execution s in the context of path ∪ { p } ; 1 symbolically execution t in the context of path ∪ {¬ p } ; 2 With while loops present additional complexities. Chris Fox, University of Essex A Conditioned Program Slicer

  64. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Combining Symbolic States The symbolic executor finds a set of pairs of path conditions and symbolic states . When encountering a condition if ( p ) s else t , each ( path = ⇒ state ) pair is replaced by the results of: symbolically execution s in the context of path ∪ { p } ; 1 symbolically execution t in the context of path ∪ {¬ p } ; 2 With while loops present additional complexities. We have chosen to implement a conservative approximation. Chris Fox, University of Essex A Conditioned Program Slicer

  65. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Chris Fox, University of Essex A Conditioned Program Slicer

  66. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Initial value Chris Fox, University of Essex A Conditioned Program Slicer

  67. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Initial value When v is referenced prior to being assigned a value Chris Fox, University of Essex A Conditioned Program Slicer

  68. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Initial value When v is referenced prior to being assigned a value, it is given a unique, uninterpreted constant value, v 0 . Chris Fox, University of Essex A Conditioned Program Slicer

  69. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Initial value When v is referenced prior to being assigned a value, it is given a unique, uninterpreted constant value, v 0 . Input value Chris Fox, University of Essex A Conditioned Program Slicer

  70. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Initial value When v is referenced prior to being assigned a value, it is given a unique, uninterpreted constant value, v 0 . Input value When v receives a value in an input ( scanf ) statement Chris Fox, University of Essex A Conditioned Program Slicer

  71. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Initial value When v is referenced prior to being assigned a value, it is given a unique, uninterpreted constant value, v 0 . Input value When v receives a value in an input ( scanf ) statement, it is given a unique, uninterpreted constant value, v n . Chris Fox, University of Essex A Conditioned Program Slicer

  72. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Initial value When v is referenced prior to being assigned a value, it is given a unique, uninterpreted constant value, v 0 . Input value When v receives a value in an input ( scanf ) statement, it is given a unique, uninterpreted constant value, v n . Within loops Chris Fox, University of Essex A Conditioned Program Slicer

  73. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Initial value When v is referenced prior to being assigned a value, it is given a unique, uninterpreted constant value, v 0 . Input value When v receives a value in an input ( scanf ) statement, it is given a unique, uninterpreted constant value, v n . Within loops When v is assigned a value within a loop body Chris Fox, University of Essex A Conditioned Program Slicer

  74. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Initial value When v is referenced prior to being assigned a value, it is given a unique, uninterpreted constant value, v 0 . Input value When v receives a value in an input ( scanf ) statement, it is given a unique, uninterpreted constant value, v n . Within loops When v is assigned a value within a loop body, we associate the variable with an uninterpreted value v p Chris Fox, University of Essex A Conditioned Program Slicer

  75. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Initial value When v is referenced prior to being assigned a value, it is given a unique, uninterpreted constant value, v 0 . Input value When v receives a value in an input ( scanf ) statement, it is given a unique, uninterpreted constant value, v n . Within loops When v is assigned a value within a loop body, we associate the variable with an uninterpreted value v p , conceptually on the penultimate execution of the loop Chris Fox, University of Essex A Conditioned Program Slicer

  76. Background Symbolic Execution and Theorem Proving Program Conditioning Combining Symbolic States Examples of Conditioning Uninterpreted Constant Values Summary and Other Work Uninterpreted Constant Values A variable v is assigned a unique, uninterpreted constant value in the following circumstances: Initial value When v is referenced prior to being assigned a value, it is given a unique, uninterpreted constant value, v 0 . Input value When v receives a value in an input ( scanf ) statement, it is given a unique, uninterpreted constant value, v n . Within loops When v is assigned a value within a loop body, we associate the variable with an uninterpreted value v p , conceptually on the penultimate execution of the loop, then we symbolically execute the loop body once to “approximate” the final symbolic values. Chris Fox, University of Essex A Conditioned Program Slicer

  77. Background Conditional Statements Program Conditioning Conditioned “if” Examples of Conditioning While Loops Summary and Other Work Conditioned “while” Symbolic States and Path Conditions x = y + 1; Chris Fox, University of Essex A Conditioned Program Slicer

  78. Background Conditional Statements Program Conditioning Conditioned “if” Examples of Conditioning While Loops Summary and Other Work Conditioned “while” Symbolic States and Path Conditions x = y + 1; (path condition = ⇒ symbolic state) {⊤ = ⇒ ( x = y 0 + 1) } Chris Fox, University of Essex A Conditioned Program Slicer

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend