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

r""" 

Polyhedral subsets of free ZZ, QQ or RR-modules. 

""" 

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

# Copyright (C) 2011 Volker Braun <vbraun.name@gmail.com> 

# 

# 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.categories.category_types import Category_over_base_ring 

 

class PolyhedralSets(Category_over_base_ring): 

r""" 

The category of polyhedra over a ring. 

 

EXAMPLES: 

 

We create the category of polyhedra over `\QQ`:: 

 

sage: PolyhedralSets(QQ) 

Category of polyhedral sets over Rational Field 

 

TESTS:: 

 

sage: TestSuite(PolyhedralSets(RDF)).run() 

 

sage: P = Polyhedron() 

sage: P.parent().category().element_class 

<class 'sage.categories.polyhedra.PolyhedralSets.element_class'> 

sage: P.parent().category().element_class.mro() 

[<class 'sage.categories.polyhedra.PolyhedralSets.element_class'>, 

<class 'sage.categories.magmas.Magmas.Commutative.element_class'>, 

<class 'sage.categories.magmas.Magmas.element_class'>, 

<class 'sage.categories.additive_monoids.AdditiveMonoids.element_class'>, 

<class 'sage.categories.additive_magmas.AdditiveMagmas.AdditiveUnital.element_class'>, 

<class 'sage.categories.additive_semigroups.AdditiveSemigroups.element_class'>, 

<class 'sage.categories.additive_magmas.AdditiveMagmas.element_class'>, 

<class 'sage.categories.sets_cat.Sets.element_class'>, 

<class 'sage.categories.sets_with_partial_maps.SetsWithPartialMaps.element_class'>, 

<class 'sage.categories.objects.Objects.element_class'>, 

<... 'object'>] 

sage: isinstance(P, P.parent().category().element_class) 

True 

""" 

 

def __init__(self, R): 

""" 

TESTS:: 

 

sage: PolyhedralSets(AA) 

Category of polyhedral sets over Algebraic Real Field 

""" 

Category_over_base_ring.__init__(self, R) 

 

@cached_method 

def super_categories(self): 

""" 

EXAMPLES:: 

 

sage: PolyhedralSets(QQ).super_categories() 

[Category of commutative magmas, Category of additive monoids] 

""" 

from sage.categories.magmas import Magmas 

from sage.categories.additive_monoids import AdditiveMonoids 

return [Magmas().Commutative(), AdditiveMonoids()]