The code under the method can be accessed, with the notations / objects from the posted question, as follows:

```
G.as_permutation_group??
```

After the doc string we get the following active lines of code:

```
from sage.groups.perm_gps.permgroup import PermutationGroup
if not self.is_finite():
raise NotImplementedError("Group must be finite.")
n = self.degree()
MS = MatrixSpace(self.base_ring(), n, n)
mats = [] # initializing list of mats by which the gens act on self
for g in self.gens():
p = MS(g.matrix())
m = p.rows()
mats.append(m)
mats_str = str(gap([[list(r) for r in m] for m in mats]))
gap.eval("iso:=IsomorphismPermGroup(Group("+mats_str+"))")
if algorithm == "smaller":
gap.eval("small:= SmallerDegreePermutationRepresentation( Image( iso ) );")
C = gap("Image( small )")
else:
C = gap("Image( iso )")
return PermutationGroup(gap_group=C, canonicalize=False)
```

(There is one more indent...)

Here, the group `G`

from the example takes the role of `self`

.

So let us see how the things work in this special case, we adapt the above code...

from sage.groups.perm_gps.permgroup import PermutationGroup

```
F = GF(11)
m1 = matrix( F, [[1,2],[ 3,4]] )
m2 = matrix( F, [[1,3],[10,0]] )
G = MatrixGroup( m1, m2 )
print "Is G finite? %s" % G.is_finite()
n = G.degree()
print "Which is the degree of G? %s" % n
print "Is G.base_ring() equal to F? %s" % bool( F == G.base_ring() )
MS = MatrixSpace(F, n, n)
mats = [] # initializing list of mats by which the gens act on self
print ( "Are the generators of G exactly m1, m2 (in this order)? %s"
% bool( G.gens() == (m1, m2) ) )
for g in G.gens():
p = MS( g.matrix() )
m = p.rows()
mats.append( m )
mats_str = str( gap( [ [ list(r) for r in m ]
for m in mats ] ) )
gap.eval( "iso:=IsomorphismPermGroup(Group("+mats_str+"))" )
#if algorithm == "smaller":
# gap.eval("small:= SmallerDegreePermutationRepresentation( Image( iso ) );")
# C = gap("Image( small )")
#else:
# C = gap("Image( iso )")
C = gap( "Image( iso )" )
PG = PermutationGroup( gap_group=C, canonicalize=False )
print "mats_str is the following string:"
print mats_str
```

The results are as follows:

```
Is G finite? True
Which is the degree of G? 2
Is G.base_ring() equal to F? True
Are the generators of G exactly m1, m2 (in this order)? True
''
mats_str is the following string:
[ [ [ Z(11)^0, Z(11) ], [ Z(11)^8, Z(11)^2 ] ],
[ [ Z(11)^0, Z(11)^8 ], [ Z(11)^5, 0*Z(11) ] ] ]
```

So our group is finite. (Since it is a part of a finite matrix group, but sage can also detect / compute this.)

It is realizea as a group of $2\times 2$ matrices. (Degree is two.)

The base ring is $F$ the field with eleven elements.

Now a first point which is relevant for the question. The two given generators are taken exactly in this form, without refinament or sorting, so the matrices `m1, m2`

used explicitly in the construction of $G$ are exactly the generators of $G$.

Then the code translates the entries $1,2,3,4$ and $1,3,10,0$ into elements of the gap field representation for $F$, and still preserves accurately the order. The matrix string used in the final gap constructor is thus:

```
mats_str is the following string:
[ [ [ Z(11)^0, Z(11) ], [ Z(11)^8, Z(11)^2 ] ],
[ [ Z(11)^0, Z(11)^8 ], [ Z(11)^5, 0*Z(11) ] ] ]
```

Now we go through the gap tunnel, construct the object `C`

,

```
sage: C
Group( [ ( 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11)(12,13,15,14,16)(17,18),
( 1, 3, 5, 7, 9,11, 2, 4, 6, 8,10)(12,14,13,16,15)(17,18) ] )
```

which collects two permutations with the corresponding same orders. (Here, we cannot distinguish between them, in the given example).

For instance, the order of `m1`

is $11\cdot 5\cdot 2$,
the product of the (relatively prime) orders of the cycles involved in `C.1`

.

```
sage: m1^( 11*5*2 )
[1 0]
[0 1]
sage: m1^( 5*2 )
[6 8]
[1 7]
sage: m1^( 11*2 )
[9 0]
[0 9]
sage: m1^( 11*5 )
[10 0]
[ 0 10]
```

So the constructions seems to respect at the two points of passage the generators and their order.

I am not good on Algebra, exactly on representation theory, but In my understanding, that is always. It means all finite groups can be represented by matrix group. Perhaps, link below may be able to help you. Sorry if it does not help you. https://math.stackexchange.com/questions/85308/can-every-group-be-represented-by-a-group-of-matrices (link text)