Using MAGMA for Group Theory

&cat[[h: h in Conjugates(G,H`subgroup) | S subset h]: H in Subgroups(G)];

will create a list of all subgroups of $G$ containing a given group $S$. The main caveat here is that the function Subgroups(G) produces a list of representatives of conjugacy classes of subgroups of $G$. So after that you have to go through all conjugates of each such representative. Also, the elements of the list that Subgroups(G) returns are so-called records. To actually access the subgroup itself, you use the construction H`subgroup, where H is one such record. The command &cat concatenates a list of lists into one long list, just like the command &+list adds all the elements of the list and so on.

If you want to loop through this list, you can do something like

for h in &cat[[h: h in Conjugates(G,H`subgroup) | S subset h]: H in Subgroups(G)] do

...

end for;

or just have two nested loops, one over the elements of Subgroup(G), and one over the $G$-conjugates of each of them.

I am afraid there is no really good place to learn magma other than the online handbook and the people who already know it.


  • Although you say you'd prefer not to use GAP, producing a Hasse diagram is very easy in GAP, at least with the right packages.
    You'll need the xgap GAP package; and either the xgap binaries, which requires an X Windows system (easiest done with Linux or a similar Unix-like system), or else Gap.app, which requires a Mac.
    Once you have these installed, start xgap/Gap.app, and follow these steps:

    • Type "GraphicSubgroupLattice(SymmetricGroup(4));"
    • In the window that pops up, go to the Subgroups | All Subgroups menu.

    The Hasse diagram of the subgroup lattice will appear.

  • It's also quite easy to show parts of the subgroup lattice -- essentially, you can take any list of subgroups and show the inclusion relations. To do this:

    • Type "GraphicSubgroupLattice(G);" as before.
    • Compute the list of subgroups you want to display. It should be the output of the last GAP command.
    • Go to the Subgroups | Insert Vertices menu.

    The Hasse diagram of the subposet consisting of subgroups from your list will appear.

    There's probably a comparably easy way to show Hasse diagrams in MAGMA. (But I'm telling you what I know...)

    Xgap is usually included with GAP, and is also available from:
    http://www.gap-system.org/Packages/xgap.html
    Gap.app is available from:
    https://cocoagap.sourceforge.io/