Skip to content

Commit

Permalink
Trac #34292: Group algebra bug
Browse files Browse the repository at this point in the history
Discussed
on [https://groups.google.com/g/sage-support/c/WVMuik1TICg sage-support]
and [https://groups.google.com/g/sage-devel/c/j6NWgHWrUf0 sage-devel].

There is a coercion bug that causes the example:
{{{
H = PermutationGroup([ [(1,2), (3,4)], [(5,6,7),(12,14,18)] ])
kH = H.algebra(GF(2))
[a, b] = H.gens()
x = kH(a) + kH(b) + kH.one(); print(x)
x*x
}}}
to fail. It does not recognize in the coercion that the parents of the
indexing elements should be the same.

URL: https://trac.sagemath.org/34292
Reported by: tkarn
Ticket author(s): Trevor K. Karn
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Aug 29, 2022
2 parents 42beee4 + e6f16a7 commit 6b373e6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/sage/algebras/group_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,16 @@ def _coerce_map_from_(self, S):
sage: QG = G.algebra(QQ)
sage: ZG = G.algebra(ZZ)
sage: ZG.coerce_map_from(H)
Coercion map:
Composite map:
From: Cyclic group of order 3 as a permutation group
To: Algebra of Dihedral group of order 6 as a permutation group over Integer Ring
Defn: Coercion map:
From: Cyclic group of order 3 as a permutation group
To: Dihedral group of order 6 as a permutation group
then
Coercion map:
From: Dihedral group of order 6 as a permutation group
To: Algebra of Dihedral group of order 6 as a permutation group over Integer Ring
sage: QG.coerce_map_from(ZG)
Generic morphism:
From: Algebra of Dihedral group of order 6 as a permutation group over Integer Ring
Expand All @@ -172,6 +179,14 @@ def _coerce_map_from_(self, S):
From: Algebra of Cyclic group of order 3 as a permutation group over Integer Ring
To: Algebra of Dihedral group of order 6 as a permutation group over Rational Field
sage: H = PermutationGroup([ [(1,2), (3,4)], [(5,6,7),(12,14,18)] ])
sage: kH = H.algebra(GF(2))
sage: [a, b] = kH.gens()
sage: x = kH(a) + kH(b) + kH.one(); print(x)
() + (5,6,7)(12,14,18) + (1,2)(3,4)
sage: x*x #checks :trac:34292
(5,7,6)(12,18,14)
As expected, there is no coercion when restricting the
field::
Expand All @@ -188,11 +203,16 @@ def _coerce_map_from_(self, S):
G = self.basis().keys()
K = self.base_ring()

if G.has_coerce_map_from(S):
G_coercion = G.coerce_map_from(S)
if G_coercion is not None:
from sage.categories.groups import Groups
# No coercion for additive groups because of ambiguity of +
# being the group action or addition of a new term.
return self.category().is_subcategory(Groups().Algebras(K))
if not self.category().is_subcategory(Groups().Algebras(K)):
return None
if S is G:
return True
return self.coerce_map_from(G) * G_coercion

if S in Sets.Algebras:
S_K = S.base_ring()
Expand Down
14 changes: 14 additions & 0 deletions src/sage/groups/perm_gps/permgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,20 @@ def __init__(self, gens=None, gap_group=None, canonicalize=True,

_libgap = None

def __copy__(self):
r"""
Return a "copy" of ``self`` by returning ``self``.
EXAMPLES::
sage: G = PermutationGroup(((1,2), (4,5)))
sage: copy(G) is G
True
"""
return self

__deepcopy__ = __copy__

def construction(self):
"""
Return the construction of ``self``.
Expand Down

0 comments on commit 6b373e6

Please sign in to comment.