Implementing Subgroups
I created my own implementation of a specific group, inheriting from Group, following the pattern in the tutorial here:
https://doc.sagemath.org/html/en/them...
I can construct elements, multiply them and find inverses.
My group is infinite, but I know that any finitely generated subgroup is finite. I'd like to have something where I can do:
sage: G = myGroup()
sage: g_1,g_2,g3 = some elements of G
sage: G2 = G.subgroup([g1,g2])
sage: g3 in G2
True/False
sage: G2.order()
35
sage: G2.list_elements()
...
My question is, do I have to implement this all "from scratch", or can sage already do most if this if I've implemented the multiplication? How do I make it work with the category framework, so G1 is a group, and has a cannonical conversion to G? (if that is the right thing to want.)
It'd help first to see how all this works for some standard group, before translating to a custom implementation.