On Sun, Aug 16, 2020 at 11:44 AM 'Peter Mueller' via sage-support
<
sage-s...@googlegroups.com> wrote:
>
> I had a hard to track down error which eventually relied on sage permutation groups behave odd in regard to subgroups. A subgroup y of a subgroup x of g isn't always considered as a subgroup of g. Compare
>
> sage: g = SymmetricGroup(2)
> ....: x = g.subgroup([])
> ....: y = x.subgroup([])
> ....: x == y
> ....:
> False
>
this seems to be a "GAP pexpect interface" bug:
sage: g = libgap.SymmetricGroup(2)
sage: x = g.Subgroup([])
sage: y = x.Subgroup([])
sage: x==y
True
sage: len({x,y})
1
> with
>
> sage: G = gap(g)
> ....: X = G.Subgroup([])
> ....: Y = X.Subgroup([])
> ....: X == Y
> ....:
> True
>
> A probably related strange phenomenon arises with subgroups of g only:
>
> sage: g = SymmetricGroup(3)
> ....: x = g.subgroup(['(1, 2)', '(2, 3)'])
> ....: y = g.subgroup(['(1, 3)', '(2, 3)'])
> ....: x == y; len({x, y})
> ....:
> True
> 2
I guess this has to do with Python hashing; objects are not checked
for `==` equality when you do {},
but for equality w.r.t. to certain internal representation:
sage: g = libgap.SymmetricGroup(3)
sage: x = g.Subgroup(libgap.eval('[(1, 2), (2, 3)]'))
sage: y = g.Subgroup(libgap.eval('[(1, 3), (2, 3)]'))
sage: z = g.Subgroup(libgap.eval('[(1, 3), (2, 3)]'))
sage: len(libgap.Set([x,y,z])) # so this is sane on GAP/libgap level
sage: len({x,y,z}) # but!
2
sage: x==y, y==z, x==z # while this makes sense
(True, True, True)
>
> On the Gap level, same subgroups given by different generators apparently get hashed correctly:
>
> sage: gap.eval('G := SymmetricGroup(3);;')
> ....: gap.eval('U := Subgroup(G, [(1, 2), (2, 3)]);;')
> ....: gap.eval('V := Subgroup(G, [(1, 3), (2, 3)]);;')
> ....: gap.eval('Length(Set([U, V]))')
> ....:
> '1'
>
> -- Peter Mueller
>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
sage-support...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-support/a18bc5e8-a1d0-4c8c-8f77-e47e7abc6e49o%40googlegroups.com.