From c67c9935789d101fe13e69ca55ffae3dcc412d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Tue, 9 Jan 2024 21:39:10 +0100 Subject: [PATCH 1/2] some details in Galois group as permutation group --- src/sage/groups/galois_group_perm.py | 44 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/sage/groups/galois_group_perm.py b/src/sage/groups/galois_group_perm.py index 162e5174143..06b3ad69c8d 100644 --- a/src/sage/groups/galois_group_perm.py +++ b/src/sage/groups/galois_group_perm.py @@ -1,9 +1,8 @@ r""" Galois groups of field extensions as permutation groups """ - from sage.groups.galois_group import _GaloisMixin, _SubGaloisMixin -from sage.groups.perm_gps.permgroup import PermutationGroup, PermutationGroup_generic, PermutationGroup_subgroup +from sage.groups.perm_gps.permgroup import PermutationGroup_generic, PermutationGroup_subgroup from sage.misc.abstract_method import abstract_method from sage.misc.lazy_attribute import lazy_attribute from sage.sets.finite_enumerated_set import FiniteEnumeratedSet @@ -27,7 +26,7 @@ class GaloisGroup_perm(_GaloisMixin, PermutationGroup_generic): @abstract_method def transitive_number(self, algorithm=None, recompute=False): """ - The transitive number (as in the GAP and Magma databases of transitive groups) + Return the transitive number (as in the GAP and Magma databases of transitive groups) for the action on the roots of the defining polynomial of the top field. EXAMPLES:: @@ -42,8 +41,10 @@ def transitive_number(self, algorithm=None, recompute=False): @lazy_attribute def _gens(self): """ - The generators of this Galois group as permutations of the roots. It's important that this - be computed lazily, since it's often possible to compute other attributes (such as the order + Return the generators of this Galois group as permutations of the roots. + + It is important that this be computed lazily, since it is + often possible to compute other attributes (such as the order or transitive number) more cheaply. EXAMPLES:: @@ -67,7 +68,6 @@ def __init__(self, field, algorithm=None, names=None, gc_numbering=False): """ self._field = field self._default_algorithm = algorithm - self._base = field.base_field() self._gc_numbering = gc_numbering if names is None: # add a c for Galois closure @@ -84,7 +84,7 @@ def __init__(self, field, algorithm=None, names=None, gc_numbering=False): @lazy_attribute def _deg(self): r""" - The number of moved points in the permutation representation. + Return the number of moved points in the permutation representation. This will be the degree of the original number field if `_gc_numbering`` is ``False``, or the degree of the Galois closure otherwise. @@ -103,16 +103,16 @@ def _deg(self): """ if self._gc_numbering: return self.order() - else: - try: - return self._field.degree() - except NotImplementedError: # relative number fields don't support degree - return self._field.relative_degree() + + try: + return self._field.degree() + except NotImplementedError: # relative number fields don't support degree + return self._field.relative_degree() @lazy_attribute def _domain(self): r""" - The integers labeling the roots on which this Galois group acts. + Return the integers labeling the roots on which this Galois group acts. EXAMPLES:: @@ -126,12 +126,12 @@ def _domain(self): sage: G = K.galois_group(gc_numbering=True); G._domain {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20} """ - return FiniteEnumeratedSet(range(1, self._deg+1)) + return FiniteEnumeratedSet(range(1, self._deg + 1)) @lazy_attribute - def _domain_to_gap(self): + def _domain_to_gap(self) -> dict: r""" - Dictionary implementing the identity (used by PermutationGroup_generic). + Return the dictionary implementing the identity (used by PermutationGroup_generic). EXAMPLES:: @@ -141,12 +141,12 @@ def _domain_to_gap(self): sage: G._domain_to_gap[5] # needs sage.rings.number_field 5 """ - return {key: i+1 for i, key in enumerate(self._domain)} + return {key: i + 1 for i, key in enumerate(self._domain)} @lazy_attribute - def _domain_from_gap(self): + def _domain_from_gap(self) -> dict: r""" - Dictionary implementing the identity (used by PermutationGroup_generic). + Return the dictionary implementing the identity (used by PermutationGroup_generic). EXAMPLES:: @@ -156,11 +156,11 @@ def _domain_from_gap(self): sage: G._domain_from_gap[20] # needs sage.rings.number_field 20 """ - return {i+1: key for i, key in enumerate(self._domain)} + return {i + 1: key for i, key in enumerate(self._domain)} - def ngens(self): + def ngens(self) -> int: r""" - Number of generators of this Galois group + Return the number of generators of this Galois group. EXAMPLES:: From 4c60c29ab4ccc1e46f55d71d25c520ce0f8a2b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Wed, 10 Jan 2024 11:58:56 +0100 Subject: [PATCH 2/2] change back doc of lazy attributes --- src/sage/groups/galois_group_perm.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/groups/galois_group_perm.py b/src/sage/groups/galois_group_perm.py index 06b3ad69c8d..7a640bcfe29 100644 --- a/src/sage/groups/galois_group_perm.py +++ b/src/sage/groups/galois_group_perm.py @@ -41,7 +41,7 @@ def transitive_number(self, algorithm=None, recompute=False): @lazy_attribute def _gens(self): """ - Return the generators of this Galois group as permutations of the roots. + The generators of this Galois group as permutations of the roots. It is important that this be computed lazily, since it is often possible to compute other attributes (such as the order @@ -84,7 +84,7 @@ def __init__(self, field, algorithm=None, names=None, gc_numbering=False): @lazy_attribute def _deg(self): r""" - Return the number of moved points in the permutation representation. + The number of moved points in the permutation representation. This will be the degree of the original number field if `_gc_numbering`` is ``False``, or the degree of the Galois closure otherwise. @@ -112,7 +112,7 @@ def _deg(self): @lazy_attribute def _domain(self): r""" - Return the integers labeling the roots on which this Galois group acts. + The integers labeling the roots on which this Galois group acts. EXAMPLES:: @@ -131,7 +131,7 @@ def _domain(self): @lazy_attribute def _domain_to_gap(self) -> dict: r""" - Return the dictionary implementing the identity (used by PermutationGroup_generic). + The dictionary implementing the identity (used by PermutationGroup_generic). EXAMPLES:: @@ -146,7 +146,7 @@ def _domain_to_gap(self) -> dict: @lazy_attribute def _domain_from_gap(self) -> dict: r""" - Return the dictionary implementing the identity (used by PermutationGroup_generic). + The dictionary implementing the identity (used by PermutationGroup_generic). EXAMPLES::