Module

Mycroft.SmtLib

Package
purescript-mycroft
Repository
afcondon/purescript-mycroft

The typed veneer: untyped Terms built by smart constructors, simple-smt style. Enough SMTLib2 for finite-domain work — enum sorts, Int arithmetic for cardinality, uninterpreted functions, named assertions, models, unsat cores.

#Sort Source

newtype Sort

Constructors

#Term Source

newtype Term

Constructors

Instances

#Result Source

data Result

Constructors

Instances

#Model Source

type Model = Map String SExpr

Constant assignments from get-model: name ↦ value s-expression.

#produceModels Source

#produceUnsatCores Source

#declareEnum Source

declareEnum :: Solver -> { ctors :: Array String, name :: String } -> Aff Sort

(declare-datatypes ((Name 0)) (((c1) (c2) …))) — a nullary datatype, i.e. an enumeration.

#declareConst Source

#declareFun Source

#assert Source

#assertNamed Source

assertNamed :: Solver -> String -> Term -> Aff Unit

(assert (! t :named n)) — named assertions are what unsat cores are made of.

#inNewScope Source

inNewScope :: forall a. Solver -> Aff a -> Aff a

Run an action inside a push/pop scope; the pop happens even if the action throws.

#eqT Source

eqT :: Term -> Term -> Term

#neqT Source

neqT :: Term -> Term -> Term

#notT Source

notT :: Term -> Term

#implies Source

#ite Source

ite :: Term -> Term -> Term -> Term

#intLit Source

#countEq Source

countEq :: Array Term -> Term -> Term

How many of the given terms equal the target — the sum-of-ite cardinality encoding, for hand-size style constraints.

#lookupAtom Source

lookupAtom :: Model -> String -> Maybe String

Read a model value that should be a bare atom (an Int literal or an enum constructor).