ersatz-0.2.6: A monad for expressing SAT or QSAT problems using observable sharing.

Portabilitynon-portable
Stabilityexperimental
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellTrustworthy

Ersatz.Bit

Description

 

Synopsis

Documentation

data Bit Source

A Bit provides a reference to a possibly indeterminate boolean value that can be determined by an external SAT solver.

Constructors

And (Seq Bit) 
Or (Seq Bit) 
Xor Bit Bit 
Mux Bit Bit Bit 
Not Bit 
Var !Literal 

assert :: (MonadState s m, HasSAT s) => Bit -> m ()Source

Assert claims that Bit must be true in any satisfying interpretation of the current problem.

class Boolean b whereSource

The normal Bool operators in Haskell are not overloaded. This provides a richer set that are.

Instances for this class for product-like types can be automatically derived for any type that is an instance of Generic

Methods

bool :: Bool -> bSource

Lift a Bool

true :: bSource

false :: bSource

(&&) :: b -> b -> bSource

Logical conjunction.

(||) :: b -> b -> bSource

Logical disjunction (inclusive or).

(==>) :: b -> b -> bSource

Logical implication.

not :: b -> bSource

Logical negation

and :: Foldable t => t b -> bSource

The logical conjunction of several values.

or :: Foldable t => t b -> bSource

The logical disjunction of several values.

nand :: Foldable t => t b -> bSource

The negated logical conjunction of several values.

nand = not . and

nor :: Foldable t => t b -> bSource

The negated logical disjunction of several values.

nor = not . or

all :: (Foldable t, Boolean b) => (a -> b) -> t a -> bSource

The logical conjunction of the mapping of a function over several values.

any :: (Foldable t, Boolean b) => (a -> b) -> t a -> bSource

The logical disjunction of the mapping of a function over several values.

xor :: b -> b -> bSource

Exclusive-or

chooseSource

Arguments

:: b

False branch

-> b

True branch

-> b

Predicate/selector branch

-> b 

Choose between two alternatives based on a selector bit.