Opened 12 months ago

# Improve coercion in residue fields of relative number fields

Reported by: Owned by: Maarten Derickx major sage-9.8 number fields Samuel Lelièvre N/A

Residue fields of relative number fields don't always work nicely with the coercion framework.

For instance, in Sage 9.4, we get this index error:

```sage: x = polygen(ZZ)
sage: f = x^2 - x + 1007
sage: K.<a> = QQ.extension(f)
sage: L.<b> = K.extension(x^2 - 11)
sage: q = L.prime_above(11)
sage: Fq = q.residue_field()
sage: R.<x1> = Fq[]
sage: Fq.0 * x1
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
.../local/lib/python3.9/site-packages/sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:10474)()
1188         try:
-> 1189             action = self._action_maps.get(xp, yp, op)
1190         except KeyError:

...

.../local/lib/python3.9/site-packages/sage/structure/category_object.pyx in sage.structure.category_object.normalize_names (build/cythonized/sage/structure/category_object.c:8361)()
1018     certify_names(names)
1019     if ngens >= 0 and len(names) != ngens:
-> 1020        raise IndexError("the number of names must equal the number of generators")
1021     return tuple(names)
1022

IndexError: the number of names must equal the number of generators
```

This prevents computing the reduction of an elliptic curve over a relative number field:

```sage: x = polygen(ZZ)
sage: f = x^2 - x + 1007
sage: K.<a> = QQ.extension(f)
sage: L.<b> = K.extension(x^2 - 11)
sage: q = L.prime_above(11)
sage: Fq = q.residue_field()
sage: E = EllipticCurve(L, [0, 11^3])
sage: E.reduction(q)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
.../local/lib/python3.9/site-packages/sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:10474)()
1188         try:
-> 1189             action = self._action_maps.get(xp, yp, op)
1190         except KeyError:

...

.../local/lib/python3.9/site-packages/sage/structure/category_object.pyx in sage.structure.category_object.normalize_names (build/cythonized/sage/structure/category_object.c:8361)()
1018     certify_names(names)
1019     if ngens >= 0 and len(names) != ngens:
-> 1020        raise IndexError("the number of names must equal the number of generators")
1021     return tuple(names)
1022

IndexError: the number of names must equal the number of generators
```

### comment:1 Changed 12 months ago by Maarten Derickx

Component: elliptic curves → algebra modified (diff) Reduction method of Elliptic curve over relative numberfield sometimes fails → Residue fields of relative numberfield sometimes don't work nicely with the coercion framework

### comment:2 Changed 12 months ago by Samuel Lelièvre

Cc: Samuel Lelièvre added algebra → number fields modified (diff) Residue fields of relative numberfield sometimes don't work nicely with the coercion framework → Improve coercion in residue fields of relative number fields

### comment:3 Changed 12 months ago by Matthias Köppe

Milestone: sage-9.5 → sage-9.6

### comment:4 Changed 10 months ago by Julian Rüth

The first example works, when writing `x1 * Fq.0` and also if you do `R(Fq.0) * x1`.

### comment:5 Changed 10 months ago by Julian Rüth

The underlying problem seems to be that `Fq.construction()` is an "AlgebraicExtensionFunctor?".

There's a hack in pushout.py that makes that functor do something completely different in the context of residue fields. However, here, a generic pushout is tried and that then fails.

### comment:6 Changed 7 months ago by Matthias Köppe

Milestone: sage-9.6 → sage-9.7

### comment:7 Changed 3 months ago by Matthias Köppe

Milestone: sage-9.7 → sage-9.8
Note: See TracTickets for help on using tickets.