picologic-0.2.0: Utilities for symbolic predicate logic expressions

Safe HaskellSafe
LanguageHaskell2010

Picologic.AST

Synopsis

Documentation

data Expr Source

Constructors

Var Ident

Variable

Neg Expr

Logical negation

Conj Expr Expr

Logical conjunction

Disj Expr Expr

Logical disjunction

Iff Expr Expr

Logical biconditional

Implies Expr Expr

Material implication

Top

Constant true

Bottom

Constant false

newtype Solutions Source

Constructors

Solutions [[Expr]] 

variables :: Expr -> [Ident] Source

Variables in expression

eval :: Ctx -> Expr -> Bool Source

Evaluate expression.

cnf :: Expr -> Expr Source

Conjunctive normal form. (May result in exponential growth)

nnf :: Expr -> Expr Source

Negation normal form. (May result in exponential growth)

simp :: Expr -> Expr Source

Remove tautologies.

isConst :: Expr -> Bool Source

Test if expression is constant.

propConst :: Expr -> Expr Source

Propagate constants (to simplify expression).

subst :: Map Ident Expr -> Expr -> Expr Source

Substitute expressions for variables. This doesn't resolve any potential variable name conflicts.

partEval :: Ctx -> Expr -> Expr Source

Partially evaluate expression.