qlogic-0.9: A Haskell Library for Propositional Logic.

Safe HaskellNone

Qlogic.Diophantine

Contents

Synopsis

Types

type DioFormula l a b = Formula l (DioAtom a b)

data DioAtom a b

Constructors

Grt (DioPoly a b) (DioPoly a b) 
Geq (DioPoly a b) (DioPoly a b) 
Equ (DioPoly a b) (DioPoly a b) 
PAtom PA 

Instances

Typeable2 DioAtom 
(Eq a, Eq b) => Eq (DioAtom a b) 
(Ord a, Ord b) => Ord (DioAtom a b) 
(Show a, Show b) => Show (DioAtom a b) 
(Eq l, PropAtom a, Eq b) => NGBoolean (DioFormula l DioVar b) a 

type DioPoly a b = [DioMono a b]

data DioMono a b

Constructors

DioMono b [VPower a] 

Instances

Typeable2 DioMono 
(Eq a, Eq b) => Eq (DioMono a b) 
(Ord a, Ord b) => Ord (DioMono a b) 
(Show a, Show b) => Show (DioMono a b) 

data VPower a

Constructors

VPower a Int 
RestrictVar a Int 

Instances

Typeable1 VPower 
Eq a => Eq (VPower a) 
Ord a => Ord (VPower a) 
Show a => Show (VPower a) 

data DioVar

Constructors

forall a . DioVarClass a => DioVar a 

class PropAtom a => DioVarClass a where

Methods

toDioVar :: a -> DioVar

fromDioVar :: DioVar -> Maybe a

Instances

class (Solver s l, SizeSemiring b) => MSemiring s l f a b | f -> a, f -> b, f -> s, f -> l, b -> f where

Methods

plus :: f -> f -> NatMonad s l f

prod :: f -> f -> NatMonad s l f

zero :: f

one :: f

geq :: f -> f -> NatMonad s l (PropFormula l)

grt :: f -> f -> NatMonad s l (PropFormula l)

equ :: f -> f -> NatMonad s l (PropFormula l)

constToFormula :: b -> f

formAtom :: b -> a -> NatMonad s l f

padFormTo :: Int -> f -> f

truncFormTo :: Int -> f -> NatMonad s l f

bigPlus :: [f] -> NatMonad s l f

bigProd :: [f] -> NatMonad s l f

class Semiring b => SizeSemiring b where

Methods

sizeToBits :: b -> Int

bitsToSize :: Int -> b

Operations

toFormula :: (Ord l, Ord b, DioVarClass a, MSemiring s l f a b) => Maybe b -> b -> DioFormula l a b -> SatSolver s l (PropFormula l)

translates a Diophantine constraint into a propositional formula, where variables are instantiated by values between 0 and n. this function tracks the maximum value of all subformulas. the length of all vectors is possibly pruned according to these maximum values

constToPoly :: b -> DioPoly a b

varToPoly :: Semiring b => a -> DioPoly a b

add :: (Eq a, Eq b, Semiring b) => DioPoly a b -> DioPoly a b -> DioPoly a b

bigAdd :: (Eq a, Eq b, Semiring b) => [DioPoly a b] -> DioPoly a b

mult :: (Eq a, Eq b, Semiring b) => DioPoly a b -> DioPoly a b -> DioPoly a b

bigMult :: (Eq a, Eq b, Semiring b) => [DioPoly a b] -> DioPoly a b

simplify :: (Eq a, Eq b, Semiring b) => DioPoly a b -> DioPoly a b