page 1  (10 pages)
2to next section

Declarative Debugging with

The Transparent Prolog Machine (TPM)

Mike Brayshaw and Marc Eisenstadt

Human Cognition Research Laboratory
The Open University
Milton Keynes MK7 6AA, UK

ECAI-88 Paper Submission, February, 1988

Abstract: The underlying philosophy of the Transparent Prolog Machine (TPM) is that it should serve as a medium for visualising the execution of Prolog programs in a manner which is rigorously faithful to the internal behaviour of the Prolog interpreter. It is therefore highly biased towards the procedural account of Prolog execution. Although this is useful for certain types of practical program debugging, a true logic programming paradigm demands a more declarative account. Since TPM already incorporates special displays to show unification details and goal outcomes, a straightforward extension enables the user to intervene to say whether a particular unification (or indeed any particular goal outcome) was desirable ('thumbs up') or undesirable ('thumbs down'). This intervention can take place either during 'live'
execution, or else retrospectively, after execution is complete. This technique can be
combined with a selective highlighting facility which takes the user directly to a particular context-sensitive point in the execution history, and with TPM's 'replay' facility which allows execution to be played forward or backward at different speeds and different grain-sizes of
analysis. The combination of techniques enables the user to mix a truly declarative debugging style for clean logic programs with a procedural style for those cases which demand it. The paper presents worked examples of this new mixed paradigm.

Section: Logic Programming

Length: 5000 Words

1 Introduction

The Transparent Prolog Machine (TPM) was introduced in (Eisenstadt and Brayshaw 1986; 1987) as a method of graphically displaying the execution of Prolog programs. The original conception of TPM emphasised fidelity to the underlying workings of the Prolog interpreter. While this provides many convenient conceptual 'hooks' for both novice learners and expert debuggers, it weds TPM overwhelmingly to a procedural account of Prolog execution.
Ideally, logic programs can be looked at declaratively, and divorced from the underlying execution machinery. Our aim in this paper is to show how straightforward extensions to TPM enable it to handle both declarative and procedural debugging styles. The key insights which drive this work are (a) that Prolog programming in practice involves the integration of both declarative and procedural techniques, and (b) user intervention in the form of 'thumbs up' or 'thumbs down' indications at critical points in the TPM animated display can provide vital 'anchor points' from which a declarative analysis of program behaviour can be performed.

Our work draws from the existing work in declarative debugging (Shapiro, 1982; Lloyd, 1986). The use of terms instead of literals as the basis for driving the bug location and the location algorithm are taken from rational debugging (Pereira,1986). Where we differ is in the graphical nature of the interaction and the intergration of such a debugging methodology into a large debugging system. The use of a stored trace history is also used by (Huntback, 1987; Sterling and Shapiro, 1986). In this paper we shall use the term declarative debugging to include both rational and algorithmic approaches.