(self)
return True
Return True if the group meets three criteria: identity is present,
        the inverse of every element is also an element, and the product of
        any two elements is also an element. If any of the tests fail, False
        is returned.

        Examples
        ========

        >>> from sympy.combinatorics import Permutation
        >>> Permutation.print_cyclic = True
        >>> from sympy.combinatorics import PermutationGroup
        >>> from sympy.combinatorics.polyhedron import tetrahedron

        The permutation group given in the tetrahedron object is not
        a true group:

        >>> G = tetrahedron.pgroup
        >>> G.is_group()
        False

        But the group generated by the permutations in the tetrahedron
        pgroup is a proper group:

        >>> H = PermutationGroup(list(G.generate()))
        >>> H.is_group()
        True

        The identity permutation is present:

        >>> H.has(Permutation(G.degree - 1))
        True

        The product of any two elements from the group is also in the group:

        >>> from sympy import TableForm
        >>> g = list(H)
        >>> n = len(g)
        >>> m = []
        >>> for i in g:
        ...     m.append([g.index(i*H) for H in g])
        ...
        >>> TableForm(m, headings=[range(n), range(n)], wipe_zeros=False)
           | 0  1  2  3  4  5  6  7  8  9  10 11
        ----------------------------------------
         0 | 11 0  8  10 6  2  7  4  5  3  9  1
         1 | 0  1  2  3  4  5  6  7  8  9  10 11
         2 | 6  2  7  4  5  3  9  1  11 0  8  10
         3 | 5  3  9  1  11 0  8  10 6  2  7  4
         4 | 3  4  0  2  10 6  11 8  9  7  1  5
         5 | 4  5  6  7  8  9  10 11 0  1  2  3
         6 | 10 6  11 8  9  7  1  5  3  4  0  2
         7 | 9  7  1  5  3  4  0  2  10 6  11 8
         8 | 7  8  4  6  2  10 3  0  1  11 5  9
         9 | 8  9  10 11 0  1  2  3  4  5  6  7
        10 | 2  10 3  0  1  11 5  9  7  8  4  6
        11 | 1  11 5  9  7  8  4  6  2  10 3  0
        >>>
        The entries in the table give the element in the group corresponding
        to the product of a given column element and row element:

        >>> g[3]*g[2] == g[9]
        True

        The inverse of every element is also in the group:

        >>> TableForm([[g.index(~gi) for gi in g]], headings=[[], range(n)],
        ...    wipe_zeros=False)
        0  1 2 3 4  5 6 7 8 9 10 11
        ---------------------------
        11 1 7 3 10 9 6 2 8 5 4  0

        So we see that g[1] and g[3] are equivalent to their inverse while
        g[7] == ~g[2].
Return True if the group meets three criteria: identity is present,
        the inverse of every element is also an element, and the product of
        any two elements is also an element. If any of the tests fail, False
        is returned.
Return True if the group meets three criteria : identity is present the inverse of every element is also an element and the product of any two elements is also an element . If any of the tests fail False is returned .
def is_group(self):
        """Return True if the group meets three criteria: identity is present,
        the inverse of every element is also an element, and the product of
        any two elements is also an element. If any of the tests fail, False
        is returned.

        Examples
        ========

        >>> from sympy.combinatorics import Permutation
        >>> Permutation.print_cyclic = True
        >>> from sympy.combinatorics import PermutationGroup
        >>> from sympy.combinatorics.polyhedron import tetrahedron

        The permutation group given in the tetrahedron object is not
        a true group:

        >>> G = tetrahedron.pgroup
        >>> G.is_group()
        False

        But the group generated by the permutations in the tetrahedron
        pgroup is a proper group:

        >>> H = PermutationGroup(list(G.generate()))
        >>> H.is_group()
        True

        The identity permutation is present:

        >>> H.has(Permutation(G.degree - 1))
        True

        The product of any two elements from the group is also in the group:

        >>> from sympy import TableForm
        >>> g = list(H)
        >>> n = len(g)
        >>> m = []
        >>> for i in g:
        ...     m.append([g.index(i*H) for H in g])
        ...
        >>> TableForm(m, headings=[range(n), range(n)], wipe_zeros=False)
           | 0  1  2  3  4  5  6  7  8  9  10 11
        ----------------------------------------
         0 | 11 0  8  10 6  2  7  4  5  3  9  1
         1 | 0  1  2  3  4  5  6  7  8  9  10 11
         2 | 6  2  7  4  5  3  9  1  11 0  8  10
         3 | 5  3  9  1  11 0  8  10 6  2  7  4
         4 | 3  4  0  2  10 6  11 8  9  7  1  5
         5 | 4  5  6  7  8  9  10 11 0  1  2  3
         6 | 10 6  11 8  9  7  1  5  3  4  0  2
         7 | 9  7  1  5  3  4  0  2  10 6  11 8
         8 | 7  8  4  6  2  10 3  0  1  11 5  9
         9 | 8  9  10 11 0  1  2  3  4  5  6  7
        10 | 2  10 3  0  1  11 5  9  7  8  4  6
        11 | 1  11 5  9  7  8  4  6  2  10 3  0
        >>>
        The entries in the table give the element in the group corresponding
        to the product of a given column element and row element:

        >>> g[3]*g[2] == g[9]
        True

        The inverse of every element is also in the group:

        >>> TableForm([[g.index(~gi) for gi in g]], headings=[[], range(n)],
        ...    wipe_zeros=False)
        0  1 2 3 4  5 6 7 8 9 10 11
        ---------------------------
        11 1 7 3 10 9 6 2 8 5 4  0

        So we see that g[1] and g[3] are equivalent to their inverse while
        g[7] == ~g[2].
        """
        # identity present
        I = Permutation(size=self.degree)
        for g in self:
            if g == I:
                break
        else:
            return False

        # associativity already holds: a*(b*c) == (a*b)*c for permutations

        # inverse of each is present
        if not all(self.has(~a) for a in self):
            return False

        # closure
        for a in self:
            for b in self:
                if not self.has(a*b):
                    return False
        return True
def is_group ( self ) : # identity present I = Permutation ( size = self . degree ) for g in self : if g == I : break else : return False # associativity already holds: a*(b*c) == (a*b)*c for permutations # inverse of each is present if not all ( self . has ( ~ a ) for a in self ) : return False # closure for a in self : for b in self : if not self . has ( a * b ) : return False return True