-
Notifications
You must be signed in to change notification settings - Fork 162
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
Fix recursion depth trap and other improvements for quotients of fp groups #1884
Fix recursion depth trap and other improvements for quotients of fp groups #1884
Conversation
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.
This PR adds a new feature, but does not document it. Is that intentional?
lib/grpfp.gi
Outdated
{F, rels} -> FactorFreeGroupByRelators(F, List(rels, r -> r[1] * r[2]^-1))); | ||
|
||
InstallOtherMethod( \/, | ||
"for free groups and a list of equations", |
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.
free -> fp
lib/grpfp.gi
Outdated
IsElmsColls, | ||
[ IsFreeGroup, IsCollection ], | ||
0, | ||
{F, rels} -> FactorFreeGroupByRelators(F, List(rels, r -> r[1] * r[2]^-1))); |
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.
Perhaps write r -> r[1] / r[2]
for brevity? Not that it's important.
It would be nice if @hulpke could review this, too. |
We install methods to take quotients of finitely presented groups by lists of relations, and quotients of free and finitely presented groups by lists of equations (pairs of left hand side and right hand side).
Codecov Report
@@ Coverage Diff @@
## master #1884 +/- ##
==========================================
+ Coverage 56.56% 64.11% +7.55%
==========================================
Files 898 917 +19
Lines 273508 282686 +9178
Branches 12764 12765 +1
==========================================
+ Hits 154697 181244 +26547
+ Misses 116068 98647 -17421
- Partials 2743 2795 +52
|
46c2855
to
2443b83
Compare
When quotienting a fp group by relators or equations are the relators or equations written over the FP group, or the underlying free group? |
@stevelinton good point. I only installed a method for Both functionalities would make sense and we could install methods for both (or, I am overlooking something and we should not install methods for any?). |
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.
The use fpgroup / words in free looks inconsistent to me. (This concerns the /
operator. I'd be happy for a specific function if there is need for it.)
The more generic generalization seems to me to be
<group>/<elmlist>
installed with IsCollsElms
that would form <group>
/N where N is the smallest normal subgroup containing <elmlist>
. In the case of fp groups these are words, but it would also work for other groups (and redirect to FactorGroup
) and remain consistent with the use for free groups.
@hulpke as said above, I only installed a method that employs an already existing function, but I do like your suggestion (installing a method for Can I just inquire what you refer to by "words" in this context: Is this strings in a generating set of a group in question (not the underlying free group for fp groups)? |
Just to clarify, I seem to have confused myself. With this PR the following happens
This is the behaviour you want, isn't it? If one wanted to support What does not work yet is the following
where the expected output then would be
Which could be made to work by installing the appropriate method. I don't see right now how I can make
Maybe I am overlooking something? |
I don't think that a generic method for |
Max Horn writes:
I don't think that a generic method for FactorByClosureOfElms is
possible that works efficiently in "all" cases. But one could (and
should) install methods for it that deal with specific cases. So for
fpgroups, one could simply install FactorGroupFpGroupByRels as a
method.
You mean you want to introduce a new Operation
"FactorByNormalClosureOfElms"?
|
No, what I mean is more like this: If you want/need a |
Max Horn writes:
No, what I mean is more like this: If *you* want/need a `FactorByClosureOfElms`, then I think the only sane way to do it is to make it an operation, because how to do it efficiently varies quite a bit depending on how the group is represented internally, and the generic case using a normal closure won't be useful in all of them, as you pointed out yourself :-)
Sorry for being obstinate: Say I make an operation
`FactorByNormalClosureOfElms`, I would then install this as method
for `\/` on `[IsGroup, IsElmsColl]`?
|
That sounds sensible to me |
@markuspf |
I've started Jenkins test of this PR to check how it works with different packages loaded. |
This will break teststandard, since If all packages are loaded, we will have two diffs (unless this will somehow vanish after rebase, but I doubt that):
Shall this be treated as an issue in the core system or in a package? Perhaps this comes from one of @james-d-mitchell's packages? |
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.
Marked this as "Request changes" what just means "feedback that must be addressed before merging". Not clear if changes are required in the core system or some package.
@alex-konovalov we do have a method for displaying semigroup congruences in Semigroups, which might cause the diff. I would simply not display the return value in these tests. |
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.
Looks ok to me, other than that one question.
lib/semiquo.gi
Outdated
@@ -51,7 +51,8 @@ function(cong) | |||
SetOne(Q, One(S)^QuotientSemigroupHomomorphism(Q)); | |||
fi; | |||
|
|||
if HasGeneratorsOfSemigroup(S) then | |||
if HasGeneratorsOfMagmaWithInverses(S) or | |||
HasGeneratorsOfSemigroup(S) then | |||
Qgens:= List( GeneratorsOfSemigroup( S ), |
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.
Doesn't this assume that if HasGeneratorsOfMagmaWithInverses
then we can obtain GeneratorsOfSemigroup
? Is this safe?
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.
Probably not. I'll check.
I don't really like suppressing output, because it then removes any notion of testing whether the output (or the result) makes any sense. I can't think of a better way to address this problem though. |
You could check essentially what is displayed:
|
2443b83
to
2aa98e8
Compare
lib/semiquo.gi
Outdated
# GeneratorsOfMagmaWithInverses. | ||
# | ||
# We put this in, because groups do not set their | ||
# semigroup generators. |
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.
I don't understand the second paragraph. I.e. the implication "because" indicates is beyond me.
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.
It describes the reason why this hack is there in the first place: groups do not know their semigroup generating set, they only know their GeneratorsOfMagmaWithInverses.
I don't know whether putting Semigroup and Monoid generating sets into Group constructors wreaks more havoc on the library than I want to fix right now.
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.
Actually, after reading this added "explanation" I still do not quite understand what you mean. What is "this" in "We put this in" referring to: the check? Or the code inside the if/fi? Each interpretation seems valid to me (if one does not study resp. know the surrounding code well, at least). I first thought the latter, but now I think perhaps the former is meant?
After reading the surrounding code, and also the discussion in the PR, I think I now have a guess of what was meant, and wrote the following suggestion for an alternate comment based on that -- did I get it right?
Ensure GeneratorsOfSemigroup(Q) is set if possible, by mapping GeneratorsOfSemigroup(S).
Note that it is not sufficient to check HasGeneratorsOfSemigroup(S), because e. g. groups by default
have GeneratorsOfMagmaWithInverses set but not GeneratorsOfSemigroup. However, there are
GeneratorsOfSemigroup methods for domains knowing GeneratorsOfMagmaWithInverses or
GeneratorsOfMagma, thus the following check and code works correctly even for groups.
doc/ref/grpfp.xml
Outdated
Then a list of relators is constructed as words in the generators of the | ||
free group and is factored out to obtain the finitely presented group. | ||
free group, or a list of equations, that is, pairs of words in the generators | ||
of the free group, and is factored out to obtain the finitely presented group. |
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.
That sentence now is somewhat longish and it took me some time grok it. How about this?
Then either a list of relators is constructed as words in the generators of the free group,
or else a list of relations as pairs of words in the generators of the free group. In either case,
the quotient of the free group by the list is the finitely presented group with the given
relators respectively relations.
doc/ref/grpfp.xml
Outdated
@@ -119,16 +123,19 @@ See also <Ref Func="SetReducedMultiplication"/>. | |||
<ManSection> | |||
<Meth Name="\/" Arg="F, rels" | |||
Label="for a free group and a list of elements"/> | |||
<Meth Name="\/" Arg="F, eqns" | |||
Label="for a free group and a list of equations"/> |
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.
maybe replace "equations" by "pairs of elements"?
doc/ref/grpfp.xml
Outdated
Note that relations are entered as <E>relators</E>, i.e. as words in the | ||
generators of <A>F</A>, or as <E>equations</E>, i.e. as pairs of | ||
words in the generators of the group <A>F</A>. | ||
Note that relators and equations cannot be mixed. |
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.
Perhaps avoid using "Note that" twice? It's purely a filler anyway, both could be removed.
2aa98e8
to
0552648
Compare
The semigroups package installs a different method to print congruences and quotients, so we only test some of the properties of the results, not the output itself.
d644417
to
4bb6934
Compare
@alex-konovalov can you please check about your issue with this PR again and remove the blocker, if appropriate |
4bb6934
to
d157f53
Compare
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.
Looks good to me now, thanks!
@markuspf I am re-running Jenkins test with the latest state of this PR - please bear with me till it's completed. |
@markuspf happy with this now. I've seen some diffs in Jenkins, but they all look familiar and caused by earlier problems that are already fixed. |
While addressing the immediate problem with #405, I stumbled across some more things that I added.
The immediate problem in #405 is that the quotient did not know it had
GeneratorsOfSemigroup
, so now theRecursionDepthTrap
problem does not occur anymore (when taking the quotient of a group by a semigroup congruence). This was fixed by making the quotient aware of the presence of semigroup generators.Using the code pasted in #405 now produces the following behaviour:
This is because this PR installs a method to handle quotients of free groups by lists of equations, by delegating to quotients of free groups by relators, rewriting the equations
[u,v]
to the relatorsuv^{-1}
.Additionally this PR installs a method to take quotients of finitely presented groups by relators (and pairs of equations), as these were not previously installed.
Closes #405 .