Metamath Proof Explorer


Theorem proththd

Description: Proth's theorem (1878). If P is aProth number, i.e. a number of the form k2^n+1 with k less than 2^n, and if there exists an integer x for which x^((P-1)/2) is -1 modulo P, then P is prime. Such a prime is called aProth prime. Like Pocklington's theorem (see pockthg ), Proth's theorem allows for a convenient method for verifying large primes. (Contributed by AV, 5-Jul-2020)

Ref Expression
Hypotheses proththd.n ⊢ φ → N ∈ ℕ
proththd.k ⊢ φ → K ∈ ℕ
proththd.p ⊢ φ → P = K ⁢ 2 N + 1
proththd.l ⊢ φ → K < 2 N
proththd.x ⊢ φ → ∃ x ∈ ℤ x P − 1 2 mod P = -1 mod P
Assertion proththd ⊢ φ → P ∈ ℙ

Proof

Step Hyp Ref Expression
1 proththd.n ⊢ φ → N ∈ ℕ
2 proththd.k ⊢ φ → K ∈ ℕ
3 proththd.p ⊢ φ → P = K ⁢ 2 N + 1
4 proththd.l ⊢ φ → K < 2 N
5 proththd.x ⊢ φ → ∃ x ∈ ℤ x P − 1 2 mod P = -1 mod P
6 2nn ⊢ 2 ∈ ℕ
7 6 a1i ⊢ φ → 2 ∈ ℕ
8 1 nnnn0d ⊢ φ → N ∈ ℕ 0
9 7 8 nnexpcld ⊢ φ → 2 N ∈ ℕ
10 2 nncnd ⊢ φ → K ∈ ℂ
11 9 nncnd ⊢ φ → 2 N ∈ ℂ
12 10 11 mulcomd ⊢ φ → K ⁢ 2 N = 2 N ⁢ K
13 12 oveq1d ⊢ φ → K ⁢ 2 N + 1 = 2 N ⁢ K + 1
14 3 13 eqtrd ⊢ φ → P = 2 N ⁢ K + 1
15 simpr ⊢ φ ∧ p ∈ ℙ → p ∈ ℙ
16 2prm ⊢ 2 ∈ ℙ
17 16 a1i ⊢ φ ∧ p ∈ ℙ → 2 ∈ ℙ
18 1 adantr ⊢ φ ∧ p ∈ ℙ → N ∈ ℕ
19 prmdvdsexpb ⊢ p ∈ ℙ ∧ 2 ∈ ℙ ∧ N ∈ ℕ → p ∥ 2 N ↔ p = 2
20 15 17 18 19 syl3anc ⊢ φ ∧ p ∈ ℙ → p ∥ 2 N ↔ p = 2
21 1 2 3 proththdlem ⊢ φ → P ∈ ℕ ∧ 1 < P ∧ P − 1 2 ∈ ℕ
22 21 simp1d ⊢ φ → P ∈ ℕ
23 22 nncnd ⊢ φ → P ∈ ℂ
24 peano2cnm ⊢ P ∈ ℂ → P − 1 ∈ ℂ
25 23 24 syl ⊢ φ → P − 1 ∈ ℂ
26 25 adantr ⊢ φ ∧ x ∈ ℤ → P − 1 ∈ ℂ
27 2cnd ⊢ φ ∧ x ∈ ℤ → 2 ∈ ℂ
28 2ne0 ⊢ 2 ≠ 0
29 28 a1i ⊢ φ ∧ x ∈ ℤ → 2 ≠ 0
30 26 27 29 divcan1d ⊢ φ ∧ x ∈ ℤ → P − 1 2 ⋅ 2 = P − 1
31 30 eqcomd ⊢ φ ∧ x ∈ ℤ → P − 1 = P − 1 2 ⋅ 2
32 31 oveq2d ⊢ φ ∧ x ∈ ℤ → x P − 1 = x P − 1 2 ⋅ 2
33 zcn ⊢ x ∈ ℤ → x ∈ ℂ
34 33 adantl ⊢ φ ∧ x ∈ ℤ → x ∈ ℂ
35 2nn0 ⊢ 2 ∈ ℕ 0
36 35 a1i ⊢ φ ∧ x ∈ ℤ → 2 ∈ ℕ 0
37 21 simp3d ⊢ φ → P − 1 2 ∈ ℕ
38 37 nnnn0d ⊢ φ → P − 1 2 ∈ ℕ 0
39 38 adantr ⊢ φ ∧ x ∈ ℤ → P − 1 2 ∈ ℕ 0
40 34 36 39 expmuld ⊢ φ ∧ x ∈ ℤ → x P − 1 2 ⋅ 2 = x P − 1 2 2
41 32 40 eqtrd ⊢ φ ∧ x ∈ ℤ → x P − 1 = x P − 1 2 2
42 41 ad4ant13 ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 = x P − 1 2 2
43 42 oveq1d ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 mod P = x P − 1 2 2 mod P
44 38 adantr ⊢ φ ∧ p = 2 → P − 1 2 ∈ ℕ 0
45 44 anim1i ⊢ φ ∧ p = 2 ∧ x ∈ ℤ → P − 1 2 ∈ ℕ 0 ∧ x ∈ ℤ
46 45 ancomd ⊢ φ ∧ p = 2 ∧ x ∈ ℤ → x ∈ ℤ ∧ P − 1 2 ∈ ℕ 0
47 zexpcl ⊢ x ∈ ℤ ∧ P − 1 2 ∈ ℕ 0 → x P − 1 2 ∈ ℤ
48 46 47 syl ⊢ φ ∧ p = 2 ∧ x ∈ ℤ → x P − 1 2 ∈ ℤ
49 48 adantr ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 2 ∈ ℤ
50 22 nnrpd ⊢ φ → P ∈ ℝ +
51 50 ad3antrrr ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → P ∈ ℝ +
52 21 simp2d ⊢ φ → 1 < P
53 52 ad3antrrr ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → 1 < P
54 simpr ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 2 mod P = -1 mod P
55 49 51 53 54 modexp2m1d ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 2 2 mod P = 1
56 43 55 eqtrd ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 mod P = 1
57 oveq2 ⊢ p = 2 → P − 1 p = P − 1 2
58 57 eleq1d ⊢ p = 2 → P − 1 p ∈ ℕ 0 ↔ P − 1 2 ∈ ℕ 0
59 58 adantl ⊢ φ ∧ p = 2 → P − 1 p ∈ ℕ 0 ↔ P − 1 2 ∈ ℕ 0
60 44 59 mpbird ⊢ φ ∧ p = 2 → P − 1 p ∈ ℕ 0
61 60 anim2i ⊢ x ∈ ℤ ∧ φ ∧ p = 2 → x ∈ ℤ ∧ P − 1 p ∈ ℕ 0
62 61 ancoms ⊢ φ ∧ p = 2 ∧ x ∈ ℤ → x ∈ ℤ ∧ P − 1 p ∈ ℕ 0
63 zexpcl ⊢ x ∈ ℤ ∧ P − 1 p ∈ ℕ 0 → x P − 1 p ∈ ℤ
64 62 63 syl ⊢ φ ∧ p = 2 ∧ x ∈ ℤ → x P − 1 p ∈ ℤ
65 64 zred ⊢ φ ∧ p = 2 ∧ x ∈ ℤ → x P − 1 p ∈ ℝ
66 65 adantr ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 p ∈ ℝ
67 1red ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → 1 ∈ ℝ
68 67 renegcld ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → − 1 ∈ ℝ
69 oveq2 ⊢ 2 = p → P − 1 2 = P − 1 p
70 69 eqcoms ⊢ p = 2 → P − 1 2 = P − 1 p
71 70 oveq2d ⊢ p = 2 → x P − 1 2 = x P − 1 p
72 71 oveq1d ⊢ p = 2 → x P − 1 2 mod P = x P − 1 p mod P
73 72 eqeq1d ⊢ p = 2 → x P − 1 2 mod P = -1 mod P ↔ x P − 1 p mod P = -1 mod P
74 73 adantl ⊢ φ ∧ p = 2 → x P − 1 2 mod P = -1 mod P ↔ x P − 1 p mod P = -1 mod P
75 74 adantr ⊢ φ ∧ p = 2 ∧ x ∈ ℤ → x P − 1 2 mod P = -1 mod P ↔ x P − 1 p mod P = -1 mod P
76 75 biimpa ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 p mod P = -1 mod P
77 eqidd ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → 1 mod P = 1 mod P
78 66 68 67 67 51 76 77 modsub12d ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 p − 1 mod P = - 1 - 1 mod P
79 78 oveq1d ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 p − 1 mod P gcd P = - 1 - 1 mod P gcd P
80 peano2zm ⊢ x P − 1 p ∈ ℤ → x P − 1 p − 1 ∈ ℤ
81 64 80 syl ⊢ φ ∧ p = 2 ∧ x ∈ ℤ → x P − 1 p − 1 ∈ ℤ
82 22 ad2antrr ⊢ φ ∧ p = 2 ∧ x ∈ ℤ → P ∈ ℕ
83 modgcd ⊢ x P − 1 p − 1 ∈ ℤ ∧ P ∈ ℕ → x P − 1 p − 1 mod P gcd P = x P − 1 p − 1 gcd P
84 81 82 83 syl2anc ⊢ φ ∧ p = 2 ∧ x ∈ ℤ → x P − 1 p − 1 mod P gcd P = x P − 1 p − 1 gcd P
85 84 adantr ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 p − 1 mod P gcd P = x P − 1 p − 1 gcd P
86 ax-1cn ⊢ 1 ∈ ℂ
87 negdi2 ⊢ 1 ∈ ℂ ∧ 1 ∈ ℂ → − 1 + 1 = - 1 - 1
88 87 eqcomd ⊢ 1 ∈ ℂ ∧ 1 ∈ ℂ → - 1 - 1 = − 1 + 1
89 86 86 88 mp2an ⊢ - 1 - 1 = − 1 + 1
90 1p1e2 ⊢ 1 + 1 = 2
91 90 negeqi ⊢ − 1 + 1 = − 2
92 89 91 eqtri ⊢ - 1 - 1 = − 2
93 92 a1i ⊢ φ → - 1 - 1 = − 2
94 93 oveq1d ⊢ φ → - 1 - 1 mod P = -2 mod P
95 94 oveq1d ⊢ φ → - 1 - 1 mod P gcd P = -2 mod P gcd P
96 nnnegz ⊢ 2 ∈ ℕ → − 2 ∈ ℤ
97 7 96 syl ⊢ φ → − 2 ∈ ℤ
98 modgcd ⊢ − 2 ∈ ℤ ∧ P ∈ ℕ → -2 mod P gcd P = -2 gcd P
99 97 22 98 syl2anc ⊢ φ → -2 mod P gcd P = -2 gcd P
100 2z ⊢ 2 ∈ ℤ
101 22 nnzd ⊢ φ → P ∈ ℤ
102 neggcd ⊢ 2 ∈ ℤ ∧ P ∈ ℤ → -2 gcd P = 2 gcd P
103 100 101 102 sylancr ⊢ φ → -2 gcd P = 2 gcd P
104 nnz ⊢ P ∈ ℕ → P ∈ ℤ
105 oddm1d2 ⊢ P ∈ ℤ → ¬ 2 ∥ P ↔ P − 1 2 ∈ ℤ
106 104 105 syl ⊢ P ∈ ℕ → ¬ 2 ∥ P ↔ P − 1 2 ∈ ℤ
107 106 biimprd ⊢ P ∈ ℕ → P − 1 2 ∈ ℤ → ¬ 2 ∥ P
108 nnz ⊢ P − 1 2 ∈ ℕ → P − 1 2 ∈ ℤ
109 107 108 impel ⊢ P ∈ ℕ ∧ P − 1 2 ∈ ℕ → ¬ 2 ∥ P
110 isoddgcd1 ⊢ P ∈ ℤ → ¬ 2 ∥ P ↔ 2 gcd P = 1
111 104 110 syl ⊢ P ∈ ℕ → ¬ 2 ∥ P ↔ 2 gcd P = 1
112 111 adantr ⊢ P ∈ ℕ ∧ P − 1 2 ∈ ℕ → ¬ 2 ∥ P ↔ 2 gcd P = 1
113 109 112 mpbid ⊢ P ∈ ℕ ∧ P − 1 2 ∈ ℕ → 2 gcd P = 1
114 113 3adant2 ⊢ P ∈ ℕ ∧ 1 < P ∧ P − 1 2 ∈ ℕ → 2 gcd P = 1
115 21 114 syl ⊢ φ → 2 gcd P = 1
116 103 115 eqtrd ⊢ φ → -2 gcd P = 1
117 99 116 eqtrd ⊢ φ → -2 mod P gcd P = 1
118 95 117 eqtrd ⊢ φ → - 1 - 1 mod P gcd P = 1
119 118 ad3antrrr ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → - 1 - 1 mod P gcd P = 1
120 79 85 119 3eqtr3d ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 p − 1 gcd P = 1
121 56 120 jca ⊢ φ ∧ p = 2 ∧ x ∈ ℤ ∧ x P − 1 2 mod P = -1 mod P → x P − 1 mod P = 1 ∧ x P − 1 p − 1 gcd P = 1
122 121 ex ⊢ φ ∧ p = 2 ∧ x ∈ ℤ → x P − 1 2 mod P = -1 mod P → x P − 1 mod P = 1 ∧ x P − 1 p − 1 gcd P = 1
123 122 reximdva ⊢ φ ∧ p = 2 → ∃ x ∈ ℤ x P − 1 2 mod P = -1 mod P → ∃ x ∈ ℤ x P − 1 mod P = 1 ∧ x P − 1 p − 1 gcd P = 1
124 123 ex ⊢ φ → p = 2 → ∃ x ∈ ℤ x P − 1 2 mod P = -1 mod P → ∃ x ∈ ℤ x P − 1 mod P = 1 ∧ x P − 1 p − 1 gcd P = 1
125 5 124 mpid ⊢ φ → p = 2 → ∃ x ∈ ℤ x P − 1 mod P = 1 ∧ x P − 1 p − 1 gcd P = 1
126 125 adantr ⊢ φ ∧ p ∈ ℙ → p = 2 → ∃ x ∈ ℤ x P − 1 mod P = 1 ∧ x P − 1 p − 1 gcd P = 1
127 20 126 sylbid ⊢ φ ∧ p ∈ ℙ → p ∥ 2 N → ∃ x ∈ ℤ x P − 1 mod P = 1 ∧ x P − 1 p − 1 gcd P = 1
128 127 ralrimiva ⊢ φ → ∀ p ∈ ℙ p ∥ 2 N → ∃ x ∈ ℤ x P − 1 mod P = 1 ∧ x P − 1 p − 1 gcd P = 1
129 9 2 4 14 128 pockthg ⊢ φ → P ∈ ℙ