Reduce non-integral element mod ideal

asked 6 years ago

David Loeffler gravatar image

Suppose I have a nonzero ideal I in a number field K, and an element xK whose denominator ideal {αOK:αxOK} is coprime to I. Then x defines an element of OK/I, even if xOK.

How can I efficiently find an element xOK which represents the same class in OK/I as x?

The first things I tried were x % I, I.reduce(x) and I.small_residue(x), but these all either fail or return non-useful output if x isn't integral:

sage: K.= QuadraticField(10).objgen()
sage: I = K.ideal(3, a + 1)
sage: x = (1 - 2*a)/3
sage: x % I
[...]
TypeError: unsupported operand parent(s) for %
sage: I.reduce(x)
[...]
TypeError: reduce only defined for integral elements
sage: I.small_residue(x)
1/3*a + 4/3
The only one-liner I could come up with was sage: I.reduce( x * x.denominator_ideal().element_1_mod(I) ) -a which works, but is a bit clumsy. Is there a simpler, cleaner Sage idiom for this?
Preview: (hide)