Skip to content

Commit

Permalink
Trac #23484: Zmod(nm) → Zmod(n) is surjective but not injective
Browse files Browse the repository at this point in the history
URL: https://trac.sagemath.org/23484
Reported by: saraedum
Ticket author(s): Julian Rüth
Reviewer(s): David Ayotte
  • Loading branch information
Release Manager authored and vbraun committed Aug 5, 2017
2 parents 6b553b5 + 04f2da0 commit fb6e3fa
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/sage/rings/finite_rings/integer_mod.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4166,6 +4166,30 @@ cdef class IntegerMod_to_IntegerMod(IntegerMod_hom):
def _repr_type(self):
return "Natural"

def is_surjective(self):
r"""
Return whether this morphism is surjective.
EXAMPLES::
sage: Zmod(4).hom(Zmod(2)).is_surjective()
True
"""
return True

def is_injective(self):
r"""
Return whether this morphism is injective.
EXAMPLES::
sage: Zmod(4).hom(Zmod(2)).is_injective()
False
"""
return self.domain().order() == self.codomain().order()

cdef class Integer_to_IntegerMod(IntegerMod_hom):
r"""
Fast `\ZZ \rightarrow \ZZ/n\ZZ`
Expand Down

0 comments on commit fb6e3fa

Please sign in to comment.