Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions src/sage/topology/simplicial_complex_homset.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,32 +61,6 @@
from .simplicial_complex_morphism import SimplicialComplexMorphism


def is_SimplicialComplexHomset(x) -> bool:
"""
Return ``True`` if and only if ``x`` is a simplicial complex homspace.

EXAMPLES::

sage: S = SimplicialComplex(is_mutable=False)
sage: T = SimplicialComplex(is_mutable=False)
sage: H = Hom(S, T)
sage: H
Set of Morphisms from Simplicial complex with vertex set () and facets {()}
to Simplicial complex with vertex set () and facets {()}
in Category of finite simplicial complexes
sage: from sage.topology.simplicial_complex_homset import is_SimplicialComplexHomset
sage: is_SimplicialComplexHomset(H)
doctest:warning...
DeprecationWarning: the function is_SimplicialComplexHomset is deprecated;
use 'isinstance(..., SimplicialComplexHomset)' instead
See https://github.com/sagemath/sage/issues/37922 for details.
True
"""
from sage.misc.superseded import deprecation
deprecation(37922, "the function is_SimplicialComplexHomset is deprecated; use 'isinstance(..., SimplicialComplexHomset)' instead")
return isinstance(x, SimplicialComplexHomset)


class SimplicialComplexHomset(sage.categories.homset.Homset):
def __call__(self, f):
"""
Expand Down
39 changes: 7 additions & 32 deletions src/sage/topology/simplicial_complex_morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,36 +114,11 @@
lazy_import('sage.matrix.constructor', ['matrix', 'zero_matrix'])


def is_SimplicialComplexMorphism(x):
"""
Return ``True`` if and only if ``x`` is a morphism of simplicial complexes.

EXAMPLES::

sage: from sage.topology.simplicial_complex_morphism import is_SimplicialComplexMorphism
sage: S = SimplicialComplex([[0,1],[3,4]], is_mutable=False)
sage: H = Hom(S,S)
sage: f = {0:0,1:1,3:3,4:4}
sage: x = H(f)
sage: is_SimplicialComplexMorphism(x)
doctest:warning...
DeprecationWarning: The function is_SimplicialComplexMorphism is deprecated;
use 'isinstance(..., SimplicialComplexMorphism)' instead.
See https://github.com/sagemath/sage/issues/38103 for details.
True
"""
from sage.misc.superseded import deprecation
deprecation(38103,
"The function is_SimplicialComplexMorphism is deprecated; "
"use 'isinstance(..., SimplicialComplexMorphism)' instead.")
return isinstance(x, SimplicialComplexMorphism)


class SimplicialComplexMorphism(Morphism):
"""
An element of this class is a morphism of simplicial complexes.
"""
def __init__(self, f, X, Y):
def __init__(self, f, X, Y) -> None:
"""
Input is a dictionary ``f``, the domain ``X``, and the codomain ``Y``.

Expand Down Expand Up @@ -181,7 +156,7 @@ def __init__(self, f, X, Y):
self._vertex_dictionary = f
Morphism.__init__(self, Hom(X, Y, SimplicialComplexes()))

def __eq__(self, x):
def __eq__(self, x) -> bool:
"""
Return ``True`` if and only if ``self == x``.

Expand Down Expand Up @@ -291,7 +266,7 @@ def __call__(self, x, orientation=False):
else:
return Simplex(set(fx))

def _repr_type(self):
def _repr_type(self) -> str:
"""
EXAMPLES::

Expand All @@ -304,7 +279,7 @@ def _repr_type(self):
"""
return "Simplicial complex"

def _repr_defn(self):
def _repr_defn(self) -> str:
"""
If there are fewer than 5 vertices, print the image of each vertex
on a separate line. Otherwise, print the map as a single line.
Expand Down Expand Up @@ -502,7 +477,7 @@ def image(self):
fa = [self(i) for i in self.domain().facets()]
return SimplicialComplex(fa, maximality_check=True)

def is_surjective(self):
def is_surjective(self) -> bool:
"""
Return ``True`` if and only if ``self`` is surjective.

Expand All @@ -529,7 +504,7 @@ def is_surjective(self):
"""
return self.codomain() == self.image()

def is_injective(self):
def is_injective(self) -> bool:
"""
Return ``True`` if and only if ``self`` is injective.

Expand All @@ -550,7 +525,7 @@ def is_injective(self):
True
"""
v = [self._vertex_dictionary[i[0]] for i in self.domain().faces()[0]]
return all(v.count(i) <= 1 for i in v)
return len(v) == len(set(v))

def is_identity(self) -> bool:
"""
Expand Down
Loading