Opened 2 years ago

# change matrix group comparison

Reported by: Owned by: vdelecroix major sage-8.2 group theory days93 N/A

### Description

For `PermutationGroup_generic` (in `sage.groups.perm_gps.permgroup`) one can read in the documentation of the `__richcmp__` method

```The comparison extends the subgroup relation. Hence, it
is first checked whether one of the groups is subgroup of
the other. If this is not the case then the ordering is
whatever it is in Gap.
```

While for `MatrixGroup_generic` (from `sage.groups.matrix_gps.matrix_group`) one can read

```We treat two matrix groups as equal if their generators are
the same in the same order. Infinitely-generated groups are
compared by identity.
```

This is terribly confusing (not discussing the fact that this piece of information would better be in the class documentation since the `__richcmp__` is not easily reachable).

In this ticket, the matrix group comparison is changed in favor of the convention used for permutation groups. Here are some reasons

1) it follows Python convention for sets

```    sage: set([1,2]) <= set([1,2,3])
True
```

which is a relevant comparison for subgroups of a given ambient group.

2) it is trivial to write `self.gens() == other.gens()` which corresponds to the matrix version of "=="

3) the permutation version of "==" is not accessible on matrix groups (`is_isomorphic` is a different thing)

4) GAP is using this convention

Note that for most matrix groups, deciding "==" is a non-trivial task. When no algorithm is implemented a clear error message is raised.

### comment:2 Changed 2 years ago by wuthrich

Here is another annoying bug, similar to what was highlighted in #24301.

```sage: G = GL(2,5)
sage: g = G( matrix([[1,0],[0,4]]))
sage: H = G.subgroup([g])
sage: g in H
False
```

It may or may not be related to this ticket.

In any case, it makes me dream of going back to magma.

Note: See TracTickets for help on using tickets.