2022-12-22 14:44:57 +01:00
|
|
|
def as_reduction(AS, fct):
|
|
|
|
'''Simplify rational function fct as a function in the function field of AS, so that z[i] appear in powers <p and only in numerator'''
|
|
|
|
n = AS.height
|
|
|
|
F = AS.base_ring
|
|
|
|
RxyzQ, Rxyz, x, y, z = AS.fct_field
|
2024-01-22 10:24:12 +01:00
|
|
|
p = F.characteristic()
|
2022-12-22 14:44:57 +01:00
|
|
|
ff = AS.functions
|
|
|
|
ff = [RxyzQ(F.function) for F in ff]
|
|
|
|
fct = RxyzQ(fct)
|
|
|
|
fct1 = numerator(fct)
|
|
|
|
fct2 = denominator(fct)
|
|
|
|
denom = as_function(AS, fct2)
|
2024-06-11 19:48:37 +02:00
|
|
|
denom_norm = prod(as_function(AS, fct2).group_action(g) for g in AS.group.elts if g != AS.group.one)
|
2022-12-22 14:44:57 +01:00
|
|
|
fct1 = Rxyz(fct1*denom_norm.function)
|
|
|
|
fct2 = Rxyz(fct2*denom_norm.function)
|
2024-06-13 13:11:28 +02:00
|
|
|
f_super = Rxyz(AS.quotient.polynomial)
|
|
|
|
m_super = AS.quotient.exponent
|
2022-12-22 14:44:57 +01:00
|
|
|
if fct2 != 1:
|
|
|
|
return as_reduction(AS, fct1)/as_reduction(AS, fct2)
|
|
|
|
|
|
|
|
result = RxyzQ(0)
|
|
|
|
change = 0
|
|
|
|
for a in fct1.monomials():
|
|
|
|
degrees_zi = [a.degree(z[i]) for i in range(n)]
|
|
|
|
d_div = [a.degree(z[i])//p for i in range(n)]
|
2024-06-13 13:11:28 +02:00
|
|
|
if d_div != n*[0] or a.degree(y) >= m_super:
|
2022-12-22 14:44:57 +01:00
|
|
|
change = 1
|
|
|
|
d_rem = [a.degree(z[i])%p for i in range(n)]
|
2024-06-13 13:11:28 +02:00
|
|
|
monomial = fct1.monomial_coefficient(a)*x^(a.degree(x))*y^(a.degree(y)%m_super)*f_super^(a.degree(y)//m_super)*prod(z[i]^(d_rem[i]) for i in range(n))*prod((z[i]+AS.rhs[i])^(d_div[i]) for i in range(n))
|
2022-12-22 14:44:57 +01:00
|
|
|
result += RxyzQ(monomial)
|
|
|
|
|
|
|
|
if change == 0:
|
|
|
|
return RxyzQ(result)
|
|
|
|
else:
|
|
|
|
return as_reduction(AS, RxyzQ(result))
|