def sdm_nf_buchberger_reduced(f, G, O, K):
 h = sdm_zero()
 g = f
 while g:
  g = sdm_nf_buchberger(g, G, O, K)
  if g:
   h = sdm_add(h, [sdm_LT(g)], O, K)
   g = g[1:]
 return h

def sdm_nf_buchberger_reduced ( f , G , O , K ) : h = sdm_zero ( ) g = f while g : g = sdm_nf_buchberger ( g , G , O , K ) if g : h = sdm_add ( h , [ sdm_LT ( g ) ] , O , K ) g = g [ 1 : ] return h
compute a reduced normal form of f with respect to g and order o .