def test_pc_presentation(): Groups = [ SymmetricGroup(3), SymmetricGroup(4), SymmetricGroup(9).sylow_subgroup(3), SymmetricGroup(9).sylow_subgroup(2), SymmetricGroup(8).sylow_subgroup(2) ] S = SymmetricGroup(125).sylow_subgroup(5) G = S.derived_series()[2] Groups.append(G) G = SymmetricGroup(25).sylow_subgroup(5) Groups.append(G) S = SymmetricGroup(11**2).sylow_subgroup(11) G = S.derived_series()[2] Groups.append(G) for G in Groups: PcGroup = G.polycyclic_group() collector = PcGroup.collector pc_presentation = collector.pc_presentation pcgs = PcGroup.pcgs free_group = collector.free_group free_to_perm = {} for s, g in zip(free_group.symbols, pcgs): free_to_perm[s] = g for k, v in pc_presentation.items(): k_array = k.array_form if v != (): v_array = v.array_form lhs = Permutation() for gen in k_array: s = gen[0] e = gen[1] lhs = lhs * free_to_perm[s]**e if v == (): assert lhs.is_identity continue rhs = Permutation() for gen in v_array: s = gen[0] e = gen[1] rhs = rhs * free_to_perm[s]**e assert lhs == rhs
def test_derived_series(): # the derived series of the trivial group consists only of the trivial group triv = PermutationGroup([Permutation([0, 1, 2])]) assert triv.derived_series()[0].is_subgroup(triv) # the derived series for a simple group consists only of the group itself for i in (5, 6, 7): A = AlternatingGroup(i) assert A.derived_series()[0].is_subgroup(A) # the derived series for S_4 is S_4 > A_4 > K_4 > triv S = SymmetricGroup(4) series = S.derived_series() assert series[1].is_subgroup(AlternatingGroup(4)) assert series[2].is_subgroup(DihedralGroup(2)) assert series[3].is_trivial