82 lines
2.9 KiB
Python
82 lines
2.9 KiB
Python
|
class as_witt_form:
|
||
|
def __init__(self, fcts1, fcts2):
|
||
|
self.Vs = fcts1
|
||
|
self.dVs = fcts2
|
||
|
self.n = len(fcts1) - 1
|
||
|
self.curve = fcts1[0].curve
|
||
|
|
||
|
def __repr__(self):
|
||
|
result = ''
|
||
|
i = 0
|
||
|
for f in self.Vs:
|
||
|
if i != 0:
|
||
|
result += 'V^' + str(i) + '([' + str(f) + '] d[x]) +'
|
||
|
else:
|
||
|
result += '[' + str(f) + '] d[x] +'
|
||
|
i+=1
|
||
|
i = 1
|
||
|
for f in self.Vs:
|
||
|
result += 'dV^' + str(i) + '([' + str(f) + ']) +'
|
||
|
i+=1
|
||
|
return result
|
||
|
|
||
|
def __add__(self, other):
|
||
|
n = self.n
|
||
|
AS = self.curve
|
||
|
result = as_witt_form((n+1)*[0 * AS.x], (n+1)*[0 * AS.x])
|
||
|
flag = 1
|
||
|
for i in range(0, n+1):
|
||
|
if self.Vs[i] != 0 and other.Vs[i] != 0:
|
||
|
flag = 0
|
||
|
if flag == 1:
|
||
|
aux = [self.Vs[i] + other.Vs[i] for i in range(0, n+1)]
|
||
|
aux = as_witt_form(aux, (n+1)*[0*AS.x])
|
||
|
other1 = as_witt_form((n+1)*[0*AS.x], other.dVs)
|
||
|
return aux + other1
|
||
|
flag = 1
|
||
|
for i in range(0, n+1):
|
||
|
if self.dVs[i] != 0 and other.dVs[i] != 0:
|
||
|
flag = 0
|
||
|
if flag == 1:
|
||
|
aux = [self.dVs[i] + other.dVs[i] for i in range(0, n+1)]
|
||
|
aux = as_witt_form((n+1)*[0*AS.x], aux)
|
||
|
other1 = as_witt_form(other.Vs, (n+1)*[0*AS.x])
|
||
|
return aux + other1
|
||
|
##################
|
||
|
i = 0
|
||
|
while(self.Vs[i].function == 0 or other.Vs[i].function == 0):
|
||
|
i+=1
|
||
|
self1 = self.Vs[:i] + [0*AS.x] + self.Vs[i+1 : ]
|
||
|
self1 = as_witt_form(self1, self.dVs)
|
||
|
other1 = other.Vs[:i] + [0*AS.x] + other.Vs[i+1 : ]
|
||
|
other1 = as_witt_form(other1, other.dVs)
|
||
|
fct = self.Vs[i].teichmuller(n+1 - i) + other.Vs[i].teichmuller(n+1 - i)
|
||
|
result = self1 + other1
|
||
|
for j in range(0, n+1 - i):
|
||
|
aux = as_witt_form((n+1)*[0*AS.x], (n+1)*[0*AS.x]) ####? write Verschiebung
|
||
|
aux.Vs[i + j] = fct[j]
|
||
|
result = result + aux
|
||
|
|
||
|
#############
|
||
|
if [a.function for a in other.Vs] == (n+1)*[0] and [a.function for a in other.dVs] == (n+1)*[0]:
|
||
|
return self
|
||
|
if [a.function for a in other.Vs] != (n+1)*[0]:
|
||
|
|
||
|
f1 = self.f[i]
|
||
|
f2 = other.f[i]
|
||
|
f = f1.teichmuller(n) + f2.teichmuller(n)
|
||
|
for j in range(i, i+1):
|
||
|
result[i] += self.f[i] + other.f[i]
|
||
|
|
||
|
|
||
|
|
||
|
def verschiebung(self, i = 1):
|
||
|
AS = self.curve
|
||
|
p = AS.base_ring.characteristic()
|
||
|
n = self.n
|
||
|
if i == 1:
|
||
|
result_Vs = [0*AS.x] + self.Vs[1:]
|
||
|
result_dVs = 2*[0*AS.x] + self.Vs[2:]
|
||
|
result_dVs = [a^p for a in result_dVs]
|
||
|
return as_witt_form(result_Vs, result_dVs)
|
||
|
return self.verschiebung().verschiebung(i = i-1)
|