(m, f, g, h, s, t, K)
return G, H, S, T
One step in Hensel lifting in `Z[x]`.

    Given positive integer `m` and `Z[x]` polynomials `f`, `g`, `h`, `s`
    and `t` such that::

        f == g*h (mod m)
        s*g + t*h == 1 (mod m)

        lc(f) is not a zero divisor (mod m)
        lc(h) == 1

        deg(f) == deg(g) + deg(h)
        deg(s) < deg(h)
        deg(t) < deg(g)

    returns polynomials `G`, `H`, `S` and `T`, such that::

        f == G*H (mod m**2)
        S*G + T**H == 1 (mod m**2)

    References
    ==========

    1. [Gathen99]_
One step in Hensel lifting in `Z[x]`.
One step in Hensel lifting in Z [ x ] .
def dup_zz_hensel_step(m, f, g, h, s, t, K):
    """
    One step in Hensel lifting in `Z[x]`.

    Given positive integer `m` and `Z[x]` polynomials `f`, `g`, `h`, `s`
    and `t` such that::

        f == g*h (mod m)
        s*g + t*h == 1 (mod m)

        lc(f) is not a zero divisor (mod m)
        lc(h) == 1

        deg(f) == deg(g) + deg(h)
        deg(s) < deg(h)
        deg(t) < deg(g)

    returns polynomials `G`, `H`, `S` and `T`, such that::

        f == G*H (mod m**2)
        S*G + T**H == 1 (mod m**2)

    References
    ==========

    1. [Gathen99]_

    """
    M = m**2

    e = dup_sub_mul(f, g, h, K)
    e = dup_trunc(e, M, K)

    q, r = dup_div(dup_mul(s, e, K), h, K)

    q = dup_trunc(q, M, K)
    r = dup_trunc(r, M, K)

    u = dup_add(dup_mul(t, e, K), dup_mul(q, g, K), K)
    G = dup_trunc(dup_add(g, u, K), M, K)
    H = dup_trunc(dup_add(h, r, K), M, K)

    u = dup_add(dup_mul(s, G, K), dup_mul(t, H, K), K)
    b = dup_trunc(dup_sub(u, [K.one], K), M, K)

    c, d = dup_div(dup_mul(s, b, K), H, K)

    c = dup_trunc(c, M, K)
    d = dup_trunc(d, M, K)

    u = dup_add(dup_mul(t, b, K), dup_mul(c, G, K), K)
    S = dup_trunc(dup_sub(s, d, K), M, K)
    T = dup_trunc(dup_sub(t, u, K), M, K)

    return G, H, S, T
def dup_zz_hensel_step ( m , f , g , h , s , t , K ) : M = m ** 2 e = dup_sub_mul ( f , g , h , K ) e = dup_trunc ( e , M , K ) q , r = dup_div ( dup_mul ( s , e , K ) , h , K ) q = dup_trunc ( q , M , K ) r = dup_trunc ( r , M , K ) u = dup_add ( dup_mul ( t , e , K ) , dup_mul ( q , g , K ) , K ) G = dup_trunc ( dup_add ( g , u , K ) , M , K ) H = dup_trunc ( dup_add ( h , r , K ) , M , K ) u = dup_add ( dup_mul ( s , G , K ) , dup_mul ( t , H , K ) , K ) b = dup_trunc ( dup_sub ( u , [ K . one ] , K ) , M , K ) c , d = dup_div ( dup_mul ( s , b , K ) , H , K ) c = dup_trunc ( c , M , K ) d = dup_trunc ( d , M , K ) u = dup_add ( dup_mul ( t , b , K ) , dup_mul ( c , G , K ) , K ) S = dup_trunc ( dup_sub ( s , d , K ) , M , K ) T = dup_trunc ( dup_sub ( t , u , K ) , M , K ) return G , H , S , T