2024-01-13 17:11:29 +01:00
|
|
|
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
|
2024-01-13 21:18:03 +01:00
|
|
|
if self.dVs[0].function!=0:
|
|
|
|
raise ValueError('First dV should be zero!')
|
|
|
|
if len(fcts1) != len(fcts2):
|
|
|
|
raise ValueError('Both lists should be of the same length!')
|
2024-01-13 17:11:29 +01:00
|
|
|
|
|
|
|
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
|
2024-01-13 21:18:03 +01:00
|
|
|
for f in self.dVs[1:]:
|
2024-01-13 17:11:29 +01:00
|
|
|
result += 'dV^' + str(i) + '([' + str(f) + ']) +'
|
|
|
|
i+=1
|
|
|
|
return result
|
|
|
|
|
|
|
|
def __add__(self, other):
|
2024-01-22 10:24:12 +01:00
|
|
|
#print(self, other)
|
2024-01-13 17:11:29 +01:00
|
|
|
n = self.n
|
|
|
|
AS = self.curve
|
2024-01-13 21:18:03 +01:00
|
|
|
########
|
2024-01-13 17:11:29 +01:00
|
|
|
i = 0
|
2024-01-13 21:18:03 +01:00
|
|
|
while(i <= n and self.Vs[i].function == 0 and other.Vs[i].function == 0):
|
2024-01-13 17:11:29 +01:00
|
|
|
i+=1
|
2024-01-13 21:18:03 +01:00
|
|
|
if i<=n:
|
2024-01-22 10:24:12 +01:00
|
|
|
#print('a')
|
2024-01-13 21:18:03 +01:00
|
|
|
if (i <= n and self.Vs[i].function != 0 and other.Vs[i].function != 0):
|
|
|
|
self1 = self.cutVs(i)
|
|
|
|
other1 = other.cutVs(i)
|
|
|
|
result = self1 + other1
|
|
|
|
self_first = self.Vs[i].teichmuller(n)
|
|
|
|
other_first = other.Vs[i].teichmuller(n)
|
|
|
|
aux = self_first + other_first
|
|
|
|
for j in range(0, n+1 - i):
|
2024-01-22 10:24:12 +01:00
|
|
|
#print(i, j)
|
2024-01-13 21:18:03 +01:00
|
|
|
result += aux.f[j].Vd(n, i+j)
|
|
|
|
return result
|
|
|
|
if (i <= n and self.Vs[i].function != 0 and other.Vs[i].function == 0):
|
|
|
|
self1 = self.cutVs(i)
|
|
|
|
other1 = other.cutVs(i)
|
|
|
|
result = self1 + other1
|
|
|
|
result.Vs[i] = self.Vs[i]
|
|
|
|
return result
|
|
|
|
if (i <= n and self.Vs[i].function == 0 and other.Vs[i].function != 0):
|
|
|
|
self1 = self.cutVs(i)
|
|
|
|
other1 = other.cutVs(i)
|
|
|
|
result = self1 + other1
|
|
|
|
result.Vs[i] = other.Vs[i]
|
|
|
|
return result
|
|
|
|
########
|
|
|
|
i = 0
|
|
|
|
while(i <= n and self.dVs[i].function == 0 and other.dVs[i].function == 0):
|
|
|
|
i+=1
|
|
|
|
if i<=n:
|
2024-01-22 10:24:12 +01:00
|
|
|
#print('b', i)
|
2024-01-13 21:18:03 +01:00
|
|
|
if (i <= n and self.dVs[i].function != 0 and other.dVs[i].function != 0):
|
|
|
|
self1 = self.cutdVs(i)
|
|
|
|
other1 = other.cutdVs(i)
|
|
|
|
result = self1 + other1
|
|
|
|
self_first = self.dVs[i].teichmuller(n)
|
|
|
|
other_first = other.dVs[i].teichmuller(n)
|
|
|
|
aux = self_first + other_first
|
|
|
|
for j in range(0, n+1 - i):
|
|
|
|
result += aux.f[j].dV(n, i+j)
|
|
|
|
return result
|
|
|
|
if (i <= n and self.dVs[i].function != 0 and other.dVs[i].function == 0):
|
|
|
|
self1 = self.cutdVs(i)
|
|
|
|
other1 = other.cutdVs(i)
|
|
|
|
result = self1 + other1
|
|
|
|
result.dVs[i] = self.dVs[i]
|
|
|
|
return result
|
|
|
|
if (i <= n and self.dVs[i].function == 0 and other.dVs[i].function != 0):
|
|
|
|
self1 = self.cutdVs(i)
|
|
|
|
other1 = other.cutdVs(i)
|
|
|
|
result = self1 + other1
|
|
|
|
result.dVs[i] = other.dVs[i]
|
|
|
|
return result
|
|
|
|
return (0*AS.x).Vd(n)
|
|
|
|
|
2024-01-22 10:24:12 +01:00
|
|
|
def __rmul__(self, other):
|
|
|
|
n = self.n
|
|
|
|
AS = self.curve
|
|
|
|
|
|
|
|
if parent(other) == ZZ or isinstance(other, int):
|
|
|
|
if other == 0:
|
|
|
|
return as_witt_form((n+1)*[0*AS.x], (n+1)*[0*AS.x])
|
|
|
|
if other < 0:
|
|
|
|
return -(-other)*self
|
|
|
|
return self + (other - 1)*self
|
|
|
|
|
|
|
|
if isinstance(other, as_witt):
|
|
|
|
result = as_witt_form((n+1)*[0*AS.x], (n+1)*[0*AS.x])
|
|
|
|
for i in range(0, n+1):
|
|
|
|
for j in range(0, n+1):
|
|
|
|
result += auxilliary_multiplication(other.f[i], i, self.Vs[j], j, n)
|
|
|
|
result += auxilliary_multiplication(other.f[i], i, self.dVs[j], j, n)
|
|
|
|
return result
|
|
|
|
|
2024-01-13 17:11:29 +01:00
|
|
|
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)
|
2024-01-13 21:18:03 +01:00
|
|
|
return self.verschiebung().verschiebung(i = i-1)
|
|
|
|
|
|
|
|
def cutVs(self, i):
|
|
|
|
n = self.n
|
|
|
|
AS = self.curve
|
|
|
|
result_Vs = self.Vs[:i] + (n+1 - i)*[0*AS.x]
|
|
|
|
return as_witt_form(result_Vs, self.dVs)
|
|
|
|
|
|
|
|
def cutdVs(self, i):
|
|
|
|
n = self.n
|
|
|
|
AS = self.curve
|
|
|
|
result_dVs = self.dVs[:i] + (n+1 - i)*[0*AS.x]
|
|
|
|
return as_witt_form(self.Vs, result_dVs)
|