Here I will be outlying what it is I have done for my senior project. It will go over some basic concepts of logic, some of the code I have written, as well as ways that I feel this code can be improved upon.

Rough Draft

Over the course of this semester I have been writing a proof checker in python. Specifically, it checks proofs written in the Hilbert style which I have found in Understanding Symbolic Logic by Klenk. My motivation came from the QED Manifesto. I did some additional research by reading QED Manifesto Revisited and looked at various proof assistants and checkers. What I found was that none of these seemed to be focused towards Mathematicians. The syntax used to check certain simple proofs seemed overly complicated. It is this learning curve that makes these programs not as useful for educational purposes. I would like to make something that can be used to show how the very basics of logic work in a way that is not overly complicated.

My first attempt in checking proofs followed this approach. First I would break up the text document's individual lines into a dictionary. A dictionary in python is similar to a hash table in other languages. The key for each element in the dictionary would be the line number and the value would be a list containing the rest of the line. I would then go through this dictionary line by line, call the appropriate method according to what rule was being applied, and finally that method would take the dictionary along with the line number that they were checking and return a true or false. Although it worked for the first few rules, this ended up making the code much too complex and so I decided that I needed to refactor it.

My second attempt started with making sure that the methods for applying the rules of inference were as simple as possible. The simplest way that I could think of was having each method compare two or three strings, depending on the rule of inference being used, and return a true or false. The strings themselves would have to confirmed to be well formed formulas using another method. So, I worked on making some methods that would apply the rules of inference to strings. I then decided that I needed a quicker way of checking them manual, so I made a python unittest, sometimes referred to as a Pyunit, which is similar to Junit. I was then able to test my code much quicker and whenever I came across a bug that I failed to check with the unittest I would add it to the list of test cases and fix that bug. At this point I still did not have a method for confirming proofs found in text files so I decided that since I had enough rules of inference I should probably try that next. The text files are in this format

“4.\tB\t\tMP 1,2"

The first part is the line number followed by a period and separated from the next element by at least on tab. This part is actually discarded, but it is still a necessary part in writing out the proofs. The next part is the well formed formula. The third part is separated from the second by at least one tab. The last element is a list of referenced lines and is separated from the third by a single space.

Eventually the references are replaced by actually strings, the rule of inference becomes the first element and the conclusion, second element, becomes the last element.


The first element of the list is the name of the method called and the last three elements are arguments for this method. After creating the methods for taking a proof text file, I took some examples from the book and used them as test cases. I stored all of the proof text file in a separate folder called proofs.

I continued with this approach and managed to get through all of the rules of inference and the substitution rules.

Checking subproofs

Next I needed to include the ability to use subproofs. I treated the beggining of the subproof in the same why that I treated the premise. I assumed it to be true. Each part of the subproof was checked in the same way that it was normally.

$1.$$A\rightarrow B$$\text{Pr}$
$3.$$B$$\text{MP }1,2$

After developing methods for each of the rules of inference, I then moved on to the replacement rules.

Basics of Propositional Logic

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.