Graphical Debugging with the Transparent PROLOG Machine (TPM)

Marc Eisenstadt, Mike Brayshaw

Introduction

In the mid-1980s, the Transparent Prolog Machine (TPM) emerged as a pioneering graphical debugger designed to address the inherent difficulties in tracking Prolog's non-linear execution. Prolog's reliance on backtracking, unification, and the "cut" operator makes traditional text-based traces notoriously difficult to follow. TPM provides both high-level "gestalt" views of execution and low-level details of variable unification, helping users navigate the "forest-vs-trees" problem.

The AORTA Diagram

The core of TPM is the AORTA (Augmented And/OR Tree) diagram. Unlike traditional AND/OR trees, AORTA diagrams enrich nodes with "status boxes." These boxes use intuitive icons—ticks for success, crosses for failure, and question marks for pending states—alongside numbers indicating which clause in a procedure is currently active.

A basic AORTA diagram illustrating status boxes (ticks for success, crosses for failure) and variable unification.

TPM introduces two primary views to manage complexity and allow for "retrospective zooming":

Long Distance View (LDV)

The LDV provides a compressed map of the execution space, capable of displaying thousands of nodes simultaneously. It utilizes "shallow cliches"—abstractions like ellipsis for tail recursion—to maintain readability. This allows developers to recognize the "shape" of a program's execution and identify "symptom clusters" or visual patterns of failure.

The Long Distance View (LDV) offers a high-level 'gestalt' perspective of the entire execution space.

Unification Graphics

Users can zoom from the LDV into specific AORTA boxes to inspect variable unification. TPM uses a specialized syntax of arrows: down arrows for input, up arrows for output, and right-angled arrows for variables shared between "sister" goals. "Lozenges" (oval shapes) are used to display the specific instantiation of a variable at any given moment.

Conceptual Framework: The Family Metaphor

To explain complex logic like the "cut" operator, TPM employs a family analogy. Goals are viewed as "sisters," their caller as the "mother," and different clauses as "fathers." In this context, the "cut" is defined as an operation that "freezes older sister goals and eliminates future step-fathers," providing a concise mental model for a difficult concept.

Key Insights and Results

The power of TPM lies in its ability to reveal bugs that are often invisible in text-based traces. For instance, in a warehouse database example, a bug caused by accidental variable reuse becomes immediately apparent in an AORTA diagram because the unification arrows point to incorrect data sources.

Furthermore, TPM handles the history of execution through "ghost status boxes." When a goal is retried, previous states are preserved as ghosts, allowing users to click back through time to inspect the search space's evolution. Selective highlighting also allows users to search the tree for specific variable instantiation patterns.

Limitations and Future Directions

While TPM was a significant advancement, it relied heavily on the user's ability to manually recognize "healthy" execution patterns. Early implementations were limited in the variety of "cliches" available for the LDV. Future work suggested expanding these patterns and optimizing memory overhead for history preservation in non-terminating programs.

Summary updated

BibTeX
@inproceedings{eisenstadt1987graphical,
  author = {Marc Eisenstadt and Mike Brayshaw},
  title = {{Graphical Debugging with the Transparent PROLOG Machine (TPM)}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {1987},
}
Figure