As part of an assignment I've been asked to check if proofs in natural deduction are either correct or incorrect, using Prolog. An example text file called "valid.txt" containing a proof looks like this:
[imp(p, q), p].
q.
[
[1, imp(p,q), premise],
[2, p, premise],
[3, q, impel(2,1)]
].```
This would be the input into my program, which should respond "yes" or "true" to a correct proof (which the above is), and "no" or "false" to an incorrect proof.
I have no idea where to begin. So my question is if there are some resources out there where I could learn about verifying/controlling proofs in prolog. I have some small amounts of experience programming in prolog, but I feel like I need some specific instruction on how to construct a program that can verify proofs. I've looked for textbooks and websites, but been unable to find anything that could help me.
In the end my program should probably resemble something like this: Checking whether or not a logical sequence that has assumptions in it is valid
As this is my first time asking a question on here I apologize if I missed something.
In part I totally understand the close votes, comments and such, but on the other had I can totally understand your side of the story.
Realize that I do view your question just barely on the wrong side of what is allowed here, but not so much so that other newcomers don't get away with doing the same thing.
Book recommendation questions are not allowed here. Normally a book recommendation would be seen as subjective, but when there is only one or two books that meet the requirements, how can it be subjective.
"Handbook of Practical Logic and Automated Reasoning" by John Harrison (WorldCat) (Amazon) (Webpage)
Note: The book uses the programming language OCaml, but implements a subset of Prolog. Also the book uses a domain specific language and implements a parser.
The book clearly goes way beyond what you need so you won't need to get or read the entire book.
You might only need this which is found in prop.ml
let rec eval fm v =
match fm with
False -> false
| True -> true
| Atom(x) -> v(x)
| Not(p) -> not(eval p v)
| And(p,q) -> (eval p v) & (eval q v)
| Or(p,q) -> (eval p v) or (eval q v)
| Imp(p,q) -> not(eval p v) or (eval q v)
| Iff(p,q) -> (eval p v) = (eval q v);;
Example query
tautology <<p \/ q ==> q \/ (p <=> q)>>;;
The book is more of a detailed introduction to the source code of a more feature rich version HOL-Light which is a simpler version of HOL.
The links should put you in the ball park of working applications and these all fall under the broader topic of automated theorem proves which is different from proof assistants.