The second supplementary law of quadratic reciprocity
ProvedFamousTheorems.second_supplementary_law_qrThe second supplementary law of quadratic reciprocity. Let be an odd prime. Then is a square modulo if and only if .
Equivalently, . Together with quadratic reciprocity and the first supplementary law, it lets one compute any Legendre symbol. It also gives facts such as the primality test for when and is prime.
Formalization note. Mathlib's ZMod.exists_sq_eq_two_iff. IsSquare (2 : ZMod p) says that is a square in .
Preamble
import Mathlib
Formal statement
namespace FamousTheorems
theorem second_supplementary_law_qr {p : ℕ} [Fact p.Prime] (hp : p ≠ 2) : IsSquare (2 : ZMod p) ↔ p % 8 = 1 ∨ p % 8 = 7 := by sorry
end FamousTheoremsSource
Listed in Mathlib's curated theorem manifests (docs/1000.yaml); formalized in Mathlib as `ZMod.exists_sq_eq_two_iff`. Proof here reduces to that Mathlib result.