Metamath Proof Explorer


Theorem 2sqcoprm

Description: If the sum of two squares is prime, the two original numbers are coprime. (Contributed by Thierry Arnoux, 2-Feb-2020)

Ref Expression
Hypotheses 2sqcoprm.1 φ P
2sqcoprm.2 φ A
2sqcoprm.3 φ B
2sqcoprm.4 φ A 2 + B 2 = P
Assertion 2sqcoprm φ A gcd B = 1

Proof

Step Hyp Ref Expression
1 2sqcoprm.1 φ P
2 2sqcoprm.2 φ A
3 2sqcoprm.3 φ B
4 2sqcoprm.4 φ A 2 + B 2 = P
5 1 2 3 4 2sqn0 φ A 0
6 2 3 gcdcld φ A gcd B 0
7 6 adantr φ A 0 A gcd B 0
8 2 adantr φ A 0 A
9 3 adantr φ A 0 B
10 simpr φ A 0 A 0
11 10 neneqd φ A 0 ¬ A = 0
12 11 intnanrd φ A 0 ¬ A = 0 B = 0
13 gcdn0cl A B ¬ A = 0 B = 0 A gcd B
14 8 9 12 13 syl21anc φ A 0 A gcd B
15 14 nnsqcld φ A 0 A gcd B 2
16 6 nn0zd φ A gcd B
17 sqnprm A gcd B ¬ A gcd B 2
18 16 17 syl φ ¬ A gcd B 2
19 zsqcl A gcd B A gcd B 2
20 16 19 syl φ A gcd B 2
21 zsqcl A A 2
22 2 21 syl φ A 2
23 zsqcl B B 2
24 3 23 syl φ B 2
25 gcddvds A B A gcd B A A gcd B B
26 2 3 25 syl2anc φ A gcd B A A gcd B B
27 26 simpld φ A gcd B A
28 dvdssqim A gcd B A A gcd B A A gcd B 2 A 2
29 28 imp A gcd B A A gcd B A A gcd B 2 A 2
30 16 2 27 29 syl21anc φ A gcd B 2 A 2
31 26 simprd φ A gcd B B
32 dvdssqim A gcd B B A gcd B B A gcd B 2 B 2
33 32 imp A gcd B B A gcd B B A gcd B 2 B 2
34 16 3 31 33 syl21anc φ A gcd B 2 B 2
35 20 22 24 30 34 dvds2addd φ A gcd B 2 A 2 + B 2
36 35 4 breqtrd φ A gcd B 2 P
37 36 adantr φ A gcd B 2 2 A gcd B 2 P
38 simpr φ A gcd B 2 2 A gcd B 2 2
39 1 adantr φ A gcd B 2 2 P
40 dvdsprm A gcd B 2 2 P A gcd B 2 P A gcd B 2 = P
41 38 39 40 syl2anc φ A gcd B 2 2 A gcd B 2 P A gcd B 2 = P
42 37 41 mpbid φ A gcd B 2 2 A gcd B 2 = P
43 42 39 eqeltrd φ A gcd B 2 2 A gcd B 2
44 18 43 mtand φ ¬ A gcd B 2 2
45 eluz2b3 A gcd B 2 2 A gcd B 2 A gcd B 2 1
46 44 45 sylnib φ ¬ A gcd B 2 A gcd B 2 1
47 imnan A gcd B 2 ¬ A gcd B 2 1 ¬ A gcd B 2 A gcd B 2 1
48 46 47 sylibr φ A gcd B 2 ¬ A gcd B 2 1
49 48 adantr φ A 0 A gcd B 2 ¬ A gcd B 2 1
50 15 49 mpd φ A 0 ¬ A gcd B 2 1
51 df-ne A gcd B 2 1 ¬ A gcd B 2 = 1
52 50 51 sylnib φ A 0 ¬ ¬ A gcd B 2 = 1
53 52 notnotrd φ A 0 A gcd B 2 = 1
54 nn0sqeq1 A gcd B 0 A gcd B 2 = 1 A gcd B = 1
55 7 53 54 syl2anc φ A 0 A gcd B = 1
56 5 55 mpdan φ A gcd B = 1