Metamath Proof Explorer


Theorem 4sq

Description: Lagrange's four-square theorem, or Bachet's conjecture: every nonnegative integer is expressible as a sum of four squares. This is Metamath 100 proof #19. (Contributed by Mario Carneiro, 16-Jul-2014)

Ref Expression
Assertion 4sq A0abcdA=a2+b2+c2+d2

Proof

Step Hyp Ref Expression
1 eqeq1 m=nm=x2+y2+z2+w2n=x2+y2+z2+w2
2 1 2rexbidv m=nzwm=x2+y2+z2+w2zwn=x2+y2+z2+w2
3 2 2rexbidv m=nxyzwm=x2+y2+z2+w2xyzwn=x2+y2+z2+w2
4 3 cbvabv m|xyzwm=x2+y2+z2+w2=n|xyzwn=x2+y2+z2+w2
5 4 4sqlem19 0=m|xyzwm=x2+y2+z2+w2
6 5 4sqlem2 A0abcdA=a2+b2+c2+d2