Opened 4 years ago

Closed 2 years ago

#18606 closed defect (fixed)

p-adic extensions created with "the same" polynomials may not be the same

Reported by: mmasdeu Owned by:
Priority: major Milestone: sage-8.1
Component: padics Keywords: padics, extensions, hash, sd87
Cc: roed, cremona Merged in:
Authors: David Roe Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: c1cfe4a (Commits) Commit: c1cfe4a898ea67805a1e21e2bf5c9752ea80330b
Dependencies: Stopgaps:


The follow snippet of code shows the bug:

sage: x = QQ['x'].gen()
sage: F = Qp(5,20)
sage: K = F.extension(x^2-F(13),names = 'g')
sage: R = MatrixSpace(K,1,1)
sage: K1 = F.extension(x^2-13,names = 'g')
sage: Matrix(K1,1,1,[K1(0)])

You would expect the last line to never fail, but it does in this case, and the exception raised is not informative:

NotImplementedError: Conversion from different p-adic extensions not yet supported

The reason is the following:

sage: K is K1
sage: hash(K) == hash(K1)

Since MatrixSpace? has unique representation, the second time that it is called it returns the space over K, not over K1 (this uses the hash of the key values). In the same initialization, it refuses to see K1(0) as an element of K, and the exception is raised.

I think that what should be done to avoid this problem is to convert the defining polynomial of the extension to a polynomial over the base when sanitising the keys.

Change History (5)

comment:1 Changed 2 years ago by roed

  • Keywords sd87 added

Also see #23331

comment:2 Changed 2 years ago by roed

  • Branch set to u/roed/same_poly

comment:3 Changed 2 years ago by roed

  • Authors set to David Roe
  • Commit set to c1cfe4a898ea67805a1e21e2bf5c9752ea80330b
  • Status changed from new to needs_review

New commits:

c1cfe4aAdd doctest to show 18606 resolved

comment:4 Changed 2 years ago by chapoton

  • Milestone changed from sage-6.8 to sage-8.1
  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review


comment:5 Changed 2 years ago by vbraun

  • Branch changed from u/roed/same_poly to c1cfe4a898ea67805a1e21e2bf5c9752ea80330b
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.