From d92aa8c96ea49d68999a98239be1550ab47d5590 Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Mon, 1 Apr 2024 05:46:04 +0900 Subject: [PATCH] Fixing bug with quotients by trivial ideals. --- src/sage/algebras/lie_algebras/quotient.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/sage/algebras/lie_algebras/quotient.py b/src/sage/algebras/lie_algebras/quotient.py index 0787229774c..74f3b444c1f 100644 --- a/src/sage/algebras/lie_algebras/quotient.py +++ b/src/sage/algebras/lie_algebras/quotient.py @@ -274,6 +274,7 @@ def __init__(self, I, L, names, index_set, category=None): self._ambient = L self._I = I self._sm = sm + self._triv_ideal = bool(I.dimension() == 0) LieAlgebraWithStructureCoefficients.__init__( self, L.base_ring(), s_coeff, names, index_set, category=category) @@ -426,14 +427,23 @@ def from_vector(self, v, order=None, coerce=False): sage: el.parent() == Q True - An element from a vector of the ambient module + An element from a vector of the ambient module:: sage: el = Q.from_vector([1, 2, 3]); el -2*X - Y sage: el.parent() == Q True + + Check for the trivial ideal:: + + sage: L. = LieAlgebra(GF(3), {('x','z'): {'x':1, 'y':1}, ('y','z'): {'y':1}}) + sage: I = L.ideal([]) + sage: Q = L.quotient(I) + sage: v = Q.an_element().to_vector() + sage: Q.from_vector(v) + x + y + z """ - if len(v) == self.ambient().dimension(): + if not self._triv_ideal and len(v) == self.ambient().dimension(): return self.retract(self.ambient().from_vector(v)) return super().from_vector(v)