Path: blob/master/src/sage/modular/local_comp/liftings.py
8820 views
r"""1Helper functions for local components23This module contains various functions relating to lifting elements of4`\mathrm{SL}_2(\ZZ / N\ZZ)` to `\mathrm{SL}_2(\ZZ)`, and other related5problems.6"""78from sage.rings.all import ZZ, Zmod9from sage.rings.arith import crt, inverse_mod10from sage.modular.modsym.p1list import lift_to_sl2z1112def lift_to_gamma1(g, m, n):13r"""14If ``g = [a,b,c,d]`` is a list of integers defining a `2 \times 2` matrix15whose determinant is `1 \pmod m`, return a list of integers giving the16entries of a matrix which is congruent to `g \pmod m` and to17`\begin{pmatrix} 1 & * \\ 0 & 1 \end{pmatrix} \pmod n`. Here `m` and `n`18must be coprime.1920Here `m` and `n` should be coprime positive integers. Either of `m` and `n`21can be `1`. If `n = 1`, this still makes perfect sense; this is what is22called by the function :func:`~lift_matrix_to_sl2z`. If `m = 1` this is a23rather silly question, so we adopt the convention of always returning the24identity matrix.2526The result is always a list of Sage integers (unlike ``lift_to_sl2z``,27which tends to return Python ints).2829EXAMPLE::3031sage: from sage.modular.local_comp.liftings import lift_to_gamma132sage: A = matrix(ZZ, 2, lift_to_gamma1([10, 11, 3, 11], 19, 5)); A33[371 68]34[ 60 11]35sage: A.det() == 136True37sage: A.change_ring(Zmod(19))38[10 11]39[ 3 11]40sage: A.change_ring(Zmod(5))41[1 3]42[0 1]43sage: m = list(SL2Z.random_element())44sage: n = lift_to_gamma1(m, 11, 17)45sage: assert matrix(Zmod(11), 2, n) == matrix(Zmod(11),2,m)46sage: assert matrix(Zmod(17), 2, [n[0], 0, n[2], n[3]]) == 147sage: type(lift_to_gamma1([10,11,3,11],19,5)[0])48<type 'sage.rings.integer.Integer'>4950Tests with `m = 1` and with `n = 1`::5152sage: lift_to_gamma1([1,1,0,1], 5, 1)53[1, 1, 0, 1]54sage: lift_to_gamma1([2,3,11,22], 1, 5)55[1, 0, 0, 1]56"""57if m == 1:58return [ZZ(1),ZZ(0),ZZ(0),ZZ(1)]59a,b,c,d = [ZZ(x) for x in g]60if not (a*d - b*c) % m == 1:61raise ValueError( "Determinant is {0} mod {1}, should be 1".format((a*d - b*c) % m, m) )62c2 = crt(c, 0, m, n)63d2 = crt(d, 1, m, n)64a3,b3,c3,d3 = map(ZZ, lift_to_sl2z(c2,d2,m*n))65r = (a3*b - b3*a) % m66return [a3 + r*c3, b3 + r*d3, c3, d3]6768def lift_matrix_to_sl2z(A, N):69r"""70Given a list of length 4 representing a 2x2 matrix over `\ZZ / N\ZZ` with71determinant 1 (mod `N`), lift it to a 2x2 matrix over `\ZZ` with72determinant 1.7374This is a special case of :func:`~lift_to_gamma1`, and is coded as such.7576TESTS::7778sage: from sage.modular.local_comp.liftings import lift_matrix_to_sl2z79sage: lift_matrix_to_sl2z([10, 11, 3, 11], 19)80[29, 106, 3, 11]81sage: type(_[0])82<type 'sage.rings.integer.Integer'>83sage: lift_matrix_to_sl2z([2,0,0,1], 5)84Traceback (most recent call last):85...86ValueError: Determinant is 2 mod 5, should be 187"""88return lift_to_gamma1(A, N, 1)8990def lift_gen_to_gamma1(m, n):91r"""92Return four integers defining a matrix in `\mathrm{SL}_2(\ZZ)` which is93congruent to `\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} \pmod m` and94lies in the subgroup `\begin{pmatrix} 1 & * \\ 0 & 1 \end{pmatrix} \pmod95n`.9697This is a special case of :func:`~lift_to_gamma1`, and is coded as such.9899EXAMPLE::100101sage: from sage.modular.local_comp.liftings import lift_gen_to_gamma1102sage: A = matrix(ZZ, 2, lift_gen_to_gamma1(9, 8)); A103[441 62]104[ 64 9]105sage: A.change_ring(Zmod(9))106[0 8]107[1 0]108sage: A.change_ring(Zmod(8))109[1 6]110[0 1]111sage: type(lift_gen_to_gamma1(9, 8)[0])112<type 'sage.rings.integer.Integer'>113"""114return lift_to_gamma1([0,-1,1,0], m, n)115116def lift_uniformiser_odd(p, u, n):117r"""118Construct a matrix over `\ZZ` whose determinant is `p`, and which is119congruent to `\begin{pmatrix} 0 & -1 \\ p & 0 \end{pmatrix} \pmod{p^u}` and120to `\begin{pmatrix} p & 0 \\ 0 & 1\end{pmatrix} \pmod n`.121122This is required for the local components machinery in the "ramified" case123(when the exponent of `p` dividing the level is odd).124125EXAMPLE::126127sage: from sage.modular.local_comp.liftings import lift_uniformiser_odd128sage: lift_uniformiser_odd(3, 2, 11)129[432, 377, 165, 144]130sage: type(lift_uniformiser_odd(3, 2, 11)[0])131<type 'sage.rings.integer.Integer'>132"""133g = lift_gen_to_gamma1(p**u, n)134return [p*g[0], g[1], p*g[2], g[3]]135136137def lift_ramified(g, p, u, n):138r"""139Given four integers `a,b,c,d` with `p \mid c` and `ad - bc = 1 \pmod{p^u}`,140find `a',b',c',d'` congruent to `a,b,c,d \pmod{p^u}`, with `c' = c141\pmod{p^{u+1}}`, such that `a'd' - b'c'` is exactly 1, and `\begin{pmatrix}142a & b \\ c & d \end{pmatrix}` is in `\Gamma_1(n)`.143144Algorithm: Uses :func:`~lift_to_gamma1` to get a lifting modulo `p^u`, and145then adds an appropriate multiple of the top row to the bottom row in order146to get the bottom-left entry correct modulo `p^{u+1}`.147148EXAMPLE::149150sage: from sage.modular.local_comp.liftings import lift_ramified151sage: lift_ramified([2,2,3,2], 3, 1, 1)152[5, 8, 3, 5]153sage: lift_ramified([8,2,12,2], 3, 2, 23)154[323, 110, -133584, -45493]155sage: type(lift_ramified([8,2,12,2], 3, 2, 23)[0])156<type 'sage.rings.integer.Integer'>157"""158a,b,c,d = lift_to_gamma1(g, p**u, n)159r = crt( (c - g[2]) / p**u * inverse_mod(a, p), 0, p, n)160c = c - p**u * r * a161d = d - p**u * r * b162# assert (c - g[2]) % p**(u+1) == 0163return [a,b,c,d]164165166