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

https://github.com/digikar99/pl-theorem-prover

Basic theorem prover for propositional logic that supports `and or not` operators. Currently, this has no dependencies.
https://github.com/digikar99/pl-theorem-prover

lisp propositional-logic semantic-tableau theorem-proving

Last synced: 16 days ago
JSON representation

Basic theorem prover for propositional logic that supports `and or not` operators. Currently, this has no dependencies.

Awesome Lists containing this project

README

          

# pl-theorem-prover - Propositional Logic Theorem Prover

Basic theorem prover for propositional logic that supports `and or not` operators. Currently, this has no dependencies.

This uses the [Method of analytic tableaux](https://en.wikipedia.org/wiki/Method_of_analytic_tableaux), but users can customize the theorem prover.

## Example

```lisp
CL-USER> (defpackage :pltp-user
(:use :cl)
(:local-nicknames (:pl :pl-theorem-prover)))
#

CL-USER> (in-package :pltp-user)
#

PLTP-USER> (set-pprint-dispatch 'pl:node 'pl:pprint-node)
NIL

PLTP-USER> (pl:well-formed-formula-p '(not))
; Evaluation aborted on #.

PLTP-USER> (pl:well-formed-formula-p '(not a b))
; Evaluation aborted on #.

PLTP-USER> (pl:well-formed-formula-p '(and a b))
(AND A B)

PLTP-USER> (pl:well-formed-formula-p '(not a))
(NOT A)

PLTP-USER> (pl:prove* a (not a))
Unprovable.
NIL
#

PLTP-USER> (pl:prove* a (or b (not a)))
Provable.

T: B
T: A
T: (OR B (NOT A))
#

PLTP-USER> (pl:prove* (not b) (or b (not a)))
Provable.

NIL: B
T: (NOT A)
T: (NOT B)
T: (OR B (NOT A))
#

PLTP-USER> (pl:prove* a (not b) (or b (not a)))
Unprovable.
NIL
#

PLTP-USER> (pl:prove* (and a c)
(or (not a) b))
Provable.

T: (NOT A)
T: A
T: C
T: (AND A C)
T: (OR (NOT A) B)
#
```

## Notes

- `prove*` is a macro. It calls the function `prove`
- Theorem proving algorithm can be changed using the variable `*prover*`. Its default value is `'semantic-tableau-prover`.

## References

- https://philosophy.stackexchange.com/questions/10785/semantic-vs-syntactic-consequence
- https://oeis.org/wiki/Propositional_calculus
- Brute force: https://en.wikipedia.org/wiki/British_Museum_algorithm
- https://en.wikipedia.org/wiki/Method_of_analytic_tableaux