All Projects → sosy-lab → Java Smt

sosy-lab / Java Smt

Licence: apache-2.0
JavaSMT - Unified Java API for SMT solvers.

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to Java Smt

Cvc4
CVC4 is an efficient open-source automatic theorem prover for satisfiability modulo theories (SMT) problems.
Stars: ✭ 476 (+440.91%)
Mutual labels:  smt
Liquidhaskell
Liquid Types For Haskell
Stars: ✭ 863 (+880.68%)
Mutual labels:  smt
Dreal4
SMT Solver for Nonlinear Theories of Reals
Stars: ✭ 72 (-18.18%)
Mutual labels:  smt
Vroom
Vehicle Routing Open-source Optimization Machine
Stars: ✭ 533 (+505.68%)
Mutual labels:  solver
Flutter Ai Rubik Cube Solver
Flutter-Python rubiks cube solver.
Stars: ✭ 744 (+745.45%)
Mutual labels:  solver
Pulp
A python Linear Programming API
Stars: ✭ 1,080 (+1127.27%)
Mutual labels:  solver
Adafruit cad parts
CAD files for various boards, components and parts
Stars: ✭ 386 (+338.64%)
Mutual labels:  smt
Hiop
HPC solver for nonlinear optimization problems
Stars: ✭ 75 (-14.77%)
Mutual labels:  solver
Cuckoo
a memory-bound graph-theoretic proof-of-work system
Stars: ✭ 747 (+748.86%)
Mutual labels:  solver
Visma
VISual MAth - an equation solver and visualizer
Stars: ✭ 71 (-19.32%)
Mutual labels:  solver
Zeratool
Automatic Exploit Generation (AEG) and remote flag capture for exploitable CTF problems
Stars: ✭ 584 (+563.64%)
Mutual labels:  solver
Osqp
The Operator Splitting QP Solver
Stars: ✭ 689 (+682.95%)
Mutual labels:  solver
Prioritizr
Systematic conservation prioritization in R
Stars: ✭ 62 (-29.55%)
Mutual labels:  solver
Choco Solver
An open-source Java library for Constraint Programming
Stars: ✭ 518 (+488.64%)
Mutual labels:  solver
Nopol
Automatic program repair and patch generation system for Java based on dynamic analysis and code synthesis with SMT, developed at University of Lille and Inria, France.
Stars: ✭ 73 (-17.05%)
Mutual labels:  smt
Convex.jl
A Julia package for disciplined convex programming
Stars: ✭ 417 (+373.86%)
Mutual labels:  solver
Mayamatchmovesolver
A Bundle Adjustment solver for MatchMove related tasks.
Stars: ✭ 50 (-43.18%)
Mutual labels:  solver
Storm
A blackbox mutational fuzzer for detecting critical bugs in SMT solvers
Stars: ✭ 79 (-10.23%)
Mutual labels:  smt
Angler
Frequency-domain photonic simulation and inverse design optimization for linear and nonlinear devices
Stars: ✭ 75 (-14.77%)
Mutual labels:  solver
Py Lapsolver
Fast linear assignment problem (LAP) solvers for Python based on c-extensions
Stars: ✭ 70 (-20.45%)
Mutual labels:  solver

JavaSMT

Build Status Build Status on Windows Code Quality Test Coverage Apache 2.0 License Maven Central

JavaSMT is a common API layer for accessing various SMT solvers. The API is optimized for performance (using JavaSMT has very little runtime overhead compared to using the solver API directly), customizability (features and settings exposed by various solvers should be visible through the wrapping layer) and type-safety (it shouldn't be possible to add boolean terms to integer ones at compile time) sometimes at the cost of verbosity.

Quick links

Getting Started | Documentation | Known Issues | Documentation for Developers | Changelog | Configuration Options

References

Feature overview

JavaSMT can express formulas in the following theories:

  • Integer
  • Rational
  • Bitvector
  • Floating point
  • Array
  • Uninterpreted Function

Currently JavaSMT supports several SMT solvers (see Getting Started for installation):

SMT Solver Linux64 Windows64 MacOS Description
Boolector ✔️ a fast solver for bitvector logic, misses formula introspection
CVC4 ✔️
MathSAT5 ✔️ ✔️
OptiMathSAT ✔️ same as MathSAT5, but with support for optimization
Princess ✔️ ✔️ ✔️ Java-based SMT solver
SMTInterpol ✔️ ✔️ ✔️ Java-based SMT solver
Yices2 ✔️ soon
Z3 ✔️ ✔️ ✔️ mature and well-known solver

The following features are supported (depending on the used SMT solver):

  • Satisfiability checking
  • Quantifiers and quantifier elimination
  • Incremental solving with assumptions
  • Incremental solving with push/pop
  • Multiple independent contexts
  • Model generation
  • Interpolation, including tree and sequential structure
  • Formula transformation using built-in tactics
  • Formula introspection using visitors

We aim for supporting more important features, more SMT solvers, and more systems. If something specific is missing, please look for or file an issue.

Multithreading Support

The solvers Z3(w and w/o Optimization), SMTInterpol, Princess, MathSAT5, Boolector and CVC4 support multithreading, provided that different threads use different contexts, and all operations on a single context are performed from a single thread. Interruption using ShutdownNotifier may be used to interrupt a a solver from any thread. CVC4 supports multithreading on a single context with multiple stacks(=provers).

Garbage Collection in Native Solvers

JavaSMT exposes an API for performing garbage collection on solvers implemented in a native language. As a native solver has no way of knowing whether the created formula object is still referenced by the client application, this API is necessary to avoid leaking memory. Note that several solvers already support hash consing and thus, there is never more than one copy of an identical formula object in memory. Consequently, if all created formulas are later re-used (or re-created) in the application, it is not necessary to perform any garbage collection at all.

Z3

The parameter solver.z3.usePhantomReferences may be used to control whether JavaSMT will attempt to decrease references on Z3 formula objects once they are no longer referenced.

MathSAT5

Currently we do not support performing garbage collection for MathSAT5.

Getting started

Installation is possible via Maven, Ivy, or manually. Please see our Getting Started Guide.

Usage

// Instantiate JavaSMT with SMTInterpol as backend (for dependencies cf. documentation)
try (SolverContext context = SolverContextFactory.createSolverContext(
        config, logger, shutdownNotifier, Solvers.SMTINTERPOL)) {
  IntegerFormulaManager imgr = context.getFormulaManager().getIntegerFormulaManager();

  // Create formula "a = b" with two integer variables
  IntegerFormula a = imgr.makeVariable("a");
  IntegerFormula b = imgr.makeVariable("b");
  BooleanFormula f = imgr.equal(a, b);

  // Solve formula, get model, and print variable assignment
  try (ProverEnvironment prover = context.newProverEnvironment(ProverOptions.GENERATE_MODELS)) {
    prover.addConstraint(f);
    boolean isUnsat = prover.isUnsat();
    assert !isUnsat;
    try (Model model = prover.getModel()) {
      System.out.printf("SAT with a = %s, b = %s", model.evaluate(a), model.evaluate(b));
    }
  }
}

Authors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].