Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

r""" 

Objects 

""" 

#***************************************************************************** 

# Copyright (C) 2005 David Kohel <kohel@maths.usyd.edu> 

# William Stein <wstein@math.ucsd.edu> 

# 2008 Teresa Gomez-Diaz (CNRS) <Teresa.Gomez-Diaz@univ-mlv.fr> 

# 2008-2013 Nicolas M. Thiery <nthiery at users.sf.net> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# http://www.gnu.org/licenses/ 

#****************************************************************************** 

 

from sage.misc.cachefunc import cached_method 

from sage.misc.superseded import deprecated_function_alias 

from sage.categories.category_singleton import Category_singleton 

from sage.categories.homsets import HomsetsCategory 

 

############################################################# 

# Generic category (default when requesting category of 

# an object using misc.functional.category 

############################################################# 

 

class Objects(Category_singleton): 

""" 

The category of all objects 

the basic category 

 

EXAMPLES:: 

 

sage: Objects() 

Category of objects 

sage: Objects().super_categories() 

[] 

 

TESTS:: 

 

sage: TestSuite(Objects()).run() 

""" 

 

def additional_structure(self): 

""" 

Return ``None`` 

 

Indeed, by convention, the category of objects defines no 

additional structure. 

 

.. SEEALSO:: :meth:`Category.additional_structure` 

 

EXAMPLES:: 

 

sage: Objects().additional_structure() 

""" 

return None 

 

def super_categories(self): 

""" 

EXAMPLES:: 

 

sage: Objects().super_categories() 

[] 

""" 

return [] 

 

def __contains__(self, x): 

""" 

Anything is in the category of objects. 

 

EXAMPLES:: 

 

sage: int(1) in Objects() 

True 

sage: ZZ in Objects() 

True 

sage: 2/3 in Objects() 

True 

""" 

return True 

 

class SubcategoryMethods: 

@cached_method 

def Homsets(self): 

r""" 

Return the category of homsets between objects of this category. 

 

EXAMPLES:: 

 

sage: Sets().Homsets() 

Category of homsets of sets 

 

sage: Rings().Homsets() 

Category of homsets of unital magmas and additive unital additive magmas 

 

This used to be called ``hom_category``:: 

 

sage: Sets().hom_category() 

doctest:...: DeprecationWarning: hom_category is deprecated. Please use Homsets instead. 

See http://trac.sagemath.org/10668 for details. 

Category of homsets of sets 

 

.. NOTE:: Background 

 

Information, code, documentation, and tests about the 

category of homsets of a category ``Cs`` should go in 

the nested class ``Cs.Homsets``. They will then be 

made available to homsets of any subcategory of 

``Cs``. 

 

Assume, for example, that homsets of ``Cs`` are ``Cs`` 

themselves. This information can be implemented in the 

method ``Cs.Homsets.extra_super_categories`` to make 

``Cs.Homsets()`` a subcategory of ``Cs()``. 

 

Methods about the homsets themselves should go in the 

nested class ``Cs.Homsets.ParentMethods``. 

 

Methods about the morphisms can go in the nested class 

``Cs.Homsets.ElementMethods``. However it's generally 

preferable to put them in the nested class 

``Cs.MorphimMethods``; indeed they will then apply to 

morphisms of all subcategories of ``Cs``, and not only 

full subcategories. 

 

 

.. SEEALSO:: 

 

:class:`~.covariant_functorial_construction.FunctorialConstruction` 

 

.. TODO:: 

 

- Design a mechanism to specify that an axiom is 

compatible with taking subsets. Examples: 

``Finite``, ``Associative``, ``Commutative`` (when 

meaningful), but not ``Infinite`` nor ``Unital``. 

 

- Design a mechanism to specify that, when `B` is a 

subcategory of `A`, a `B`-homset is a subset of the 

corresponding `A` homset. And use it to recover all 

the relevant axioms from homsets in super categories. 

 

- For instances of redundant code due to this missing 

feature, see: 

 

- :meth:`AdditiveMonoids.Homsets.extra_super_categories` 

- :meth:`HomsetsCategory.extra_super_categories` 

(slightly different nature) 

- plus plenty of spots where this is not implemented. 

""" 

return HomsetsCategory.category_of(self) 

 

hom_category = deprecated_function_alias(10668, Homsets) 

 

@cached_method 

def Endsets(self): 

r""" 

Return the category of endsets between objects of this category. 

 

EXAMPLES:: 

 

sage: Sets().Endsets() 

Category of endsets of sets 

 

sage: Rings().Endsets() 

Category of endsets of unital magmas and additive unital additive magmas 

 

.. SEEALSO:: 

 

- :meth:`Homsets` 

""" 

return self.Homsets()._with_axiom("Endset") 

 

class ParentMethods: 

""" 

Methods for all category objects 

"""