Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isomorphisms of absolute fields can not be used in change_ring #28869

Closed
sagetrac-jvlangen mannequin opened this issue Dec 10, 2019 · 15 comments
Closed

Isomorphisms of absolute fields can not be used in change_ring #28869

sagetrac-jvlangen mannequin opened this issue Dec 10, 2019 · 15 comments

Comments

@sagetrac-jvlangen
Copy link
Mannequin

sagetrac-jvlangen mannequin commented Dec 10, 2019

For a polynomial f defined over a number field K, when replacing K by its absolute field L = K.absolute_field(names='b') there might be an error when changing f with the appropriate isomorphism f.change_ring(L.structure()[1]).

The problem arises from the fact that change_ring wants to check whether the isomorphism is part of K.Hom(L) by calling K.Hom(L)(L.structure()[1]) which gives an error if L.structure()[1] is not an instance of NumberFieldHomomorphism_im_gens which it not necessarily is. Here is a minimal working example

sage: K.<a> = CyclotomicField(8)
sage: L.<b> = K.absolute_field()
sage: phi = L.structure()[1]
sage: phi.parent() == K.Hom(L)
True
sage: K.Hom(L)(phi)
Traceback (most recent call last):
...
TypeError: unable to convert Isomorphism given by variable name change map:
  From: Cyclotomic Field of order 8 and degree 4
  To:   Number Field in b with defining polynomial x^4 + 1 to an element of Number Field in b with defining polynomial x^4 + 1

The error seems a consequence of a call to K.Hom(L) interpreting the argument as an element of the codomain if it is not an instance of NumberFieldHomomorphism_im_gens.

Here is the example failing on change_ring where the error message is even less insightful

sage: K.<a> = CyclotomicField(8)
sage: L.<b> = K.absolute_field()
sage: R.<x> = K[]
sage: f = x^2 + a
sage: f.change_ring(L.structure()[1])
Traceback (most recent call last):
...
TypeError: 

Depends on #29008
Depends on #29010

Component: number fields

Keywords: absolute field

Author: Peter Bruin

Branch/Commit: 5939e98

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/28869

@sagetrac-jvlangen sagetrac-jvlangen mannequin added this to the sage-9.0 milestone Dec 10, 2019
@embray
Copy link
Contributor

embray commented Jan 6, 2020

comment:1

Ticket retargeted after milestone closed

@embray embray modified the milestones: sage-9.0, sage-9.1 Jan 6, 2020
@pjbruin
Copy link
Contributor

pjbruin commented Jan 14, 2020

comment:2

One way to solve this is by moving ring homsets to the new coercion model; among other things, when doing R.Hom(S)(f), this will check if f already has R.Hom(S) as its parent without checking the exact type. I am working on this.

@pjbruin
Copy link
Contributor

pjbruin commented Jan 14, 2020

Dependencies: #29008

@pjbruin
Copy link
Contributor

pjbruin commented Jan 14, 2020

Changed dependencies from #29008 to #29008, #29010

@pjbruin
Copy link
Contributor

pjbruin commented Jan 14, 2020

@pjbruin
Copy link
Contributor

pjbruin commented Jan 14, 2020

Author: Peter Bruin

@pjbruin
Copy link
Contributor

pjbruin commented Jan 14, 2020

Commit: 4470ebf

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 17, 2020

Changed commit from 4470ebf to 8c010d7

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 17, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

8c010d7Trac 28869: add more doctests

@pjbruin
Copy link
Contributor

pjbruin commented Jan 17, 2020

comment:7

The last commit modifies/adds doctests to cover all NumberFieldHomset classes (absolute fields, relative fields and cyclotomic fields).

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 17, 2020

Changed commit from 8c010d7 to 5939e98

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 17, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

5939e98Trac 28869: make _element_constructor_() always return an instance of element_class

@tscrim
Copy link
Collaborator

tscrim commented Jan 29, 2020

comment:9

LGTM.

@tscrim
Copy link
Collaborator

tscrim commented Jan 29, 2020

Reviewer: Travis Scrimshaw

@vbraun
Copy link
Member

vbraun commented Jan 31, 2020

Changed branch from u/pbruin/28869-NumberFieldHomset_coercion to 5939e98

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants