Abstract

We present techniques that enable higher-order functional computations to "explain" their work by answering questions about how parts of their output were calculated. As explanations, we consider the traditional notion of program slices, which we show can be inadequate, and propose a new notion: trace slices. We present techniques for specifying flexible and rich slicing criteria based on partial expressions, parts of which have been replaced by holes. We characterise program slices in an algorithm-independent fashion and show that a least slice for a given criterion exists. We then present an algorithm, called unevaluation , for computing least program slices from computations reified as traces. Observing a limitation of program slices, we develop a notion of trace slice as another form of explanation and present an algorithm for computing them. The unevaluation algorithm can be applied to any subtrace of a trace slice to compute a program slice whose evaluation generates that subtrace. This close correspondence between programs, traces, and their slices can enable the programmer to understand a computation interactively, in terms of the programming language in which the computation is expressed. We present an implementation in the form of a tool, discuss some important practical implementation concerns and present some techniques for addressing them.

Highlights

  • Many problem domains in computer science require understanding a computation and how a certain result was computed

  • We develop techniques for computing program slices for strict, higher-order functional programs based on rich slicing criteria and propose techniques for more powerful examinations of computations via trace slices

  • We presented a novel algorithm-independent characterisation of the problem of calculating a least dynamic program slice, showed how to support fine-grained differential slicing criteria in the presence of higher-order functions, and showed how to slice reified computations, or traces, as well as programs

Read more

Summary

Introduction

Many problem domains in computer science require understanding a computation and how a certain result was computed. Defined to yield backward slices, which identify parts of a program contributing to a specific criterion on the output, slicing techniques were later extended to compute forward slices. Since it pertains to a specific execution, and explains the relationship between a computation and its result, dynamic backward slicing is considered more relevant for the purposes of understanding a computation. Biswas [6] considers strict, higher-order functional programs and proposes slicing techniques with a single form of criterion: the entire output of the program. 3. An algorithm, called unevaluation, for computing least slices of strict, higher-order functional programs. Proofs that are omitted due to space restrictions can be found in the companion technical report [20]

Overview
Example
The reference language
Characterizing program slices
A Characterisation of Program Slicing
Slicing with respect to partial output
Existence of least slices
Differential slices
Program Slicing as Backwards Execution
Abstract syntax
Tracing semantics
Program slicing via unevaluation
Correctness of tracing evaluation
Correctness of unevaluation
Computation of least slices
Trace Slicing
Computation of least trace slices
Implementation and Tracing Strategies
Related Work
Findings
Conclusions
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.