def _remove_gens(base, strong_gens, basic_orbits=None, strong_gens_distr=None):
 from sympy.combinatorics.perm_groups import _orbit
 base_len = len(base)
 degree = strong_gens[0].size
 if (strong_gens_distr is None):
  strong_gens_distr = _distribute_gens_by_base(base, strong_gens)
 temp = strong_gens_distr[:]
 if (basic_orbits is None):
  basic_orbits = []
  for i in range(base_len):
   basic_orbit = _orbit(degree, strong_gens_distr[i], base[i])
   basic_orbits.append(basic_orbit)
 strong_gens_distr.append([])
 res = strong_gens[:]
 for i in range((base_len - 1), (-1), (-1)):
  gens_copy = strong_gens_distr[i][:]
  for gen in strong_gens_distr[i]:
   if (gen not in strong_gens_distr[(i + 1)]):
    temp_gens = gens_copy[:]
    temp_gens.remove(gen)
    if (temp_gens == []):
     continue
    temp_orbit = _orbit(degree, temp_gens, base[i])
    if (temp_orbit == basic_orbits[i]):
     gens_copy.remove(gen)
     res.remove(gen)
 return res

def _remove_gens ( base , strong_gens , basic_orbits = None , strong_gens_distr = None ) : from sympy . combinatorics . perm_groups import _orbit base_len = len ( base ) degree = strong_gens [ 0 ] . size if ( strong_gens_distr is None ) : strong_gens_distr = _distribute_gens_by_base ( base , strong_gens ) temp = strong_gens_distr [ : ] if ( basic_orbits is None ) : basic_orbits = [ ] for i in range ( base_len ) : basic_orbit = _orbit ( degree , strong_gens_distr [ i ] , base [ i ] ) basic_orbits . append ( basic_orbit ) strong_gens_distr . append ( [ ] ) res = strong_gens [ : ] for i in range ( ( base_len - 1 ) , ( - 1 ) , ( - 1 ) ) : gens_copy = strong_gens_distr [ i ] [ : ] for gen in strong_gens_distr [ i ] : if ( gen not in strong_gens_distr [ ( i + 1 ) ] ) : temp_gens = gens_copy [ : ] temp_gens . remove ( gen ) if ( temp_gens == [ ] ) : continue temp_orbit = _orbit ( degree , temp_gens , base [ i ] ) if ( temp_orbit == basic_orbits [ i ] ) : gens_copy . remove ( gen ) res . remove ( gen ) return res
remove redundant generators from a strong generating set .