smtlib
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Node.js API for SMT-LIB 2.0

Build Status Coverage Status Dependency Status

SMT-LIB 2.0 is an interoperability format to communicate with different SMT solvers, such as CVC4 or Z3.

The syntax of SMT-LIB is similar to Lisp:

(set-logic QF_ALL_SUPPORTED)
(declare-fun x () Bool)
(declare-fun y () Bool)
(assert (and (or x y) (not x) (not y))
(check-sat)

This package provides an high-level API to construct SMT-Lib expressions, taking care of escaping:

const smt = require('smtlib');
let solver = new smt.LocalCVC4Solver('QF_ALL_SUPPORTED');
solver.add(smt.DeclareFun('x', [], 'Bool'))
solver.add(smt.DeclareFun('y', [], 'Bool'))
solver.assert(smt.And(smt.Or('x', 'y'), smt.Not('x'), smt.Not('y')));
solver.checkSat().then(([sat, assignment]) => ...).catch((e) => ...);

The library also includes code to interact with a locally installed CVC4, as an external process.

Dependencies (2)

Dev Dependencies (11)

Package Sidebar

Install

npm i smtlib

Weekly Downloads

6

Version

1.0.0

License

MIT

Unpacked Size

83.1 kB

Total Files

26

Last publish

Collaborators

  • gcampax