Smt.ml is an SMT solver frontend for OCaml that simplifies integration with various solvers through a consistent interface. Its parametric encoding facilitates the easy addition of new solver backends, while optimisations like formula simplification, result caching, and detailed error feedback enhance performance and usability.
Install opam and bootstrap the OCaml compiler:
opam init
opam switch create 5.1.1 5.1.1
Then install encoding:
opam install smtml
Smt.ml uses optional dependencies (known as depopts
in opam) to integrate
with different SMT solvers. By default, Smt.ml installs without a solver, but
you can enable support for a specific solver by installing it with opam.
For example, to install smtml with Z3:
opam install smtml z3
Alternatively, if you've already installed Smt.ml through opam, you can simply install the solver of your choice and opam will recompile smtml for you. For example, to install Z3 after installing smtml:
opam install z3
See the Supported Solvers section below for a complete list of available solvers.
Clone the repo and install the dependencies:
git clone https://github.com/formalsec/smtml.git
cd smtml
opam install . --deps-only --with-test
Build and test:
dune build @install
dune runtest
Install smtml
on your path by running:
dune install
BISECT_FILE=`pwd`/bisect dune runtest --force --instrument-with bisect_ppx
bisect-ppx-report summary # Shell summary
bisect-ppx-report html # Detailed Report in _coverage/index.html
Solver | Status | Opam Package |
---|---|---|
Z3 | ☑️ | z3 |
Colibri2 | ☑️ | colibri2 |
Bitwuzla | ☑️ | bitwuzla-cxx |
Alt-Ergo | ☑️ | alt-ergo |
cvc5 | ☑️ | cvc5 |
Minisat | 📆 | minisat |
- ☑️ Solver is currently supported
- 🔄 Ongoing work to support solver
- 📆 Planned to support in the future
The name Smt.ml
is a portmanteau of the terms SMT
and OCaml
. The .ml
extension is a common file extension for OCaml source files. The library itself
is named smtml
and can be imported into OCaml programs using the following
syntax:
open Smtml
See CHANGES
MIT License
Copyright (c) 2024 formalsec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.