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

group theory: Implemented Sylow Subgroups #13104

Merged
merged 8 commits into from Aug 18, 2017

Conversation

Projects
None yet
2 participants
@valglad
Contributor

valglad commented Aug 10, 2017

This PR adds the method sylow_subgroup to the PermutationGroup class for computing Sylow subgroups. As part of this:

  • Implemented orbit and block system action homomorphisms (orbit_homomorphism and block_homomorphism in the homomorphisms module).

  • Added the method minimal_blocks for returning all minimal block systems of a group

  • Fixed a bug related to the _strong_gens_slp attribute: it used to be set inside schreier_sims_incremental however this method is called by normalizer and stabilizer methods which led to a key mismatch with respect to strong_gens.

Show outdated Hide outdated sympy/combinatorics/homomorphisms.py
@@ -207,6 +207,39 @@ def is_trivial(self):
'''
return self.image().order() == 1
def restict_to(self, H):

This comment has been minimized.

@jksuom

jksuom Aug 10, 2017

Member

restict -> restrict

@jksuom

jksuom Aug 10, 2017

Member

restict -> restrict

Show outdated Hide outdated sympy/combinatorics/perm_groups.py
@@ -2668,9 +2735,11 @@ def schreier_sims(self):
return
def _schreier_sims(self, base=None):
base, strong_gens = self.schreier_sims_incremental(base=base)
schreier = self.schreier_sims_incremental(base=base, slp_dict=True)
base, strong_gens = schreier[0], schreier[1]

This comment has been minimized.

@jksuom

jksuom Aug 10, 2017

Member

Maybe base, strong_gens = schreier[:2].

@jksuom

jksuom Aug 10, 2017

Member

Maybe base, strong_gens = schreier[:2].

Show outdated Hide outdated sympy/combinatorics/perm_groups.py
if slp_dict:
# rewrite the indices of strong_gens_slp in terms of the elements
# of strong_gens
for k in strong_gens_slp:

This comment has been minimized.

@jksuom

jksuom Aug 10, 2017

Member

Maybe this could be for k, slp in strong_gens_slp.items():

@jksuom

jksuom Aug 10, 2017

Member

Maybe this could be for k, slp in strong_gens_slp.items():

# apply _sylow_reduce to orbit actions
orbits = sorted(orbits, key = lambda x: len(x))
omega1 = orbits.pop()
omega2 = orbits[0].union(*orbits)

This comment has been minimized.

@jksuom

jksuom Aug 10, 2017

Member

union will take only one argument in addition to self. This should probably be Union(*orbits) (or maybe Union(orbits)).

@jksuom

jksuom Aug 10, 2017

Member

union will take only one argument in addition to self. This should probably be Union(*orbits) (or maybe Union(orbits)).

This comment has been minimized.

@valglad

valglad Aug 13, 2017

Contributor

I tried it with a simple example and union seems to do the right thing. E.g.

>>> a = set([1,2])
>>> b = [set(3,4),set(5,6)]
>>> a.union(*b)
set([1,2,3,4,5,6])

Same with python3.

@valglad

valglad Aug 13, 2017

Contributor

I tried it with a simple example and union seems to do the right thing. E.g.

>>> a = set([1,2])
>>> b = [set(3,4),set(5,6)]
>>> a.union(*b)
set([1,2,3,4,5,6])

Same with python3.

This comment has been minimized.

@jksuom

jksuom Aug 13, 2017

Member

Ah, This is Python union. (Changed in version 2.6: Accepts multiple input iterables.) I was thinking of SymPy union that only takes one argument.

@jksuom

jksuom Aug 13, 2017

Member

Ah, This is Python union. (Changed in version 2.6: Accepts multiple input iterables.) I was thinking of SymPy union that only takes one argument.

Show outdated Hide outdated sympy/combinatorics/perm_groups.py
P = Z._p_elements_group(p)
h = P.random()
C_h = self.centralizer(h)
while C_h.order() % s_order != 0:

This comment has been minimized.

@jksuom

jksuom Aug 12, 2017

Member

Should we have p*s_order instead of s_order?

@jksuom

jksuom Aug 12, 2017

Member

Should we have p*s_order instead of s_order?

Show outdated Hide outdated sympy/combinatorics/perm_groups.py
nu = nu.restict_to(Q)
R = nu.image().sylow_subgroup(p)
return nu.invert_subgroup(R)

This comment has been minimized.

@jksuom

jksuom Aug 13, 2017

Member

It should be tested that p is a prime. (isprime in ntheory.)

@jksuom

jksuom Aug 13, 2017

Member

It should be tested that p is a prime. (isprime in ntheory.)

Show outdated Hide outdated sympy/combinatorics/tests/test_perm_groups.py
@@ -777,3 +777,26 @@ def test_generator_product():
for g in gens:
w = g*w
assert w == p

This comment has been minimized.

@jksuom

jksuom Aug 13, 2017

Member

There could also be tests for minimal_blocks and examples in its docstring.

@jksuom

jksuom Aug 13, 2017

Member

There could also be tests for minimal_blocks and examples in its docstring.

Show outdated Hide outdated sympy/combinatorics/perm_groups.py
return _sylow_reduce(mu, nu)
elif len(blocks) == 1:
block = list(blocks)[0]
if block != [0]*self.degree:

This comment has been minimized.

@jksuom

jksuom Aug 13, 2017

Member

Something like any(i != 0 for i in blocks) would probably be more efficient.

@jksuom

jksuom Aug 13, 2017

Member

Something like any(i != 0 for i in blocks) would probably be more efficient.

@jksuom jksuom merged commit 93267c8 into sympy:master Aug 18, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@valglad valglad deleted the valglad:sylow branch Aug 18, 2017

@ylemkimon ylemkimon referenced this pull request Sep 27, 2017

Open

PyPy travis failures #8972

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