Metamath Proof Explorer


Theorem 2sqnn

Description: All primes of the form 4 k + 1 are sums of squares of two positive integers. (Contributed by AV, 11-Jun-2023)

Ref Expression
Assertion 2sqnn PPmod4=1xyP=x2+y2

Proof

Step Hyp Ref Expression
1 2sqnn0 PPmod4=1a0b0P=a2+b2
2 elnn0 a0aa=0
3 elnn0 b0bb=0
4 oveq1 x=ax2=a2
5 4 oveq1d x=ax2+y2=a2+y2
6 5 eqeq2d x=aP=x2+y2P=a2+y2
7 oveq1 y=by2=b2
8 7 oveq2d y=ba2+y2=a2+b2
9 8 eqeq2d y=bP=a2+y2P=a2+b2
10 6 9 rspc2ev abP=a2+b2xyP=x2+y2
11 10 3expia abP=a2+b2xyP=x2+y2
12 11 a1d abPP=a2+b2xyP=x2+y2
13 12 expcom baPP=a2+b2xyP=x2+y2
14 sq0i a=0a2=0
15 14 adantr a=0ba2=0
16 15 oveq1d a=0ba2+b2=0+b2
17 nncn bb
18 17 sqcld bb2
19 18 addlidd b0+b2=b2
20 19 adantl a=0b0+b2=b2
21 16 20 eqtrd a=0ba2+b2=b2
22 21 eqeq2d a=0bP=a2+b2P=b2
23 eleq1 P=b2Pb2
24 23 adantl bP=b2Pb2
25 nnz bb
26 sqnprm b¬b2
27 25 26 syl b¬b2
28 27 pm2.21d bb2xyP=x2+y2
29 28 adantr bP=b2b2xyP=x2+y2
30 24 29 sylbid bP=b2PxyP=x2+y2
31 30 ex bP=b2PxyP=x2+y2
32 31 adantl a=0bP=b2PxyP=x2+y2
33 22 32 sylbid a=0bP=a2+b2PxyP=x2+y2
34 33 com23 a=0bPP=a2+b2xyP=x2+y2
35 34 expcom ba=0PP=a2+b2xyP=x2+y2
36 13 35 jaod baa=0PP=a2+b2xyP=x2+y2
37 sq0i b=0b2=0
38 37 adantr b=0ab2=0
39 38 oveq2d b=0aa2+b2=a2+0
40 nncn aa
41 40 sqcld aa2
42 41 addridd aa2+0=a2
43 42 adantl b=0aa2+0=a2
44 39 43 eqtrd b=0aa2+b2=a2
45 44 eqeq2d b=0aP=a2+b2P=a2
46 eleq1 P=a2Pa2
47 46 adantl aP=a2Pa2
48 nnz aa
49 sqnprm a¬a2
50 48 49 syl a¬a2
51 50 pm2.21d aa2xyP=x2+y2
52 51 adantr aP=a2a2xyP=x2+y2
53 47 52 sylbid aP=a2PxyP=x2+y2
54 53 ex aP=a2PxyP=x2+y2
55 54 adantl b=0aP=a2PxyP=x2+y2
56 45 55 sylbid b=0aP=a2+b2PxyP=x2+y2
57 56 com23 b=0aPP=a2+b2xyP=x2+y2
58 57 ex b=0aPP=a2+b2xyP=x2+y2
59 14 37 oveqan12rd b=0a=0a2+b2=0+0
60 00id 0+0=0
61 59 60 eqtrdi b=0a=0a2+b2=0
62 61 eqeq2d b=0a=0P=a2+b2P=0
63 eleq1 P=0P0
64 0nprm ¬0
65 64 pm2.21i 0xyP=x2+y2
66 63 65 syl6bi P=0PxyP=x2+y2
67 62 66 syl6bi b=0a=0P=a2+b2PxyP=x2+y2
68 67 com23 b=0a=0PP=a2+b2xyP=x2+y2
69 68 ex b=0a=0PP=a2+b2xyP=x2+y2
70 58 69 jaod b=0aa=0PP=a2+b2xyP=x2+y2
71 36 70 jaoi bb=0aa=0PP=a2+b2xyP=x2+y2
72 3 71 sylbi b0aa=0PP=a2+b2xyP=x2+y2
73 72 com12 aa=0b0PP=a2+b2xyP=x2+y2
74 2 73 sylbi a0b0PP=a2+b2xyP=x2+y2
75 74 imp a0b0PP=a2+b2xyP=x2+y2
76 75 com12 Pa0b0P=a2+b2xyP=x2+y2
77 76 adantr PPmod4=1a0b0P=a2+b2xyP=x2+y2
78 77 rexlimdvv PPmod4=1a0b0P=a2+b2xyP=x2+y2
79 1 78 mpd PPmod4=1xyP=x2+y2