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.
- Host: GitHub
- URL: https://github.com/digikar99/pl-theorem-prover
- Owner: digikar99
- Created: 2026-02-28T00:27:24.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-03-06T12:49:24.000Z (3 months ago)
- Last Synced: 2026-03-06T16:53:53.254Z (3 months ago)
- Topics: lisp, propositional-logic, semantic-tableau, theorem-proving
- Language: Common Lisp
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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