Portability | Boolean expressions and various representations. |
---|---|
Stability | provisional |
Maintainer | Nicolas Pouillard <nicolas.pouillard@gmail.com> |
- class Boolean f where
- data BoolExpr a
- reduceBoolExpr :: BoolExpr Bool -> Bool
- evalBoolExpr :: (a -> Bool) -> BoolExpr a -> Bool
- data Signed a
- constants :: BoolExpr a -> [Signed a]
- newtype CNF a = CNF {}
- newtype Conj a = Conj {
- unConj :: [a]
- boolTreeToCNF :: NegateConstant a -> BoolExpr a -> CNF a
- reduceCNF :: CNF Bool -> Bool
- newtype Disj a = Disj {
- unDisj :: [a]
- newtype DNF a = DNF {}
- boolTreeToDNF :: (a -> BoolExpr a) -> BoolExpr a -> DNF a
- reduceDNF :: DNF Bool -> Bool
- dualize :: NegateConstant a -> BoolExpr a -> BoolExpr a
- pushNotInwards :: NegateConstant a -> BoolExpr a -> BoolExpr a
A boolean class
Boolean trees
Syntax of boolean expressions parameterized over a set of leaves, named constants.
reduceBoolExpr :: BoolExpr Bool -> BoolSource
Reduce a boolean tree annotated by booleans to a single boolean.
evalBoolExpr :: (a -> Bool) -> BoolExpr a -> BoolSource
Signed constants
Signed values are either positive of negative.
constants :: BoolExpr a -> [Signed a]Source
Returns constants used in a given boolean tree, these constants are returned signed depending one how many negations stands over a given constant.
Conjunctive Normal Form
boolTreeToCNF :: NegateConstant a -> BoolExpr a -> CNF aSource
Convert a boolean tree to a conjunctive normal form.
reduceCNF :: CNF Bool -> BoolSource
Reduce a boolean expression in conjunctive normal form to a single boolean.
Disjunctive Normal Form
boolTreeToDNF :: (a -> BoolExpr a) -> BoolExpr a -> DNF aSource
Convert a boolean tree to a disjunctive normal form.
reduceDNF :: DNF Bool -> BoolSource
Reduce a boolean expression in disjunctive normal form to a single boolean.
Other transformations
pushNotInwards :: NegateConstant a -> BoolExpr a -> BoolExpr aSource
Push the negations inwards as much as possible. The resulting boolean tree no longer use negations.