Skip to content

Bug in AbelianGroup.Subgroup #36974

@grhkm21

Description

@grhkm21

Steps To Reproduce

sage: G, (g0, g1) = AbelianGroup(2, [48, 0]).objgens()
....: print(G, g0, g1)
....: assert g0.order() == 48 and g1.order() == oo
....: 
....: G0 = G.subgroup([g0])
....: print(G0, G0.gens(), G0.gens_orders())
....: print(len(G0.gens()) == len(G0.gens_orders()))
Multiplicative Abelian group isomorphic to C48 x Z f0 f1
Multiplicative Abelian subgroup isomorphic to C3 x C16 generated by {f0} (f0,) (3, 16)
False

Problem: The length of G0.gens() and G0.gens_orders() should be the same.

Additional Information

The Subgroup is computed here. The issue seems to be that the GAP functions AbelianInvariants doesn't actually return the orders of the generators in GeneratorsOfGroup, as demonstrated below:

sage: G, (g0, g1) = AbelianGroup(2, [48, 0]).objgens()
....: H = libgap(G).Subgroup(gens)
....: H_invs = H.AbelianInvariants().sage()
....: H_gens = H.GeneratorsOfGroup()
....: print(H, H_invs, H_gens)
Pcp-group with orders [ 48 ] [3, 16] [ g1 ]

The obvious fix would be to replace .AbelianInvariants on line 1710 with, well, [g.Order().sage() for g in H.GeneratorsOfGroup()] or something like that. If any GAP users have a better solution that returns the order of all (finite?) generators, please suggest it, since I haven't used GAP before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions