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

a conditioned program slicer
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

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

slide-2
SLIDE 2

Background Program Conditioning Examples of Conditioning Summary and Other Work

1 Background

Slicing Conditioning Slicing and Conditioning Constraining the Context

2 Program Conditioning

Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

3 Examples of Conditioning

Conditional Statements Conditioned “if” While Loops Conditioned “while”

Chris Fox, University of Essex A Conditioned Program Slicer

slide-3
SLIDE 3

Background Program Conditioning Examples of Conditioning Summary and Other Work

Philosophy/Motivation

Chris Fox, University of Essex A Conditioned Program Slicer

slide-4
SLIDE 4

Background Program Conditioning Examples of Conditioning Summary and Other Work

Philosophy/Motivation

Put a programmer-friendly face on software analysis

Chris Fox, University of Essex A Conditioned Program Slicer

slide-5
SLIDE 5

Background Program Conditioning Examples of Conditioning Summary and Other Work

Philosophy/Motivation

Put a programmer-friendly face on software analysis Use formal analysis to check the correctness of the analysis tools and their transformations,

Chris Fox, University of Essex A Conditioned Program Slicer

slide-6
SLIDE 6

Background Program Conditioning Examples of Conditioning Summary and Other Work

Philosophy/Motivation

Put a programmer-friendly face on software analysis Use formal analysis to check the correctness of the analysis tools and their transformations,not the programs under examination.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-7
SLIDE 7

Background Program Conditioning Examples of Conditioning Summary and Other Work

Philosophy/Motivation

Put a programmer-friendly face on software analysis Use formal analysis to check the correctness of the analysis tools and their transformations,not the programs under examination. A pragmatic approach to formal methods.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-8
SLIDE 8

Background Program Conditioning Examples of Conditioning Summary and Other Work

Philosophy/Motivation

Put a programmer-friendly face on software analysis Use formal analysis to check the correctness of the analysis tools and their transformations,not the programs under examination. A pragmatic approach to formal methods?

Chris Fox, University of Essex A Conditioned Program Slicer

slide-9
SLIDE 9

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing

Slicing can be thought of as projecting out part of a program involved in a subcomputation of interest.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-10
SLIDE 10

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing

Slicing can be thought of as projecting out part of a program involved in a subcomputation of interest. Usually specified in terms of a set of variables and program point of interest, with the variables constituting the “output”

  • f the subcomputation (backward slicing), or its “input”

(forward slicing).

Chris Fox, University of Essex A Conditioned Program Slicer

slide-11
SLIDE 11

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing

Slicing can be thought of as projecting out part of a program involved in a subcomputation of interest. Usually specified in terms of a set of variables and program point of interest, with the variables constituting the “output”

  • f the subcomputation (backward slicing), or its “input”

(forward slicing). Usually using one transformation:

Chris Fox, University of Essex A Conditioned Program Slicer

slide-12
SLIDE 12

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing

Slicing can be thought of as projecting out part of a program involved in a subcomputation of interest. Usually specified in terms of a set of variables and program point of interest, with the variables constituting the “output”

  • f the subcomputation (backward slicing), or its “input”

(forward slicing). Usually using one transformation: statement deletion.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-13
SLIDE 13

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing

Slicing can be thought of as projecting out part of a program involved in a subcomputation of interest. Usually specified in terms of a set of variables and program point of interest, with the variables constituting the “output”

  • f the subcomputation (backward slicing), or its “input”

(forward slicing). Usually using one transformation: statement deletion. Need to keep statements that could change (or are changed by) the values of interest.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-14
SLIDE 14

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing

Slicing can be thought of as projecting out part of a program involved in a subcomputation of interest. Usually specified in terms of a set of variables and program point of interest, with the variables constituting the “output”

  • f the subcomputation (backward slicing), or its “input”

(forward slicing). Usually using one transformation: statement deletion. Need to keep statements that could change (or are changed by) the values of interest.

1

Data dependence

2

Control dependence

Chris Fox, University of Essex A Conditioned Program Slicer

slide-15
SLIDE 15

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing

Slicing can be thought of as projecting out part of a program involved in a subcomputation of interest. Usually specified in terms of a set of variables and program point of interest, with the variables constituting the “output”

  • f the subcomputation (backward slicing), or its “input”

(forward slicing). Usually using one transformation: statement deletion. Need to keep statements that could change (or are changed by) the values of interest.

1

Data dependence

2

Control dependence

Computing either of these precisely is problematic, so we are

  • bliged to accept conservative approximations.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-16
SLIDE 16

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Example

Chris Fox, University of Essex A Conditioned Program Slicer

slide-17
SLIDE 17

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Example

Consider: x := y; w := x; while (x > z) { w := w + 1; x := x - 1; }

Chris Fox, University of Essex A Conditioned Program Slicer

slide-18
SLIDE 18

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Example

Consider: x := y; w := x; while (x > z) { w := w + 1; x := x - 1; } Slicing (backward) with respect to the value of x at the end

  • f 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

slide-19
SLIDE 19

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Example

Consider: x := y; w := x; while (x > z) { w := w + 1; x := x - 1; } Slicing (backward) with respect to the value of x at the end

  • f 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

slide-20
SLIDE 20

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Another Example

Chris Fox, University of Essex A Conditioned Program Slicer

slide-21
SLIDE 21

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Another Example

Consider: x := y; w := x; while (true) { w := 1; x := x + 1; }

Chris Fox, University of Essex A Conditioned Program Slicer

slide-22
SLIDE 22

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

  • f 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

slide-23
SLIDE 23

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

  • f 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

slide-24
SLIDE 24

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

  • f 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

slide-25
SLIDE 25

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-26
SLIDE 26

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-27
SLIDE 27

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-28
SLIDE 28

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing is Not Trivial

Chris Fox, University of Essex A Conditioned Program Slicer

slide-29
SLIDE 29

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-30
SLIDE 30

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing is Not Trivial

Even just using statement deletion, slicing real programs is non-trivial:

1

unstructured code (breaks and returns);

Chris Fox, University of Essex A Conditioned Program Slicer

slide-31
SLIDE 31

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing is Not Trivial

Even just using statement deletion, slicing real programs is non-trivial:

1

unstructured code (breaks and returns);

2

arrays, union types and pointers (& functions in C);

Chris Fox, University of Essex A Conditioned Program Slicer

slide-32
SLIDE 32

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing is Not Trivial

Even just using statement deletion, slicing real programs is non-trivial:

1

unstructured code (breaks and returns);

2

arrays, union types and pointers (& functions in C);

3

difficult to analyse with standard state-based semantics

Chris Fox, University of Essex A Conditioned Program Slicer

slide-33
SLIDE 33

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing is Not Trivial

Even just using statement deletion, slicing real programs is non-trivial:

1

unstructured code (breaks and returns);

2

arrays, union types and pointers (& functions in C);

3

difficult to analyse with standard state-based semantics (non-termination behaviour changes);

4

minimal slices are not computable.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-34
SLIDE 34

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing is Not Trivial

Even just using statement deletion, slicing real programs is non-trivial:

1

unstructured code (breaks and returns);

2

arrays, union types and pointers (& functions in C);

3

difficult to analyse with standard state-based semantics (non-termination behaviour changes);

4

minimal slices are not computable.

How should we slice OO languages?

Chris Fox, University of Essex A Conditioned Program Slicer

slide-35
SLIDE 35

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-36
SLIDE 36

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-37
SLIDE 37

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-38
SLIDE 38

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-39
SLIDE 39

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

  • utput variables using a slicing algorithm.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-40
SLIDE 40

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

  • utput 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

slide-41
SLIDE 41

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Conditioning

Conditioning =

Chris Fox, University of Essex A Conditioned Program Slicer

slide-42
SLIDE 42

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Conditioning

Conditioning = Symbolic Execution

Chris Fox, University of Essex A Conditioned Program Slicer

slide-43
SLIDE 43

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Conditioning

Conditioning = Symbolic Execution + Theorem Proving

Chris Fox, University of Essex A Conditioned Program Slicer

slide-44
SLIDE 44

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Conditioning

Conditioning = Symbolic Execution + Theorem Proving Symbolic Execution

Chris Fox, University of Essex A Conditioned Program Slicer

slide-45
SLIDE 45

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-46
SLIDE 46

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-47
SLIDE 47

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-48
SLIDE 48

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-49
SLIDE 49

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-50
SLIDE 50

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-51
SLIDE 51

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-52
SLIDE 52

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning Constraining the Context

Slicing and Conditioning

Slicing

Chris Fox, University of Essex A Conditioned Program Slicer

slide-53
SLIDE 53

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-54
SLIDE 54

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-55
SLIDE 55

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-56
SLIDE 56

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-57
SLIDE 57

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-58
SLIDE 58

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-59
SLIDE 59

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-60
SLIDE 60

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-61
SLIDE 61

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-62
SLIDE 62

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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

slide-63
SLIDE 63

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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.(an > 0) while (p) { . . . scanf("%d", &a); . . . };

Chris Fox, University of Essex A Conditioned Program Slicer

slide-64
SLIDE 64

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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.(an > 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

slide-65
SLIDE 65

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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.(an > 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

slide-66
SLIDE 66

Background Program Conditioning Examples of Conditioning Summary and Other Work Slicing Conditioning Slicing and Conditioning 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.(an > 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

slide-67
SLIDE 67

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-68
SLIDE 68

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-69
SLIDE 69

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-70
SLIDE 70

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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 x0 y0 z0

Chris Fox, University of Essex A Conditioned Program Slicer

slide-71
SLIDE 71

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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 x0 y0 z0 x := z;

Chris Fox, University of Essex A Conditioned Program Slicer

slide-72
SLIDE 72

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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 x0 y0 z0 x := z; z0 y0 z0

Chris Fox, University of Essex A Conditioned Program Slicer

slide-73
SLIDE 73

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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 x0 y0 z0 x := z; z0 y0 z0 y := x + z;

Chris Fox, University of Essex A Conditioned Program Slicer

slide-74
SLIDE 74

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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 x0 y0 z0 x := z; z0 y0 z0 y := x + z; z0 z0 + z0 z0

Chris Fox, University of Essex A Conditioned Program Slicer

slide-75
SLIDE 75

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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 x0 y0 z0 x := z; z0 y0 z0 y := x + z; z0 z0 + z0 z0 Theorem Proving

Chris Fox, University of Essex A Conditioned Program Slicer

slide-76
SLIDE 76

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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 x0 y0 z0 x := z; z0 y0 z0 y := x + z; z0 z0 + z0 z0 Theorem Proving Does y==2*z ?

Chris Fox, University of Essex A Conditioned Program Slicer

slide-77
SLIDE 77

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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 x0 y0 z0 x := z; z0 y0 z0 y := x + z; z0 z0 + z0 z0 Theorem Proving Does y==2*z ? From the symbolic state, this is true if: z0+z0 = 2z0

Chris Fox, University of Essex A Conditioned Program Slicer

slide-78
SLIDE 78

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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 x0 y0 z0 x := z; z0 y0 z0 y := x + z; z0 z0 + z0 z0 Theorem Proving Does y==2*z ? From the symbolic state, this is true if: z0+z0 = 2z0 Is x < y ?

Chris Fox, University of Essex A Conditioned Program Slicer

slide-79
SLIDE 79

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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 x0 y0 z0 x := z; z0 y0 z0 y := x + z; z0 z0 + z0 z0 Theorem Proving Does y==2*z ? From the symbolic state, this is true if: z0+z0 = 2z0 Is x < y ? True if z0 < 2z0.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-80
SLIDE 80

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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 x0 y0 z0 x := z; z0 y0 z0 y := x + z; z0 z0 + z0 z0 Theorem Proving Does y==2*z ? From the symbolic state, this is true if: z0+z0 = 2z0 Is x < y ? True if z0 < 2z0. What if z is negative?

Chris Fox, University of Essex A Conditioned Program Slicer

slide-81
SLIDE 81

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-82
SLIDE 82

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-83
SLIDE 83

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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:

1

symbolically execution s in the context of path ∪ {p};

Chris Fox, University of Essex A Conditioned Program Slicer

slide-84
SLIDE 84

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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:

1

symbolically execution s in the context of path ∪ {p};

2

symbolically execution t in the context of path ∪ {¬p};

Chris Fox, University of Essex A Conditioned Program Slicer

slide-85
SLIDE 85

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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:

1

symbolically execution s in the context of path ∪ {p};

2

symbolically execution t in the context of path ∪ {¬p};

With while loops present additional complexities.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-86
SLIDE 86

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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:

1

symbolically execution s in the context of path ∪ {p};

2

symbolically execution t in the context of path ∪ {¬p};

With while loops present additional complexities. We have chosen to implement a conservative approximation.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-87
SLIDE 87

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-88
SLIDE 88

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-89
SLIDE 89

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-90
SLIDE 90

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-91
SLIDE 91

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-92
SLIDE 92

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-93
SLIDE 93

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-94
SLIDE 94

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-95
SLIDE 95

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-96
SLIDE 96

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-97
SLIDE 97

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

slide-98
SLIDE 98

Background Program Conditioning Examples of Conditioning Summary and Other Work Symbolic Execution and Theorem Proving Combining Symbolic States Uninterpreted Constant Values

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

  • nce to “approximate” the final symbolic values.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-99
SLIDE 99

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Symbolic States and Path Conditions

x = y + 1;

Chris Fox, University of Essex A Conditioned Program Slicer

slide-100
SLIDE 100

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Symbolic States and Path Conditions

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)}

Chris Fox, University of Essex A Conditioned Program Slicer

slide-101
SLIDE 101

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Symbolic States and Path Conditions

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)}

if (x < y) x = 5 else x = 10;

Chris Fox, University of Essex A Conditioned Program Slicer

slide-102
SLIDE 102

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Symbolic States and Path Conditions

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)} Condition True

if (x < y) x = 5 else x = 10;

Chris Fox, University of Essex A Conditioned Program Slicer

slide-103
SLIDE 103

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Symbolic States and Path Conditions

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)} Condition True y0 + 1 < y0

if (x < y) x = 5 else x = 10;

Chris Fox, University of Essex A Conditioned Program Slicer

slide-104
SLIDE 104

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Symbolic States and Path Conditions

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)} Condition True y0 + 1 < y0 x = 5

if (x < y) x = 5 else x = 10;

Chris Fox, University of Essex A Conditioned Program Slicer

slide-105
SLIDE 105

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Symbolic States and Path Conditions

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)} Condition True y0 + 1 < y0 x = 5

if (x < y) x = 5 else x = 10;

Condition False

Chris Fox, University of Essex A Conditioned Program Slicer

slide-106
SLIDE 106

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Symbolic States and Path Conditions

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)} Condition True y0 + 1 < y0 x = 5

if (x < y) x = 5 else x = 10;

Condition False y0 + 1 < y0

Chris Fox, University of Essex A Conditioned Program Slicer

slide-107
SLIDE 107

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Symbolic States and Path Conditions

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)} Condition True y0 + 1 < y0 x = 5

if (x < y) x = 5 else x = 10;

Condition False y0 + 1 < y0 x = 10

Chris Fox, University of Essex A Conditioned Program Slicer

slide-108
SLIDE 108

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Symbolic States and Path Conditions

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)} Condition True y0 + 1 < y0 x = 5

if (x < y) x = 5 else x = 10;

Condition False y0 + 1 < y0 x = 10 Final Symbolic States: {(y0 + 1 < y0) = ⇒ x = 5, (y0 + 1 < y0) = ⇒ x = 10}

Chris Fox, University of Essex A Conditioned Program Slicer

slide-109
SLIDE 109

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Conditioned “if”

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)} Condition True y0 + 1 < y0 x = 5

if (x < y) x = 5 else x = 10;

Condition False y0 + 1 < y0 x = 10 Final Symbolic States: {(y0 + 1 < y0) = ⇒ x = 5, (y0 + 1 < y0) = ⇒ x = 10}

Chris Fox, University of Essex A Conditioned Program Slicer

slide-110
SLIDE 110

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Conditioned “if”

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)} Condition True y0 + 1 < y0 x = 5

x = 10

Condition False y0 + 1 < y0 x = 10 Final Symbolic States: {(y0 + 1 < y0) = ⇒ x = 5, (y0 + 1 < y0) = ⇒ x = 10}

Chris Fox, University of Essex A Conditioned Program Slicer

slide-111
SLIDE 111

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Conditioned “if”

x = y + 1; (path condition = ⇒ symbolic state)

{⊤ = ⇒ (x = y0 + 1)} Condition True y0 + 1 < y0 x = 5

x = 10

Condition False y0 + 1 < y0 x = 10 Final Symbolic States: {(y0 + 1 < y0) = ⇒ x = 10}

Chris Fox, University of Essex A Conditioned Program Slicer

slide-112
SLIDE 112

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)}

Chris Fox, University of Essex A Conditioned Program Slicer

slide-113
SLIDE 113

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)}

while (x > y) x = x - 1;

Final States:

Chris Fox, University of Essex A Conditioned Program Slicer

slide-114
SLIDE 114

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)}

while (x > y) x = x - 1;

Initially False: Final States:

  • 1. condition initially false =

⇒ state unchanged

Chris Fox, University of Essex A Conditioned Program Slicer

slide-115
SLIDE 115

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)}

while (x > y) x = x - 1;

Initially False: y0 + 1 > y0 Final States:

  • 1. (y0 + 1 > y0) =

⇒ state unchanged

Chris Fox, University of Essex A Conditioned Program Slicer

slide-116
SLIDE 116

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)}

while (x > y) x = x - 1;

Initially False: y0 + 1 > y0 State: x = y0 + 1 Final States:

  • 1. (y0 + 1 > y0) =

⇒ (x = y0 + 1)

Chris Fox, University of Essex A Conditioned Program Slicer

slide-117
SLIDE 117

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)} Initially True: y0 + 1 > y0

while (x > y) x = x - 1;

Initially False: y0 + 1 > y0 State: x = y0 + 1 Final States:

  • 1. (y0 + 1 > y0) =

⇒ (x = y0 + 1)

  • 2. initially true, penultimately true, finally false =

⇒ new state

Chris Fox, University of Essex A Conditioned Program Slicer

slide-118
SLIDE 118

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)} Initially True: y0 + 1 > y0 State: x = xp − 1

while (x > y) x = x - 1;

Initially False: y0 + 1 > y0 State: x = y0 + 1 Final States:

  • 1. (y0 + 1 > y0) =

⇒ (x = y0 + 1)

  • 2. (y0 + 1 > y0), penultimately true, finally false =

⇒ new state

Chris Fox, University of Essex A Conditioned Program Slicer

slide-119
SLIDE 119

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)} Initially True: y0 + 1 > y0 State: x = xp − 1

while (x > y) x = x - 1;

Initially False: y0 + 1 > y0 State: x = y0 + 1 Final States:

  • 1. (y0 + 1 > y0) =

⇒ (x = y0 + 1)

  • 2. (y0 + 1 > y0), (xp > y0), finally false =

⇒ new state

Chris Fox, University of Essex A Conditioned Program Slicer

slide-120
SLIDE 120

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)} Initially True: y0 + 1 > y0 State: x = xp − 1

while (x > y) x = x - 1;

Initially False: y0 + 1 > y0 State: x = y0 + 1 Final States:

  • 1. (y0 + 1 > y0) =

⇒ (x = y0 + 1)

  • 2. (y0 + 1 > y0), (xp > y0), (xp − 1 > y0) =

⇒ new state

Chris Fox, University of Essex A Conditioned Program Slicer

slide-121
SLIDE 121

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)} Initially True: y0 + 1 > y0 State: x = xp − 1

while (x > y) x = x - 1;

Initially False: y0 + 1 > y0 State: x = y0 + 1 Final States:

  • 1. (y0 + 1 > y0) =

⇒ (x = y0 + 1)

  • 2. (y0 + 1 > y0), (xp > y0), (xp − 1 > y0) =

⇒ (x = xp − 1)

Chris Fox, University of Essex A Conditioned Program Slicer

slide-122
SLIDE 122

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)} Initially True: y0 + 1 > y0 State: x = xp − 1

while (x > y) x = x - 1;

Initially False: y0 + 1 > y0 State: x = y0 + 1 Final States:

  • 1. (y0 + 1 > y0) =

⇒ (x = y0 + 1)

  • 2. (y0 + 1 > y0), (xp > y0), (xp − 1 > y0) =

⇒ (x = xp − 1)

  • 3. If we can show that neither path condition is true,. . .

Chris Fox, University of Essex A Conditioned Program Slicer

slide-123
SLIDE 123

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

While Loops

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)} Initially True: y0 + 1 > y0 State: x = xp − 1

while (x > y) x = x - 1;

Initially False: y0 + 1 > y0 State: x = y0 + 1 Final States:

  • 1. (y0 + 1 > y0) =

⇒ (x = y0 + 1)

  • 2. (y0 + 1 > y0), (xp > y0), (xp − 1 > y0) =

⇒ (x = xp − 1)

  • 3. If we can show that neither path condition is true,. . .

then we know that the loop does not terminate

Chris Fox, University of Essex A Conditioned Program Slicer

slide-124
SLIDE 124

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Conditioned “while”

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)} Initially True: y0 + 1 > y0 State: x = xp + 1

while (x > y) x = x - 1;

Initially False: y0 + 1 > y0 State: x = y0 + 1 Final States: {(y0 + 1 > y0) = ⇒ (x = y0 + 1), (y0 + 1 > y0), (xp > y0), (xp − 1 > y0) = ⇒ (x = xp − 1)}

Chris Fox, University of Essex A Conditioned Program Slicer

slide-125
SLIDE 125

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Conditioned “while”

x = y + 1;

{⊤ = ⇒ (x = y0 + 1)} Initially True: y0 + 1 > y0 State: x = xp + 1

while (x > y) x = x - 1;

Initially False: y0 + 1 > y0 State: x = y0 + 1 Final State: {(y0 + 1 > y0), (xp > y0), (xp − 1 > y0) = ⇒ (x = xp − 1)}

Chris Fox, University of Essex A Conditioned Program Slicer

slide-126
SLIDE 126

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Comments on “while”

Although (in this case) we have not simplified the loop, we have gained some information that can be used when conditioning statements which follow the loop:

Chris Fox, University of Essex A Conditioned Program Slicer

slide-127
SLIDE 127

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Comments on “while”

Although (in this case) we have not simplified the loop, we have gained some information that can be used when conditioning statements which follow the loop: We know that the loop will be executed at least once.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-128
SLIDE 128

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Comments on “while”

Although (in this case) we have not simplified the loop, we have gained some information that can be used when conditioning statements which follow the loop: We know that the loop will be executed at least once. We know that the loop terminates.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-129
SLIDE 129

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Comments on “while”

Although (in this case) we have not simplified the loop, we have gained some information that can be used when conditioning statements which follow the loop: We know that the loop will be executed at least once. We know that the loop terminates. If we were to add the statement p=5 within the loop body, and the loop was then followed by a conditional if (p=5) s, then the system can determine that the statement s would be executed.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-130
SLIDE 130

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Comments on “while”

Although (in this case) we have not simplified the loop, we have gained some information that can be used when conditioning statements which follow the loop: We know that the loop will be executed at least once. We know that the loop terminates. If we were to add the statement p=5 within the loop body, and the loop was then followed by a conditional if (p=5) s, then the system can determine that the statement s would be executed. Although a programmer might not put a statement of the form p=5 within the loop body, it might have arisen as a result of conditioning the loop body.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-131
SLIDE 131

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Comments on “while”

In the example given, the system can determine that the final value of x is less than or equal to the initial value of y, and that x + 1 (i.e. the penultimate value of x) is greater than the initial value of y.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-132
SLIDE 132

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Comments on “while”

In the example given, the system can determine that the final value of x is less than or equal to the initial value of y, and that x + 1 (i.e. the penultimate value of x) is greater than the initial value of y. This helps us to simplify any condition involving x and y that follows the loop.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-133
SLIDE 133

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Comments on “while”

In the example given, the system can determine that the final value of x is less than or equal to the initial value of y, and that x + 1 (i.e. the penultimate value of x) is greater than the initial value of y. This helps us to simplify any condition involving x and y that follows the loop.

In the example given, if x and y are integers, then we know that x = y when the loop terminates.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-134
SLIDE 134

Background Program Conditioning Examples of Conditioning Summary and Other Work Conditional Statements Conditioned “if” While Loops Conditioned “while”

Comments on “while”

In the example given, the system can determine that the final value of x is less than or equal to the initial value of y, and that x + 1 (i.e. the penultimate value of x) is greater than the initial value of y. This helps us to simplify any condition involving x and y that follows the loop.

In the example given, if x and y are integers, then we know that x = y when the loop terminates.

This analysis of loops appears to be more powerful than in any other published work in symbolic execution.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-135
SLIDE 135

Background Program Conditioning Examples of Conditioning Summary and Other Work

Summary

Chris Fox, University of Essex A Conditioned Program Slicer

slide-136
SLIDE 136

Background Program Conditioning Examples of Conditioning Summary and Other Work

Summary

Developed the first implementation of a fully automatic conditioned slicer (ConSIT) using SVC (and Isabelle) for theorem proving.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-137
SLIDE 137

Background Program Conditioning Examples of Conditioning Summary and Other Work

Summary

Developed the first implementation of a fully automatic conditioned slicer (ConSIT) using SVC (and Isabelle) for theorem proving. Our assert statement (now not unusual) simplifies the system and creates additional expressiveness.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-138
SLIDE 138

Background Program Conditioning Examples of Conditioning Summary and Other Work

Summary

Developed the first implementation of a fully automatic conditioned slicer (ConSIT) using SVC (and Isabelle) for theorem proving. Our assert statement (now not unusual) simplifies the system and creates additional expressiveness. The conditioner can be modified so that asserts can be used to establish preconditions and check postconditions.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-139
SLIDE 139

Background Program Conditioning Examples of Conditioning Summary and Other Work

Summary

Developed the first implementation of a fully automatic conditioned slicer (ConSIT) using SVC (and Isabelle) for theorem proving. Our assert statement (now not unusual) simplifies the system and creates additional expressiveness. The conditioner can be modified so that asserts can be used to establish preconditions and check postconditions. We have generalised conditioning to the “backward” case.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-140
SLIDE 140

Background Program Conditioning Examples of Conditioning Summary and Other Work

Summary

Developed the first implementation of a fully automatic conditioned slicer (ConSIT) using SVC (and Isabelle) for theorem proving. Our assert statement (now not unusual) simplifies the system and creates additional expressiveness. The conditioner can be modified so that asserts can be used to establish preconditions and check postconditions. We have generalised conditioning to the “backward” case.

Removes code that does not contribute to the specified

  • utcome.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-141
SLIDE 141

Background Program Conditioning Examples of Conditioning Summary and Other Work

Summary

Developed the first implementation of a fully automatic conditioned slicer (ConSIT) using SVC (and Isabelle) for theorem proving. Our assert statement (now not unusual) simplifies the system and creates additional expressiveness. The conditioner can be modified so that asserts can be used to establish preconditions and check postconditions. We have generalised conditioning to the “backward” case.

Removes code that does not contribute to the specified

  • utcome.

Potentially useful in combination with forward conditioning;

Chris Fox, University of Essex A Conditioned Program Slicer

slide-142
SLIDE 142

Background Program Conditioning Examples of Conditioning Summary and Other Work

Summary

Developed the first implementation of a fully automatic conditioned slicer (ConSIT) using SVC (and Isabelle) for theorem proving. Our assert statement (now not unusual) simplifies the system and creates additional expressiveness. The conditioner can be modified so that asserts can be used to establish preconditions and check postconditions. We have generalised conditioning to the “backward” case.

Removes code that does not contribute to the specified

  • utcome.

Potentially useful in combination with forward conditioning; forward conditioning on the pre-conditions and backward conditioning on the negation of the post-conditions can isolate those code fragements that might contribute to

  • ut-of-specification behaviour.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-143
SLIDE 143

Background Program Conditioning Examples of Conditioning Summary and Other Work

Related and Other Work

Chris Fox, University of Essex A Conditioned Program Slicer

slide-144
SLIDE 144

Background Program Conditioning Examples of Conditioning Summary and Other Work

Related and Other Work

ConSUS [David Daoudi] a WSL (Martin Ward) version of a conditioned slicer using WSL’s built in simplify and also CVC.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-145
SLIDE 145

Background Program Conditioning Examples of Conditioning Summary and Other Work

Related and Other Work

ConSUS [David Daoudi] a WSL (Martin Ward) version of a conditioned slicer using WSL’s built in simplify and also CVC. VADA: variable dependence analyser for “ANSI C” [with Harman and DaimlerChrysler].

Chris Fox, University of Essex A Conditioned Program Slicer

slide-146
SLIDE 146

Background Program Conditioning Examples of Conditioning Summary and Other Work

Related and Other Work

ConSUS [David Daoudi] a WSL (Martin Ward) version of a conditioned slicer using WSL’s built in simplify and also CVC. VADA: variable dependence analyser for “ANSI C” [with Harman and DaimlerChrysler].

Uses slicing techniques to determine which variables determine the truth-value of a specified expression.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-147
SLIDE 147

Background Program Conditioning Examples of Conditioning Summary and Other Work

Related and Other Work

ConSUS [David Daoudi] a WSL (Martin Ward) version of a conditioned slicer using WSL’s built in simplify and also CVC. VADA: variable dependence analyser for “ANSI C” [with Harman and DaimlerChrysler].

Uses slicing techniques to determine which variables determine the truth-value of a specified expression. This helps to constrain the search space in Daimler’s evolutionary test-generation system.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-148
SLIDE 148

Background Program Conditioning Examples of Conditioning Summary and Other Work

Related and Other Work

ConSUS [David Daoudi] a WSL (Martin Ward) version of a conditioned slicer using WSL’s built in simplify and also CVC. VADA: variable dependence analyser for “ANSI C” [with Harman and DaimlerChrysler].

Uses slicing techniques to determine which variables determine the truth-value of a specified expression. This helps to constrain the search space in Daimler’s evolutionary test-generation system.

Restructing transformations for testing: translate code with (multi-level) break statements into “pure” structured code, whilst preserving feasible paths [with Hierons and Harman].

Chris Fox, University of Essex A Conditioned Program Slicer

slide-149
SLIDE 149

Background Program Conditioning Examples of Conditioning Summary and Other Work

Related and Other Work

ConSUS [David Daoudi] a WSL (Martin Ward) version of a conditioned slicer using WSL’s built in simplify and also CVC. VADA: variable dependence analyser for “ANSI C” [with Harman and DaimlerChrysler].

Uses slicing techniques to determine which variables determine the truth-value of a specified expression. This helps to constrain the search space in Daimler’s evolutionary test-generation system.

Restructing transformations for testing: translate code with (multi-level) break statements into “pure” structured code, whilst preserving feasible paths [with Hierons and Harman].

1

A test-set for the original programming will have the same class of coverage (Statement, Branch, MCDC etc) for the structured version of the program.

2

Increases the applicability of tools and techniques for testing and analysis.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-150
SLIDE 150

Background Program Conditioning Examples of Conditioning Summary and Other Work

Current Activities

Chris Fox, University of Essex A Conditioned Program Slicer

slide-151
SLIDE 151

Background Program Conditioning Examples of Conditioning Summary and Other Work

Current Activities

We are currently working on an analysis of conditioning [Arthorn Luangsodsai] and slicing [Lahcen Ouarbya] as semantic preserving transformations.

Chris Fox, University of Essex A Conditioned Program Slicer

slide-152
SLIDE 152

Background Program Conditioning Examples of Conditioning Summary and Other Work

Current Activities

We are currently working on an analysis of conditioning [Arthorn Luangsodsai] and slicing [Lahcen Ouarbya] as semantic preserving transformations. We are exploring the use of conditioning for specification-based testing [Hierons].

Chris Fox, University of Essex A Conditioned Program Slicer

slide-153
SLIDE 153

Background Program Conditioning Examples of Conditioning Summary and Other Work

Current Activities

We are currently working on an analysis of conditioning [Arthorn Luangsodsai] and slicing [Lahcen Ouarbya] as semantic preserving transformations. We are exploring the use of conditioning for specification-based testing [Hierons]. There is a relationship between conditioned slicing and refinement (Chung, Lee, Yoon and Kwon) which merits further exploration [Voelkner].

Chris Fox, University of Essex A Conditioned Program Slicer

slide-154
SLIDE 154

Background Program Conditioning Examples of Conditioning Summary and Other Work

The End

Chris Fox, University of Essex A Conditioned Program Slicer