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

r""" 

Finite Fields 

""" 

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

# 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-2009 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.categories.category_with_axiom import CategoryWithAxiom 

from sage.categories.enumerated_sets import EnumeratedSets 

 

class FiniteFields(CategoryWithAxiom): 

""" 

The category of finite fields. 

 

EXAMPLES:: 

 

sage: K = FiniteFields(); K 

Category of finite enumerated fields 

 

A finite field is a finite monoid with the structure of a field; 

it is currently assumed to be enumerated:: 

 

sage: K.super_categories() 

[Category of fields, 

Category of finite commutative rings, 

Category of finite enumerated sets] 

 

Some examples of membership testing and coercion:: 

 

sage: FiniteField(17) in K 

True 

sage: RationalField() in K 

False 

sage: K(RationalField()) 

Traceback (most recent call last): 

... 

TypeError: unable to canonically associate a finite field to Rational Field 

 

TESTS:: 

 

sage: K is Fields().Finite() 

True 

sage: TestSuite(K).run() 

""" 

 

def extra_super_categories(self): 

r""" 

Any finite field is assumed to be endowed with an enumeration. 

 

TESTS:: 

 

sage: Fields().Finite().extra_super_categories() 

[Category of finite enumerated sets] 

sage: FiniteFields().is_subcategory(FiniteEnumeratedSets()) 

True 

""" 

return [EnumeratedSets().Finite()] 

 

def __contains__(self, x): 

""" 

EXAMPLES:: 

 

sage: GF(4, "a") in FiniteFields() 

True 

sage: QQ in FiniteFields() 

False 

sage: IntegerModRing(4) in FiniteFields() 

False 

""" 

from sage.categories.fields import Fields 

return x in Fields() and x.is_finite() 

 

# As is, this does no more than the usual __call__ of Category, but for the error message 

def _call_(self, x): 

""" 

EXAMPLES:: 

 

sage: FiniteFields()(GF(4, "a")) 

Finite Field in a of size 2^2 

sage: FiniteFields()(RationalField()) # indirect doctest 

Traceback (most recent call last): 

... 

TypeError: unable to canonically associate a finite field to Rational Field 

""" 

raise TypeError("unable to canonically associate a finite field to %s"%x) 

# TODO: local dvr ring? 

 

class ParentMethods: 

pass 

 

class ElementMethods: 

pass