Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carstenkoenig/satsolver
simple solver for expressions in the propositional logic
https://github.com/carstenkoenig/satsolver
Last synced: 23 days ago
JSON representation
simple solver for expressions in the propositional logic
- Host: GitHub
- URL: https://github.com/carstenkoenig/satsolver
- Owner: CarstenKoenig
- License: other
- Created: 2013-10-14T13:21:47.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-03-18T13:04:40.000Z (almost 11 years ago)
- Last Synced: 2024-10-15T09:17:49.593Z (2 months ago)
- Language: Haskell
- Size: 133 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple SAT solver
## overview
This programm tries to find out if a set of prop. logical sentences is satisfiable (that is: is there a assignment of truth-values such that all sentences are true?).
The idea/background for this is me having a look at the first few lessons of the coursere-course [Introduction to Logic](https://www.coursera.org/course/intrologic).
In the second week the basic algorithm I use here is explained/introduced.The algorithm used to search for solutions tries to find these by backtracking and propagation of known facts
step by step the system of sentences are simplified (by choosing truth-assignments for open variables and propagating the effects)
till either there is a known FALSE fact in the system (in this case backtracking happens and on the top level there is no solution)
or all facts in the system are TRUE in this case the found truth-assignment is returned## Parser - Description
On top of this sits a simple expression parser that can handle simple strings like this:
- variables starts with a letter followed by letters or numbers
- not = '~'
- and = '&'
- or = '|'
- implication = '=>'
- equivalence = '=='
- precedence is from top to bottom in this list, sub-sentences can be grouped with parentheses '(..)'### Example
p => ~q & p; p | r
.. SAT - tester ..
please input your system of sentences (separeted by ';'):
p => ~q & p; p | r
the system [p => ~q & p; p | r] is satisfied by p=True, q=False## Usage
You can solve such a string with a friendly message using satTest or by running main - which ask you for it