General-purpose functions
This commit is contained in:
parent
e3d4c5fb79
commit
83455a2252
1 changed files with 17 additions and 0 deletions
17
Sat.hs
17
Sat.hs
|
@ -36,6 +36,23 @@ type Assignment = [Lit]
|
|||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
-- General-purpose functions
|
||||
|
||||
-- Extracts a variable from a literal
|
||||
fromLit :: Lit -> Var
|
||||
fromLit (Pos x) = x
|
||||
fromLit (Neg x) = x
|
||||
|
||||
-- Tests for positive/negative literals
|
||||
isPos :: Lit -> Bool
|
||||
isPos (Pos _) = True
|
||||
isPos (Neg _) = False
|
||||
|
||||
isNeg :: Lit -> Bool
|
||||
isNeg = not . isPos
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
-- Literal Evaluation
|
||||
|
||||
-- Negates a literal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue