Skip to content

Quaternion ideals sometimes compare incorrectly #32245

@yyyyx4

Description

@yyyyx4

On sage 9.3, the following code unexpectedly prints False:

Q.<i,j,k> = QuaternionAlgebra(-1,-19)
I = Q.maximal_order().unit_ideal()
print(I.scale(1) == I)

(This behaviour was discovered by Jana Sotáková.)

Cause: The .scale() method for QuaternionFractionalIdeal_rational passes the set of generators of the scaled ideal to the parent algebra's .ideal() method as a list, whereas other code seems to assume that the basis is stored as a tuple. In particular, the __eq__ method for QuaternionFractionalIdeal_rational simply compares the __basis members, and since a list is never equal to a tuple, the equality tested in the snippet above fails even though scaling an ideal by 1 clearly shouldn't change anything.

Fix: Compare HNF bases everywhere (see the discussion below).

Depends on #31582

CC: @slel

Component: algebra

Keywords: quaternion ideals

Stopgaps: mathematically_wrong

Author: Lorenz Panny, Peter Bruin

Branch/Commit: 7159ed8

Reviewer: Samuel Lelièvre

Issue created by migration from https://trac.sagemath.org/ticket/32245

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions