Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/categories/dual.py
4069 views
1
"""
2
Dual functorial construction
3
4
AUTHORS:
5
6
- Nicolas M. Thiery (2009-2010): initial revision
7
"""
8
#*****************************************************************************
9
# Copyright (C) 2009 Nicolas M. Thiery <nthiery at users.sf.net>
10
#
11
# Distributed under the terms of the GNU General Public License (GPL)
12
# http://www.gnu.org/licenses/
13
#*****************************************************************************
14
15
from category import Category
16
17
# could do SelfDualCategory
18
19
from sage.categories.category import Category
20
from sage.categories.covariant_functorial_construction import CovariantFunctorialConstruction, CovariantConstructionCategory
21
22
# This is Category.DualObjects
23
def DualObjects(self):
24
"""
25
Returns the category of duals of objects of ``self``.
26
27
INPUT:
28
29
- ``self`` -- a subcategory of vector spaces over some base ring
30
31
The dual of a vector space `V` is the space consisting of all
32
linear functionals on `V` (http://en.wikipedia.org/wiki/Dual_space).
33
Additional structure on `V` can endow its dual with additional
34
structure; e.g. if `V` is an algebra, then its dual is a
35
coalgebra.
36
37
This returns the category of dual of spaces in ``self`` endowed
38
with the appropriate additional structure.
39
40
See also
41
:class:`~sage.categories.covariant_functorial_construction.CovariantFunctorialConstruction`.
42
43
TODO: add support for graded duals.
44
45
EXAMPLES::
46
47
sage: VectorSpaces(QQ).DualObjects()
48
Category of duals of vector spaces over Rational Field
49
50
The dual of a vector space is a vector space::
51
52
sage: VectorSpaces(QQ).DualObjects().super_categories()
53
[Category of vector spaces over Rational Field]
54
55
The dual of an algebra space is a coalgebra::
56
57
sage: Algebras(QQ).DualObjects().super_categories()
58
[Category of coalgebras over Rational Field, Category of duals of vector spaces over Rational Field]
59
60
The dual of a coalgebra space is an algebra::
61
62
sage: Coalgebras(QQ).DualObjects().super_categories()
63
[Category of algebras over Rational Field, Category of duals of vector spaces over Rational Field]
64
65
As a shorthand, this category can be accessed with the
66
:meth:`dual` method::
67
68
sage: VectorSpaces(QQ).dual()
69
Category of duals of vector spaces over Rational Field
70
71
TESTS::
72
73
sage: C = VectorSpaces(QQ).DualObjects()
74
sage: C.base_category()
75
Category of vector spaces over Rational Field
76
sage: C.super_categories()
77
[Category of vector spaces over Rational Field]
78
sage: latex(C)
79
\mathbf{DualObjects}(\mathbf{VectorSpaces}_{\Bold{Q}})
80
sage: TestSuite(C).run()
81
"""
82
return DualObjectsCategory.category_of(self)
83
84
Category.DualObjects = DualObjects
85
Category.dual = DualObjects
86
87
class DualFunctor(CovariantFunctorialConstruction):
88
"""
89
A singleton class for the dual functor
90
"""
91
_functor_name = "dual"
92
_functor_category = "DualObjects"
93
symbol = "^*"
94
95
class DualObjectsCategory(CovariantConstructionCategory):
96
97
_functor_category = "DualObjects"
98
99
def _repr_object_names(self):
100
"""
101
EXAMPLES::
102
103
sage: VectorSpaces(QQ).DualObjects() # indirect doctest
104
Category of duals of vector spaces over Rational Field
105
"""
106
# Just to remove the `objects`
107
return "duals of %s"%(self.base_category()._repr_object_names())
108
109