def sig_cmp(u, v, order):
 if (u[1] > v[1]):
  return (-1)
 if (u[1] == v[1]):
  if (order(u[0]) < order(v[0])):
   return (-1)
 return 1

def sig_cmp ( u , v , order ) : if ( u [ 1 ] > v [ 1 ] ) : return ( - 1 ) if ( u [ 1 ] == v [ 1 ] ) : if ( order ( u [ 0 ] ) < order ( v [ 0 ] ) ) : return ( - 1 ) return 1
compare two signatures by extending the term order to k[x]^n .