Skip to content

Commit

Permalink
cover non-noetherian case
Browse files Browse the repository at this point in the history
  • Loading branch information
sweeneyde committed Apr 28, 2024
1 parent dc01830 commit 18a3adc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion monoid_homology/crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _reduce(self, word):
word = word.replace(left, right)
if word == old:
return word
raise RuntimeError(f"No fixed point was found for {word0}"
raise RuntimeError(f"No fixed point was found for {word0} "
f"after {self.max_rewrites} iterations")

def reduce(self, word):
Expand Down
8 changes: 8 additions & 0 deletions test/test_monoid_homology.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
kb_complete
)

import pytest

def test_crs_homology():
# Uses Sympy because it's hard to set up CI for SAGE.

Expand Down Expand Up @@ -193,3 +195,9 @@ def test_kb_eliminate_redundant_generators():
# The example that caught the bug
find_best_gens_crs([[0, 0, 0], [0, 0, 1], [0, 1, 0]], maxdim=4, extra=2)

def test_non_noetherian():
crs = CRS("abc", [('cca', 'aca'), ('ba', 'bbc'), ('bca', 'cac')], max_rewrites=10_000)
culprit = "bcbcbcca"
msg = f"No fixed point was found for {culprit} after 10000 iterations"
with pytest.raises(RuntimeError, match=msg):
crs.reduce(culprit)

0 comments on commit 18a3adc

Please sign in to comment.