Skip to content

Commit

Permalink
qed on failed subproof
Browse files Browse the repository at this point in the history
  • Loading branch information
isahers1 committed Apr 18, 2022
1 parent 73ffe6c commit 495203b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
Binary file modified __pycache__/logicObjects.cpython-39.pyc
Binary file not shown.
Binary file modified __pycache__/proof.cpython-39.pyc
Binary file not shown.
3 changes: 2 additions & 1 deletion contradiction_proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
p.switchSidesOfEqual(8)
p.notElim(6,9)
p.concludeSubproof(6)
#p.impliesIntroduction([4,5],11)
p.impliesIntroduction([4,5],11)
p.qed(12)
11 changes: 11 additions & 0 deletions logicObjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ def elim(self, arg):
if arg==self.assum:
return self.conc

def __eq__(self, other):
return self.assum == other.assum and self.conc == other.conc

def __repr__(self):
assumptionstr = ""
for assumption in self.assum:
assumptionstr += str(assumption)
assumptionstr += ", "
assumptionstr = assumptionstr[:-2]
return assumptionstr + " → " + str(self.conc)

class Not:
def __init__(self, arg):
self.arg = arg
Expand Down
15 changes: 14 additions & 1 deletion proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,4 +615,17 @@ def notElim(self, lineNum1, lineNum2):
self.justifications += [f'Contradiction from lines {lineNum1} and {lineNum2}']
self.show()
else:
print(f"The statement on line {lineNum1} isn't a Not")
print(f"The statement on line {lineNum1} isn't a Not")

def impliesIntroduction(self, lineNumsAssums, lineNumConc): # needs work, a lot of it
'''
Introduce an implication based on assumptions and a conclusion
:param lineNumsAssums: the lines containing the assumptions
:param lineNumConc: the line to conclude
'''
assums = []
for line in lineNumsAssums:
assums.append(self.steps[line])
self.steps += [Implies(assums,self.steps[lineNumConc])]
self.justifications += [f"Introduced implies based on assumptions on lines {lineNumsAssums} to conclude line {lineNumConc}"]
self.show()

0 comments on commit 495203b

Please sign in to comment.