mios-1.3.0: A Minisat-based SAT solver in Haskell

Safe HaskellTrustworthy
LanguageHaskell2010

SAT.Mios.Types

Contents

Description

Basic data types used throughout mios.

Synopsis

Documentation

class VectorFamily s t | s -> t where Source #

Public interface as Container

Minimal complete definition

dump

Methods

clear :: s -> IO () Source #

erases all elements in it

dump :: Show t => String -> s -> IO String Source #

dump the contents

asVec :: s -> IOVector Int Source #

get a raw data

asList :: s -> IO [t] Source #

converts into a list

Variable

type Var = Int Source #

represents Var

bottomVar :: Var Source #

Special constant in Var (p.7)

int2var :: Integer -> Integer Source #

converts a usual Int as literal to an internal Var presentation

>>> int2var 1
1  -- the first literal is the first variable
>>> int2var 2
2  -- literal @2@ is variable 2
>>> int2var (-2)
2 -- literal @-2@ is corresponding to variable 2

Internal encoded Literal

type Lit = Int Source #

The literal data has an index method which converts the literal to a "small" integer suitable for array indexing. The var method returns the underlying variable of the literal, and the sign method if the literal is signed (False for x and True for -x).

lit2int :: Lit -> Int Source #

converts Lit into Int as int2lit . lit2int == id

>>> lit2int 2
1
>>> lit2int 3
-1
>>> lit2int 4
2
>>> lit2int 5
-2

int2lit :: Int -> Lit Source #

converts Int into Lit as lit2int . int2lit == id

>>> int2lit 1
2
>>> int2lit (-1)
3
>>> int2lit 2
4
>>> int2lit (-2)
5

bottomLit :: Lit Source #

Special constant in Lit (p.7)

newLit :: Var -> Lit Source #

converts Var into Lit

positiveLit :: Lit -> Bool Source #

returns True if the literal is positive

lit2var :: Lit -> Var Source #

converts Lit into Var

>>> lit2var 2
1
>>> lit2var 3
1
>>> lit2var 4
2
>>> lit2var 5
2

var2lit :: Var -> Bool -> Lit Source #

converts a Var to the corresponing literal

>>> var2lit 1 True
2
>>> var2lit 1 False
3
>>> var2lit 2 True
4
>>> var2lit 2 False
5

negateLit :: Lit -> Lit Source #

negates literal

>>> negateLit 2
3
>>> negateLit 3
2
>>> negateLit 4
5
>>> negateLit 5
4

Assignment

lbool :: Bool -> LiftedBool Source #

converts Bool into LBool

lFalse :: Int Source #

A contant representing False

lTrue :: Int Source #

A constant representing True

lBottom :: Int Source #

A constant for "undefined"

class VarOrder o where Source #

Assisting ADT for the dynamic variable ordering of the solver. The constructor takes references to the assignment vector and the activity vector of the solver. The method select will return the unassigned variable with the highest activity.

Methods

newVarOrder :: (VectorFamily v1 Bool, VectorFamily v2 Double) => v1 -> v2 -> IO o Source #

constructor

newVar :: o -> IO Var Source #

Called when a new variable is created.

update :: o -> Var -> IO () Source #

Called when variable has increased in activity.

updateAll :: o -> IO () Source #

Called when all variables have been assigned new activities.

undo :: o -> Var -> IO () Source #

Called when variable is unbound (may be selected again).

select :: o -> IO Var Source #

Called to select a new, unassigned variable.

Instances

VarOrder Solver Source #

Interfate to select a decision var based on variable activity.

CNF