# Bug computing kernel of ring homomorphism GCA

40 views

### Trevor Karn

Oct 18, 2021, 1:21:47 PMOct 18
to sage-devel
Hi all,

It looks like I have found a bug in the `.kernel()` method of a ring homomorphism from one  `GradedCommutativeAlgebra` to another. I think I have identified the issue, but was hoping to post here for confirmation that my thinking makes sense before opening a trac ticket and working on a fix.

The bug: let A, B be `GradedCommutativeAlgebra`s each generated by two elements (a_1, a_2 and b_1, b_2 respectively) of degree-1 (so A,B are exterior algebras). Define a homomorphism f: A -> B taking a_1 -> b_1 and a_2 -> b_1 + b_2.

Then f(a_1a_2) = f(a_1)f(a_2) = b_1(b_1+b_2) = b_1^2 + b_1b_2 = 0 + b_1b2 =/= 0.

When I perform the same computation in Sage,  I get:

sage: A = GradedCommutativeAlgebra(QQ,['a1','a2'], (1,1))
sage: B = GradedCommutativeAlgebra(QQ,['b1','b2'], (1,1))
sage: A.inject_variables();
sage: B.inject_variables();
sage: f = A.hom([b1, b1+b2], codomain=B)
sage: f.kernel()
Twosided Ideal (0, a1*a2, 0) of Graded Commutative Algebra with generators ('a1', 'a2') in degrees (1, 1) over Rational Field

which I believe to be incorrect by my computation above.

What I think is going wrong:
When computing the kernel, the graph ideal is computed as an ideal in the tensor product ring of the domain tensored with the codomain. In constructing this it uses a (commutative) polynomial ring and takes a quotient. In creating the commutative polynomial ring the `.defining_ideal().gens()` method is called on the domain. The `.defining_ideal()` for a noncommutative ring has generators and relations, but calling the `.gens()` method accesses the generators only. For example:

sage: A.defining_ideal()
Twosided Ideal (a1^2, a2^2) of Noncommutative Multivariate Polynomial Ring in a1, a2 over Rational Field, nc-relations: {a2*a1: -a1*a2}
sage: A.defining_ideal().gens()
(a1^2, a2^2)

And so the relation that a2*a1 = - a1*a2 is forgotten in the tensor product ring.

My proposed fix:
Add a function in sage.rings.morphism that computes the tensor product ring when the two rings are noncommutative, then add a check inside of graph_ideal to call _tensor_product_ring_nc as opposed to _tensor_product_ring.

Does this seem like a reasonable plan, or is there a better approach?

Thanks!

-Trevor

### Trevor Karn

Oct 18, 2021, 1:28:39 PMOct 18
to sage-devel
I forgot to add that Sage does recognize that f(a1*b2) is nonzero:

sage: f(a1*a2)
b1*b2