If the congruence has a solution we say that is a quadratic residue. If the congruence has no solution we say that is a quadratic nonresidue, see definition in [ApostolNT] p. 178. The Legendre symbol is defined in a way that its value is if is a quadratic residue and if is a quadratic nonresidue (and if divides ), see lgsqr.
Originally, the Legendre symbol was defined for odd primes only (and arbitrary integers ) by Adrien-Marie Legendre in 1798, see definition in [ApostolNT] p. 179. It was generalized to be defined for any positive odd integer by Carl Gustav Jacob Jacobi in 1837 (therefore called "Jacobi symbol" since then), see definition in [ApostolNT] p. 188. Finally, it was generalized to be defined for any integer by Leopold Kronecker in 1885 (therefore called "Kronecker symbol" since then). The definition df-lgs for the "Legendre symbol" is actually the definition of the "Kronecker symbol". Since only one definition (and one class symbol) are provided in set.mm, the names "Legendre symbol", "Jacobi symbol" and "Kronecker symbol" are used synonymously for , but mostly it is called "Legendre symbol", even if it is used in the context of a "Jacobi symbol" or "Kronecker symbol".