From 55b33e4ecbe79e0731d6f14a2f39afeb5f668689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20R=C3=BCth?= Date: Thu, 5 Oct 2017 14:48:44 +0800 Subject: [PATCH] Coercions to the fraction field are injective --- src/sage/categories/rings.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sage/categories/rings.py b/src/sage/categories/rings.py index b8a8525bea4..d10f778ff1f 100644 --- a/src/sage/categories/rings.py +++ b/src/sage/categories/rings.py @@ -128,6 +128,12 @@ def is_injective(self): sage: f.is_injective() True + A coercion to the fraction field is injective:: + + sage: R = ZpFM(3) + sage: R.fraction_field().coerce_map_from(R).is_injective() + True + """ if self.domain().is_zero(): return True @@ -155,6 +161,10 @@ def is_injective(self): if self.domain().fraction_field() in NumberFields(): return True + if self._is_coercion: + if self.domain().fraction_field() is self.codomain(): + return True + if self.domain().cardinality() > self.codomain().cardinality(): return False