Skip to content

Commit

Permalink
add is_trivial method
Browse files Browse the repository at this point in the history
  • Loading branch information
mantepse committed Dec 13, 2023
1 parent ab24b1c commit 65e1d7b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/sage/groups/perm_gps/permgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,29 @@ def ngens(self):
"""
return len(self.gens())

def is_trivial(self):
r"""
Return ``True`` if this group is the trivial group.
A permutation group is trivial, if it consists only of the
identity element, that is, if it has no generators.
EXAMPLES::
sage: G = PermutationGroup([], domain=["a", "b", "c"])
sage: G.is_trivial()
True
sage: SymmetricGroup(0).is_trivial()
True
sage: SymmetricGroup(1).is_trivial()
True
sage: SymmetricGroup(2).is_trivial()
False
sage: DihedralGroup(1).is_trivial()
False
"""
return not self._gens or (len(self._gens) == 1 and self._gens[0].is_one())

@cached_method
def one(self):
"""
Expand Down

0 comments on commit 65e1d7b

Please sign in to comment.