---
name: "hat-delta"
section: "1"
platform: "linux"
package: "hat"
version: "2.05+rerolled-7+b1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/hat-delta"
---

# hat-delta(1)

find a bug by algorithmic debugging, with delta debugging optimisations.

## NAME

hat-delta - find a bug by algorithmic debugging, with delta debugging optimisations.

## SYNOPSIS

**hat-delta** \[**-chv**\] \[**-d** *depth*\] \[**-f** *heuristicFunction*\] \[**-s** *sliceDepth*\] prog\[.hat\]

## DESCRIPTION

*hat-delta* is an interactive tool for finding bugs in the trace of a Haskell program *prog* supplied as its argument.  The user must answer a sequence of yes/no questions.  Each question asked by hat-delta concerns the reduction of a function application to a value.  You answer *yes* if the reduction is correct with respect to your intentions, and *no* otherwise. After a number of questions hat-delta reports an example equation which is the cause of the observed faulty behaviour - that is, which function definition is incorrect.

## OPTIONS

- **-c**

  Disable compression of the EDT based on reporting the same answer for several questions.

- **-d depth**

  Set the maximum depth hat-delta will consider making a jump into the EDT.

- **-f function**

  Set the heuristic function that hat-delta should use.  Heuristic functions are input in the form of a Haskell data structure as discussed in the Heuristic functions section.

- **-h**

  Display help message and exit.

- **-s sliceDepth**

  Set the number of child connections hat-delta will follow when generating a program slice.

- **-v**

  Print hat-delta's version number, and exit.

## INTERACTIVE COMMANDS

The hat-delta browser asks you questions, so the basic mode of interaction is to type answers:

- **yes**

  Yes, the equation looks correct by my understanding of the meaning of the function.

- **no**

  No, the equation looks incorrect.  Given the displayed arguments, the function is returning the wrong result.

The following other commands are available.  They each begin with a colon.

- **:show**

  Show the EDTs hat-detect is currently searching for bugs

- **:quit**

  Exit the interactive tool.

- **:help**

  Shows help text giving an overview of the commands available.

- **:source**

  Shows (in a separate window) the source code for the reduction currently being queried.

- **:anim**

  Start the hat-anim browser in a new window, beginning with the currently queried rediction.

- **:delta**

  or **:split** Start the hat-delta browser in a new window, beginning with the currently queried reduction.

- **:detect**

  Start the hat-detect browser in a new window, beginning with the currently queried reduction.

- **:explore**

  Start the hat-explore browser in a new window, beginning with the currently queried reduction.

- **:trail**

  Start a hat-trail browser in a new window, beginning with the currently queried reduction.

- **:set**

  Set an option in the form \`:set option value\`. Options are:

  **depthLimit** Set the maximum depth hat-delta will consider making a jump into the EDT. Must be greater than 0.

  **sliceDepth** Set the number of child connections hat-delta will follow when generating a program slice. Must be positive.  A depth of 0 indicates that the whole function definition should be used as a slice.

  **heuristic** Set the heuristic function, as described in the Heuristic functions section.

## HEURISTIC FUNCTIONS

Heuristic functions calculate an estimate of how likely a particular program slice is to be the buggy one.  They may be specified by the user in the form of a Haskell data structure using the following constructors.

- **ZeroHeuristic**

  Constant 0.0

- **OneHeuristic**

  Constant 1.0

- **Correct**

  The number of correct evaluations of the slice.

- **Incorrect**

  The number of incorrect evaluations of the slice.

- **Add f1 f2**

  Add the values of f1 and f2.

- **Negate f**

  Negate the value of f.

- **Multiply f1 f2**

  Multiply the values of f1 and f2.

- **Invert f**

  Invert the value of f.

If no heuristic is specified, the system will use Negate (Multiply Correct (Invert (Add Correct Incorrect))).

## FILES

- **/usr/bin/hat-delta**

  ## SEE ALSO

[hmake(1)](/hmake/1.md), [hat-trans(1)](/hat-trans/1.md), [hat-detect(1)](/hat-detect/1.md), [hat-stack(1)](/hat-stack/1.md), [hat-observe(1)](/hat-observe/1.md), [hat-trail(1)](/hat-trail/1.md)
