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

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

cimport cython 

  

@cython.binding(True) 

def frobenius_unram(self, arithmetic=True): 

""" 

Returns the image of this element under the Frobenius automorphism 

applied to its parent. 

  

INPUT: 

  

- ``self`` -- an element of an unramified extension. 

- ``arithmetic`` -- whether to apply the arithmetic Frobenius (acting 

by raising to the `p`-th power on the residue field). If ``False`` is 

provided, the image of geometric Frobenius (raising to the `(1/p)`-th 

power on the residue field) will be returned instead. 

  

EXAMPLES:: 

  

sage: R.<a> = Zq(5^4,3) 

sage: a.frobenius() 

(a^3 + a^2 + 3*a) + (3*a + 1)*5 + (2*a^3 + 2*a^2 + 2*a)*5^2 + O(5^3) 

sage: f = R.defining_polynomial() 

sage: f(a) 

O(5^3) 

sage: f(a.frobenius()) 

O(5^3) 

sage: for i in range(4): a = a.frobenius() 

sage: a 

a + O(5^3) 

  

sage: K.<a> = Qq(7^3,4) 

sage: b = (a+1)/7 

sage: c = b.frobenius(); c 

(3*a^2 + 5*a + 1)*7^-1 + (6*a^2 + 6*a + 6) + (4*a^2 + 3*a + 4)*7 + (6*a^2 + a + 6)*7^2 + O(7^3) 

sage: c.frobenius().frobenius() 

(a + 1)*7^-1 + O(7^3) 

  

An error will be raised if the parent of self is a ramified extension:: 

  

sage: K.<a> = Qp(5).extension(x^2 - 5) 

sage: a.frobenius() 

Traceback (most recent call last): 

... 

NotImplementedError: Frobenius automorphism only implemented for unramified extensions 

""" 

if self == 0: 

return self 

R = self.parent() 

p = R.prime() 

a = R.gen() 

frob_a = R._frob_gen() 

ppow = self.valuation() 

unit = self.unit_part() 

coefs = unit.expansion() 

ans = 0 

  

# Xavier's implementation based on Horner scheme 

for i in range(R.f()-1, -1, -1): 

update = 0 

for j in range(len(coefs)-1, -1, -1): 

update *= p 

try: 

update += coefs[j][i] 

except IndexError: 

pass 

ans *= frob_a 

ans += update 

return ans << ppow 

  

  

@cython.binding(True) 

def norm_unram(self, base = None): 

""" 

Return the absolute or relative norm of this element. 

  

.. WARNING:: 

  

This is not the `p`-adic absolute value. This is a 

field theoretic norm down to a ground ring. If you want the 

`p`-adic absolute value, use the ``abs()`` function instead. 

  

INPUT: 

  

``base`` -- a subfield of the parent `L` of this element. 

The norm is the relative norm from ``L`` to ``base``. 

Defaults to the absolute norm down to `\mathbb{Q}_p` or `\mathbb{Z}_p`. 

  

EXAMPLES:: 

  

sage: R = ZpCR(5,5) 

sage: S.<x> = R[] 

sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5 

sage: W.<w> = R.ext(f) 

sage: ((1+2*w)^5).norm() 

1 + 5^2 + O(5^5) 

sage: ((1+2*w)).norm()^5 

1 + 5^2 + O(5^5) 

  

TESTS:: 

  

sage: R = ZpCA(5,5) 

sage: S.<x> = ZZ[] 

sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5 

sage: W.<w> = R.ext(f) 

sage: ((1+2*w)^5).norm() 

1 + 5^2 + O(5^5) 

sage: ((1+2*w)).norm()^5 

1 + 5^2 + O(5^5) 

sage: R = ZpFM(5,5) 

sage: S.<x> = ZZ[] 

sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5 

sage: W.<w> = R.ext(f) 

sage: ((1+2*w)^5).norm() 

1 + 5^2 + O(5^5) 

sage: ((1+2*w)).norm()^5 

1 + 5^2 + O(5^5) 

  

TESTS: 

  

Check that :trac:`11586` has been resolved:: 

  

sage: R.<x> = QQ[] 

sage: f = x^2 + 3*x + 1 

sage: M.<a> = Qp(7).extension(f) 

sage: M(7).norm() 

7^2 + O(7^22) 

sage: b = 7*a + 35 

sage: b.norm() 

4*7^2 + 7^3 + O(7^22) 

sage: b*b.frobenius() 

4*7^2 + 7^3 + O(7^22) 

""" 

if base is not None: 

if base is self.parent(): 

return self 

else: 

raise NotImplementedError 

if self._is_exact_zero(): 

return self.parent().ground_ring()(0) 

elif self._is_inexact_zero(): 

return self.ground_ring(0, self.valuation()) 

if self.valuation() == 0: 

return self.parent().ground_ring()(self.matrix_mod_pn().det()) 

else: 

if self.parent().e() == 1: 

norm_of_uniformizer = self.parent().ground_ring().uniformizer_pow(self.parent().degree()) 

else: 

norm_of_uniformizer = (-1)**self.parent().degree() * self.parent().defining_polynomial()[0] 

return self.parent().ground_ring()(self.unit_part().matrix_mod_pn().det()) * norm_of_uniformizer**self.valuation() 

  

  

@cython.binding(True) 

def trace_unram(self, base = None): 

""" 

Return the absolute or relative trace of this element. 

  

If ``base`` is given then ``base`` must be a subfield of the 

parent `L` of ``self``, in which case the norm is the relative 

norm from `L` to ``base``. 

  

In all other cases, the norm is the absolute norm down to 

`\mathbb{Q}_p` or `\mathbb{Z}_p`. 

  

EXAMPLES:: 

  

sage: R = ZpCR(5,5) 

sage: S.<x> = R[] 

sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5 

sage: W.<w> = R.ext(f) 

sage: a = (2+3*w)^7 

sage: b = (6+w^3)^5 

sage: a.trace() 

3*5 + 2*5^2 + 3*5^3 + 2*5^4 + O(5^5) 

sage: a.trace() + b.trace() 

4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5) 

sage: (a+b).trace() 

4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5) 

  

TESTS:: 

  

sage: R = ZpCA(5,5) 

sage: S.<x> = ZZ[] 

sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5 

sage: W.<w> = R.ext(f) 

sage: a = (2+3*w)^7 

sage: b = (6+w^3)^5 

sage: a.trace() 

3*5 + 2*5^2 + 3*5^3 + 2*5^4 + O(5^5) 

sage: a.trace() + b.trace() 

4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5) 

sage: (a+b).trace() 

4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5) 

sage: R = ZpFM(5,5) 

sage: S.<x> = R[] 

sage: f = x^5 + 75*x^3 - 15*x^2 +125*x - 5 

sage: W.<w> = R.ext(f) 

sage: a = (2+3*w)^7 

sage: b = (6+w^3)^5 

sage: a.trace() 

3*5 + 2*5^2 + 3*5^3 + 2*5^4 + O(5^5) 

sage: a.trace() + b.trace() 

4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5) 

sage: (a+b).trace() 

4*5 + 5^2 + 5^3 + 2*5^4 + O(5^5) 

""" 

if base is not None: 

if base is self.parent(): 

return self 

else: 

raise NotImplementedError 

if self._is_exact_zero(): 

return self.parent().ground_ring()(0) 

elif self._is_inexact_zero(): 

return self.ground_ring(0, self.precision_absolute()) 

if self.valuation() >= 0: 

return self.parent().ground_ring()(self.matrix_mod_pn().trace()) 

else: 

shift = -self.valuation() 

return self.parent().ground_ring()((self * self.parent().prime() ** shift).matrix_mod_pn().trace()) / self.parent().prime()**shift