General-purpose functions

This commit is contained in:
Dimitri Lozeve 2016-08-02 19:34:44 +01:00
parent e3d4c5fb79
commit 83455a2252
No known key found for this signature in database
GPG key ID: 12B390E6BD7CF219

17
Sat.hs
View file

@ -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 -- Literal Evaluation
-- Negates a literal -- Negates a literal