Skip to content

Recog An/Sn unknown degree: conder, holt#265

Open
ssiccha wants to merge 32 commits intogap-packages:masterfrom
ssiccha:frss/AnSnRecogUnknownDegree-2
Open

Recog An/Sn unknown degree: conder, holt#265
ssiccha wants to merge 32 commits intogap-packages:masterfrom
ssiccha:frss/AnSnRecogUnknownDegree-2

Conversation

@ssiccha
Copy link
Collaborator

@ssiccha ssiccha commented Apr 9, 2021

A PR based on #176.

We are going to implement the extensions by Conder and Derek Holt's
GuessAltSymDegree.

@ssiccha
Copy link
Collaborator Author

ssiccha commented Apr 12, 2021

Rebased the last commit onto the current version of #176.

@codecov
Copy link

codecov bot commented Apr 12, 2021

Codecov Report

❌ Patch coverage is 75.32468% with 95 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.48%. Comparing base (c309d8a) to head (16bace0).

Files with missing lines Patch % Lines
gap/generic/SnAnUnknownDegree.gi 75.13% 95 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #265      +/-   ##
==========================================
+ Coverage   69.12%   70.48%   +1.35%     
==========================================
  Files          43       43              
  Lines       18321    18637     +316     
==========================================
+ Hits        12665    13136     +471     
+ Misses       5656     5501     -155     
Files with missing lines Coverage Δ
gap/matrix.gi 92.97% <100.00%> (+0.01%) ⬆️
gap/perm.gi 79.76% <100.00%> (+0.07%) ⬆️
gap/projective.gi 83.17% <100.00%> (+0.08%) ⬆️
gap/generic/SnAnUnknownDegree.gi 85.07% <75.13%> (-5.02%) ⬇️

... and 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ssiccha ssiccha force-pushed the frss/AnSnRecogUnknownDegree-2 branch from d40a988 to dc4a895 Compare April 12, 2021 12:32
@FriedrichRober FriedrichRober force-pushed the frss/AnSnRecogUnknownDegree-2 branch from dc4a895 to f162f36 Compare June 23, 2021 14:20
@ssiccha ssiccha force-pushed the frss/AnSnRecogUnknownDegree-2 branch from cca25fd to 35a39de Compare June 23, 2021 16:37
@FriedrichRober
Copy link
Contributor

Link to our Hackmd

@ssiccha ssiccha force-pushed the frss/AnSnRecogUnknownDegree-2 branch from 96f9a25 to 705504c Compare March 28, 2022 22:01
@FriedrichRober FriedrichRober force-pushed the frss/AnSnRecogUnknownDegree-2 branch 3 times, most recently from e63f4a8 to 956884d Compare March 29, 2022 22:51
@ssiccha
Copy link
Collaborator Author

ssiccha commented Mar 29, 2022

We should be almost done. We think there are two TODOs left: clean up the tests and figure out what to do with small classical groups like: Omega(-1,4,3). It has element orders <= 5, thus slips through our heuristics to weed out groups which are not isomorphic to An or Sn. Hence the SnAnUnknownDegree algorithm takes forever until it realizes, that the group in question is not an An or Sn. We think we should be able to alleviate this by simply saying that we're NeverApplicable if the vector space our group acts has less than e.g. 100 elements. And then we'll post a challenge on slack or the GAP forum whether somebody can find a small group, which makes the algorithm run slow.

And get the tests to pass again. :)

And in Make CallMethods directly write into the RecogNode update the docs of CallMethods.

And, @FriedrichRober is writing a short text, how all the parts fit together, that is how our implementation differs from a "vanilla" implementation of the JLNP algorithm according to the paper.

@ssiccha ssiccha force-pushed the frss/AnSnRecogUnknownDegree-2 branch 2 times, most recently from 3b12114 to daceec3 Compare March 29, 2022 23:52
@fingolfin
Copy link
Member

Awesome, thank you!

@fingolfin
Copy link
Member

@FriedrichRober do you think you can finish this on your own, now that @ssiccha is gone? Perhaps I can help a bit?

@FriedrichRober
Copy link
Contributor

Yes, I think I can finish this on my own. The code is finished (except for handling small classical groups). What is missing now is to finish the documentation (comments) and looking at the runtime of the test suite.

@FriedrichRober FriedrichRober force-pushed the frss/AnSnRecogUnknownDegree-2 branch 2 times, most recently from d45adbb to 7ba5ec6 Compare June 1, 2022 13:32
@FriedrichRober FriedrichRober force-pushed the frss/AnSnRecogUnknownDegree-2 branch 4 times, most recently from 85ca56f to deb2974 Compare November 7, 2022 03:36
@FriedrichRober
Copy link
Contributor

@fingolfin, ich habe nun die Änderungen implementiert, wie wir es besprochen haben. Wir geben früher auf, und speichern uns die Iteratoren im recog node ab, um sie später weiter zu verwenden. Trotzdem dauert die Test-Suite auf meinem Rechner 3-4 Minuten länger als auf dem master. Meiner Meinung nach ist dieser Zustand inakzeptabel, um das einfach so zu mergen :(

Ich muss dann nochmal genau schauen, an welchen Stellen wir zu viel Zeit verschwenden, und ob sich da was machen lässt.

@FriedrichRober
Copy link
Contributor

@fingolfin, the pull request is ready now. The test suite on my laptop was as quick as on master, however some unrelated errors occures. Two where the stamp is not what was expected in the test file. One where the group was wrongly recognized which would require further investigation. I assume that this is a random error which simply occured from inserting the recognition method into the database.

@fingolfin
Copy link
Member

Fantastic, @FriedrichRober, thank you so much!

doc/recog.bib Outdated
AUTHOR = {Conder, Jonathan},
TITLE = {Algorithms for Permutation Groups},
YEAR = {2012},
NOTE = {TODO},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be filled in by someone? At which university was this thesis written; what kind of thesis was it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I talked to @aniemeyer and learned that this was a thesis in Auckland, but I didn't find something initially. But now it seems this was indeed a B.Sc. thesis there, and it was written by @jonathan-conder . I have now pinged them, and will also write an email. Perhaps we get permissions to post the thesis somewhere, or perhaps Jonathan is willing to put it on e.g. the arXiv (I am not sure if they accept such things, but it seems to contain original research, and they definitely have at least phd theses?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jonathan replied to my email and generously gave permission to share copies of his thesis, and he also made it available at https://jonathan-conder.github.io/afpg.pdf -- this should keep working for the foreseeable future, and I also made sure archive.org has a snapshot. Still, we should probably see if we can also get this onto e.g. Zenodo or so.

Anyway, that gives us enough info to complete this bib record. I'll do so eventually (if nobody beats me to it).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NOTE = {TODO},
NOTE = {https://web.archive.org/web/20251219002033/https://jonathan-conder.github.io/afpg.pdf},

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I've pushed a bunch of changes (see commit log). I'll try to understand the errors better tomorrow

Comment on lines +1274 to +1284
# This is usually much smaller than RECOG.SnAnUpperBoundForDegree.
# The number to compare N with was chosen arbitrarily as a "large" degree.
# if N > 20 then
# degreeData := RECOG.GuessSnAnDegree(ri);
# if degreeData = fail then
# cache.N := TemporaryFailure;
# return;
# fi;
# N := Minimum(N, degreeData.degree);
# cache.N := N;
# fi;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the only call to RECOG.GuessSnAnDegree?? If so... do we need it at all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to keep it just for the sake of Issue #348. But right now the code is not used by SnAnUnknownDegree, and we can surely move it somewhere else.

constants := RECOG.ThreeCycleCandidatesConstants(1. / 4., N);
for i in [1 .. T] do
iterator := RECOG.ThreeCycleCandidatesIterator(ri, constants);
# This is the main method used by RECOG.RecogniseSnAn and RECOG.RecogniseSnAnLazy.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, RECOG.RecogniseSnAn is not used anymore. Can we just remove it then, and perhaps rename RECOG.RecogniseSnAnLazy to RECOG.RecogniseSnAn ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, in theory RECOG.RecogniseSnAn is the algorithm that you can run with an arbitrary epsilon and it guarantees you to recognise SnAn with this error bound, so it is running all iterations as often as computed in the respective paper. However, in practice it is too expensive to run this method for the recog tree, so we wrote the lazy variant that exits the iterations way sooner. Whether we want to keep it or not depends on whether or not it is interesting to have this version of the algorithm to play around with, which I honestly do not have a strong opinion on. We can definitely rename the functions to RECOG.RecogniseSnAnExact or something like this and then drop the lazy from the other :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the code, but rename as Friedrich suggested.

@FriedrichRober
Copy link
Contributor

Thank you! I've pushed a bunch of changes (see commit log). I'll try to understand the errors better tomorrow

The rest of the changes look good to me

# eps : real number, the error bound
# N : integer, upper bound for the degree of G
#
# Returns a record of constants used in ThreeCyclesCanditatesIterator.
Copy link
Collaborator

@TWiedemann TWiedemann Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

        # Returns a record of constants used in ThreeCycleCandidatesIterator.
      
      
        
        # The meaning of these constants is documented under "Changes" at the beginning of this file and their values are from [JLNP13, 4.1].

Typo (not from this PR), ThreeCycleCandidatesIterator was misspelled.
I find it difficult to rememer the meaning of the constant names B, T, ..., but it is probably best to follow the notation from [JLNP13].

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the constants are named as in [JLNP13]. If we ever renamed constants, it should be hopefully noted in a comment above the function.

FriedrichRober and others added 3 commits March 10, 2026 11:45
Co-authored-by: Torben Wiedemann <7226617+TWiedemann@users.noreply.github.com>
Co-authored-by: Max Horn <max@quendi.de>
Co-authored-by: Max Horn <max@quendi.de>
# determine this. It is based on the Magma function heuristicThreeCycleTest.
# R is a list of logInt2N+1 many random elements of the group of ri.
RECOG.HeuristicThreeCycleTest := function(ri, c, logInt2N, R)
local r, y, yTo5, k;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local r, y, yTo5, k;
local r, y, y2, y3, k;

Update local variables.

doc/recog.bib Outdated
NOTE = {https://doi.org/10.1017/CBO9780511565830.007},
}

@article{C12,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems Bibtex and GAPDoc only know mastersthesis and phdthesis but not bscthesis or bachelorthesis. Ah well. Let's then do

Suggested change
@article{C12,
@misc{C12,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check this Pr out locally to try what actually works and then will push an improvement

Comment on lines +252 to +256
# We make a small improvement to the version described in
# <Cite Key="JLNP13"/>. The order of r ^ M is a 2-power.
# It can be at most 2 ^ logInt2N. Thus, if we find an r such that
# (r ^ M) ^ (2 ^ logInt2N) is non-trivial, then we can return
# NeverApplicable.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# We make a small improvement to the version described in
# <Cite Key="JLNP13"/>. The order of r ^ M is a 2-power.
# It can be at most 2 ^ logInt2N. Thus, if we find an r such that
# (r ^ M) ^ (2 ^ logInt2N) is non-trivial, then we can return
# NeverApplicable.
# We make a small improvement to the version described in
# <Cite Key="JLNP13"/>. The order of r ^ M is a 2-power.
# It can be at most 2 ^ logInt2N. Thus, if we find an r such that
# (r ^ M) ^ (2 ^ logInt2N) is non-trivial, then we can return
# NeverApplicable. I.e. we need one iteration less than in [JLNP13],
# which also computes (r ^ M) ^ (2 ^ (longInt2N + 1))

Make the difference between the code and JLNP13 more explicit (hoping that I understood this correctly, I am not sure).

Comment on lines +286 to +294
Li := L;
Li := Minimum(Li, B);
Ki := Ki + K;
Ki := Minimum(Ki, C);
curInvolutionPos := 1;
return SnAnTryLater;
elif curInvolutionPos = Li then
Li := Li + L;
Li := Minimum(Li, B);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Li := L;
Li := Minimum(Li, B);
Ki := Ki + K;
Ki := Minimum(Ki, C);
curInvolutionPos := 1;
return SnAnTryLater;
elif curInvolutionPos = Li then
Li := Li + L;
Li := Minimum(Li, B);
# Last involution reached. Restart with next batch of conjugates later.
Li := Minimum(L, B); # Reset Li to initial value
Ki := Minimum(Ki+K, C); # Try up to K more conjugates later
curInvolutionPos := 1; # Restart from first involution
return SnAnTryLater;
elif curInvolutionPos = Li then
# End of batch of involutions reached. Try next batch later.
Li := Minimum(Li+L, B);

The new Minimum statements should be equivalent to the old ones. Also added some comments.

@TWiedemann
Copy link
Collaborator

@FriedrichRober I went through ThreeCycleCandidatesIterator and it looks good to me! The only other comment I have is that I think whenever you write "commutating", you actually mean "non-commutating": The algorithm looks for conjugates of the involution t that do not commute with t, and counts how many it has found already. Hence I think nrCommutatingConjugates should be appropriately renamed, and some comments adapted.

curInvolutionPos := 1;
Ki := Minimum(K, C);
Li := Minimum(L, B);
# Counts the elements c in step 4 that we use to conjugate the current
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Counts the elements c in step 4 that we use to conjugate the current
# Entry i of this list counts the elements c in step 4 that we use to conjugate the current

Clarification.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is actually 'commuting' and 'non-commuting' instead of 'commutating' and 'non-commutating"

Comment on lines 203 to 204
# counts the size of the set Gamma_i in step 4 for the current involution
# t_i
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# counts the size of the set Gamma_i in step 4 for the current involution
# t_i
# Entry i of this list counts the size of the set Gamma_i in step 4
# for the current involution t_i

As above.

Comment on lines +206 to +207
# counts the actual number of three cycle candidates considered
# which are filtered from the Gamma_i via heuristic order tests.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# counts the actual number of three cycle candidates considered
# which are filtered from the Gamma_i via heuristic order tests.
# Entry i of this list counts the actual number of three cycle candidates considered
# which are filtered from the Gamma_i via heuristic order tests.

As above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants