Skip to content

Commit

Permalink
fix: wrong proof for superman question
Browse files Browse the repository at this point in the history
  • Loading branch information
Vipul-Cariappa committed Dec 2, 2023
1 parent 6c33de0 commit b2ba653
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions logic/proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def _prove_decomposed_conclusion(self, to_prove: Statement) -> tuple[Proof, bool

# Applying Addition
proof_first, truth_first = prove(
self.assumptions.remove(to_prove), first
self.assumptions, first
)
if truth_first:
my_proof.extend(proof_first)
Expand All @@ -254,7 +254,7 @@ def _prove_decomposed_conclusion(self, to_prove: Statement) -> tuple[Proof, bool
)
return my_proof, True
proof_second, truth_second = prove(
self.assumptions.remove(to_prove), second
self.assumptions, second
)
if truth_second:
my_proof.extend(proof_second)
Expand Down Expand Up @@ -283,10 +283,10 @@ def _prove_decomposed_conclusion(self, to_prove: Statement) -> tuple[Proof, bool

# Applying Conjunction
proof_first, truth_first = prove(
self.assumptions.remove(to_prove), first
self.assumptions, first
)
proof_second, truth_second = prove(
self.assumptions.remove(to_prove), second
self.assumptions, second
)
if truth_first and truth_second:
my_proof.extend(proof_first)
Expand Down Expand Up @@ -315,11 +315,11 @@ def _prove_decomposed_conclusion(self, to_prove: Statement) -> tuple[Proof, bool
assumption_implies_conclusion = IMPLY(assumption, conclusion)
conclusion_implies_assumption = IMPLY(conclusion, assumption)
proof_p_implies_q, truth_p_implies_q = prove(
self.assumptions.remove(to_prove),
self.assumptions,
assumption_implies_conclusion,
)
proof_q_implies_p, truth_q_implies_p = prove(
self.assumptions.remove(to_prove),
self.assumptions,
conclusion_implies_assumption,
)
if truth_p_implies_q and truth_q_implies_p:
Expand Down Expand Up @@ -619,7 +619,7 @@ def prove(self, to_prove: Statement) -> tuple[Proof, bool]:
i,
~conclusion,
)
if to_prove != ~assumption:
if to_prove == ~assumption:
# ~assumption is the thing we want to prove
return my_proof, True

Expand Down
4 changes: 2 additions & 2 deletions tests/test_prover.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ def test_prove_superman_does_not_exists(self):
b = Proposition("b", "Superman is willing to prevent evil")
c = Proposition("c", "Superman is impotent")
d = Proposition("d", "Superman is malevolent")
e = Proposition("f", "Superman prevents evil")
f = Proposition("g", "Superman exists")
e = Proposition("e", "Superman prevents evil")
f = Proposition("f", "Superman exists")

assumptions = [
IMPLY(a & b, e),
Expand Down

0 comments on commit b2ba653

Please sign in to comment.