Metamath Proof Explorer


Theorem 2sqreu

Description: There exists a unique decomposition of a prime of the form 4 k + 1 as a sum of squares of two nonnegative integers. See 2sqnn0 for the existence of such a decomposition. (Contributed by AV, 4-Jun-2023) (Revised by AV, 25-Jun-2023)

Ref Expression
Hypothesis 2sqreu.1
|- ( ph <-> ( a <_ b /\ ( ( a ^ 2 ) + ( b ^ 2 ) ) = P ) )
Assertion 2sqreu
|- ( ( 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 2sqreu.1
 |-  ( ph <-> ( a <_ b /\ ( ( a ^ 2 ) + ( b ^ 2 ) ) = P ) )
2 2sqreulem1
 |-  ( ( 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 ) )