def dup_trunc(f, p, K):
 if K.is_ZZ:
  g = []
  for c in f:
   c = (c % p)
   if (c > (p // 2)):
    g.append((c - p))
   else:
    g.append(c)
 else:
  g = [(c % p) for c in f]
 return dup_strip(g)

def dup_trunc ( f , p , K ) : if K . is_ZZ : g = [ ] for c in f : c = ( c % p ) if ( c > ( p // 2 ) ) : g . append ( ( c - p ) ) else : g . append ( c ) else : g = [ ( c % p ) for c in f ] return dup_strip ( g )
reduce a k[x] polynomial modulo a constant p in k .