Skip to content

About

SATSentinel is an observer that can be attached to a generic CDCL Solver to monitor invariants.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

50 Commits

Folders and files

Repository files navigation

SATSentinel

SATSentinel is an observer/debugger for CDCL SAT solvers. It is designed to either receive notifications from a solver, through the Sentinel-API.hpp interface, or to parse a log of notifications produced by a solver, and replay the execution step by step, while checking invariants and allowing the user to inspect the solver's state at any point.

See the wiki for the full documentation: building, integrating a solver, the command language, invariants, the GUI, and internal architecture.

Quick start

The simplest way to try it out is to build the CLI tool and run it on a solver log. We provide an example log file in tests/data/example.log:

Building

make

Builds the CLI tool (build/SATSentinel). The CLI only needs g++ (C++17) and make.

Dependencies

The optional GUI needs the GLFW and OpenGL development headers, and the Dear ImGui submodule:

System Command
Debian/Ubuntu sudo apt-get install libglfw3-dev libgl1-mesa-dev
Fedora/RHEL sudo dnf install glfw-devel mesa-libGL-devel
openSUSE sudo zypper install 'pkgconfig(glfw3)' 'pkgconfig(gl)'
Arch sudo pacman -S glfw mesa
Alpine sudo apk add glfw-dev mesa-dev
git submodule update --init third_party/imgui

The tests (make tests) need Catch2 v3. Ubuntu 22.04 and older only ship v2; there, build Catch2 v3 from source.

System Command
Debian/Ubuntu sudo apt-get install catch2
Fedora/RHEL sudo dnf install catch-devel
openSUSE sudo zypper install 'pkgconfig(catch2-with-main)'
Arch sudo pacman -S catch2
Alpine sudo apk add catch2-3

GUI

Once the GUI dependencies are installed, the option GUI=1 can be passed to the make command to build the GUI frontend:

make GUI=1

Note: switching between GUI=0 and GUI=1 reuses stale .o files unless you make clean first, since the build doesn't track the flag's value as a dependency.

Running

While the Sentinel is meant to be integrated into a solver using the API, it can also be used as a standalone tool. You may use the default parser whose commands are detailed in Command Language & Replay, or write your own parser to fit your solver outputs by overriding the parser defined in the main.cpp file.

The command line can be used to run the sentinel on a log file, with the following syntax:

./build/SATSentinel <log_file> [--options]

Where <log_file> is the path to the log file to be parsed, and [--options] are optional command line arguments (e.g. --gui for the GUI). The available options are detailed in the help message:

Let's try to run the example log file with the default parser:

./build/SATSentinel tests/data/example.log

How to use SATSentinel

The sentinel makes the distinction between two types of commands:

  • navigation commands, which are used to navigate through the execution of the solver, and
  • user commands, which are used to interact with the solver and the sentinel. The CLI will clearly display which type of command is expected at any point. The navigation commands are detailed in Navigation & Debugging, while the user commands are detailed in Command Language & Replay.

Try running the example log file and use the empty navigation command to step forward by typing the enter key, or typing next and pressing enter. You can also type help to see the list of available navigation commands. You may type b or back to step backward in the execution.

Right now, the sentinel will only skip though all the notifications. And after a few steps, it will ask for a user command. You may type help to see the list of available user commands. Try to add a new clause with the NEW CLAUSE 1 v1 ~v2 command. The first number is the clause index, and the rest are the literals of the clause.

Display level

An important and powerful tool in the SATSentinel is the display level. The display level controls the level of granularity of the information displayed by the sentinel. The display level can be set using the set level <l> command, where <l> is an integer between 0 and 10. The higher the level, the more information is displayed. The display level can be changed at any time as a navigation command. The information displayed at each level is detailed in Navigation & Debugging.

Use the set level 5 command to set the display level to 5, which will show more details about the notifications. You can now go through the notifications forwards and backwards with more details.

Breakpoints and markers

The sentinel allows the user to set breakpoints at specific notification numbers, which will override the display level of that notification to 0. Markers do a similar thing, but for variables and clauses. When a marker is set on a variable or clause, any notification that touches that variable or clause will have its display level overridden to 0. Breakpoints and markers can be set and removed at any time as navigation commands. The commands to set and remove breakpoints and markers are detailed in Navigation & Debugging.

Set the level back to 0 with the set level 0 command. Let's now mark variable 2 with the mark var 2 command. You can now go through the notifications forwards and backwards, and the sentinel will stop at any notification that touches variable 2.

Acknowledgements

The first version of this project was developed at the TU Wien to support the NapSAT SAT Solver. The project was later severed from NapSAT and is now independent.

The code for the GUI was written with the help of Claude Code. The core was taken from NapSAT and modified by Robin Coutelier, who still maintains the project.

About

SATSentinel is an observer that can be attached to a generic CDCL Solver to monitor invariants.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages