hatt- A truth table generator for classical propositional logic.

Safe HaskellNone



This module contains the truth table generating functionality of Hatt. The core function it exports is truthTable which prints the truth table of the given expression. truthTableP is a configurable version which allows one to select how to print expressions and truth values. This gives one the option of, for example, colouring outputs and changing the symbols used to represent the logical connectives.



colourBool :: Bool -> StringSource

Prints a green T for True and a red F for False. This is used when producing a string representation of a truth table with truthTable. It can also be used as (as the second component of a Printer pair) as an argument to the configurable truthTableP function.

showBool :: Bool -> StringSource

Prints T for True and F for False.

truthTable :: Expr -> StringSource

The truthTable function produces a truth table for the given expression.

truthTableP :: Printer -> Expr -> StringSource

The truthTableP is a configurable version of truthTable which allows a printer function to be selected, so for example one can print ASCII truth tables by passing showAscii to truthTableP instead of show.