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

r""" 

Semirngs 

""" 

from __future__ import absolute_import 

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

# Copyright (C) 2010 Nicolas Borie <nicolas.borie@math.u-psud.fr> 

# 

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

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

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

 

from sage.categories.category_with_axiom import CategoryWithAxiom 

from .magmas_and_additive_magmas import MagmasAndAdditiveMagmas 

 

class Semirings(CategoryWithAxiom): 

""" 

The category of semirings. 

 

A semiring `(S,+,*)` is similar to a ring, but without the 

requirement that each element must have an additive inverse. In 

other words, it is a combination of a commutative additive monoid 

`(S,+)` and a multiplicative monoid `(S,*)`, where `*` distributes 

over `+`. 

 

.. SEEALSO:: 

 

:wikipedia:`Semiring` 

 

EXAMPLES:: 

 

sage: Semirings() 

Category of semirings 

sage: Semirings().super_categories() 

[Category of associative additive commutative additive associative additive unital distributive magmas and additive magmas, 

Category of monoids] 

 

sage: sorted(Semirings().axioms()) 

['AdditiveAssociative', 'AdditiveCommutative', 'AdditiveUnital', 'Associative', 'Distributive', 'Unital'] 

 

sage: Semirings() is (CommutativeAdditiveMonoids() & Monoids()).Distributive() 

True 

 

sage: Semirings().AdditiveInverse() 

Category of rings 

 

 

TESTS:: 

 

sage: TestSuite(Semirings()).run() 

""" 

_base_category_class_and_axiom = (MagmasAndAdditiveMagmas.Distributive.AdditiveAssociative.AdditiveCommutative.AdditiveUnital.Associative, "Unital")