Beispiel #1
0
def supersingular_D(prime):
    r"""
    This function returns a fundamental discriminant `D` of an
    imaginary quadratic field, where the given prime does not split
    (see Silverman's Advanced Topics in the Arithmetic of Elliptic
    Curves, page 184, exercise 2.30(d).)

    INPUT:

    - prime -- integer, prime

    OUTPUT:
        D -- integer, negative

    EXAMPLES:

    These examples return *supersingular discriminants* for 7,
    15073 and 83401::

        sage: supersingular_D(7)
        -4

        sage: supersingular_D(15073)
        -15

        sage: supersingular_D(83401)
        -7

    AUTHORS:

    - David Kohel - [email protected]

    - Iftikhar Burhanuddin - [email protected]
    """
    if not (rings.Integer(prime).is_prime()):
        raise ValueError("%s is not a prime" % prime)

    # Making picking D more intelligent
    D = -1
    while True:
        Dmod4 = rings.Mod(D, 4)
        if Dmod4 in (0, 1) and (rings.kronecker(D, prime) != 1):
            return D
        D = D - 1
Beispiel #2
0
def supersingular_D(prime):
    r"""
    This function returns a fundamental discriminant `D` of an
    imaginary quadratic field, where the given prime does not split
    (see Silverman's Advanced Topics in the Arithmetic of Elliptic
    Curves, page 184, exercise 2.30(d).)

    INPUT:

    - prime -- integer, prime

    OUTPUT:
        D -- integer, negative

    EXAMPLES:

    These examples return *supersingular discriminants* for 7,
    15073 and 83401::

        sage: supersingular_D(7)
        -4

        sage: supersingular_D(15073)
        -15

        sage: supersingular_D(83401)
        -7

    AUTHORS:

    - David Kohel - [email protected]

    - Iftikhar Burhanuddin - [email protected]
    """
    if not (rings.Integer(prime).is_prime()):
        raise ValueError("%s is not a prime" % prime)

    #Making picking D more intelligent
    D = -1
    while True:
        Dmod4 = rings.Mod(D, 4)
        if Dmod4 in (0, 1) and (rings.kronecker(D, prime) != 1):
            return D
        D = D - 1
Beispiel #3
0
def supersingular_j(FF):
    r"""
    This function returns a supersingular j-invariant over the finite
    field FF.

    INPUT:

    - ``FF``  -- finite field with p^2 elements, where p is a prime number

    OUTPUT:
       finite field element -- a supersingular j-invariant
       defined over the finite field FF

    EXAMPLES:

    The following examples calculate supersingular j-invariants for a
    few finite fields::

        sage: supersingular_j(GF(7^2, 'a'))
        6

    Observe that in this example the j-invariant is not defined over
    the prime field::

        sage: supersingular_j(GF(15073^2,'a'))  # optional - database
        10630*a + 6033

        sage: supersingular_j(GF(83401^2, 'a'))
        67977

    AUTHORS:

    - David Kohel -- [email protected]

    - Iftikhar Burhanuddin -- [email protected]
    """
    if not (FF.is_field()) or not (FF.is_finite()):
        raise ValueError("%s is not a finite field" % FF)
    prime = FF.characteristic()
    if not (rings.Integer(prime).is_prime()):
        raise ValueError("%s is not a prime" % prime)
    if not (rings.Integer(FF.cardinality())) == rings.Integer(prime ** 2):
        raise ValueError("%s is not a quadratic extension" % FF)
    if rings.kronecker(-1, prime) != 1:
        j_invss = 1728  # (2^2 * 3)^3
    elif rings.kronecker(-2, prime) != 1:
        j_invss = 8000  # (2^2 * 5)^3
    elif rings.kronecker(-3, prime) != 1:
        j_invss = 0  # 0^3
    elif rings.kronecker(-7, prime) != 1:
        j_invss = 16581375  # (3 * 5 * 17)^3
    elif rings.kronecker(-11, prime) != 1:
        j_invss = -32768  # -(2^5)^3
    elif rings.kronecker(-19, prime) != 1:
        j_invss = -884736  # -(2^5 * 3)^3
    elif rings.kronecker(-43, prime) != 1:
        j_invss = -884736000  # -(2^6 * 3 * 5)^3
    elif rings.kronecker(-67, prime) != 1:
        j_invss = -147197952000  # -(2^5 * 3 * 5 * 11)^3
    elif rings.kronecker(-163, prime) != 1:
        j_invss = -262537412640768000  # -(2^6 * 3 * 5 * 23 * 29)^3
    else:
        D = supersingular_D(prime)
        DBCP = HilbertClassPolynomialDatabase()
        hc_poly = FF["x"](DBCP[D])
        root_hc_poly_list = list(hc_poly.roots())

        j_invss = root_hc_poly_list[0][0]
    return FF(j_invss)
Beispiel #4
0
def supersingular_j(FF):
    r"""
    This function returns a supersingular j-invariant over the finite
    field FF.

    INPUT:

    - ``FF``  -- finite field with p^2 elements, where p is a prime number

    OUTPUT:
       finite field element -- a supersingular j-invariant
       defined over the finite field FF

    EXAMPLES:

    The following examples calculate supersingular j-invariants for a
    few finite fields::

        sage: supersingular_j(GF(7^2, 'a'))
        6

    Observe that in this example the j-invariant is not defined over
    the prime field::

        sage: supersingular_j(GF(15073^2,'a'))  # optional - database
        10630*a + 6033

        sage: supersingular_j(GF(83401^2, 'a'))
        67977

    AUTHORS:

    - David Kohel -- [email protected]

    - Iftikhar Burhanuddin -- [email protected]
    """
    if not (FF.is_field()) or not (FF.is_finite()):
        raise ValueError("%s is not a finite field" % FF)
    prime = FF.characteristic()
    if not (rings.Integer(prime).is_prime()):
        raise ValueError("%s is not a prime" % prime)
    if not (rings.Integer(FF.cardinality())) == rings.Integer(prime**2):
        raise ValueError("%s is not a quadratic extension" % FF)
    if rings.kronecker(-1, prime) != 1:
        j_invss = 1728  #(2^2 * 3)^3
    elif rings.kronecker(-2, prime) != 1:
        j_invss = 8000  #(2^2 * 5)^3
    elif rings.kronecker(-3, prime) != 1:
        j_invss = 0  #0^3
    elif rings.kronecker(-7, prime) != 1:
        j_invss = 16581375  #(3 * 5 * 17)^3
    elif rings.kronecker(-11, prime) != 1:
        j_invss = -32768  #-(2^5)^3
    elif rings.kronecker(-19, prime) != 1:
        j_invss = -884736  #-(2^5 * 3)^3
    elif rings.kronecker(-43, prime) != 1:
        j_invss = -884736000  #-(2^6 * 3 * 5)^3
    elif rings.kronecker(-67, prime) != 1:
        j_invss = -147197952000  #-(2^5 * 3 * 5 * 11)^3
    elif rings.kronecker(-163, prime) != 1:
        j_invss = -262537412640768000  #-(2^6 * 3 * 5 * 23 * 29)^3
    else:
        D = supersingular_D(prime)
        DBCP = HilbertClassPolynomialDatabase()
        hc_poly = FF['x'](DBCP[D])
        root_hc_poly_list = list(hc_poly.roots())

        j_invss = root_hc_poly_list[0][0]
    return FF(j_invss)