https://github.com/colemangariety/derivation-machine
Propositional calculus in Haskell
https://github.com/colemangariety/derivation-machine
calculus conclusion homework logic premise
Last synced: 8 months ago
JSON representation
Propositional calculus in Haskell
- Host: GitHub
- URL: https://github.com/colemangariety/derivation-machine
- Owner: ColemanGariety
- Created: 2016-10-18T07:23:02.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-11-21T17:22:53.000Z (almost 9 years ago)
- Last Synced: 2025-02-02T01:11:28.078Z (9 months ago)
- Topics: calculus, conclusion, homework, logic, premise
- Language: Haskell
- Homepage: https://en.wikipedia.org/wiki/Propositional_calculus
- Size: 23.4 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# :computer: Propositional Derivation Machine
I wrote this library to do my Philosophy 201 (Introductory Logic) homework for me.
For a good description of propositional logic, see this page: https://en.wikipedia.org/wiki/Propositional_calculus
What we want is to give the program a book problem, and for the derivation machine to prove that it is true. The program lazily builds an infinite tree of logical sentences which "follow" from the given premises. Once it generates something that remembles the conclusion it walks backwards to the root and prints the result.
---
A simple book problem in Haskell syntax (a list of premises and a conclusion):
```
[ (If A B),
(Not B)
] (Not A)
```This conclusion follows from the premises by the simple but unintuaitive rule called "modus tollendo tollens." Haskell gives us the answer:
```
1 "If A B" S
2 "Not B" S
3 "Not A" 1,2 MTT
(0.03 secs, 149,584 bytes)
```Although this is an elementary example, the derivation machine can do all propositional derivations that involve the *simple rules*. And now we have no more homework for first term!
---
Disclaimer: do your homework.
---
~~Will it be slow?~~
It's fast as hell!