Metamath Proof Explorer


Theorem 4sqlem4

Description: Lemma for 4sq . We can express the four-square property more compactly in terms of gaussian integers, because the norms of gaussian integers are exactly sums of two squares. (Contributed by Mario Carneiro, 14-Jul-2014)

Ref Expression
Hypothesis 4sq.1 S=n|xyzwn=x2+y2+z2+w2
Assertion 4sqlem4 ASuiviA=u2+v2

Proof

Step Hyp Ref Expression
1 4sq.1 S=n|xyzwn=x2+y2+z2+w2
2 1 4sqlem2 ASabcdA=a2+b2+c2+d2
3 gzreim aba+ibi
4 3 adantr abcda+ibi
5 gzreim cdc+idi
6 5 adantl abcdc+idi
7 gzcn a+ibia+ib
8 3 7 syl aba+ib
9 8 absvalsq2d aba+ib2=a+ib2+a+ib2
10 zre aa
11 zre bb
12 crre aba+ib=a
13 10 11 12 syl2an aba+ib=a
14 13 oveq1d aba+ib2=a2
15 crim aba+ib=b
16 10 11 15 syl2an aba+ib=b
17 16 oveq1d aba+ib2=b2
18 14 17 oveq12d aba+ib2+a+ib2=a2+b2
19 9 18 eqtrd aba+ib2=a2+b2
20 gzcn c+idic+id
21 5 20 syl cdc+id
22 21 absvalsq2d cdc+id2=c+id2+c+id2
23 zre cc
24 zre dd
25 crre cdc+id=c
26 23 24 25 syl2an cdc+id=c
27 26 oveq1d cdc+id2=c2
28 crim cdc+id=d
29 23 24 28 syl2an cdc+id=d
30 29 oveq1d cdc+id2=d2
31 27 30 oveq12d cdc+id2+c+id2=c2+d2
32 22 31 eqtrd cdc+id2=c2+d2
33 19 32 oveqan12d abcda+ib2+c+id2=a2+b2+c2+d2
34 33 eqcomd abcda2+b2+c2+d2=a+ib2+c+id2
35 fveq2 u=a+ibu=a+ib
36 35 oveq1d u=a+ibu2=a+ib2
37 36 oveq1d u=a+ibu2+v2=a+ib2+v2
38 37 eqeq2d u=a+iba2+b2+c2+d2=u2+v2a2+b2+c2+d2=a+ib2+v2
39 fveq2 v=c+idv=c+id
40 39 oveq1d v=c+idv2=c+id2
41 40 oveq2d v=c+ida+ib2+v2=a+ib2+c+id2
42 41 eqeq2d v=c+ida2+b2+c2+d2=a+ib2+v2a2+b2+c2+d2=a+ib2+c+id2
43 38 42 rspc2ev a+ibic+idia2+b2+c2+d2=a+ib2+c+id2uivia2+b2+c2+d2=u2+v2
44 4 6 34 43 syl3anc abcduivia2+b2+c2+d2=u2+v2
45 eqeq1 A=a2+b2+c2+d2A=u2+v2a2+b2+c2+d2=u2+v2
46 45 2rexbidv A=a2+b2+c2+d2uiviA=u2+v2uivia2+b2+c2+d2=u2+v2
47 44 46 syl5ibrcom abcdA=a2+b2+c2+d2uiviA=u2+v2
48 47 rexlimdvva abcdA=a2+b2+c2+d2uiviA=u2+v2
49 48 rexlimivv abcdA=a2+b2+c2+d2uiviA=u2+v2
50 2 49 sylbi ASuiviA=u2+v2
51 1 4sqlem4a uiviu2+v2S
52 eleq1a u2+v2SA=u2+v2AS
53 51 52 syl uiviA=u2+v2AS
54 53 rexlimivv uiviA=u2+v2AS
55 50 54 impbii ASuiviA=u2+v2