Metamath Proof Explorer


Theorem 2sqreunnltb

Description: There exists a unique decomposition of a prime as a sum of squares of two different positive integers iff the prime is of the form 4 k + 1 . (Contributed by AV, 11-Jun-2023) The prime needs not be odd, as observed by WL. (Revised by AV, 25-Jun-2023)

Ref Expression
Hypothesis 2sqreult.1 ( 𝜑 ↔ ( 𝑎 < 𝑏 ∧ ( ( 𝑎 ↑ 2 ) + ( 𝑏 ↑ 2 ) ) = 𝑃 ) )
Assertion 2sqreunnltb ( 𝑃 ∈ ℙ → ( ( 𝑃 mod 4 ) = 1 ↔ ( ∃! 𝑎 ∈ ℕ ∃ 𝑏 ∈ ℕ 𝜑 ∧ ∃! 𝑏 ∈ ℕ ∃ 𝑎 ∈ ℕ 𝜑 ) ) )

Proof

Step Hyp Ref Expression
1 2sqreult.1 ( 𝜑 ↔ ( 𝑎 < 𝑏 ∧ ( ( 𝑎 ↑ 2 ) + ( 𝑏 ↑ 2 ) ) = 𝑃 ) )
2 2sqreunnltblem ( 𝑃 ∈ ℙ → ( ( 𝑃 mod 4 ) = 1 ↔ ∃! 𝑎 ∈ ℕ ∃! 𝑏 ∈ ℕ ( 𝑎 < 𝑏 ∧ ( ( 𝑎 ↑ 2 ) + ( 𝑏 ↑ 2 ) ) = 𝑃 ) ) )
3 1 bicomi ( ( 𝑎 < 𝑏 ∧ ( ( 𝑎 ↑ 2 ) + ( 𝑏 ↑ 2 ) ) = 𝑃 ) ↔ 𝜑 )
4 3 reubii ( ∃! 𝑏 ∈ ℕ ( 𝑎 < 𝑏 ∧ ( ( 𝑎 ↑ 2 ) + ( 𝑏 ↑ 2 ) ) = 𝑃 ) ↔ ∃! 𝑏 ∈ ℕ 𝜑 )
5 4 reubii ( ∃! 𝑎 ∈ ℕ ∃! 𝑏 ∈ ℕ ( 𝑎 < 𝑏 ∧ ( ( 𝑎 ↑ 2 ) + ( 𝑏 ↑ 2 ) ) = 𝑃 ) ↔ ∃! 𝑎 ∈ ℕ ∃! 𝑏 ∈ ℕ 𝜑 )
6 1 2sqreunnlem2 𝑎 ∈ ℕ ∃* 𝑏 ∈ ℕ 𝜑
7 2reu1 ( ∀ 𝑎 ∈ ℕ ∃* 𝑏 ∈ ℕ 𝜑 → ( ∃! 𝑎 ∈ ℕ ∃! 𝑏 ∈ ℕ 𝜑 ↔ ( ∃! 𝑎 ∈ ℕ ∃ 𝑏 ∈ ℕ 𝜑 ∧ ∃! 𝑏 ∈ ℕ ∃ 𝑎 ∈ ℕ 𝜑 ) ) )
8 6 7 ax-mp ( ∃! 𝑎 ∈ ℕ ∃! 𝑏 ∈ ℕ 𝜑 ↔ ( ∃! 𝑎 ∈ ℕ ∃ 𝑏 ∈ ℕ 𝜑 ∧ ∃! 𝑏 ∈ ℕ ∃ 𝑎 ∈ ℕ 𝜑 ) )
9 5 8 bitri ( ∃! 𝑎 ∈ ℕ ∃! 𝑏 ∈ ℕ ( 𝑎 < 𝑏 ∧ ( ( 𝑎 ↑ 2 ) + ( 𝑏 ↑ 2 ) ) = 𝑃 ) ↔ ( ∃! 𝑎 ∈ ℕ ∃ 𝑏 ∈ ℕ 𝜑 ∧ ∃! 𝑏 ∈ ℕ ∃ 𝑎 ∈ ℕ 𝜑 ) )
10 2 9 bitrdi ( 𝑃 ∈ ℙ → ( ( 𝑃 mod 4 ) = 1 ↔ ( ∃! 𝑎 ∈ ℕ ∃ 𝑏 ∈ ℕ 𝜑 ∧ ∃! 𝑏 ∈ ℕ ∃ 𝑎 ∈ ℕ 𝜑 ) ) )