Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

An explicit one-parameter family of solutions

Proved
EqualTwoSquares.explicit_family_identity

by Yuxuan Xu · Sep 26, 2026 · Mathlib 0df444a (Lean v4.33.1)

number-theorypolynomial-identitiessums-of-squares

For every integer n, 1^2 + (n^2 - n + 1)^2 = (2n - 1)^2 + (n^2 - n - 1)^2. No positivity or size hypothesis is imposed on n: the identity is a polynomial identity in n.

Preamble
import Mathlib
Formal statement
namespace EqualTwoSquares

/-- Objective 2, equality part: the explicit one-parameter family, valid for every integer n. -/
theorem explicit_family_identity (n : ℤ) :
    (1 : ℤ)^2 + (n^2 - n + 1)^2 = (2 * n - 1)^2 + (n^2 - n - 1)^2 := by sorry

end EqualTwoSquares
Source
Mission target; machine-checked locally in examples/two-squares/Family.lean.
Read-back

What the Lean code literally says, in plain math · independent-agent

Read-back: explicit_family_identity

Declared in namespace EqualTwoSquares (file items/explicit_family_identity.lean); the name agrees with the file name. Its own doc line reads "Objective 2, equality part: the explicit one-parameter family, valid for every integer n."

What the declaration literally says

For every integer n∈Zn \in \mathbb{Z}n∈Z, writing A=n2−nA = n^2 - nA=n2−n, the following equality of sums of two squares holds:

12+(A+1)2  =  (2n−1)2+(A−1)2,1^2 + (A + 1)^2 \;=\; (2n - 1)^2 + (A - 1)^2 ,12+(A+1)2=(2n−1)2+(A−1)2,

that is, explicitly,

12+(n2−n+1)2  =  (2n−1)2+(n2−n−1)2.1^2 + (n^2 - n + 1)^2 \;=\; (2n - 1)^2 + (n^2 - n - 1)^2 .12+(n2−n+1)2=(2n−1)2+(n2−n−1)2.

The single integer parameter nnn is an explicit argument and is completely unrestricted: no positivity, no lower bound, no distinctness and no coprimality is required. The quadruple of entries involved is (a,b,c,d)=(1,  n2−n+1,  2n−1,  n2−n−1)(a,b,c,d) = (1,\; n^2-n+1,\; 2n-1,\; n^2-n-1)(a,b,c,d)=(1,n2−n+1,2n−1,n2−n−1), with (1,n2−n+1)(1, n^2-n+1)(1,n2−n+1) on the left of the equality of sums of squares and (2n−1,n2−n−1)(2n-1, n^2-n-1)(2n−1,n2−n−1) on the right.

Degenerate and edge cases silently covered: n=0n = 0n=0 gives 12+12=(−1)2+(−1)21^2 + 1^2 = (-1)^2 + (-1)^212+12=(−1)2+(−1)2, i.e. 2=22 = 22=2; n=1n = 1n=1 gives 12+12=12+(−1)21^2 + 1^2 = 1^2 + (-1)^212+12=12+(−1)2; negative nnn (e.g. n=−1n = -1n=−1: 12+32=(−3)2+121^2 + 3^2 = (-3)^2 + 1^212+32=(−3)2+12, i.e. 10=1010 = 1010=10); and repeated entries (for n=0n=0n=0 and n=1n=1n=1 several of the four entries coincide). The claim is asserted for all of them.

Expanding both sides confirms it: with A=n2−nA = n^2-nA=n2−n the left side is 1+(A+1)2=A2+2A+21 + (A+1)^2 = A^2 + 2A + 21+(A+1)2=A2+2A+2, while the right side is (2n−1)2+(A−1)2=4n2−4n+1+A2−2A+1=A2−2A+2+4A=A2+2A+2(2n-1)^2 + (A-1)^2 = 4n^2-4n+1 + A^2 - 2A + 1 = A^2 - 2A + 2 + 4A = A^2 + 2A + 2(2n−1)2+(A−1)2=4n2−4n+1+A2−2A+1=A2−2A+2+4A=A2+2A+2, using 4A=4n2−4n4A = 4n^2 - 4n4A=4n2−4n.

Audit notes

  • Truth. Verified algebraically (above) and numerically for every integer nnn with ∣n∣≤300|n| \le 300∣n∣≤300; no counterexample. TRUE.
  • Faithfulness. Name matches file name; the doc line's "valid for every integer n" corresponds exactly to the unrestricted parameter (n:Z)(n : \mathbb{Z})(n:Z); the equality asserted is exactly the family identity. All variables bound.
  • Trivializing premise. None: no hypotheses.
  • Satisfiability. No hypothesis; instantly non-vacuous and non-trivial (e.g. n=4n=4n=4: 12+132=72+112=1701^2+13^2 = 7^2+11^2 = 17012+132=72+112=170).
  • Elaboration. Included in statements/All.lean; elaborates with only the expected declaration uses 'sorry' warning.

FAITHFUL

Human review
  • Endorsed by Shuze Chen · Sep 26, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Yuxuan Xu · Sep 26, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me