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

r""" 

Complete Discrete Valuation Rings (CDVR) and Fields (CDVF) 

""" 

from __future__ import absolute_import 

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

# Copyright (C) 2013 Xavier Caruso <xavier.caruso@normalesup.org> 

# 

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

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

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

 

 

from sage.misc.abstract_method import abstract_method 

 

from sage.categories.category_singleton import Category_singleton 

from .discrete_valuation import DiscreteValuationRings, DiscreteValuationFields 

#from sage.misc.cachefunc import cached_method 

 

class CompleteDiscreteValuationRings(Category_singleton): 

""" 

The category of complete discrete valuation rings 

 

EXAMPLES:: 

 

sage: Zp(7) in CompleteDiscreteValuationRings() 

True 

sage: QQ in CompleteDiscreteValuationRings() 

False 

sage: QQ[['u']] in CompleteDiscreteValuationRings() 

True 

sage: Qp(7) in CompleteDiscreteValuationRings() 

False 

sage: TestSuite(CompleteDiscreteValuationRings()).run() 

""" 

def super_categories(self): 

""" 

EXAMPLES:: 

 

sage: CompleteDiscreteValuationRings().super_categories() 

[Category of discrete valuation rings] 

""" 

return [DiscreteValuationRings()] 

 

class ElementMethods: 

@abstract_method 

def valuation(self): 

""" 

Return the valuation of this element. 

 

EXAMPLES:: 

 

sage: R = Zp(7) 

sage: x = R(7); x 

7 + O(7^21) 

sage: x.valuation() 

1 

""" 

 

def denominator(self): 

""" 

Return the denominator of this element normalized 

as a power of the uniformizer 

 

EXAMPLES:: 

 

sage: K = Qp(7) 

sage: x = K(1/21) 

sage: x.denominator() 

7 + O(7^21) 

 

sage: x = K(7) 

sage: x.denominator() 

1 + O(7^20) 

 

Note that the denominator lives in the ring of integers:: 

 

sage: x.denominator().parent() 

7-adic Ring with capped relative precision 20 

 

An error is raised when the input is indistinguishable from 0:: 

 

sage: x = K(0,5); x 

O(7^5) 

sage: x.denominator() 

Traceback (most recent call last): 

... 

ValueError: Cannot determine the denominator of an element indistinguishable from 0 

""" 

return self.parent()(1) 

 

 

class CompleteDiscreteValuationFields(Category_singleton): 

""" 

The category of complete discrete valuation fields 

 

EXAMPLES:: 

 

sage: Zp(7) in CompleteDiscreteValuationFields() 

False 

sage: QQ in CompleteDiscreteValuationFields() 

False 

sage: LaurentSeriesRing(QQ,'u') in CompleteDiscreteValuationFields() 

True 

sage: Qp(7) in CompleteDiscreteValuationFields() 

True 

sage: TestSuite(CompleteDiscreteValuationFields()).run() 

""" 

 

def super_categories(self): 

""" 

EXAMPLES:: 

 

sage: CompleteDiscreteValuationFields().super_categories() 

[Category of discrete valuation fields] 

""" 

return [DiscreteValuationFields()] 

 

class ElementMethods: 

@abstract_method 

def valuation(self): 

""" 

Return the valuation of this element. 

 

EXAMPLES:: 

 

sage: K = Qp(7) 

sage: x = K(7); x 

7 + O(7^21) 

sage: x.valuation() 

1 

""" 

 

def denominator(self): 

""" 

Return the denominator of this element normalized 

as a power of the uniformizer 

 

EXAMPLES:: 

 

sage: K = Qp(7) 

sage: x = K(1/21) 

sage: x.denominator() 

7 + O(7^21) 

 

sage: x = K(7) 

sage: x.denominator() 

1 + O(7^20) 

 

Note that the denominator lives in the ring of integers:: 

 

sage: x.denominator().parent() 

7-adic Ring with capped relative precision 20 

 

An error is raised when the input is indistinguishable from 0:: 

 

sage: x = K(0,5); x 

O(7^5) 

sage: x.denominator() 

Traceback (most recent call last): 

... 

ValueError: Cannot determine the denominator of an element indistinguishable from 0 

""" 

if self == 0: 

raise ValueError("Cannot determine the denominator of an element indistinguishable from 0") 

val = self.valuation() 

R = self.parent().integer_ring() 

if val >= 0: 

return R(1) 

else: 

return R(1) << (-val)