Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong results in is_isotopic method of the Link class for certain chiral link #37668

Merged
merged 9 commits into from
Apr 8, 2024
76 changes: 66 additions & 10 deletions src/sage/knots/knotinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
....: [17,19,8,18], [9,10,11,14], [10,12,13,11],
....: [12,19,15,13], [20,16,14,15], [16,20,17,2]])
sage: L.get_knotinfo()
(<KnotInfo.K0_1: '0_1'>, None)
(<KnotInfo.K0_1: '0_1'>, <SymmetryMutant.itself: 's'>)


REFERENCES:
Expand Down Expand Up @@ -335,6 +335,45 @@
return False
raise ValueError('%s is not a KnotInfo boolean')


class SymmetryMutant(Enum):
r"""
Enum to specify the symmetry mutant link of the prime link listed in the
KnotInfo and LinkInfo databases. From the KnotInfo description page:

If a knot is viewed as the oriented diffeomorphism
class of an oriented pair, `K = (S_3, S_1)`, with `S_i`
diffeomorphic to `S^i`, there are four oriented knots
associated to any particular knot `K`. In addition to
`K` itself, there is the reverse, `K^r = (S_3, -S_1)`,
the concordance inverse, `-K = (-S_3, -S_1)`, and the
mirror image, `K^m = (-S_3, S_1)`.
"""
itself = 's'
reverse = 'r'
concordance_inverse = 'mr'
mirror_image = 'm'
mixed = 'x' # to be used in connection with KnotInfoSeries
unknown = '?'

def __gt__(self, other):
r"""
Implement comparison of different items in order to have ``sorted`` work.

EXAMPLES::

sage: from sage.knots.knotinfo import SymmetryMutant
sage: sorted(SymmetryMutant) # indirect doctest
[<SymmetryMutant.mixed: 'x'>,
<SymmetryMutant.itself: 's'>,
<SymmetryMutant.reverse: 'r'>,
<SymmetryMutant.concordance_inverse: 'mr'>,
<SymmetryMutant.mirror_image: 'm'>,
<SymmetryMutant.unknown: '?'>]
"""
return self.value < other.value
tscrim marked this conversation as resolved.
Show resolved Hide resolved


# ---------------------------------------------------------------------------------
# KnotInfoBase
# ---------------------------------------------------------------------------------
Expand Down Expand Up @@ -945,13 +984,29 @@

sage: KnotInfo.K6_3.is_reversible()
True

TESTS::

sage: KnotInfo.K10_67.is_reversible() # optional - database_knotinfo
False
sage: KnotInfo.L7a4_0.is_reversible() # optional - database_knotinfo
"""
symmetry_type = self.symmetry_type()
if symmetry_type == 'reversible':
return True
if symmetry_type == 'fully amphicheiral':
if self.is_knot():
symmetry_type = self.symmetry_type()
if symmetry_type == 'reversible':
return True
if symmetry_type == 'fully amphicheiral':
return True
return False

Check warning on line 1000 in src/sage/knots/knotinfo.py

View check run for this annotation

Codecov / codecov/patch

src/sage/knots/knotinfo.py#L1000

Added line #L1000 was not covered by tests

# revert orientation
b = self.braid()
bt = list(b.Tietze())
bt.reverse()
br = b.parent()(tuple(bt))
if b.is_conjugated(br):
return True
return False
return None

Check warning on line 1009 in src/sage/knots/knotinfo.py

View check run for this annotation

Codecov / codecov/patch

src/sage/knots/knotinfo.py#L1009

Added line #L1009 was not covered by tests

@cached_method
def is_amphicheiral(self, positive=False):
Expand Down Expand Up @@ -2123,6 +2178,9 @@
else:
l = self.link()
if mirror:
if self.is_amphicheiral():
# no need to test again
return True
l = l.mirror_image()

def check_result(L, m):
Expand All @@ -2131,12 +2189,10 @@
"""
if L != self:
return False
if m is None or m == '?':
return True
if mirror:
return m
return m is SymmetryMutant.mirror_image
else:
return not m
return m is SymmetryMutant.itself

try:
L, m = l.get_knotinfo()
Expand Down
Loading
Loading