-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A truth table generator for classical propositional logic. -- -- Hatt is a command-line program which prints truth tables for -- expressions in classical propositional logic, and a library allowing -- its parser, evaluator and truth table generator to be used in other -- programs. @package hatt @version 1.0 -- | The Data.Logic.Propositional module provides a set of functions -- for parsing, manipulating and generating truth tables for expressions -- in classical propositional logic. -- -- The core of the API is the Expr data type, which has -- constructors for all the usual expression forms: variables, standing -- for atomic propositions; negation, the only unary connective; and the -- binary connectives of conjunction, disjunction, material implication -- and logical equivalence. module Data.Logic.Propositional data Expr Variable :: String -> Expr Negation :: Expr -> Expr Conjunction :: Expr -> Expr -> Expr Disjunction :: Expr -> Expr -> Expr Conditional :: Expr -> Expr -> Expr Biconditional :: Expr -> Expr -> Expr type Mapping = Map String Bool -- | Determines whether two expressions are extensionally equivalent (that -- is, have the same values under all interpretations). equivalent :: Expr -> Expr -> Bool -- | In order to interpret an expression, a mapping from variables to truth -- values needs to be provided. Truth values are compositional; that's to -- say, the value of a composite expression (any expression which is not -- atomic) depends on the truth values of its component parts. For -- example, the Haskell expression below would evaluate to -- False. -- --
--   interpret
--       (Conjunction (Variable "A") (Variable "B"))
--       (fromList [("A", True), ("B", False)])
--   
interpret :: Expr -> Mapping -> Bool -- | Generates the possible assignments of variables in an expression. assignments :: Expr -> [Mapping] -- | Determines whether an expression is contingent (that is, true in at -- least one interpretation and false in at least one interpretation). isContingent :: Expr -> Bool -- | Determines whether an expression is contradictory. isContradiction :: Expr -> Bool -- | Determines whether an expression is tautological. isTautology :: Expr -> Bool -- | The parseExpr function accepts the name of a source, and a -- string to be parsed, and attempts to parse the string as a logical -- expression of the following forms, where φ and ψ are -- metalinguistic variables standing for any valid expression. -- -- parseExpr :: SourceName -> String -> Either ParseError Expr -- | A specialised variant of showsPrec, using precedence context -- zero, and returning an ordinary String. show :: Show a => a -> String -- | Represents expressions using only ASCII characters (the show -- function pretty-prints expressions using logical symbols only present -- in extended character sets). showAscii :: Expr -> String -- | The truthTable function produces a truth table for the given -- expression. truthTable :: Expr -> String -- | 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. truthTableP :: (Expr -> String) -> Expr -> String -- | Lists the names of variables present in an expression. variables :: Expr -> [String]