Metamath Proof Explorer


Theorem 2sqreultb

Description: There exists a unique decomposition of a prime as a sum of squares of two different nonnegative integers iff P == 1 (mod 4). (Contributed by AV, 10-Jun-2023) The prime needs not be odd, as observed by WL. (Revised by AV, 25-Jun-2023)

Ref Expression
Hypothesis 2sqreult.1 φa<ba2+b2=P
Assertion 2sqreultb PPmod4=1∃!a0b0φ∃!b0a0φ

Proof

Step Hyp Ref Expression
1 2sqreult.1 φa<ba2+b2=P
2 2sqreultblem PPmod4=1∃!a0∃!b0a<ba2+b2=P
3 1 bicomi a<ba2+b2=Pφ
4 3 reubii ∃!b0a<ba2+b2=P∃!b0φ
5 4 reubii ∃!a0∃!b0a<ba2+b2=P∃!a0∃!b0φ
6 5 a1i P∃!a0∃!b0a<ba2+b2=P∃!a0∃!b0φ
7 1 2sqreulem4 a0*b0φ
8 2reu1 a0*b0φ∃!a0∃!b0φ∃!a0b0φ∃!b0a0φ
9 7 8 mp1i P∃!a0∃!b0φ∃!a0b0φ∃!b0a0φ
10 2 6 9 3bitrd PPmod4=1∃!a0b0φ∃!b0a0φ