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

Commit

Permalink
Added axiom for Complete and made manifolds a category over a base ring.
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Scrimshaw committed Sep 29, 2015
1 parent 9a23df1 commit 7c54c8a
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 54 deletions.
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 @@ -1677,6 +1677,7 @@ class ``Sets.Finite``), or in a separate file (typically in a class
"Differentiable", "Smooth", "Analytic", "AlmostComplex", "Real",
"FinitelyGeneratedAsMagma",
"Facade", "Finite", "Infinite",
"Complete",
"FiniteDimensional", "Connected", "WithBasis",
"Irreducible",
"Commutative", "Associative", "Inverse", "Unital", "Division", "NoZeroDivisors",
Expand Down
128 changes: 76 additions & 52 deletions src/sage/categories/manifolds.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
from sage.misc.cachefunc import cached_method
from sage.misc.lazy_attribute import lazy_attribute
from sage.misc.lazy_import import LazyImport
from sage.categories.category import Category
from sage.categories.category_singleton import Category_singleton
from sage.categories.category_with_axiom import CategoryWithAxiom
from sage.categories.category_types import Category_over_base_ring
from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring
from sage.categories.sets_cat import Sets
from sage.categories.fields import Fields

class Manifolds(Category_singleton):
class Manifolds(Category_over_base_ring):
r"""
The category of manifolds over any field.
Expand All @@ -29,22 +28,36 @@ class Manifolds(Category_singleton):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: C = Manifolds(); C
Category of manifolds
sage: C = Manifolds(RR); C
Category of manifolds over Real Field with 53 bits of precision
sage: C.super_categories()
[Category of topological spaces]
TESTS::
sage: TestSuite(C).run()
"""
def __init__(self, base, name=None):
r"""
Initialize ``self``.
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: C = Manifolds(RR)
sage: TestSuite(C).run()
"""
if base not in Fields().Topological():
raise ValueError("base must be a topological field")
Category_over_base_ring.__init__(self, base, name)

@cached_method
def super_categories(self):
"""
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().super_categories()
sage: Manifolds(RR).super_categories()
[Category of topological spaces]
"""
return [Sets().Topological()]
Expand All @@ -62,7 +75,7 @@ def additional_structure(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().additional_structure()
sage: Manifolds(RR).additional_structure()
"""
return None

Expand All @@ -75,7 +88,7 @@ def dimension(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: M = Manifolds().example()
sage: M = Manifolds(RR).example()
sage: M.dimension()
3
"""
Expand All @@ -89,13 +102,14 @@ def Connected(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Connected()
sage: Manifolds(RR).Connected()
Category of connected manifolds
over Real Field with 53 bits of precision
TESTS::
sage: TestSuite(Manifolds().Connected()).run()
sage: Manifolds().Connected.__module__
sage: TestSuite(Manifolds(RR).Connected()).run()
sage: Manifolds(RR).Connected.__module__
'sage.categories.manifolds'
"""
return self._with_axiom('Connected')
Expand All @@ -109,15 +123,16 @@ def FiniteDimensional(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: C = Manifolds().Connected().FiniteDimensional(); C
sage: C = Manifolds(RR).Connected().FiniteDimensional(); C
Category of finite dimensional connected manifolds
over Real Field with 53 bits of precision
TESTS::
sage: from sage.categories.manifolds import Manifolds
sage: C = Manifolds().Connected().FiniteDimensional()
sage: C = Manifolds(RR).Connected().FiniteDimensional()
sage: TestSuite(C).run()
sage: Manifolds().Connected().FiniteDimensional.__module__
sage: Manifolds(RR).Connected().FiniteDimensional.__module__
'sage.categories.manifolds'
"""
return self._with_axiom('FiniteDimensional')
Expand All @@ -130,13 +145,14 @@ def Real(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Real()
sage: Manifolds(RR).Real()
Category of real manifolds
over Real Field with 53 bits of precision
TESTS::
sage: TestSuite(Manifolds().Real()).run()
sage: Manifolds().Real.__module__
sage: TestSuite(Manifolds(RR).Real()).run()
sage: Manifolds(RR).Real.__module__
'sage.categories.manifolds'
"""
return self._with_axiom('Real')
Expand All @@ -149,28 +165,29 @@ def Complex(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Complex()
sage: Manifolds(RR).Complex()
Category of complex manifolds
over Real Field with 53 bits of precision
TESTS::
sage: TestSuite(Manifolds().Complex()).run()
sage: Manifolds().Complex.__module__
sage: TestSuite(Manifolds(RR).Complex()).run()
sage: Manifolds(RR).Complex.__module__
'sage.categories.manifolds'
"""
return self._with_axiom('Complex')

class FiniteDimensional(CategoryWithAxiom):
class FiniteDimensional(CategoryWithAxiom_over_base_ring):
"""
Category of finite dimensional manifolds.
"""

class Connected(CategoryWithAxiom):
class Connected(CategoryWithAxiom_over_base_ring):
"""
The category of connected manifolds.
"""

class Real(CategoryWithAxiom):
class Real(CategoryWithAxiom_over_base_ring):
"""
The category of manifolds over `\RR`.
"""
Expand All @@ -184,7 +201,7 @@ def Complex(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Real().Complex()
sage: Manifolds(RR).Real().Complex()
Traceback (most recent call last):
...
TypeError: a real manifold is not a complex manifold
Expand All @@ -200,13 +217,14 @@ def Differentiable(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Real().Differentiable()
sage: Manifolds(RR).Real().Differentiable()
Category of differentiable real manifolds
over Real Field with 53 bits of precision
TESTS::
sage: TestSuite(Manifolds().Real().Differentiable()).run()
sage: Manifolds().Real().Differentiable.__module__
sage: TestSuite(Manifolds(RR).Real().Differentiable()).run()
sage: Manifolds(RR).Real().Differentiable.__module__
'sage.categories.manifolds'
"""
return self._with_axiom('Differentiable')
Expand All @@ -219,13 +237,14 @@ def Smooth(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Real().Smooth()
sage: Manifolds(RR).Real().Smooth()
Category of smooth real manifolds
over Real Field with 53 bits of precision
TESTS::
sage: TestSuite(Manifolds().Real().Smooth()).run()
sage: Manifolds().Real().Smooth.__module__
sage: TestSuite(Manifolds(RR).Real().Smooth()).run()
sage: Manifolds(RR).Real().Smooth.__module__
'sage.categories.manifolds'
"""
return self._with_axiom('Smooth')
Expand All @@ -238,13 +257,14 @@ def Analytic(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Real().Analytic()
sage: Manifolds(RR).Real().Analytic()
Category of analytic real manifolds
over Real Field with 53 bits of precision
TESTS::
sage: TestSuite(Manifolds().Real().Analytic()).run()
sage: Manifolds().Real().Analytic.__module__
sage: TestSuite(Manifolds(RR).Real().Analytic()).run()
sage: Manifolds(RR).Real().Analytic.__module__
'sage.categories.manifolds'
"""
return self._with_axiom('Analytic')
Expand All @@ -258,26 +278,27 @@ def AlmostComplex(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Real().AlmostComplex()
sage: Manifolds(RR).Real().AlmostComplex()
Category of almost complex real manifolds
over Real Field with 53 bits of precision
TESTS::
sage: TestSuite(Manifolds().Real().AlmostComplex()).run()
sage: Manifolds().Real().AlmostComplex.__module__
sage: TestSuite(Manifolds(RR).Real().AlmostComplex()).run()
sage: Manifolds(RR).Real().AlmostComplex.__module__
'sage.categories.manifolds'
"""
return self._with_axiom('AlmostComplex')

class Differentiable(CategoryWithAxiom):
class Differentiable(CategoryWithAxiom_over_base_ring):
"""
The category of differentiable manifolds over `\RR`.
A `d`-dimensional differentiable manifold is a manifold whose
underlying vector space is `\RR^d` and differentiable atlas.
"""

class Smooth(CategoryWithAxiom):
class Smooth(CategoryWithAxiom_over_base_ring):
"""
The category of smooth manifolds over `\RR`.
Expand All @@ -293,12 +314,13 @@ def extra_super_categories(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Real().Smooth().super_categories() # indirect doctest
[Category of differentiable real manifolds]
sage: Manifolds(RR).Real().Smooth().super_categories() # indirect doctest
[Category of differentiable real manifolds
over Real Field with 53 bits of precision]
"""
return [Manifolds().Real().Differentiable()]
return [Manifolds(self.base()).Real().Differentiable()]

class Analytic(CategoryWithAxiom):
class Analytic(CategoryWithAxiom_over_base_ring):
r"""
The category of complex manifolds.
Expand All @@ -314,12 +336,13 @@ def extra_super_categories(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Real().Analytic().super_categories() # indirect doctest
[Category of smooth real manifolds]
sage: Manifolds(RR).Real().Analytic().super_categories() # indirect doctest
[Category of smooth real manifolds
over Real Field with 53 bits of precision]
"""
return [Manifolds().Real().Smooth()]
return [Manifolds(self.base()).Real().Smooth()]

class AlmostComplex(CategoryWithAxiom):
class AlmostComplex(CategoryWithAxiom_over_base_ring):
r"""
The category of almost complex manifolds.
Expand All @@ -338,12 +361,13 @@ def extra_super_categories(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Real().Analytic().super_categories() # indirect doctest
[Category of smooth real manifolds]
sage: Manifolds(RR).Real().Analytic().super_categories() # indirect doctest
[Category of smooth real manifolds
over Real Field with 53 bits of precision]
"""
return [Manifolds().Real().Smooth()]
return [Manifolds(self.base()).Real().Smooth()]

class Complex(CategoryWithAxiom):
class Complex(CategoryWithAxiom_over_base_ring):
r"""
The category of complex manifolds.
Expand All @@ -360,7 +384,7 @@ def Real(self):
EXAMPLES::
sage: from sage.categories.manifolds import Manifolds
sage: Manifolds().Complex().Real()
sage: Manifolds(RR).Complex().Real()
Traceback (most recent call last):
...
TypeError: a complex manifold is not a real manifold
Expand Down
26 changes: 26 additions & 0 deletions src/sage/categories/metric_spaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#******************************************************************************

from sage.misc.abstract_method import abstract_method
from sage.misc.cachefunc import cached_method
from sage.categories.category import Category
from sage.categories.category_with_axiom import CategoryWithAxiom
from sage.categories.covariant_functorial_construction import RegressiveCovariantConstructionCategory
from sage.categories.with_realizations import WithRealizationsCategory

Expand Down Expand Up @@ -184,3 +186,27 @@ def dist(self, a, b):
R = self.a_realization()
return R.dist(R(a), R(b))

class SubcategoryMethods:
@cached_method
def Complete(self):
"""
Return the full subcategory of the complete objects of ``self``.
EXAMPLES::
sage: Sets().Metric().Complete()
Category of complete metric spaces
TESTS::
sage: TestSuite(Sets().Metric().Complete()).run()
sage: Sets().Metric().Complete.__module__
'sage.categories.metric_spaces'
"""
return self._with_axiom('Complete')

class Complete(CategoryWithAxiom):
"""
The category of complete metric spaces.
"""

5 changes: 3 additions & 2 deletions src/sage/categories/sets_cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1680,8 +1680,9 @@ def __invert__(self):
Facade = LazyImport('sage.categories.facade_sets', 'FacadeSets')
Finite = LazyImport('sage.categories.finite_sets', 'FiniteSets', at_startup=True)
Topological = LazyImport('sage.categories.topological_spaces',
'TopologicalSpaces', 'Topological')
Metric = LazyImport('sage.categories.metric_spaces', 'MetricSpaces', 'Mertic')
'TopologicalSpaces', 'Topological', at_startup=True)
Metric = LazyImport('sage.categories.metric_spaces', 'MetricSpaces',
'Mertic', at_startup=True)

class Infinite(CategoryWithAxiom):

Expand Down

0 comments on commit 7c54c8a

Please sign in to comment.