Inox is a solver for higher-order functional programs, providing first-class support for features such as:
- Recursive and first-class functions
- ADTs, integers, bitvectors, strings, set-multiset-map abstractions
- Quantifiers
- ADT invariants
- Dependent types
Interfacing with the solver can be done through the Scala API by constructing the AST for your query and feeding it to one of the solvers. For more information, see:
- The usage tutorial for using Inox as a library.
- The tree interpolators for easy tree construction/extraction.
- The API for available solver/evaluator calls.
- The trees API and how to extend them.
To use Inox as a Scala 3 dependency, refer to a specific git commit in your
build.sbt
file as follows:
def remoteProject(repo: String, version: String) = RootProject(uri(s"${repo}#${version}"))
// Choose a commit hash to pin the Inox version (replace with the latest or chosen commit):
val inoxRepository = "https://github.com/epfl-lara/inox.git"
val inoxCommitHash = "467725efc4f7d7cf92017581ded04e257bee7368" // example commit
lazy val inox = remoteProject(inoxRepository, inoxCommitHash)
// And depend on it in your project
lazy val yourProject = (project in file("."))
.settings(
// ...
)
.dependsOn(inox) // <<<
One can also use Inox through command-line by using the
TIP format to describe the relevant query. The
easiest way to use the Inox command line is to simply build
the project and use the generated inox
script.
Inox relies on SMT solvers to solve the constraints it generates. Inox ships with the JVM SMT solver Princess and Horn solver Eldarica which should work out of the box on any system.
You can also use the following external SMT solvers:
Solver binaries you install should match your operating system and architecture.
We recommend installing these solvers as binaries and ensuring they are
available in your $PATH
(as z3
or cvc5
). Once installed, you can instruct
Inox to use a sequence of solvers. The more solvers you have installed, the more
likely Inox is to succeed, as solver capabilities are often complementary.
In addition to these external binaries, a native Z3 API for Linux is bundled with Inox and should work out of the box (although having an external Z3 binary is a good idea in any case). If you build yourself, the generated script should put the native API onto your classpath. Otherwise, you will have to make sure the relevant jar from unmanaged is on your runtime classpath.
If a version for your platform is not shipped with Inox, you will have to
recompile the native Z3 communication layer yourself; see the
ScalaZ3 repository for information about
how to build and package the project. You will then need to copy the resulting
jar into the unmanaged directory, named
scalaz3-$os-$arch-$scalaBinaryVersion.jar
(replace the variables with the
relevant values).
Currently, the default solver is the native Z3 API. If that solver is
unavailable, a series of fallbacks occur, ending with the princess solver. You
can specify which solver to use by, for example, giving the option
--solvers=smt-cvc5
to use cvc5. Check the --solvers
line in Inox's help for
more details.
Inox is easiest to build on Linux-like platforms, but see below for other platforms.
Due to the evolving nature of the project, this documentation may not always be up to date for all platforms; we welcome pull requests with carefully written and tested improvements to the information below.
Requirements:
- Java Development Kit 17 for your platform (and the corresponding runtime environment)
- sbt >= 1.6.0 (Available from http://www.scala-sbt.org/)
- The git command on your path
Get the sources of Inox by cloning the official Inox repository:
$ git clone https://github.com/epfl-lara/inox
Cloning into 'inox'...
// ...
$ cd inox
$ sbt clean compile
// takes about 1 minute
Inox compilation generates an inox
bash script that runs Inox with all the appropriate settings. This script expects input files in the TIP format and will report SAT or UNSAT for the specified properties.
See ./inox --help
for more information about CLI usage.
Not well tested!
We strongly recommend using Windows Subsystem for Linux (WSL) to run Inox on Windows. However, if you wish to run Inox natively on Windows:
- You will need a Git shell for Windows, e.g. Git for Windows. Building then proceeds as described above.
- You will need to either port the
inox
bash script to Windows, or run it under Cygwin.
You may be able to obtain additional tips on getting Inox to work on Windows from Mikael Mayer or on his dedicated web page.
Inox comes with a test suite. You can run the following commands to invoke different test suites:
$ sbt test
$ sbt it:test
Contributions are welcome! Please open issues or pull requests for bug fixes, improvements, or documentation updates.
This project is licensed under the Apache License 2.0.