Maintainer | bastiaan.heeren@ou.nl |
---|---|
Stability | provisional |
Portability | portable (depends on ghc) |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- type LogicAlg b a = (b -> a, a -> a -> a, a -> a -> a, a -> a -> a, a -> a -> a, a -> a, a, a)
- type SLogic = Logic ShowString
- data Logic a
- foldLogic :: LogicAlg b a -> Logic b -> a
- ppLogic :: Show a => Logic a -> String
- ppLogicPrio :: Show a => Int -> Logic a -> String
- catLogic :: Logic (Logic a) -> Logic a
- evalLogic :: (a -> Bool) -> Logic a -> Bool
- eqLogic :: Eq a => Logic a -> Logic a -> Bool
- tautology :: Eq a => Logic a -> Bool
- isNot :: Logic a -> Bool
- isAtomic :: Logic a -> Bool
- isDNF :: Logic a -> Bool
- isCNF :: Logic a -> Bool
- countEquivalences :: Logic a -> Int
- varsLogic :: Eq a => Logic a -> [a]
- trueSymbol :: Symbol
- falseSymbol :: Symbol
- notSymbol :: Symbol
- impliesSymbol :: Symbol
- equivalentSymbol :: Symbol
- andSymbol :: Symbol
- orSymbol :: Symbol
- module Domain.Algebra.Boolean
Documentation
type LogicAlg b a = (b -> a, a -> a -> a, a -> a -> a, a -> a -> a, a -> a -> a, a -> a, a, a) Source #
The type LogicAlg is the algebra for the data type Logic | Used in the fold for Logic.
type SLogic = Logic ShowString Source #
For simple use, we assume the variables to be strings
The data type Logic is the abstract syntax for the domain | of logic expressions.
Var a | |
(Logic a) :->: (Logic a) infixr 3 | |
(Logic a) :<->: (Logic a) infixr 2 | |
(Logic a) :&&: (Logic a) infixr 5 | |
(Logic a) :||: (Logic a) infixr 4 | |
Not (Logic a) | |
T | |
F |
Instances
evalLogic :: (a -> Bool) -> Logic a -> Bool Source #
evalLogic takes a function that gives a logic value to a variable, | and a Logic expression, and evaluates the boolean expression.
eqLogic :: Eq a => Logic a -> Logic a -> Bool Source #
eqLogic determines whether or not two Logic expression are logically | equal, by evaluating the logic expressions on all valuations.
isAtomic :: Logic a -> Bool Source #
A Logic expression is atomic if it is a variable or a constant True or False.
isDNF :: Logic a -> Bool Source #
Functions isDNF, and isCNF determine whether or not a Logix expression | is in disjunctive normal form, or conjunctive normal form, respectively.
isCNF :: Logic a -> Bool Source #
Functions isDNF, and isCNF determine whether or not a Logix expression | is in disjunctive normal form, or conjunctive normal form, respectively.
countEquivalences :: Logic a -> Int Source #
Count the number of equivalences
varsLogic :: Eq a => Logic a -> [a] Source #
Function varsLogic returns the variables that appear in a Logic expression.
trueSymbol :: Symbol Source #
falseSymbol :: Symbol Source #
module Domain.Algebra.Boolean