-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
Some improvements for braids computations #35214
Changes from 12 commits
670fc7a
74ffbd3
362108a
960e0b4
5f1952b
c158a0a
5c42b98
eea3f55
56d33d8
690c5d5
89d50fb
eef2f8d
fedd35e
d10343d
b4c0ded
f343579
536dd75
f8930f1
a1de926
76baf01
d7a1145
2d53fd3
0691a8d
1fb924a
4d31ba4
05b02e8
6987456
544832e
6e240c9
ee744be
be8b114
905f40a
8ab98f2
6ab2fd4
3b1f50b
01ffa05
10533b8
9137908
768aa79
78ead55
1689aae
cdede32
3ad1ed1
d92e0e5
c7e4d83
1cd0e79
39ce62e
57f49f1
791c9ae
6041d12
30d6be1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -75,6 +75,7 @@ | |||||||||||||
from sage.misc.misc_c import prod | ||||||||||||||
from sage.categories.groups import Groups | ||||||||||||||
from sage.groups.free_group import FreeGroup, is_FreeGroup | ||||||||||||||
from sage.groups.perm_gps.permgroup_named import SymmetricGroup | ||||||||||||||
from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing | ||||||||||||||
from sage.matrix.constructor import identity_matrix, matrix | ||||||||||||||
from sage.combinat.permutation import Permutations | ||||||||||||||
|
@@ -89,7 +90,7 @@ | |||||||||||||
|
||||||||||||||
|
||||||||||||||
lazy_import('sage.libs.braiding', | ||||||||||||||
['rightnormalform', 'centralizer', 'supersummitset', 'greatestcommondivisor', | ||||||||||||||
['leftnormalform','rightnormalform', 'centralizer', 'supersummitset', 'greatestcommondivisor', | ||||||||||||||
'leastcommonmultiple', 'conjugatingbraid', 'ultrasummitset', | ||||||||||||||
'thurston_type', 'rigidity', 'sliding_circuits'], | ||||||||||||||
feature=PythonModule('sage.libs.braiding', spkg='libbraiding')) | ||||||||||||||
|
@@ -1447,6 +1448,33 @@ def annular_khovanov_homology(self, qagrad=None, ring=IntegerRing()): | |||||||||||||
return {qa: C[qa].homology() for qa in C} | ||||||||||||||
return self.annular_khovanov_complex(qagrad, ring).homology() | ||||||||||||||
|
||||||||||||||
def left_normal_form(self): | ||||||||||||||
r""" | ||||||||||||||
Return the left normal form of the braid. | ||||||||||||||
|
||||||||||||||
A tuple of simple generators in the left normal form. The first | ||||||||||||||
element is a power of `\Delta`, and the rest are elements of the | ||||||||||||||
natural section lift from the corresponding symmetric group. | ||||||||||||||
|
||||||||||||||
EXAMPLES:: | ||||||||||||||
|
||||||||||||||
sage: B = BraidGroup(4) | ||||||||||||||
sage: b = B([1, 2, 3, -1, 2, -3]) | ||||||||||||||
sage: b.left_normal_form() | ||||||||||||||
(s0^-1*s1^-1*s2^-1*s0^-1*s1^-1*s0^-1, s0*s1*s2*s1*s0, s0*s2*s1) | ||||||||||||||
sage: c = B([1]) | ||||||||||||||
sage: c.left_normal_form() | ||||||||||||||
(1, s0) | ||||||||||||||
sage: B = BraidGroup(3) | ||||||||||||||
sage: B([1,2,-1]).left_normal_form() | ||||||||||||||
(s0^-1*s1^-1*s0^-1, s1*s0, s0*s1) | ||||||||||||||
sage: B([1,2,1]).left_normal_form() | ||||||||||||||
(s0*s1*s0,) | ||||||||||||||
""" | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might consider adding tests for trivial examples. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your comments. I completed the descriptions and added more examples. |
||||||||||||||
l = leftnormalform(self) | ||||||||||||||
B = self.parent() | ||||||||||||||
return tuple([B.delta()**l[0][0]] + [B(b) for b in l[1:]] ) | ||||||||||||||
|
||||||||||||||
def _left_normal_form_coxeter(self): | ||||||||||||||
r""" | ||||||||||||||
Return the left normal form of the braid, in permutation form. | ||||||||||||||
|
@@ -1471,6 +1499,11 @@ def _left_normal_form_coxeter(self): | |||||||||||||
(-2, [3, 5, 4, 2, 6, 1], [1, 6, 3, 5, 2, 4], [5, 6, 2, 4, 1, 3], | ||||||||||||||
[3, 2, 4, 1, 5, 6], [1, 5, 2, 3, 4, 6]) | ||||||||||||||
|
||||||||||||||
.. NOTE:: | ||||||||||||||
|
||||||||||||||
This method is not used anymore since the above left_normal_form is faster. | ||||||||||||||
It is kept here since it may be used elsewhere. | ||||||||||||||
|
||||||||||||||
.. TODO:: | ||||||||||||||
|
||||||||||||||
Remove this method and use the default one from | ||||||||||||||
|
@@ -1517,8 +1550,12 @@ def _left_normal_form_coxeter(self): | |||||||||||||
return tuple([-delta] + form) | ||||||||||||||
|
||||||||||||||
def right_normal_form(self): | ||||||||||||||
""" | ||||||||||||||
r""" | ||||||||||||||
Return the right normal form of the braid. | ||||||||||||||
|
||||||||||||||
A tuple of simple generators in the right normal form. The last | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could leave the original "Return the right normal form" and have your additions on the next line after a blank line. |
||||||||||||||
element is a power of `\Delta`, and the rest are elements of the | ||||||||||||||
natural section lift from the corresponding symmetric group. | ||||||||||||||
|
||||||||||||||
EXAMPLES:: | ||||||||||||||
|
||||||||||||||
|
@@ -1622,19 +1659,43 @@ def conjugating_braid(self, other): | |||||||||||||
sage: a = B([2, 2, -1, -1]) | ||||||||||||||
sage: b = B([2, 1, 2, 1]) | ||||||||||||||
sage: c = b * a / b | ||||||||||||||
sage: d = a.conjugating_braid(c) | ||||||||||||||
sage: d * c / d == a | ||||||||||||||
True | ||||||||||||||
sage: d | ||||||||||||||
sage: d1 = a.conjugating_braid(c) | ||||||||||||||
sage: print (d1) | ||||||||||||||
s1*s0 | ||||||||||||||
sage: d * a / d == c | ||||||||||||||
sage: d1 * c / d1 == a | ||||||||||||||
True | ||||||||||||||
sage: d1 * a / d1 == c | ||||||||||||||
False | ||||||||||||||
sage: l = sage.groups.braid.conjugatingbraid(a,c) | ||||||||||||||
sage: d1 == B._element_from_libbraiding(l) | ||||||||||||||
True | ||||||||||||||
sage: b = B([2, 2, 2, 2, 1]) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I'm not understanding something, but you could leave the already existing tests and just add to them below. |
||||||||||||||
sage: c = b * a / b | ||||||||||||||
sage: d1 = a.conjugating_braid(c) | ||||||||||||||
sage: print (len(d1.Tietze())) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PEP8
Suggested change
and similar below. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||||||||||
7 | ||||||||||||||
sage: d1 * c / d1 == a | ||||||||||||||
True | ||||||||||||||
sage: d1 * a / d1 == c | ||||||||||||||
False | ||||||||||||||
sage: d1 | ||||||||||||||
s1^2*s0^2*s1^2*s0 | ||||||||||||||
sage: l = sage.groups.braid.conjugatingbraid(a,c) | ||||||||||||||
sage: d2 = B._element_from_libbraiding(l) | ||||||||||||||
sage: print (len(d2.Tietze())) | ||||||||||||||
13 | ||||||||||||||
sage: print (c.conjugating_braid(b)) | ||||||||||||||
None | ||||||||||||||
""" | ||||||||||||||
l = conjugatingbraid(self, other) | ||||||||||||||
if not l: | ||||||||||||||
return None | ||||||||||||||
else: | ||||||||||||||
return self.parent()._element_from_libbraiding(l) | ||||||||||||||
B = self.parent() | ||||||||||||||
n = B.strands() | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the reason for getting the number of strands? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To define the symmetric group There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You no longer define it here. |
||||||||||||||
k = int(l[0][0] % 2) | ||||||||||||||
b0 = B.delta() ** k * B(prod(B(a) for a in l[1:])) | ||||||||||||||
return b0 | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||||||||||
|
||||||||||||||
def is_conjugated(self, other): | ||||||||||||||
""" | ||||||||||||||
|
@@ -1657,6 +1718,82 @@ def is_conjugated(self, other): | |||||||||||||
""" | ||||||||||||||
l = conjugatingbraid(self, other) | ||||||||||||||
return bool(l) | ||||||||||||||
|
||||||||||||||
def pure_conjugating_braid(self, other): | ||||||||||||||
r""" | ||||||||||||||
Return a pure conjugating braid, if it exists. | ||||||||||||||
|
||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a more detailed description; in particular, including the definition of a pure conjugating braid. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should not be part of the one-line description. Spend a little bit of time/mathematical notation spelling it out a bit more. |
||||||||||||||
INPUT: | ||||||||||||||
|
||||||||||||||
- ``other`` -- the other braid to look for conjugating braid | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is confusing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||||||||||
|
||||||||||||||
This comment was marked as resolved.
Sorry, something went wrong. |
||||||||||||||
EXAMPLES:: | ||||||||||||||
|
||||||||||||||
sage: B = BraidGroup(4) | ||||||||||||||
sage: a = B([1, 2, 3]) | ||||||||||||||
sage: b = B([3, 2,]) | ||||||||||||||
sage: c = b ^ 12 * a / b ^ 12 | ||||||||||||||
sage: d1 = a.conjugating_braid(c) | ||||||||||||||
sage: print (len(d1.Tietze())) | ||||||||||||||
30 | ||||||||||||||
sage: print (d1.permutation()) | ||||||||||||||
[3, 4, 1, 2] | ||||||||||||||
sage: d1 * c / d1 == a | ||||||||||||||
True | ||||||||||||||
sage: d1 * a / d1 == c | ||||||||||||||
False | ||||||||||||||
sage: d2 = a.pure_conjugating_braid(c) | ||||||||||||||
sage: print (len(d2.Tietze())) | ||||||||||||||
24 | ||||||||||||||
sage: print (d2.permutation()) | ||||||||||||||
[1, 2, 3, 4] | ||||||||||||||
sage: d2 * c / d2 == a | ||||||||||||||
True | ||||||||||||||
sage: print (d2) | ||||||||||||||
(s0*s1*s2^2*s1*s0)^4 | ||||||||||||||
sage: print(a.conjugating_braid(b)) | ||||||||||||||
None | ||||||||||||||
sage: print(a.pure_conjugating_braid(b)) | ||||||||||||||
None | ||||||||||||||
sage: a1=B([1]) | ||||||||||||||
sage: a2=B([2]) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PEP8
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||||||||||||||
sage: a1.conjugating_braid(a2) | ||||||||||||||
s1*s0 | ||||||||||||||
sage: a1.permutation() | ||||||||||||||
[2, 1, 3, 4] | ||||||||||||||
sage: a2.permutation() | ||||||||||||||
[1, 3, 2, 4] | ||||||||||||||
sage: print (a1.pure_conjugating_braid(a2)) | ||||||||||||||
None | ||||||||||||||
sage: (a1^2).conjugating_braid(a2^2) | ||||||||||||||
s1*s0 | ||||||||||||||
sage: print ((a1^2).pure_conjugating_braid(a2^2)) | ||||||||||||||
None | ||||||||||||||
""" | ||||||||||||||
B = self.parent() | ||||||||||||||
n = B.strands() | ||||||||||||||
G = SymmetricGroup(n) | ||||||||||||||
p1 = G(self.permutation()) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would only convert to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I move the definition of |
||||||||||||||
p2 = G(other.permutation()) | ||||||||||||||
if p1 != p2: | ||||||||||||||
return None | ||||||||||||||
b0 = self.conjugating_braid(other) | ||||||||||||||
if not b0: | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It is better to check explicitly against There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done but putting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, right, whoops. Thanks. |
||||||||||||||
return None | ||||||||||||||
p3 = G(b0.permutation().inverse()) | ||||||||||||||
if p3.is_one(): | ||||||||||||||
return b0 | ||||||||||||||
LB = self.centralizer() | ||||||||||||||
LP = [G(a.permutation()) for a in LB] | ||||||||||||||
if p3 not in G.subgroup(LP): | ||||||||||||||
return None | ||||||||||||||
P = p3.word_problem(LP, display = False, as_list = True) | ||||||||||||||
enriqueartal marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
b1 = prod(LB[LP.index(G(a))] ** b for a,b in P) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, if you make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the first question a previous There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I might say also the previous
You can pass a sage: G = groups.permutation.Symmetric(5)
sage: d = {G.random_element(): i for i in range(5)}
sage: d
{(1,5,2,4): 0, (1,5)(2,3): 1, (1,3,5,2): 2, (1,5,3,2): 3, (1,5)(2,4,3): 4}
sage: G.subgroup(d)
Subgroup generated by [(1,3,5,2), (1,5,3,2), (1,5)(2,3), (1,5)(2,4,3), (1,5,2,4)] of (Symmetric group of order 5! as a permutation group) Indeed for |
||||||||||||||
b0 = b1 * b0 | ||||||||||||||
L = leftnormalform(b0) | ||||||||||||||
k = int(L[0][0] % 2) | ||||||||||||||
b0 = B.delta() ** k * B(prod(B(a) for a in L[1:])) | ||||||||||||||
return b0 | ||||||||||||||
enriqueartal marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
|
||||||||||||||
def ultra_summit_set(self): | ||||||||||||||
""" | ||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.