• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
      • Ipasir
      • Aignet
      • Aig
      • Satlink
        • Sat-solver-options
          • Unsat-checking
          • Check-config
        • Config-p
        • Logical-story
        • Dimacs
        • Gather-benchmarks
        • Cnf
        • Satlink-extra-hook
        • Sat
      • Truth
      • Ubdds
      • Bdd
      • Faig
      • Bed
      • 4v
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Testing-utilities
    • Math
  • Satlink

Sat-solver-options

How to get a SAT solver that you can use with satlink.

To use Satlink you will need at least one SAT solver. Below are some solvers that are known to work well with Satlink. You may wish to install several of these. This lets you switch between solvers to figure out which solver is best for your particular problem, and perhaps to gain some additional confidence that a particular problem really is unsatisfiable (by checking it with many solvers.)

Special recommendations are for Glucose (no longer the most modern or highest-performing, but adequate and needed for certifying certain ACL2 community books) and Kissat (as of 2020, the best-performing free/open-source solver).

Glucose — open source, recommended

Based on our experiences using gl for proofs about hardware modules at Centaur, we usually try Glucose first. On Linux, version 3.0, 4.0, or 4.1 should work with Satlink without modification (though, some users have had difficulty with 4.0). (We have also successfully used earlier versions with Satlink, but occasionally needed to patch them in minor ways, e.g., to print counterexamples.)

Quick instructions:

  • Download Glucose 3.0 and extract glucose-3.0.tgz somewhere
  • cd glucose-3.0/core; make
  • cd glucose-3.0/simp; make
  • Verify that glucose-3.0/simp/glucose --help prints a help message

(NOTE for Mac and FreeBSD/PCBSD users: If you are building Glucose 3.0 or 4.0, the build might fail. In that case, a solution may be first to make the replacements shown below, where the the first in each pair (<) is the Mac/FreeBSD/PCBSD version, while the second in each pair (>) is the original source. (Thanks to Marijn Heule and Warren Hunt for these suggestions.)

In file ../glucose-3.0/core/SolverTypes.h:

<     // friend Lit mkLit(Var var, bool sign = false);
---
>     friend Lit mkLit(Var var, bool sign = false);

< inline  Lit  mkLit     (Var var, bool sign = false) { Lit p; p.x =
var + var + (int)sign; return p; }
---
> inline  Lit  mkLit     (Var var, bool sign) { Lit p; p.x = var + var + (int)sign; return p; }

In the file ../glucose-3.0/utils/System.cc comment the line below, but note that this is probably only necessary for FreeBSD/PCBSD, not for Mac:

<   // double MiniSat::memUsedPeak(void) { return memUsed(); }
---
>   double MiniSat::memUsedPeak(void) { return memUsed(); }

End of NOTE for Mac and FreeBSD/PCBSD users.)

Now create a shell script as follows, somewhere in your $PATH, named glucose. Note that the order of the arguments is important.

#!/bin/sh
/path/to/glucose-3.0/simp/glucose -model "$@"

As a quick test to make sure things are working, you can try to certify this book (where below, “[books]” refers to the community books directory):

cd [books]/centaur/satlink/solvers
cert.pl test-glucose

You should now be able to use Satlink with configurations such as:

(satlink::make-config :cmdline "glucose")

Glucose can (optionally) produce UNSAT proofs that can be checked by a simpler program. Satlink includes a script that makes it easy to run the solver and then check any UNSAT answers. See unsat-checking for more information.

Penelope

Penelope is a (mostly) open-source, parallel sat solver. The build process is simple: run make and add the resulting penelope executable to your PATH. As a quick test to ensure things are working, you can try to certify this book:

cd [books]/centaur/satlink/solvers
cert.pl test-penelope

Note that you will usually need to point Penelope at a configuration file that tells it, e.g., how many cores to use. The Penelope distribution has a configuration.ini file that you can start with. You can then use a Satlink configuration like:

(satlink::make-config
 :cmdline "penelope -config=/path/to/configuration.ini")

We are not aware of any UNSAT proof support for this solver.

Lingeling

An older version of Lingeling (Version ALA) is released under an open source (GPL3) license. For most of our problems, we found this version to be somewhat slower than Glucose 2.1. Of course, our experiences may not be representative.

Newer versions of Lingeling are available under a more restrictive license. These modern versions fared very well in the recent SAT competitions, so if the license does not pose a problem for you, it may well be worth trying.

For the open source version ALA, the build process is simple: download and extract the tarball, run ./configure and make, and then add the resulting lingeling and/or plingeling executables to your PATH. As a quick test to ensure things are working, you can try to certify these books:

cd [books]/centaur/satlink/solvers
cert.pl test-lingeling
cert.pl test-plingeling

Newer versions of Lingeling are allegedly able to produce unsat proofs, but we haven't figured out how to make it work.

Kissat

Variants of Kissat won most of the major tracks at the 2022 SAT competition. It can also be found on Github here. It is built using a standard configure followed by make; run ./configure -h to see options.

Riss3G

The Riss3g solver is a (mostly) open-source variant of Glucose that did fairly well in recent competitions and seems to be sometimes faster than Glucose.

The build process was reasonably straightforward. After building, put the resulting riss3g and riss3gSimp programs into your PATH. As a quick test to ensure things are working, you can try to certify these books:

cd [books]/centaur/satlink/solvers
cert.pl test-riss3g
cert.pl test-riss3gSimp

Like Glucose, riss3g has an ability to produce unsat proofs that can be checked with an external program. Satlink includes a script that makes it easy to run the solver and then check any UNSAT answers. See unsat-checking for more information.

Other Solvers

In principle, Satlink should work with any SAT solver that implements the DIMACS format. This format is used in the SAT competitions, so it is implemented by many solvers. Accordingly, you may wish to look at, e.g., the SAT Competition Results to get ideas about what SAT solvers are likely to perform well.

Getting a new solver to work with Satlink should be straightforward. Typically you will need to install the solver, add it to your PATH, and then figure out how to run it. Satlink expects to be able to invoke the solver using:

<solver-command> <input-file>

Sometimes a solver may need extra command-line arguments. For instance, Glucose needs a -model switch or it won't print the satisfying assignment (i.e., v lines) in case of SAT. You might be able to write a small script to supply these arguments, e.g., as in the glucose script above.

To test out your new solver, Satlink includes a primitive check-config command that you can use to try your solver on a handful of trivial problems. This is a very good way to make sure that at least the basic i/o contract seems to be working. It should be easy to adapt one of the test- scripts in the centaur/satlink/solvers directory to suit your solver.

If the check-config passes and you want a more thorough check, you might try to run your new solver on, e.g., centaur/esim/tutorial/sat.lsp and the various files in centaur/regression.

Subtopics

Unsat-checking
Options for running SAT solvers that produce UNSAT proofs.
Check-config
Run some quick checks of your SAT solver configuration.