Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'public/categories/topological_metric_spaces-18175' of t…
Browse files Browse the repository at this point in the history
…rac.sagemath.org:sage into public/categories/topological_metric_spaces-18175

Conflicts:
	src/sage/categories/groups.py
  • Loading branch information
Travis Scrimshaw committed May 29, 2015
2 parents 0ce29a1 + fcc3273 commit 5796cbd
Show file tree
Hide file tree
Showing 15 changed files with 959 additions and 64 deletions.
3 changes: 2 additions & 1 deletion src/sage/categories/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

from category_types import(
Elements,
SimplicialComplexes,
ChainComplexes,
)

from sage.categories.simplicial_complexes import SimplicialComplexes

from tensor import tensor
from cartesian_product import cartesian_product

Expand Down
29 changes: 1 addition & 28 deletions src/sage/categories/category_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,34 +513,7 @@ def __call__(self, v):
return v
return self.ring().ideal(v)

#############################################################
# TODO: make those two into real categories (with super_category, ...)

# SimplicialComplex
#############################################################
class SimplicialComplexes(Category):
"""
The category of simplicial complexes.
EXAMPLES::
sage: SimplicialComplexes()
Category of simplicial complexes
TESTS::
sage: TestSuite(SimplicialComplexes()).run()
"""

def super_categories(self):
"""
EXAMPLES::
sage: SimplicialComplexes().super_categories()
[Category of objects]
"""
return [Objects()] # anything better?

# TODO: make this into a better category
#############################################################
# ChainComplex
#############################################################
Expand Down
1 change: 1 addition & 0 deletions src/sage/categories/category_with_axiom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1673,6 +1673,7 @@ class ``Sets.Finite``), or in a separate file (typically in a class

all_axioms = AxiomContainer()
all_axioms += ("Flying", "Blue",
"Compact", "Complex", "Differentiable", "Smooth",
"FinitelyGeneratedAsMagma",
"Facade", "Finite", "Infinite",
"FiniteDimensional", "Connected", "WithBasis",
Expand Down
162 changes: 162 additions & 0 deletions src/sage/categories/cw_complexes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
r"""
CW Complexes
"""
#*****************************************************************************
# Copyright (C) 2015 Travis Scrimshaw <tscrim at ucdavis.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#******************************************************************************

from sage.misc.abstract_method import abstract_method
from sage.misc.cachefunc import cached_method
from sage.categories.category_singleton import Category_singleton
from sage.categories.category_with_axiom import CategoryWithAxiom
from sage.categories.sets_cat import Sets

class CWComplexes(Category_singleton):
r"""
The category of CW complexes.
A CW complex is a Closure-finite cell complex in the Weak toplogy.
REFERENCES:
- :wikipedia:`CW_complex`
EXAMPLES::
sage: from sage.categories.cw_complexes import CWComplexes
sage: C = CWComplexes(); C
Category of CW complexes
TESTS::
sage: TestSuite(C).run()
"""
@cached_method
def super_categories(self):
"""
EXAMPLES::
sage: from sage.categories.cw_complexes import CWComplexes
sage: CWComplexes().super_categories()
[Category of topological spaces]
"""
return [Sets().Topological()]

def _repr_object_names(self):
"""
EXAMPLES::
sage: from sage.categories.cw_complexes import CWComplexes
sage: CWComplexes()
Category of CW complexes
"""
return "CW complexes"

class SubcategoryMethods:
@cached_method
def Connected(self):
"""
Return the full subcategory of the connected objects of ``self``.
EXAMPLES::
sage: from sage.categories.cw_complexes import CWComplexes
sage: CWComplexes().Connected()
Category of connected CW complexes
TESTS::
sage: TestSuite(CWComplexes().Connected()).run()
sage: CWComplexes().Connected.__module__
'sage.categories.cw_complexes'
"""
return self._with_axiom('Connected')

@cached_method
def FiniteDimensional(self):
"""
Return the full subcategory of the finite dimensional
objects of ``self``.
EXAMPLES::
sage: from sage.categories.cw_complexes import CWComplexes
sage: C = CWComplexes().FiniteDimensional(); C
Category of finite dimensional CW complexes
TESTS::
sage: from sage.categories.cw_complexes import CWComplexes
sage: C = CWComplexes().FiniteDimensional()
sage: TestSuite(C).run()
sage: CWComplexes().Connected().FiniteDimensional.__module__
'sage.categories.cw_complexes'
"""
return self._with_axiom('FiniteDimensional')

class Connected(CategoryWithAxiom):
"""
The category of connected CW complexes.
"""

class FiniteDimensional(CategoryWithAxiom):
"""
Category of finite dimensional CW complexes.
"""

class Finite(CategoryWithAxiom):
"""
Category of finite CW complexes.
"""
def extra_super_categories(self):
"""
Return the extra super categories of ``self``.
A finite CW complex is a compact finite-dimensional CW complex.
"""
return [CWComplexes().FiniteDimensional(), Sets().Topological().Compact()]

class ParentMethods:
@cached_method
def dimension(self):
"""
Return the dimension of ``self``.
"""
return max(c.dimension() for c in self.cells())

def Compact_extra_super_categories(self):
"""
Return extraneous super categories for ``CWComplexes().Compact()``.
A compact CW complex is finite, see Proposition A.1 in [Hat]_.
.. TODO::
Fix the name of finite CW complexes.
EXAMPLES::
sage: from sage.categories.cw_complexes import CWComplexes
sage: CWComplexes().Compact()
Category of finite finite dimensional CW complexes
sage: CWComplexes().Compact() is CWComplexes().Finite()
True
"""
return (Sets().Finite(),)

class ParentMethods:
@abstract_method
def dimension(self):
"""
Return the dimension of ``self``.
"""

@abstract_method(optional=True)
def cells(self):
"""
Return the cells of ``self``.
"""

61 changes: 61 additions & 0 deletions src/sage/categories/graphs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"""
Graphs
"""
#*****************************************************************************
# Copyright (C) 2015 Travis Scrimshaw <tscrim at ucdavis.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#******************************************************************************

#from sage.misc.abstract_method import abstract_method
from sage.misc.cachefunc import cached_method
from sage.categories.category_singleton import Category_singleton
from sage.categories.simplicial_complexes import SimplicialComplexes

class Graphs(Category_singleton):
r"""
The category of graphs.
EXAMPLES::
sage: from sage.categories.graphs import Graphs
sage: C = Graphs(); C
Category of graphs
TESTS::
sage: TestSuite(C).run()
"""
@cached_method
def super_categories(self):
"""
EXAMPLES::
sage: from sage.categories.graphs import Graphs
sage: Graphs().super_categories()
[Category of simplicial complexes]
"""
return [SimplicialComplexes()]

class ParentMethods:
def dimension(self):
"""
Return the dimension of ``self`` as a CW complex.
"""
if self.edges():
return 1
return 0

def facets(self):
"""
Return the facets of ``self``.
"""
return self.edges()

def faces(self):
"""
Return the faces of ``self``.
"""
return set(self.edges()).union(self.vertices())

14 changes: 14 additions & 0 deletions src/sage/categories/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from sage.categories.algebra_functor import AlgebrasCategory
from sage.categories.cartesian_product import CartesianProductsCategory, cartesian_product
from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
from sage.categories.topological_spaces import TopologicalSpacesCategory

class Groups(CategoryWithAxiom):
"""
Expand Down Expand Up @@ -480,6 +481,7 @@ def conjugacy_class(self):
return self.parent().conjugacy_class(self)

Finite = LazyImport('sage.categories.finite_groups', 'FiniteGroups')
Lie = LazyImport('sage.categories.lie_groups', 'LieGroups', 'Lie')
#Algebras = LazyImport('sage.categories.group_algebras', 'GroupAlgebras')

class Commutative(CategoryWithAxiom):
Expand Down Expand Up @@ -942,3 +944,15 @@ def order(self):
"""
from sage.misc.misc_c import prod
return prod(c.cardinality() for c in self.cartesian_factors())

class Topological(TopologicalSpacesCategory):
"""
Category of topological groups.
A topological group `G` is a group which has a topology such that
multiplication and taking inverses are continuous functions.
REFERENCES:
- :wikipedia:`Topological_group`
"""
71 changes: 71 additions & 0 deletions src/sage/categories/lie_groups.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
r"""
Lie Groups
"""
#*****************************************************************************
# Copyright (C) 2015 Travis Scrimshaw <tscrim at ucdavis.edu>
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#******************************************************************************

#from sage.misc.abstract_method import abstract_method
from sage.misc.cachefunc import cached_method
from sage.categories.category_singleton import Category_singleton
from sage.categories.groups import Groups
from sage.categories.manifolds import Manifolds

class LieGroups(Category_singleton):
r"""
The category of Lie groups.
A Lie group is a topological group with a smooth manifold structure.
EXAMPLES::
sage: from sage.categories.lie_groups import LieGroups
sage: C = LieGroups(); C
Category of Lie groups
TESTS::
sage: TestSuite(C).run()
"""
@cached_method
def super_categories(self):
"""
EXAMPLES::
sage: from sage.categories.lie_groups import LieGroups
sage: LieGroups().super_categories()
[Category of topological groups, Category of smooth manifolds]
"""
return [Groups().Topological(), Manifolds().Smooth()]

def additional_structure(self):
r"""
Return ``None``.
Indeed, the category of Lie groups defines no new
structure: a morphism of topological spaces and of smooth
manifolds is a morphism as Lie groups.
.. SEEALSO:: :meth:`Category.additional_structure`
EXAMPLES::
sage: from sage.categories.lie_groups import LieGroups
sage: LieGroups().additional_structure()
"""
return None

# Because Lie is a name that deserves to be capitalized
def _repr_object_names(self):
"""
EXAMPLES::
sage: from sage.categories.lie_groups import LieGroups
sage: LieGroups() # indirect doctest
Category of Lie groups
"""
return "Lie groups"

Loading

0 comments on commit 5796cbd

Please sign in to comment.