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=K2N+1
proththd.l φK<2N
proththd.x φxxP12modP=-1modP
Assertion proththd φP

Proof

Step Hyp Ref Expression
1 proththd.n φN
2 proththd.k φK
3 proththd.p φP=K2N+1
4 proththd.l φK<2N
5 proththd.x φxxP12modP=-1modP
6 2nn 2
7 6 a1i φ2
8 1 nnnn0d φN0
9 7 8 nnexpcld φ2N
10 2 nncnd φK
11 9 nncnd φ2N
12 10 11 mulcomd φK2N=2NK
13 12 oveq1d φK2N+1=2NK+1
14 3 13 eqtrd φP=2NK+1
15 simpr φpp
16 2prm 2
17 16 a1i φp2
18 1 adantr φpN
19 prmdvdsexpb p2Np2Np=2
20 15 17 18 19 syl3anc φpp2Np=2
21 1 2 3 proththdlem φP1<PP12
22 21 simp1d φP
23 22 nncnd φP
24 peano2cnm PP1
25 23 24 syl φP1
26 25 adantr φxP1
27 2cnd φx2
28 2ne0 20
29 28 a1i φx20
30 26 27 29 divcan1d φxP122=P1
31 30 eqcomd φxP1=P122
32 31 oveq2d φxxP1=xP122
33 zcn xx
34 33 adantl φxx
35 2nn0 20
36 35 a1i φx20
37 21 simp3d φP12
38 37 nnnn0d φP120
39 38 adantr φxP120
40 34 36 39 expmuld φxxP122=xP122
41 32 40 eqtrd φxxP1=xP122
42 41 ad4ant13 φp=2xxP12modP=-1modPxP1=xP122
43 42 oveq1d φp=2xxP12modP=-1modPxP1modP=xP122modP
44 38 adantr φp=2P120
45 44 anim1i φp=2xP120x
46 45 ancomd φp=2xxP120
47 zexpcl xP120xP12
48 46 47 syl φp=2xxP12
49 48 adantr φp=2xxP12modP=-1modPxP12
50 22 nnrpd φP+
51 50 ad3antrrr φp=2xxP12modP=-1modPP+
52 21 simp2d φ1<P
53 52 ad3antrrr φp=2xxP12modP=-1modP1<P
54 simpr φp=2xxP12modP=-1modPxP12modP=-1modP
55 49 51 53 54 modexp2m1d φp=2xxP12modP=-1modPxP122modP=1
56 43 55 eqtrd φp=2xxP12modP=-1modPxP1modP=1
57 oveq2 p=2P1p=P12
58 57 eleq1d p=2P1p0P120
59 58 adantl φp=2P1p0P120
60 44 59 mpbird φp=2P1p0
61 60 anim2i xφp=2xP1p0
62 61 ancoms φp=2xxP1p0
63 zexpcl xP1p0xP1p
64 62 63 syl φp=2xxP1p
65 64 zred φp=2xxP1p
66 65 adantr φp=2xxP12modP=-1modPxP1p
67 1red φp=2xxP12modP=-1modP1
68 67 renegcld φp=2xxP12modP=-1modP1
69 oveq2 2=pP12=P1p
70 69 eqcoms p=2P12=P1p
71 70 oveq2d p=2xP12=xP1p
72 71 oveq1d p=2xP12modP=xP1pmodP
73 72 eqeq1d p=2xP12modP=-1modPxP1pmodP=-1modP
74 73 adantl φp=2xP12modP=-1modPxP1pmodP=-1modP
75 74 adantr φp=2xxP12modP=-1modPxP1pmodP=-1modP
76 75 biimpa φp=2xxP12modP=-1modPxP1pmodP=-1modP
77 eqidd φp=2xxP12modP=-1modP1modP=1modP
78 66 68 67 67 51 76 77 modsub12d φp=2xxP12modP=-1modPxP1p1modP=-1-1modP
79 78 oveq1d φp=2xxP12modP=-1modPxP1p1modPgcdP=-1-1modPgcdP
80 peano2zm xP1pxP1p1
81 64 80 syl φp=2xxP1p1
82 22 ad2antrr φp=2xP
83 modgcd xP1p1PxP1p1modPgcdP=xP1p1gcdP
84 81 82 83 syl2anc φp=2xxP1p1modPgcdP=xP1p1gcdP
85 84 adantr φp=2xxP12modP=-1modPxP1p1modPgcdP=xP1p1gcdP
86 ax-1cn 1
87 negdi2 111+1=-1-1
88 87 eqcomd 11-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-1modP=-2modP
95 94 oveq1d φ-1-1modPgcdP=-2modPgcdP
96 nnnegz 22
97 7 96 syl φ2
98 modgcd 2P-2modPgcdP=-2gcdP
99 97 22 98 syl2anc φ-2modPgcdP=-2gcdP
100 2z 2
101 22 nnzd φP
102 neggcd 2P-2gcdP=2gcdP
103 100 101 102 sylancr φ-2gcdP=2gcdP
104 nnz PP
105 oddm1d2 P¬2PP12
106 104 105 syl P¬2PP12
107 106 biimprd PP12¬2P
108 nnz P12P12
109 107 108 impel PP12¬2P
110 isoddgcd1 P¬2P2gcdP=1
111 104 110 syl P¬2P2gcdP=1
112 111 adantr PP12¬2P2gcdP=1
113 109 112 mpbid PP122gcdP=1
114 113 3adant2 P1<PP122gcdP=1
115 21 114 syl φ2gcdP=1
116 103 115 eqtrd φ-2gcdP=1
117 99 116 eqtrd φ-2modPgcdP=1
118 95 117 eqtrd φ-1-1modPgcdP=1
119 118 ad3antrrr φp=2xxP12modP=-1modP-1-1modPgcdP=1
120 79 85 119 3eqtr3d φp=2xxP12modP=-1modPxP1p1gcdP=1
121 56 120 jca φp=2xxP12modP=-1modPxP1modP=1xP1p1gcdP=1
122 121 ex φp=2xxP12modP=-1modPxP1modP=1xP1p1gcdP=1
123 122 reximdva φp=2xxP12modP=-1modPxxP1modP=1xP1p1gcdP=1
124 123 ex φp=2xxP12modP=-1modPxxP1modP=1xP1p1gcdP=1
125 5 124 mpid φp=2xxP1modP=1xP1p1gcdP=1
126 125 adantr φpp=2xxP1modP=1xP1p1gcdP=1
127 20 126 sylbid φpp2NxxP1modP=1xP1p1gcdP=1
128 127 ralrimiva φpp2NxxP1modP=1xP1p1gcdP=1
129 9 2 4 14 128 pockthg φP