1 | initial version |
Just in case anyone else struggles with these issues in future, here is how I got around the obstacles referred to above and in http://ask.sagemath.org/question/2312/extensioncoercion-of-finite-rings-fields. It was also the reason for the questions http://ask.sagemath.org/question/2114/unitary-matrices-over-finite-fields and http://ask.sagemath.org/question/2059/explicit-finite-field-extensions.
I am dealing with systems of equations over the "Hermitian" extensions of finite fields, and trying to lift them to p-adic fields.
For example, I have a vector x of solutions to a set of polynomial equations over GF(p^2) and would like to lift it to the ring O/(p^2) where O is the unique unramified quadratic extension of Z_p [so O/(p^2) may alternatively be described as extending the ring Z/(p^2) by some element t satisfying an irreducible equation of degree 2]. Let J be the Jacobian of my system of equations, and z a vector of unknowns. Let x' be the vector whose entries are 1/p times those of x, regarded either as elements of Z/(p^2) or of Z.
I had to solve the linear equation Jz=-x' mod p (see for example http://math.stackexchange.com/questions/308031/multidimensional-hensel-lifting).
Straightforward use of solve() with p-adic or finite ring elements would not work: firstly because of the distinction between polynomials and symbolic ring elements which @kcrisman kindly answered above; secondly (if I tried the p-adic approach) because of the non-implementation of solve with the O(p^n) structure; thirdly (using the finite characteristic approach) because coercing elements within towers of finite fields and/or rings is not yet possible (see http://trac.sagemath.org/11938).
So somehow the only way I could see to do this was to generate the polynomials as abstract expressions in a separate file, multiply them by their Gal(GF(p^2):GF(p))-conjugates if necessary to get rid of the non-integer coefficients, then expand() them and "print" them out (as "P1=...; P2=...;" etc). I then literally cut and paste this output into a completely different file in order to trick the machine into thinking we are dealing with integer coefficient symbolic expressions. Then all of the machinery of solve_mod() and solve_right() and coercion into finite field coefficients etc works wonderfully.
I admit this is clunky, and I would be delighted if anyone were able to point out where I could have done it better!