## Slicing as a Program Transformation (2007)

Venue: | ACM Transactions On Programming Languages and Systems |

Citations: | 11 - 2 self |

### BibTeX

@ARTICLE{Ward07slicingas,

author = {Martin Ward and Hussein Zedan},

title = {Slicing as a Program Transformation},

journal = {ACM Transactions On Programming Languages and Systems},

year = {2007},

volume = {29},

pages = {2007}

}

### OpenURL

### Abstract

The aim of this paper is to provide a unified mathematical framework for program slicing which places all slicing work, for sequential programs, on a sound theoretical foundation. The main advantage to a mathematical approach is that it is not tied to a particular representation. In fact the mathematics provides a sound basis for any particular representation. We use the WSL (Wide Spectrum Language) program transformation theory as our framework. Within this framework we define a new semantic relation, semi-refinement which lies between semantic equivalence and semantic refinement. Combining this semantic relation, a syntactic relation (called reduction) and WSL’s remove statement, we can give mathematical definitions for backwards slicing, conditioned slicing, static and dynamic slicing and semantic slicing as program transformations in the WSL transformation theory. A novel technique of “encoding ” operational semantics within a denotational semantics allows the framework to handle “operational slicing”. The theory also enables the concept of slicing to be applied to nondeterministic programs. These transformations are implemented in the industry-strength FermaT transformation system.

### Citations

1405 |
A Discipline of Programming
- Dijkstra
- 1976
(Show Context)
Citation Context ...add(x); [x = x ′ ]; remove(x ′ ) Note that the specification statement is never null (the final set of states is nonempty for every initial state), and so obey’s Dijkstra’s “Law of Excluded Miracles” =-=[14]-=- (see Section 4). 3.4 Weakest Preconditions Dijkstra introduced the concept of weakest preconditions [14] as a tool for reasoning about programs. For a given program P and condition R on the final sta... |

1283 |
Program slicing
- Weiser
- 1984
(Show Context)
Citation Context ...?” An observer cannot distinguish between the execution of a program and execution of the slice, when attention is focused on the value of v in statement s. Slicing was first described by Mark Weiser =-=[43]-=- as a debugging technique [44], and has since proved to have applications in testing, parallelisation, integration, software safety, program understanding and software maintenance. Survey articles by ... |

846 | Efficiently Computing Static Single Assignment Form and the
- Cytron, Ferrante, et al.
- 1991
(Show Context)
Citation Context ...eted. —Construct the Basic Blocks file by analysing control flow; —Construct control dependencies using the optimal algorithm of Pingali and Bilardi [25]. —Construct the Static Single Assignment form =-=[7,12]-=- of the basic blocks file: this is a concise representation of all data dependencies in the file. We use the nearlinear algorithm given in [7]. —Track control and data dependencies backwards from the ... |

636 | A survey of program slicing techniques
- Tip
- 1995
(Show Context)
Citation Context ...d has since proved to have applications in testing, parallelisation, integration, software safety, program understanding and software maintenance. Survey articles by Binkley and Gallagher [9] and Tip =-=[28]-=- include extensive bibliographies. Since the publication of Weiser’s paper, there have been many papers published which describe different algorithms for slicing and different slicing variants. Most A... |

474 |
Programming from Specifications
- Morgan
- 1994
(Show Context)
Citation Context ...tic model this is easy to achieve: the semantic function for [false] has an empty set of final states for each proper initial state. As a result, [false] is a valid refinement for any program. Morgan =-=[23]-=- calls this construct “miracle”. Such considerations have led to the Kernel language constructs being described as “the Quarks of Programming”: mysterious entities which cannot be observed in isolatio... |

278 | Programmers use slices when debugging - Weiser - 1982 |

248 | Dynamic program slicing
- Korel, Laski
- 1988
(Show Context)
Citation Context ...f any enclosing structures as far as possible, before carrying out the slicing operation itself. 6.12 Dynamic Slicing Although the term “dynamic program slice” was first introduced by Korel and Laski =-=[21]-=-, it may be regarded as a non-interactive version of Balzer’s notion of flowback analysis [5]. In flowback analysis, one is interested in how information flows through a program to obtain a particular... |

147 |
A calculus of refinements for program derivations
- Back
- 1988
(Show Context)
Citation Context ...a to be proved is: ∀R.WP(S1,R) ⇒ WP(S2,R) This approach has a serious drawback: second order logic is incomplete which means that there is not necessarily a proof for every valid transformation. Back =-=[2, 3]-=- gets round this difficulty by extending the logic with a new predicate symbol to represent the postcondition and carrying out the proof in the extended first order logic. However, it turns out that t... |

126 | Flow diagrams, turing machines and languages with only two formation rules
- Böhm, Jacopini
- 1966
(Show Context)
Citation Context ...rithm for slicing structured WSL can easily be extended to unstructured code: first restructure the program to use only if statements and while loops (for example, using Bohm and Jacopini’s algorithm =-=[10]-=-), then slice the structured program, then determine which simple statements have been reduced, and apply the corresponding reduction to the original program (or equivalently, undo the restructuring t... |

123 | Program slicing
- Binkley, Gallagher
- 1996
(Show Context)
Citation Context ...que [44], and has since proved to have applications in testing, parallelisation, integration, software safety, program understanding and software maintenance. Survey articles by Binkley and Gallagher =-=[9]-=- and Tip [28] include extensive bibliographies. Since the publication of Weiser’s paper, there have been many papers published which describe different algorithms for slicing and different slicing var... |

117 | Amorphous program slicing
- Harman, Binkley
- 2003
(Show Context)
Citation Context ...her words, why not drop the requirement that S ′ ⊑ S? ACM Transactions on Programming Languages and Systems, Vol. TBD, No. TDB, Month Year.sSlicing as a Program Transformation · 31 Harman and Danicic =-=[16,18]-=- coined the term “amorphous program slicing” for a combination of slicing and transformation of executable programs. So far the transformations have been restricted to restructuring snd simplification... |

99 |
Conditioned program slicing
- Canfora, Cimitile, et al.
- 1998
(Show Context)
Citation Context ...mation called Prog To Spec. This is used in combination with a syntactic slicing algorithm plus other transformations to develop a powerful conditioned semantic slicing algorithm. A conditioned slice =-=[11,17]-=- is a program slice which makes use of assertions added to the code to simplify the slice. The slicer applies the abstraction transformation Prog To Spec to blocks of code which do not contain loops, ... |

97 |
The semantic approach to program slicing
- Venkatesh
- 1991
(Show Context)
Citation Context ... dynamic slicing in various ways. For example: some researchers allow a finite set of initial states, or a partial initial state which restricts a subset of the initial variables to particular values =-=[29]-=-. In our formalism, all of these generalisations are subsumed ACM Transactions on Programming Languages and Systems, Vol. TBD, No. TDB, Month Year.s40 · Martin Ward and Hussein Zedan under the obvious... |

59 |
Proving Program Refinements and Transformations
- Ward
- 1989
(Show Context)
Citation Context ...t ∆ ⊢ S n ≤ S ′ for all n < ω, then ∆ ⊢ S ≤ S ′ . Here, “bounded nondeterminacy” means that in each specification statement there is a finite number of possible values for the assigned variables. See =-=[30]-=- for the proof. ACM Transactions on Programming Languages and Systems, Vol. TBD, No. TDB, Month Year.s14 · Martin Ward and Hussein Zedan An example transformation which is proved using the generic ind... |

56 |
Languages with Expressions of Infinite Length
- Karp
- 1964
(Show Context)
Citation Context ...ORY In this section we describe the kernel language and transformation theory. 3.1 The Kernel Language The Kernel language is based on infinitary first order logic, originally developed by Carol Karp =-=[20]-=-. Infinitary logic is an extension of ordinary first order logic which allows conjunction and disjunction over (countably) infinite lists of formulae, but quantification over finite lists of variables... |

43 | Abstracting a Specification from Code
- Ward
- 1993
(Show Context)
Citation Context ...ble semantic slices for a program: including slices which are actually larger than the original program. Although one would normally expect a semantic slice to be no larger than the original program, =-=[37,38]-=- discuss cases where a high-level abstract specification can be larger than the program while still being arguably easier to understand and more useful for comprehension and debugging. A program might... |

38 | Consit: A conditioned program slicer
- Danicic, Fox, et al.
(Show Context)
Citation Context ...mation called Prog To Spec. This is used in combination with a syntactic slicing algorithm plus other transformations to develop a powerful conditioned semantic slicing algorithm. A conditioned slice =-=[11,17]-=- is a program slice which makes use of assertions added to the code to simplify the slice. The slicer applies the abstraction transformation Prog To Spec to blocks of code which do not contain loops, ... |

36 | Derivation of Data Intensive Algorithms by Formal Transformation
- Ward
- 1996
(Show Context)
Citation Context ...anslating to the kernel language and applying the proof techniques directly. (5) Tackle some challenging program development and reverse engineering tasks to demonstrate the validity of this approach =-=[31,33,37,39,42,46]-=-; (6) Extend WSL with constructs for implementing program transformations (the result is called METAWSL); ACM Transactions on Programming Languages and Systems, Vol. TBD, No. TDB, Month Year.s42 · Mar... |

34 |
Specification Statements and Refinements
- Morgan, Robinson
- 1987
(Show Context)
Citation Context ...a notion of refinement using weakest preconditions as follows: S1 is refined by S2 if and only if the formula WP(S1,R) ⇒ WP(S2,R) can be proved for every formula R. Back and von Wright [4] and Morgan =-=[23,24]-=- use a second order logic to carry out this proof. In a second order logic we can quantify over boolean predicates, so the formula to be proved is: ∀R.WP(S1,R) ⇒ WP(S2,R) This approach has a serious d... |

33 | Reverse engineering through formal transformation: Knuths ’polynomial addition’ algorithm
- Ward
- 1994
(Show Context)
Citation Context ...anslating to the kernel language and applying the proof techniques directly. (5) Tackle some challenging program development and reverse engineering tasks to demonstrate the validity of this approach =-=[31,33,37,39,42,46]-=-; (6) Extend WSL with constructs for implementing program transformations (the result is called METAWSL); ACM Transactions on Programming Languages and Systems, Vol. TBD, No. TDB, Month Year.s42 · Mar... |

21 | Foundations for a Practical Theory of Program Refinement and Transformation
- Ward
- 1994
(Show Context)
Citation Context ...r of elements, and all corresponding elements are equal). This definition of refinement (using weakest preconditions) is equivalent to the definition of refinement in terms of semantic functions (see =-=[32]-=- for the proof). As a result, we have two very different methods available for proving the correctness of a program transformation: and both methods are used in practice. If both ∆ ⊢ S1 ≤ S2 and ∆ ⊢ S... |

19 | Derivation of a Sorting Algorithm
- Ward
- 1990
(Show Context)
Citation Context ...anslating to the kernel language and applying the proof techniques directly. (5) Tackle some challenging program development and reverse engineering tasks to demonstrate the validity of this approach =-=[31,33,37,39,42,46]-=-; (6) Extend WSL with constructs for implementing program transformations (the result is called METAWSL); ACM Transactions on Programming Languages and Systems, Vol. TBD, No. TDB, Month Year.s42 · Mar... |

19 | Pigs from Sausages? Reengineering from Assembler to C via FermaT Transformations
- Ward
(Show Context)
Citation Context ... is not one of the Ai) causes the whole action system to terminate immediately, without executing any further statements. In particular, none of the “pending” action call returns will take place. See =-=[42]-=- or [45] for the formal definition of do ... od, exit(n) and action systems in terms of the WSL kernel language. These loops are very valuable for restructuring unstructured code without introducing e... |

14 | A Definition of Abstraction
- Ward
- 1995
(Show Context)
Citation Context ...ble semantic slices for a program: including slices which are actually larger than the original program. Although one would normally expect a semantic slice to be no larger than the original program, =-=[37,38]-=- discuss cases where a high-level abstract specification can be larger than the program while still being arguably easier to understand and more useful for comprehension and debugging. A program might... |

13 | Reverse Engineering from Assembler to Formal Specifications via Program Transformations,” 7th Working Conference on Reverse Engineering
- Ward
(Show Context)
Citation Context ...formation engine in METAWSL with translators to and from existing programming languages. This allowed us to test our theories on large scale legacy systems (including systems written in IBM Assembler =-=[34,35,40]-=-). FermaT is an industrial strength program transformation system, the result of over eighteen years of research and development, which has recently been released under the GNU GPL (General Public Lic... |

11 |
Assembler to C Migration using the FermaT
- Ward
- 1999
(Show Context)
Citation Context ...formation engine in METAWSL with translators to and from existing programming languages. This allowed us to test our theories on large scale legacy systems (including systems written in IBM Assembler =-=[34,35,40]-=-). FermaT is an industrial strength program transformation system, the result of over eighteen years of research and development, which has recently been released under the GNU GPL (General Public Lic... |

10 | Inverse Engineering a simple Real Time program,” J. Software Maintenance: Research and Practice 6(1993), 197–234, 〈http://www.cse.dmu.ac.uk/∼mward/martin/ papers/eddy-t.ps.gz
- Younger, Ward
(Show Context)
Citation Context |

8 |
Thomas Reps David Binkley. Interprocedural slicing using dependence graphs
- Horwitz
- 1990
(Show Context)
Citation Context ...res: —Handles arbitrary control flow (including WSL code translated from assembler language) via “action systems”; —Interprocedural slicing, which handles the “calling context” problem correctly (see =-=[19]-=- and Section 7.1) combined with action systems; —Efficient algorithms for handling large and complex programs; Intermediate steps in the algorithm are not restricted to being a reduction of the origin... |

8 | The Formal Transformation Approach to Source Code Analysis and Manipulation
- Ward
- 2001
(Show Context)
Citation Context ...ivalent” but non-terminating program. Few slicing researchers are happy to allow a non-terminating program as a valid slice of a terminating program! Another semantic relation which has been proposed =-=[36]-=- is to allow any refinement of a program, which is also a reduction, as a valid slice. This would allow slicing away nonterminating code, since skip is a refinement of any nonterminating program. But ... |

7 |
Denotational Semantics: The Scott-Strachy Approach to Programming Language Theory
- Stoy
- 1977
(Show Context)
Citation Context ...er state. This restriction also simplifies the definition of semantic equivalence and refinement (see below). These “semantic functions” are used in the denotational semantics of Tennet [27] and Stoy =-=[26]-=-. If two programs have the same semantic function then they are said to be equivalent. A transformation is an operation which takes any program satisfying its applicability conditions and returns an e... |

6 |
The Denotational Semantics of Programming Languages
- Tennet
- 1976
(Show Context)
Citation Context ...lude every other state. This restriction also simplifies the definition of semantic equivalence and refinement (see below). These “semantic functions” are used in the denotational semantics of Tennet =-=[27]-=- and Stoy [26]. If two programs have the same semantic function then they are said to be equivalent. A transformation is an operation which takes any program satisfying its applicability conditions an... |

6 | Conditioned Semantic Slicing via Abstraction and Refinement in FermaT
- Ward, Zedan, et al.
- 2005
(Show Context)
Citation Context ...xpresses the weakest precondition of a statement for any postcondition as a simple formula containing a single occurrence of postcondition itself plus some weakest preconditions of fixed formulae. In =-=[41]-=- we describe a partial implementation of the representation theorem in the form of a program transformation called Prog To Spec. This is used in combination with a syntactic slicing algorithm plus oth... |

4 | Mechanized Operational Semantics of WSL
- Zhang, Munro, et al.
- 2002
(Show Context)
Citation Context ...antics, in order to find out which ones are still valid. But we would not have the benefit of the weakest precondition approach, and we would not be able to re-use any existing proofs. Xingyuan Zhang =-=[47]-=- has defined an operational semantics for WSL and started to prove the correctness of some transformations in terms of the operational semantics. It turns out that this extra work is not essential: in... |

3 |
EXDAMS – EXtendable Debugging And Monitoring
- Balzer
- 1969
(Show Context)
Citation Context ...f. 6.12 Dynamic Slicing Although the term “dynamic program slice” was first introduced by Korel and Laski [21], it may be regarded as a non-interactive version of Balzer’s notion of flowback analysis =-=[5]-=-. In flowback analysis, one is interested in how information flows through a program to obtain a particular value: the user interactively traverses a graph that represents the data and control depende... |

3 |
Munro & Xingyuan Zhang, “GUSTT: An Amorphous Slicing System Which Combines Slicing and Transformation
- Harman, Hu, et al.
- 2001
(Show Context)
Citation Context ...her words, why not drop the requirement that S ′ ⊑ S? ACM Transactions on Programming Languages and Systems, Vol. TBD, No. TDB, Month Year.sSlicing as a Program Transformation · 31 Harman and Danicic =-=[16,18]-=- coined the term “amorphous program slicing” for a combination of slicing and transformation of executable programs. So far the transformations have been restricted to restructuring snd simplification... |

2 |
Csaba Faragó, Zsolt Mihály Szabó, János Csirik & Tibor Gyimothy, “Union slices for program maintenance
- Beszédas
- 2002
(Show Context)
Citation Context ...ince otherwise it cannot distinguish between a non-terminating program and one which is simply taking arbitrarily longer to compute the same answer (this is the Halting Problem again). Beszédas et al =-=[6]-=- claim that the union of all minimal dynamic slices will be a minimal static slice. Given an efficient algorithm for computing minimal dynamic slices, it would therefore be possible to compute a reaso... |

1 |
Hierons & Jens Krinke, “Unions of Slices are not
- Lucia, Harman, et al.
(Show Context)
Citation Context ...ximation to a minimal static slice (it is not possible to compute all the minimal dynamic slices, of course). One problem with this approach is that the union of two slices is not necessarily a slice =-=[22]-=-. A more serious problem, as the next theorem shows, is that the union of all minimal dynamic slices is not necessarily a minimal static slice. Theorem 6.25. The union of all minimal dynamic slices is... |

1 |
Formal Methods to Aid the Evolution
- Ward, Bennett
(Show Context)
Citation Context ...formation engine in METAWSL with translators to and from existing programming languages. This allowed us to test our theories on large scale legacy systems (including systems written in IBM Assembler =-=[34,35,40]-=-). FermaT is an industrial strength program transformation system, the result of over eighteen years of research and development, which has recently been released under the GNU GPL (General Public Lic... |