|
135 | 135 | from sage.libs.gap.libgap import libgap
|
136 | 136 | from sage.libs.gap.element import GapElement
|
137 | 137 | from sage.misc.cachefunc import cached_method
|
| 138 | +from sage.groups.free_group import FreeGroup |
138 | 139 | from sage.groups.free_group import FreeGroupElement
|
139 | 140 | from sage.functions.generalized import sign
|
140 | 141 | from sage.matrix.constructor import matrix
|
@@ -1426,6 +1427,35 @@ def simplified(self):
|
1426 | 1427 | """
|
1427 | 1428 | return self.simplification_isomorphism().codomain()
|
1428 | 1429 |
|
| 1430 | + def sorted_presentation(self): |
| 1431 | + """ |
| 1432 | + Return the same presentation with the relations sorted to ensure equality. |
| 1433 | +
|
| 1434 | + OUTPUT: |
| 1435 | +
|
| 1436 | + A new finitely presented group with the relations sorted. |
| 1437 | +
|
| 1438 | + EXAMPLES:: |
| 1439 | +
|
| 1440 | + sage: G = FreeGroup(2) / [(1, 2, -1, -2), ()]; G |
| 1441 | + Finitely presented group < x0, x1 | x0*x1*x0^-1*x1^-1, 1 > |
| 1442 | + sage: G.sorted_presentation() |
| 1443 | + Finitely presented group < x0, x1 | 1, x1^-1*x0^-1*x1*x0 > |
| 1444 | + """ |
| 1445 | + F = FreeGroup(self.ngens()) |
| 1446 | + L0 = [r.Tietze() for r in self.relations()] |
| 1447 | + L1 = [] |
| 1448 | + for rel in L0: |
| 1449 | + C = [rel] |
| 1450 | + for j in range(len(rel) - 1): |
| 1451 | + C.append(rel[j + 1:] + rel[:j + 1]) |
| 1452 | + C1 = [tuple(-j for j in reversed(l)) for l in C] |
| 1453 | + C += C1 |
| 1454 | + C.sort() |
| 1455 | + L1.append(C[0]) |
| 1456 | + L1.sort() |
| 1457 | + return F/L1 |
| 1458 | + |
1429 | 1459 | def epimorphisms(self, H):
|
1430 | 1460 | r"""
|
1431 | 1461 | Return the epimorphisms from `self` to `H`, up to automorphism of `H`.
|
|
0 commit comments