Created
December 2, 2017 18:58
-
-
Save lironsade/cb7f4411d84ddeb07e63bde8ac26825b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_valid(self): | |
""" Return whether lines are a valid proof of statement from rules """ | |
# Task 4.6 | |
for i,line in enumerate(self.lines): | |
# If it doesn't have a rule, we assume it is an assumption | |
if line.rule is None: | |
if line.conclusion not in self.statement.assumptions: | |
return False | |
else: | |
continue | |
rule = self.rules[line.rule] | |
if not self.instance_for_line(i).is_instance_of(rule): | |
return False | |
if False in [i > x for x in line.justification]: | |
return False | |
return self.instance_for_line(len(self.lines) - 1).conclusion.infix()\ | |
== self.statement.conclusion.infix() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment