Skip to content

Commit

Permalink
Improve CLI and parser, update SMT grammar, add command framework
Browse files Browse the repository at this point in the history
  • Loading branch information
paultristanwagner authored Oct 26, 2023
2 parents bb1b11f + 75c5a32 commit 8be935c
Show file tree
Hide file tree
Showing 51 changed files with 1,417 additions and 890 deletions.
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,36 @@ A SAT solver is implemented that can
employ [DPLL+CDCL](https://en.wikipedia.org/wiki/Conflict-driven_clause_learning), [DPLL](https://en.wikipedia.org/wiki/DPLL_algorithm)
as well as simple enumeration to solve propositional logic problems.

### Example

Input can be given in conjunctive normal form in the following way.

<img src="images/cnf-input-sat.png" alt="How to input in CNF" width="350" /> <br>
<img src="images/cnf-input-unsat.png" alt="How to input in CNF" width="350" /> <br>
<img src="images/cnf-input-sat.png" alt="How to input in CNF"/> <br>
<img src="images/cnf-input-unsat.png" alt="How to input in CNF"/> <br>

# Tseitin's transformation

The Tseitin transformation is implemented for propositional logic.
It can be used to transform a formula into an equi-satisfiable formula in conjunctive normal form.
The logical operators '~', '&', '|', '->', '<->' as well as parentheses are supported.

<img src="images/tseitin.png" alt="Tseitin transformation for proving 'modus ponens'" width="700" /> <br>
<img src="images/tseitin.png" alt="Tseitin transformation for proving 'modus ponens'"/> <br>

# SMT solver

An SMT solver is implemented for linear real arithmetic (QF_LRA), linear integer arithmetic (QF_LIA), equality logic (
QF_EQ) and equality logic with
uninterpreted functions (QF_EQUF).

<img src="images/smt-qflra-sat.png" alt="Satisfiable SMT example of linear real arithmetic" width="450" /> <br>
<img src="images/smt-qflra-unsat.png" alt="Unsatisfiable SMT example of linear real arithmetic" width="450" /> <br>
<img src="images/smt-qflra-sat.png" alt="Satisfiable SMT example of linear real arithmetic"/> <br>
<img src="images/smt-qflra-unsat.png" alt="Unsatisfiable SMT example of linear real arithmetic"/> <br>

<img src="images/smt-qflia-sat.png" alt="Satisfiable SMT example of linear integer arithmetic" width="450" /> <br>
<img src="images/smt-qflia-unsat.png" alt="Unsatisfiable SMT example of linear integer arithmetic" width="450" /> <br>
<img src="images/smt-qflia-sat.png" alt="Satisfiable SMT example of linear integer arithmetic"/> <br>
<img src="images/smt-qflia-unsat.png" alt="Unsatisfiable SMT example of linear integer arithmetic"/> <br>

<img src="images/smt-qfeq-sat.png" alt="Satisfiable SMT example of equality logic" width="450" /> <br>
<img src="images/smt-qfeq-unsat.png" alt="Unsatisfiable SMT example of equality logic" width="450" /> <br>
<img src="images/smt-qfeq-sat.png" alt="Satisfiable SMT example of equality logic"/> <br>
<img src="images/smt-qfeq-unsat.png" alt="Unsatisfiable SMT example of equality logic"/> <br>

<img src="images/smt-qfequf-sat.png" alt="Satisfiable SMT example of equality logic with uninterpreted functions" width="500" /> <br>
<img src="images/smt-qfequf-unsat.png" alt="Unsatisfiable SMT example of equality logic with uninterpreted functions" width="500" /> <br>
<img src="images/smt-qfequf-sat.png" alt="Satisfiable SMT example of equality logic with uninterpreted functions"/> <br>
<img src="images/smt-qfequf-unsat.png" alt="Unsatisfiable SMT example of equality logic with uninterpreted functions"/> <br>

# Theory solvers

Expand All @@ -68,10 +66,10 @@ Currently, the program supports decimal coefficients which will be handled via f

### Examples

<img src="images/simplex-sat.png" alt="Satisfiable Simplex example" width="350" /> <br>
<img src="images/simplex-unsat.png" alt="Unsatisfiable Simplex example" width="350" /> <br>
<img src="images/simplex-sat.png" alt="Satisfiable Simplex example"/> <br>
<img src="images/simplex-unsat.png" alt="Unsatisfiable Simplex example"/> <br>

An optional objective function can be given to maximize or minimize the value of a linear expression.

<img src="images/simplex-optimal.png" alt="Optimal Simplex example" width="450" /> <br>
<img src="images/simplex-unbounded.png" alt="Unbounded Simplex example" width="350" /> <br>
<img src="images/simplex-optimal.png" alt="Optimal Simplex example"/> <br>
<img src="images/simplex-unbounded.png" alt="Unbounded Simplex example"/> <br>
Binary file modified images/cnf-input-sat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/cnf-input-unsat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/simplex-optimal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/simplex-sat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/simplex-unbounded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/simplex-unsat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/smt-qfeq-sat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/smt-qfeq-unsat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/smt-qfequf-sat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/smt-qfequf-unsat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/smt-qflia-sat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/smt-qflia-unsat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/smt-qflra-sat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/smt-qflra-unsat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/tseitin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<version>32.1.3-jre</version>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
<version>3.23.0</version>
</dependency>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline-terminal-jansi</artifactId>
<version>3.23.0</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -67,7 +77,7 @@
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>me.paultristanwagner.satchecking.CLI</mainClass>
<mainClass>me.paultristanwagner.satchecking.Main</mainClass>
</transformer>
</transformers>
</configuration>
Expand Down
303 changes: 0 additions & 303 deletions src/main/java/me/paultristanwagner/satchecking/CLI.java

This file was deleted.

Loading

0 comments on commit 8be935c

Please sign in to comment.