Id: palomar/PALOMAR-2026-11-07-000011 Url: https://github.com/jtraverso/three-squares-gauss-legendre/tree/783ec66b0db2ff2acf75cc2cd22a9e69737411b5 Json: https://data.palomar-registry.org/entries/PALOMAR-2026-11-07-000011-v1.json Repo: https://github.com/jtraverso/three-squares-gauss-legendre Tags: math.NT, msc:11E25, msc:11D85, msc:11H06 Score: 0 Title: The three squares theorem (Gauss–Legendre) Trust: high Domain: math.NT Source: palomar Authors: Juan Pablo Traverso Gianini Reviews: 0 Subject: math.NT Category: research Comments: 0 Disputed: false Division: math Mentions: 0 Verified: true Discussed: 0 Published: 2026-11-07 Formalized: true Formalizes: title=Disquisitiones Arithmeticae identifier= relationship=formalizes Page: https://delphi.science/r/palomar/PALOMAR-2026-11-07-000011 A Lean 4 / Mathlib proof of the three squares theorem of Legendre (1798) and Gauss (1801): a natural number is a sum of three squares if and only if it is not of the form 4^a (8 b + 7) (sum_three_sq_iff), with the corollary that every n ≡ 3 (mod 8) is x₀² + x₁² + x₂² for some x : Fin 3 → ℤ (exists_sum_sq_of_mod_eight_eq_three). The proof uses ternary quadratic forms of determinant one: a positive definite integral ternary form of determinant one is equivalent to x² + y² + z² (proved with Minkowski's convex body theorem), and for n ≢ 0 (mod 4), n ≢ 7 (mod 8) such a form with diagonal entry n…