Smaller generating pair sets for RMS congruences #457
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If
cong
is a congruence on a finite (0-)simple semigroup described by a linked triple (i.e. if it satisfiesIsR(Z)MSCongruenceByLinkedTriple
) then we might wish to convert it to a congruence defined by generating pairs (e.g. by usingAsSemigroupCongruenceByGeneratingPairs
). This uses a special method forGeneratingPairsOfMagmaCongruence
, which is installed incongrms.gi
.It turns out that the current method is really bad in terms of the number of pairs it spits out. It iterates over every element of the normal subgroup
n
, and doesn't combine this in any way with the column and row operations. This PR replaces it with an all-new, improved algorithm which avoids unnecessary work and condenses the information into as few pairs as possible. The number of generating pairs produced is drastically reduced, as displayed in the following example:The output of this example is currently
[ 1, 4, 6, 12, 14, 14, 16, 14, 15, 17, 17, 19, 17, 24, 26, 26, 28, 26, 27, 29, 29, 31, 29 ]
but after this PR it is improved to
[ 1, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
The idea behind the algorithm is to create three lists:
n
and then to make pairs of RMS elements for the generating set, where each pair of RMS elements encompasses three pieces of information, one from each list of these three lists. I'm currently TeXing a proper description of the algorithm and a proof of its validity for my thesis (I can show this to anyone who's interested when it's done). Anyway, I'm confident it is correct, and it certainly passes the suite of tests we have, along with any more I've thrown at it.
Note that currently
congrms
has different for RMS and RZMS congruences. These methods are different but similar, causing a certain amount of code duplication. This duplication should be removed eventually, but this PR doesn't make it any worse.