Skip to content

Conversation

@valglad
Copy link
Contributor

@valglad valglad commented Dec 7, 2017

This PR implements Sims Verify algorithm (see the docstring of _verify for description) and a function for computing strong finite presentations of permutation groups (strong_presentation). This new function is typically more efficient than obtaining a strong presentation by just using presentation on a group whose generators are already strong. _verify can be used to obtain a base and a strong generating set for a group by generating a candidate randomly (maybe using schreier_sims_random) and amending missing strong generators. This could be faster than regular Schreier-Sims for large groups, and a separate function to do that could be written in the future.

Other changes include fixing a minor bug in the order method for FpGroups (use absolute value so that the order is non-negative), excluding identity from the generating set when a PermutationGroup is constructed, allowing application of homomorphisms to tuples and the new homomorphism function compose for returning a composition of two homomorphisms.

Implementation of Sims Verify algorithm and a function for computing
strong presentations of permutation groups. This is more efficient
than obtaining a strong presentation by just using `presentation` on
the strong generators. `_verify` can be eventually used to obtain a
base and a strong generating set for a group by generating a candidate
randomly and amending missing generators which would be faster than
Schreier-Sims for large groups.

# orbit representatives of K_beta
gammas = [alpha, beta]
orbits = list(uniq(K_beta.orbit(o) for o in orbit))
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to use set instead of calling uniq?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the order isn't important. Somehow I felt that using uniq would be faster but now that I actually tried it in python shell, using set on lists is significantly faster. I'll change this in other places as well.

gammas = [alpha, beta]
orbits = list(uniq(K_beta.orbit(o) for o in orbit))
orbit_reps = [list(orb)[0] for orb in orbits]
for rep in orbit_reps:
Copy link
Member

Choose a reason for hiding this comment

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

Is it clear that alpha would be the first element, list(orb)[0], of the K_beta-orbit orb of alpha? If not, then we should probably remove that orbit from orbits (and also the orbit of beta).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

K_beta stabilizes beta (by definition) and alpha (because K == H.stabilizer(alpha)) so they are the only things in their orbits. Though excluding them when orbits are computed would probably be a little faster.

Copy link
Member

Choose a reason for hiding this comment

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

Of course. I forgot that K_beta also stabilizes alpha. This should be OK then.

# is the same as
return H.presentation(eliminate_gens=False)
# H is a group on one generator and this is the relator for it
rels = [F.generators[-1]**H.generators[0].order()]
Copy link
Member

Choose a reason for hiding this comment

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

I have not succeeded in proving this. What would happen with Klein's 4-group?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not the case in general but I was under a strong impression that schreier_sims orders the base in a way that this always happens because somehow this was the case with all of the random tests I ran (which was many). But turns out it was a wrong impression (and also silly of me to not verify, sorry about that).

Klein's 4-group always has a base of length 1 so there is only one stabilizer and it doesn't get to this point in the algorithm. But if you throw in a disjoint permutation into the generating set and order the generators in a specific way, it gives a counterexample. E.g.

>>> a = Permutation(0, 1)(2, 3)
>>> b = Permutation(0, 2)(3, 1)
>>> c = Permutation(4, 5)
>>> V = PermutationGroup(c, a, b)

(but not PermutationGroup(a, b, c)).

I'll make sure that if there are more than one generators, the stabilizer is completed by the main for loop. Also, should probably add it to the tests.

The last stabilizer in the chain isn't always cyclic and this
commit accounts for it. Also, the case in the strong_presentation
algorithm where the relators are found in the block action was
slightly corrected as the domain of one of the homomorphism should
be the whole group, otherwise composition doesn't work properly.

Additionally a new test was added and `uniq` replaced by `set`
everywhere in the new functions.
@valglad
Copy link
Contributor Author

valglad commented Dec 30, 2017

Found another problem later on in the code so pushed the changes now.

rel = rel*phi.invert(g)**-1
new_rels = [rel]
elif len(orbit_k) == 1:
success, new_rels = K_s._verify(K, phi, z, alpha)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't success be checked somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The way the function is written, we know that success will always be true because we start with a strong generating set. Theoretically, later this could be changed so that we start with a randomly generated (potential) BSGS, and then append new elements to it whenever success is false.

Copy link
Member

Choose a reason for hiding this comment

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

OK. Maybe a comment could be added to that effect for future maintenance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, will add one.

Copy link
Member

Choose a reason for hiding this comment

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

Otherwise, I think this is ready to be merged.

@jksuom
Copy link
Member

jksuom commented Jan 14, 2018

Thanks! I think this is ready to be merged.

@jksuom jksuom merged commit c5a836f into sympy:master Jan 14, 2018
@valglad valglad deleted the strong_present branch January 14, 2018 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants