Metamath Proof Explorer


Theorem 2sqreult

Description: There exists a unique decomposition of a prime as a sum of squares of two different nonnegative integers. (Contributed by AV, 8-Jun-2023) (Proposed by GL, 8-Jun-2023.) (Revised by AV, 25-Jun-2023)

Ref Expression
Hypothesis 2sqreult.1
|- ( ph <-> ( a < b /\ ( ( a ^ 2 ) + ( b ^ 2 ) ) = P ) )
Assertion 2sqreult
|- ( ( P e. Prime /\ ( P mod 4 ) = 1 ) -> ( E! a e. NN0 E. b e. NN0 ph /\ E! b e. NN0 E. a e. NN0 ph ) )

Proof

Step Hyp Ref Expression
1 2sqreult.1
 |-  ( ph <-> ( a < b /\ ( ( a ^ 2 ) + ( b ^ 2 ) ) = P ) )
2 2sqreultlem
 |-  ( ( P e. Prime /\ ( P mod 4 ) = 1 ) -> E! a e. NN0 E! b e. NN0 ( a < b /\ ( ( a ^ 2 ) + ( b ^ 2 ) ) = P ) )
3 1 bicomi
 |-  ( ( a < b /\ ( ( a ^ 2 ) + ( b ^ 2 ) ) = P ) <-> ph )
4 3 reubii
 |-  ( E! b e. NN0 ( a < b /\ ( ( a ^ 2 ) + ( b ^ 2 ) ) = P ) <-> E! b e. NN0 ph )
5 4 reubii
 |-  ( E! a e. NN0 E! b e. NN0 ( a < b /\ ( ( a ^ 2 ) + ( b ^ 2 ) ) = P ) <-> E! a e. NN0 E! b e. NN0 ph )
6 1 2sqreulem4
 |-  A. a e. NN0 E* b e. NN0 ph
7 2reu1
 |-  ( A. a e. NN0 E* b e. NN0 ph -> ( E! a e. NN0 E! b e. NN0 ph <-> ( E! a e. NN0 E. b e. NN0 ph /\ E! b e. NN0 E. a e. NN0 ph ) ) )
8 6 7 mp1i
 |-  ( ( P e. Prime /\ ( P mod 4 ) = 1 ) -> ( E! a e. NN0 E! b e. NN0 ph <-> ( E! a e. NN0 E. b e. NN0 ph /\ E! b e. NN0 E. a e. NN0 ph ) ) )
9 5 8 syl5bb
 |-  ( ( P e. Prime /\ ( P mod 4 ) = 1 ) -> ( E! a e. NN0 E! b e. NN0 ( a < b /\ ( ( a ^ 2 ) + ( b ^ 2 ) ) = P ) <-> ( E! a e. NN0 E. b e. NN0 ph /\ E! b e. NN0 E. a e. NN0 ph ) ) )
10 2 9 mpbid
 |-  ( ( P e. Prime /\ ( P mod 4 ) = 1 ) -> ( E! a e. NN0 E. b e. NN0 ph /\ E! b e. NN0 E. a e. NN0 ph ) )