# Subextension over non-prime subfield as a quotient

Hi!

I am looking for a light and easy way to build the following objects:

- a finite (possibly non prime) field
`Fq`

; - an irreducible polynomial
`p`

in`Fq[X]`

; - and a finite extension
`L`

of`Fq`

which contains`L0 = Fq[X]/p`

as a subfield.

Crucially, I want to be able to manipulate the generator `z = L0(X)`

(i.e. the
image of `X`

in `L0`

) as an element of `L`

. I also need to view these extensions
as extension over `Fq`

(e.g. using `.over(Fq)`

) and *not* the prime subfield
(in particular, I do *not* want to see `L`

as an extension of `L0`

).

Let me know if this is not clear and you need more explanations.

For this, I can define my extensions as follows:

```
sage: Fq = GF(7^2)
sage: FqX.<X> = Fq[]
sage: p = FqX.irreducible_element(3)
sage: L0 = Fq.extension(modulus=p).over(Fq); L0
Univariate Quotient Polynomial Ring in X over Finite Field in z2 of size 7^2 with modulus X^3 + z2*X + z2 + 3 over its base
sage: L = Fq.extension(modulus=FqX.irreducible_element(6)).over(Fq); L
Univariate Quotient Polynomial Ring in X over Finite Field in z2 of size 7^2 with modulus X^6 + (6*z2 + 4)*X + 4*z2 + 6 over its base
```

Now I can define `z = L0(X)`

:

```
sage: z = L0(X)
sage: assert z == L0.gen()
sage:
```

But I can't manage to see `z`

as an element of `L`

. In the following snippet,
it seems that casting `z`

as an element of `L`

converts it to a generator of
`L`

:

```
sage: zL = L(z)
sage: zL == L.gen()
True
```

I tried other ways to create the extensions. Sometimes coercion is a problem. Sometimes some methods are available on a method but not the other. Does anybody has any idea?

Welcome to Ask Sage! Thank you for your question.

You can map

`z`

in`L0`

to one of`z.minpoly().change_ring(L).roots(multiplicities=False)`

in`L`

. Unfortunately defining a homomorphism via`L0.hom`

seems to be broken for a relative extension`L0`

.