#11611: Equal PARI integers have different hashes
-----------------------------+----------------------------------------------
Reporter: jdemeyer | Owner: jdemeyer
Type: defect | Status: new
Priority: major | Milestone: sage-4.7.2
Component: number fields | Keywords: pari integer ideal hnf
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
-----------------------------+----------------------------------------------
Changes (by jdemeyer):
* keywords: pari ideal hnf => pari integer ideal hnf
Old description:
> In the code below, `I` and `I2` are equal ideals with equal HNF but they
> have different hashes:
>
> {{{
> sage: K.<a> = NumberField(x^2 - x - 1)
> sage: I = K.ideal(2 * a - 1)
> sage: I2 = I.factor()[0][0]
> sage: I == I2
> True
> sage: print I.__hash__(), I2.__hash__()
> -7493989779944505313 -6341068275337658337
> sage: print I.pari_hnf(), I2.pari_hnf()
> [5, 2; 0, 1] [5, 2; 0, 1]
> sage: print I.pari_hnf() == I2.pari_hnf()
> True
> sage: print I.pari_hnf().__hash__(), I2.pari_hnf().__hash__()
> -7493989779944505313 -6341068275337658337
> }}}
>
> The `6600000000000003` below looks suspicious:
> {{{
> sage: I.pari_hnf().debug()
> [&=0000000001ded308] MAT(lg=3):2600000000000003 0000000001ded2f0
> 0000000001ded2c0
> mat(1,1) = [&=0000000001ded2d8] INT(lg=3):0200000000000003
> (+,lgefint=3):4000000000000003 0000000000000005
> mat(1,2) = [&=0000000001ded2a8] INT(lg=3):0200000000000003
> (+,lgefint=3):4000000000000003 0000000000000002
> mat(2,1) = gen_0
> mat(2,2) = [&=0000000001ded290] INT(lg=3):0200000000000003
> (+,lgefint=3):4000000000000003 0000000000000001
> sage: I2.pari_hnf().debug()
> [&=0000000001941938] MAT(lg=3):2600000000000003 0000000001941920
> 00000000019418f0
> mat(1,1) = [&=0000000001941908] INT(lg=3):0200000000000003
> (+,lgefint=3):6600000000000003 0000000000000005
> mat(1,2) = [&=00000000019418d8] INT(lg=3):0200000000000003
> (+,lgefint=3):4000000000000003 0000000000000002
> mat(2,1) = gen_0
> mat(2,2) = [&=00000000019418c0] INT(lg=3):0200000000000003
> (+,lgefint=3):4000000000000003 0000000000000001
> }}}
New description:
In the code below, `a5` and `b5` are PARI integers equal to 5 but they
have different hashes:
{{{
sage: pariK=pari("nfinit(x^2-x-1)"); b5 = pari(5); b5.debug(); a5 =
pari(5); a5.debug(); print a5.__hash__(), b5.__hash__()
[&=00000000049437b0] INT(lg=3):0200000000000003
(+,lgefint=3):4000000000000003 0000000000000005
[&=000000000493cfe0] INT(lg=3):0200000000000003
(+,lgefint=3):7000000000000003 0000000000000005
-1729382256910270461 -8646911284551352317
}}}
This bug was discovered for ideals having different hashes.
--
Comment:
The issue is already visible on the level of PARI `INT`s, see the new
ticket description.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11611#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.