Sage does not recognize a unit ideal

I am trying to learn a bit of sage and I have tried playing with ideals in p-adic rings. But I don't understand how ideals work in polynomial rings. I have tried writing the following

A=Zp(5)
R.<x>=A[]
g1=(1+x)^(25)-1;
g2=6^(-25)*((1+x)^(25)-6^(25));
J=R.ideal(37,g1)
I=R.ideal(37,g2)
U=R.unit_ideal();
I==U
I==J
J==U

Since 37 is a 5-adic unit, I would expect the answer to be

True
True
True

because both I and J contain 37. But it is

False
False
False

What am I missing? I also apologise for not being able to understand how to TeX in stackoverflow.

Upvotes: 0

Views: 45

Answers (1)

kcrisman
kcrisman

Reputation: 4402

Well, apparently Sage isn't checking that automatically.

print(U)
print(I)
print(J)
Principal ideal (1 + O(5^20)) of Univariate Polynomial Ring in x over 5-adic Ring with capped relative precision 20
Ideal (2 + 2*5 + 5^2 + O(5^20), (1 + 4*5^3 + 2*5^4 + 4*5^7 + 2*5^8 + 3*5^9 + 3*5^10 + 3*5^12 + 5^13 + 4*5^15 + 4*5^16 + 2*5^17 + 5^18 + 5^19 + O(5^20))*x^25 + (5^2 + 4*5^5 + 2*5^6 + 4*5^9 + 2*5^10 + 3*5^11 + 3*5^12 + 3*5^14 + 5^15 + 4*5^17 + 4*5^18 + 2*5^19 + O(5^20))*x^24 + (2*5^2 + 2*5^3 + 3*5^5 + 3*5^6 + 5^7 + 5^8 + 3*5^9 + 3*5^10 + 2*5^11 + 4*5^12 + 3*5^13 + 2*5^14 + 4*5^15 + 3*5^16 + 3*5^17 + 2*5^18 + O(5^20))*x^23 + (2*5^2 + 3*5^3 + 3*5^4 + 3*5^5 + 2*5^6 + 5^7 + 3*5^10 + 2*5^11 + 5^12 + 3*5^13 + 4*5^14 + 4*5^15 + 4*5^16 + 3*5^17 + 2*5^18 + 2*5^19 + O(5^20))*x^22 + (5^2 + 5^3 + 3*5^5 + 2*5^6 + 3*5^7 + 5^8 + 4*5^10 + 5^11 + 3*5^12 + 3*5^14 + 4*5^15 + 4*5^16 + 5^17 + 4*5^19 + O(5^20))*x^21 + (5 + 4*5^4 + 4*5^5 + 3*5^6 + 2*5^8 + 3*5^10 + 4*5^12 + 2*5^14 + 3*5^15 + 5^16 + 3*5^17 + 2*5^19 + O(5^20))*x^20 + (4*5^2 + 5^3 + 3*5^4 + 2*5^5 + 5^6 + 4*5^7 + 3*5^8 + 4*5^9 + 5^10 + 2*5^12 + 4*5^13 + 3*5^14 + 4*5^15 + 3*5^16 + 2*5^17 + 2*5^19 + O(5^20))*x^19 + (3*5^2 + 4*5^4 + 4*5^6 + 3*5^7 + 4*5^8 + 2*5^9 + 4*5^10 + 3*5^11 + 2*5^12 + 4*5^14 + 2*5^16 + O(5^20))*x^18 + (3*5^2 + 2*5^3 + 3*5^5 + 5^7 + 3*5^8 + 5^9 + 3*5^14 + 5^16 + 2*5^17 + 5^18 + 5^19 + O(5^20))*x^17 + (4*5^2 + 3*5^3 + 3*5^4 + 4*5^5 + 3*5^6 + 3*5^7 + 2*5^8 + 2*5^9 + 4*5^10 + 2*5^11 + 5^13 + 5^14 + 2*5^15 + 3*5^17 + 5^18 + 5^19 + O(5^20))*x^16 + (2*5 + 3*5^4 + 5^5 + 2*5^7 + 5^9 + 3*5^10 + 4*5^11 + 3*5^12 + 4*5^13 + 2*5^14 + 3*5^15 + 4*5^16 + 2*5^17 + 4*5^19 + O(5^20))*x^15 + (5^2 + 4*5^3 + 5^4 + 4*5^6 + 2*5^7 + 3*5^10 + 3*5^11 + 5^12 + 3*5^13 + 2*5^14 + 3*5^15 + 3*5^16 + 5^17 + 5^19 + O(5^20))*x^14 + (2*5^2 + 2*5^3 + 2*5^5 + 5^6 + 3*5^7 + 5^10 + 4*5^11 + 2*5^12 + 3*5^14 + 5^15 + 4*5^16 + 2*5^17 + 4*5^18 + 2*5^19 + O(5^20))*x^13 + (2*5^2 + 2*5^3 + 2*5^5 + 5^6 + 3*5^7 + 5^10 + 4*5^11 + 2*5^12 + 3*5^14 + 5^15 + 4*5^16 + 2*5^17 + 4*5^18 + 2*5^19 + O(5^20))*x^12 + (5^2 + 4*5^3 + 5^4 + 4*5^6 + 2*5^7 + 3*5^10 + 3*5^11 + 5^12 + 3*5^13 + 2*5^14 + 3*5^15 + 3*5^16 + 5^17 + 5^19 + O(5^20))*x^11 + (2*5 + 3*5^4 + 5^5 + 2*5^7 + 5^9 + 3*5^10 + 4*5^11 + 3*5^12 + 4*5^13 + 2*5^14 + 3*5^15 + 4*5^16 + 2*5^17 + 4*5^19 + O(5^20))*x^10 + (4*5^2 + 3*5^3 + 3*5^4 + 4*5^5 + 3*5^6 + 3*5^7 + 2*5^8 + 2*5^9 + 4*5^10 + 2*5^11 + 5^13 + 5^14 + 2*5^15 + 3*5^17 + 5^18 + 5^19 + O(5^20))*x^9 + (3*5^2 + 2*5^3 + 3*5^5 + 5^7 + 3*5^8 + 5^9 + 3*5^14 + 5^16 + 2*5^17 + 5^18 + 5^19 + O(5^20))*x^8 + (3*5^2 + 4*5^4 + 4*5^6 + 3*5^7 + 4*5^8 + 2*5^9 + 4*5^10 + 3*5^11 + 2*5^12 + 4*5^14 + 2*5^16 + O(5^20))*x^7 + (4*5^2 + 5^3 + 3*5^4 + 2*5^5 + 5^6 + 4*5^7 + 3*5^8 + 4*5^9 + 5^10 + 2*5^12 + 4*5^13 + 3*5^14 + 4*5^15 + 3*5^16 + 2*5^17 + 2*5^19 + O(5^20))*x^6 + (5 + 4*5^4 + 4*5^5 + 3*5^6 + 2*5^8 + 3*5^10 + 4*5^12 + 2*5^14 + 3*5^15 + 5^16 + 3*5^17 + 2*5^19 + O(5^20))*x^5 + (5^2 + 5^3 + 3*5^5 + 2*5^6 + 3*5^7 + 5^8 + 4*5^10 + 5^11 + 3*5^12 + 3*5^14 + 4*5^15 + 4*5^16 + 5^17 + 4*5^19 + O(5^20))*x^4 + (2*5^2 + 3*5^3 + 3*5^4 + 3*5^5 + 2*5^6 + 5^7 + 3*5^10 + 2*5^11 + 5^12 + 3*5^13 + 4*5^14 + 4*5^15 + 4*5^16 + 3*5^17 + 2*5^18 + 2*5^19 + O(5^20))*x^3 + (2*5^2 + 2*5^3 + 3*5^5 + 3*5^6 + 5^7 + 5^8 + 3*5^9 + 3*5^10 + 2*5^11 + 4*5^12 + 3*5^13 + 2*5^14 + 4*5^15 + 3*5^16 + 3*5^17 + 2*5^18 + O(5^20))*x^2 + (5^2 + 4*5^5 + 2*5^6 + 4*5^9 + 2*5^10 + 3*5^11 + 3*5^12 + 3*5^14 + 5^15 + 4*5^17 + 4*5^18 + 2*5^19 + O(5^20))*x + 4*5^3 + 2*5^4 + 4*5^7 + 2*5^8 + 3*5^9 + 3*5^10 + 3*5^12 + 5^13 + 4*5^15 + 4*5^16 + 2*5^17 + 5^18 + 5^19 + O(5^20)) of Univariate Polynomial Ring in x over 5-adic Ring with capped relative precision 20
Ideal (2 + 2*5 + 5^2 + O(5^20), (1 + O(5^20))*x^25 + (5^2 + O(5^20))*x^24 + (2*5^2 + 2*5^3 + O(5^20))*x^23 + (2*5^2 + 3*5^3 + 3*5^4 + O(5^20))*x^22 + (5^2 + 5^3 + 4*5^5 + O(5^20))*x^21 + (5 + 2*5^5 + 3*5^6 + O(5^20))*x^20 + (4*5^2 + 5^3 + 3*5^4 + 5^5 + 5^6 + 2*5^7 + O(5^20))*x^19 + (3*5^2 + 4*5^4 + 3*5^5 + 5^7 + 5^8 + O(5^20))*x^18 + (3*5^2 + 2*5^3 + 5^5 + 4*5^6 + 3*5^7 + 2*5^8 + O(5^20))*x^17 + (4*5^2 + 3*5^3 + 3*5^4 + 3*5^5 + 5^7 + 5^9 + O(5^20))*x^16 + (2*5 + 5^5 + 4*5^6 + 5^7 + 3*5^8 + 5^9 + O(5^20))*x^15 + (5^2 + 4*5^3 + 5^4 + 5^5 + 2*5^7 + 5^8 + 2*5^9 + O(5^20))*x^14 + (2*5^2 + 2*5^3 + 4*5^5 + 2*5^6 + 5^7 + 3*5^8 + 2*5^9 + O(5^20))*x^13 + (2*5^2 + 2*5^3 + 4*5^5 + 2*5^6 + 5^7 + 3*5^8 + 2*5^9 + O(5^20))*x^12 + (5^2 + 4*5^3 + 5^4 + 5^5 + 2*5^7 + 5^8 + 2*5^9 + O(5^20))*x^11 + (2*5 + 5^5 + 4*5^6 + 5^7 + 3*5^8 + 5^9 + O(5^20))*x^10 + (4*5^2 + 3*5^3 + 3*5^4 + 3*5^5 + 5^7 + 5^9 + O(5^20))*x^9 + (3*5^2 + 2*5^3 + 5^5 + 4*5^6 + 3*5^7 + 2*5^8 + O(5^20))*x^8 + (3*5^2 + 4*5^4 + 3*5^5 + 5^7 + 5^8 + O(5^20))*x^7 + (4*5^2 + 5^3 + 3*5^4 + 5^5 + 5^6 + 2*5^7 + O(5^20))*x^6 + (5 + 2*5^5 + 3*5^6 + O(5^20))*x^5 + (5^2 + 5^3 + 4*5^5 + O(5^20))*x^4 + (2*5^2 + 3*5^3 + 3*5^4 + O(5^20))*x^3 + (2*5^2 + 2*5^3 + O(5^20))*x^2 + (5^2 + O(5^20))*x + O(5^20)) of Univariate Polynomial Ring in x over 5-adic Ring with capped relative precision 20

Perhaps more troubling,

U>=I
False

However, I'm not an expert in the implementation of these rings. However, Sage does give

R(37).is_unit()
True

On the other hand,

K = R.ideal(A(37))
K==U

gives True but

L = R.ideal(1,g1)
L == U

gives False.

I feel like there must be something obvious I'm missing here, but if so maybe the documentation needs some work, so I've opened Trac 28692. If we're off base, I'm sure we'll hear - you may also wish to ask on ask.sagemath where a lot more devs hang out.

Upvotes: 1

Related Questions