def __cmp__(self, other): """ Compare self to other. The ordering on congruence subgroups of the form GammaH(N) for some H is first by level and then by the subgroup H. In particular, this means that we have Gamma1(N) < GammaH(N) < Gamma0(N) for every nontrivial subgroup H. EXAMPLES:: sage: G = GammaH(86, [9]) sage: G.__cmp__(G) 0 sage: G.__cmp__(GammaH(86, [11])) is not 0 True sage: Gamma1(11) < Gamma0(11) True sage: Gamma1(11) == GammaH(11, []) True sage: Gamma0(11) == GammaH(11, [2]) True """ if is_GammaH(other): t = cmp(self.level(), other.level()) if t: return t else: return cmp(self._list_of_elements_in_H(), other._list_of_elements_in_H()) else: return CongruenceSubgroup.__cmp__(self, other)
def __cmp__(self, other): """ Compare self to other. The ordering on congruence subgroups of the form GammaH(N) for some H is first by level, then by the order of H, then lexicographically by H. In particular, this means that we have Gamma1(N) < GammaH(N) < Gamma0(N) for every nontrivial proper subgroup H. EXAMPLES:: sage: G = GammaH(86, [9]) sage: G.__cmp__(G) 0 sage: G.__cmp__(GammaH(86, [11])) is not 0 True sage: Gamma1(11) < Gamma0(11) True sage: Gamma1(11) == GammaH(11, []) True sage: Gamma0(11) == GammaH(11, [2]) True sage: G = Gamma0(86) sage: G.__cmp__(G) 0 sage: G.__cmp__(GammaH(86, [11])) is not 0 True sage: Gamma1(17) < Gamma0(17) True sage: Gamma0(1) == SL2Z True sage: Gamma0(2) == Gamma1(2) True sage: [x._list_of_elements_in_H() for x in sorted(Gamma0(24).gamma_h_subgroups())] [[1], [1, 5], [1, 7], [1, 11], [1, 13], [1, 17], [1, 19], [1, 23], [1, 5, 7, 11], [1, 5, 13, 17], [1, 5, 19, 23], [1, 7, 13, 19], [1, 7, 17, 23], [1, 11, 13, 23], [1, 11, 17, 19], [1, 5, 7, 11, 13, 17, 19, 23]] """ if is_GammaH(other): return (cmp(self.level(), other.level()) or -cmp(self.index(), other.index()) or cmp(self._list_of_elements_in_H(), other._list_of_elements_in_H())) else: return CongruenceSubgroup.__cmp__(self, other)
def __cmp__(self, other): r""" Compare self to other. EXAMPLES:: sage: Gamma(3) == SymmetricGroup(8) False sage: Gamma(3) == Gamma1(3) False sage: Gamma(5) < Gamma(6) True sage: Gamma(5) == Gamma(5) True sage: Gamma(3) == Gamma(3).as_permutation_group() True """ if is_Gamma(other): return cmp(self.level(), other.level()) else: return CongruenceSubgroup.__cmp__(self, other)