Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/estimates/simp.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def activate(self, state: ProofState) -> list[ProofState]:
newvar = new_var("pos_real", name)
else:
raise ValueError(
f"INCONSISTENCY: {name}:{typeof} was somehow proven positive, which is impossible."
f"INCONSISTENCY: {name}:{typeof(var)} was somehow proven positive, which is impossible."
)

print(f"{name} is now of type {typeof(newvar)}.")
Expand Down Expand Up @@ -277,7 +277,7 @@ def activate(self, state: ProofState) -> list[ProofState]:
newvar = new_var("nonneg_real", name)
else:
raise ValueError(
f"INCONSISTENCY: {name}:{typeof} was somehow proven nonnegative, which is impossible."
f"INCONSISTENCY: {name}:{typeof(var)} was somehow proven nonnegative, which is impossible."
)

print(f"{name} is now of type {typeof(newvar)}.")
Expand Down Expand Up @@ -334,7 +334,7 @@ def activate(self, state: ProofState) -> list[ProofState]:
newvar = new_var("nonzero_real", name)
else:
raise ValueError(
f"INCONSISTENCY: {name}:{typeof} was somehow proven positive, which is impossible."
f"INCONSISTENCY: {name}:{typeof(var)} was somehow proven nonzero, which is impossible."
)

print(f"{name} is now of type {typeof(newvar)}.")
Expand Down
11 changes: 11 additions & 0 deletions tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,14 @@ def test_subst_all_solution_reversed(self, capsys):
def test_sympy_simplify_solution(self, capsys):
sympy_simplify_solution()
self.proof_complete(capsys)

def test_type_tactic_inconsistency_messages(self):
"""Inconsistency errors should call typeof(var), and IsNonzero should say nonzero."""
import inspect
from estimates.simp import IsNonzero, IsPositive, IsNonnegative
src = inspect.getsource(IsNonzero.activate)
assert "typeof(var)" in src
assert "proven nonzero" in src
assert "proven positive" not in src
assert "typeof(var)" in inspect.getsource(IsPositive.activate)
assert "typeof(var)" in inspect.getsource(IsNonnegative.activate)
Loading