Opened 2 months ago

Closed 2 months ago

#29017 closed defect (fixed)

Coercion map to a quotient of a polynomial ring has incorrect parent

Reported by: pbruin Owned by:
Priority: major Milestone: sage-9.1
Component: coercion Keywords: quotient ring, homset
Cc: Merged in:
Authors: Travis Scrimshaw Reviewers: Peter Bruin
Report Upstream: N/A Work issues:
Branch: f8e34e1 (Commits) Commit: f8e34e1f798daf33d7a0dafa72c381e996eff411
Dependencies: Stopgaps:

Description

In SageMath 9.1.beta0:

sage: R.<x> = ZZ[]
sage: Q = R.quo(x - 1)
sage: H = R.Hom(Q); H
Set of Homomorphisms from Univariate Polynomial Ring in x over Integer Ring to Univariate Quotient Polynomial Ring in xbar over Integer Ring with modulus x - 1
sage: h = R.hom(Q); h
Coercion map:
  From: Univariate Polynomial Ring in x over Integer Ring
  To:   Univariate Quotient Polynomial Ring in xbar over Integer Ring with modulus x - 1
sage: h.parent()
Set of Homomorphisms from Univariate Polynomial Ring in x over Integer Ring to Univariate Quotient Polynomial Ring in xbar over Integer Ring with modulus x - 1

The parent of h seems to be H at first sight. However:

sage: h in H
False
sage: h.parent() == H
False

One can convert h to an element of H, but the result is bizarre:

sage: H(h)
Composite map:
  From: Univariate Polynomial Ring in x over Integer Ring
  To:   Univariate Quotient Polynomial Ring in xbar over Integer Ring with modulus x - 1
  Defn:   Identity endomorphism of Univariate Polynomial Ring in x over Integer Ring
        then
          Coercion map:
          From: Univariate Polynomial Ring in x over Integer Ring
          To:   Univariate Quotient Polynomial Ring in xbar over Integer Ring with modulus x - 1
        then
          Identity endomorphism of Univariate Quotient Polynomial Ring in xbar over Integer Ring with modulus x - 1

Change History (5)

comment:1 Changed 2 months ago by tscrim

Another symptom is the categories of the respect homspaces not agreeing:

sage: H.category()
Category of homsets of unital magmas and additive unital additive magmas
sage: h.parent().category()
Category of homsets of unital magmas and right modules over (euclidean domains and infinite enumerated sets and metric spaces) and left modules over (euclidean domains and infinite enumerated sets and metric spaces)

This is why the homsets are not the same, but I don't know what is causing this.

comment:2 Changed 2 months ago by tscrim

So the issue comes down to the fact that the coercion map from R -> Q is in the bigger category (which is not detected by default). More specifically, it comes from this line in Q._coerce_map_from_:

parent = Hom(R, self, category=self.category()._meet_(R.category()))

which the category part is

sage: Q.category()._meet_(R.category())
Category of commutative no zero divisors algebras over (euclidean domains and infinite enumerated sets and metric spaces)

However, if we reverse it, we get

sage: R.category()._meet_(Q.category())
Category of integral domains

So something is going wrong. My guess is it comes from the parameterization of the quotient ring's category:

sage: R.category()
Join of Category of unique factorization domains and Category of commutative algebras over (euclidean domains and infinite enumerated sets and metric spaces) and Category of infinite sets
sage: Q.category()
Category of commutative no zero divisors quotients of algebras over Integer Ring

comment:3 Changed 2 months ago by tscrim

  • Authors set to Travis Scrimshaw
  • Branch set to public/categories/quotient_ring_category-29017
  • Commit set to f8e34e1f798daf33d7a0dafa72c381e996eff411
  • Status changed from new to needs_review

Yep, the problem was exactly as I was suspecting. I don't think we ever implemented anything that properly category-meets together parameterized categories. This is a bit of a hack solution rather than a proper one, but it is something we should do anyways in line with other polynomial rings.


New commits:

f8e34e1Making polynomial quotient rings category parameterization be a category.

comment:4 Changed 2 months ago by pbruin

  • Reviewers set to Peter Bruin
  • Status changed from needs_review to positive_review

Looks good. Your patch makes the category of Q more consistent with that of R, and fixes the bug. Mathematically speaking, I think it would be nice if Q were in the more specific category of Z-algebras or even R-algebras, but this should do for now.

comment:5 Changed 2 months ago by vbraun

  • Branch changed from public/categories/quotient_ring_category-29017 to f8e34e1f798daf33d7a0dafa72c381e996eff411
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.