? f = x^3 - 2; ? k = nfinit(f); ? i = idealfactor(k,3); ? j = idealfactor(k,5);
Next we form matrix whose rows correspond to a product of two primes, one dividing and one dividing :
? m = matrix(2,2); ? m[1,] = i[1,]; ? m[1,2] = 1; ? m[2,] = j[1,];Note that we set m[1,2] = 1, so the exponent is 1 instead of . We apply the CRT to obtain a lift in terms of the basis for .
? ?idealchinese idealchinese(nf,x,y): x being a prime ideal factorization and y a vector of elements, gives an element b such that v_p(b-y_p)>=v_p(x) for all prime ideals p dividing x, and v_p(b)>=0 for all other p. ? idealchinese(k, m, [x,1]) [0, 0, -1]~ ? nfbasis(f) [1, x, x^2]Thus PARI finds the lift , and we finish by verifying that this lift is correct. I couldn't figure out how to test for ideal membership in PARI, so here we just check that the prime ideal plus the element is not the unit ideal, which since the ideal is prime, implies membership.
? idealadd(k, i[1,1], -x^2 - x) [3 1 2] [0 1 0] [0 0 1] ? idealadd(k, j[1,1], -x^2-1) [5 2 1] [0 1 0] [0 0 1]