Metamath Proof Explorer


Theorem 2sqreuopltb

Description: There exists a unique decomposition of a prime as a sum of squares of two different nonnegative integers iff P == 1 (mod 4). Ordered pair variant of 2sqreultb . (Contributed by AV, 3-Jul-2023)

Ref Expression
Assertion 2sqreuopltb PPmod4=1∃!p0×01stp<2ndp1stp2+2ndp2=P

Proof

Step Hyp Ref Expression
1 biid a<ba2+b2=Pa<ba2+b2=P
2 1 2sqreultb PPmod4=1∃!a0b0a<ba2+b2=P∃!b0a0a<ba2+b2=P
3 fveq2 p=ab1stp=1stab
4 fveq2 p=ab2ndp=2ndab
5 3 4 breq12d p=ab1stp<2ndp1stab<2ndab
6 vex aV
7 vex bV
8 6 7 op1st 1stab=a
9 6 7 op2nd 2ndab=b
10 8 9 breq12i 1stab<2ndaba<b
11 5 10 bitrdi p=ab1stp<2ndpa<b
12 6 7 op1std p=ab1stp=a
13 12 oveq1d p=ab1stp2=a2
14 6 7 op2ndd p=ab2ndp=b
15 14 oveq1d p=ab2ndp2=b2
16 13 15 oveq12d p=ab1stp2+2ndp2=a2+b2
17 16 eqeq1d p=ab1stp2+2ndp2=Pa2+b2=P
18 11 17 anbi12d p=ab1stp<2ndp1stp2+2ndp2=Pa<ba2+b2=P
19 18 opreu2reurex ∃!p0×01stp<2ndp1stp2+2ndp2=P∃!a0b0a<ba2+b2=P∃!b0a0a<ba2+b2=P
20 2 19 bitr4di PPmod4=1∃!p0×01stp<2ndp1stp2+2ndp2=P