An open API service indexing awesome lists of open source software.

https://github.com/vadyushkins/yafolps

Yet Another First-Order Logic Problem Solver
https://github.com/vadyushkins/yafolps

first-order-logic getopt haskell haskell-exercises predicate-logic theorem-proving

Last synced: about 1 year ago
JSON representation

Yet Another First-Order Logic Problem Solver

Awesome Lists containing this project

README

          

# YAFOLPS (Yet Another First-Order Logic Problem Solver)

#### Semester project on mathematical logic of the fourth semester of Software Engineering, Department of System Programming, Faculty of Mathematics and Mechanics, St. Petersburg State University.

## Goal

#### We must determine whether the input formula in First-Order Logic is a tautology or not. For this to be done, we have implemented the resolution method.

## EBNF (Extended Backus–Naur form)

```
::= "!"
::= "?"
::= "&"
::= "|"
::= "-"
::= ">"
::= "^"
::= "_"

::= [a-z] | [A-Z] | [0-9] | "_"
::= [A-Z] ()*
::= | [a-z] ()* "(" (( ",")* ) ")"

::= |
::= | |

::= [a-z] ()* "(" (( ",")* ) ")"

::= | |
::= | "(" ")"
|
| "(" ")"
```

# Usage

## ``stack build && stack exec -- YAFOLPS-exe ``

## Args

* ``--input-file filename / --i filename -- Reads a formula from a file. Without specifying this option reads a formula from standard input.``
* ``--print-formula / -f -- Prints the formula that have been read.``
* ``--print-ast / -a -- Prints the AST of the formula.``
* ``--print-ssf / -s -- Prints the SSF of the negated formula.``
* ``--print-solution / -r -- Prints "VALID" if is the formula is a tautology, otherwise prints "NOT VALID".``

## Examples

* ``stack build && stack exec -- YAFOLPS-exe --i examples/1.txt -fas`` -- ``Prints formula, AST and SSF``
* ``stack build && stack exec -- YAFOLPS-exe --i examples/1.txt -r`` ``-- Prints "NOT VALID"``
* ``stack build && stack exec -- YAFOLPS-exe --i examples/2.txt -r`` ``-- Prints "NOT VALID"``
* ``stack build && stack exec -- YAFOLPS-exe --i examples/3.txt -r`` ``-- Prints "NOT VALID"``
* ``stack build && stack exec -- YAFOLPS-exe --i examples/4.txt -r`` ``-- Prints "VALID"``
* ``stack build && stack exec -- YAFOLPS-exe --i examples/Top.txt -r`` ``-- Prints "VALID"``
* ``stack build && stack exec -- YAFOLPS-exe --i examples/Bottom.txt -r`` ``-- Prints "VALID"``

## Tests

* ``stack test`` -- ``Prints results on the Hilbert's axioms``

![Test results](images/Test_results.png)