The theory of ideals of Z is very elementary but for completeness the general machinery for ring ideals applies. Such ideals will have type RngInt, that is, the same type as the ring of integers itself (ideal<Integers() | 1>).
In the case of Z any subring is an ideal so that the sub-constructor creates the same object as does the ideal-constructor. One quirk of this fact that ideals are of type RngInt is that taking R/I will result in the ideal division rather than the ring-by-ideal quotient (this is for compatibility with orders of number fields, as explained in the next section). Here is an example that shows the difference.
> Z := Integers(); > I := ideal<Z|1>; // ideal of Z > Z/I; // interpreted as ideal division Integer Ring > quo<Z|I>; // quotient of ring by ideal Residue class ring of integers modulo 1
Given the ring of integers Z and an integer a, return the ideal of Z generated by a.
> Z := IntegerRing(); > I13 := ideal< Z | 13 >; > I13; Ideal of Integer Ring generated by 13 > 1 in I13; false > 0 in I13; true > -13 in I13; true > I0 := ideal< Z | 0 >; > 0 in I0; true > 1 in I0; false
We check that Z is regarded as an ideal.
> I1 := ideal< Z | 1 >; > I1 eq Z; true