Metamath Proof Explorer


Theorem pockthg

Description: The generalized Pocklington's theorem. If N - 1 = A x. B where B < A , then N is prime if and only if for every prime factor p of A , there is an x such that x ^ ( N - 1 ) = 1 ( mod N ) and gcd ( x ^ ( ( N - 1 ) / p ) - 1 , N ) = 1 . (Contributed by Mario Carneiro, 2-Mar-2014)

Ref Expression
Hypotheses pockthg.1 φ A
pockthg.2 φ B
pockthg.3 φ B < A
pockthg.4 φ N = A B + 1
pockthg.5 φ p p A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1
Assertion pockthg φ N

Proof

Step Hyp Ref Expression
1 pockthg.1 φ A
2 pockthg.2 φ B
3 pockthg.3 φ B < A
4 pockthg.4 φ N = A B + 1
5 pockthg.5 φ p p A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1
6 1 2 nnmulcld φ A B
7 nnuz = 1
8 6 7 eleqtrdi φ A B 1
9 eluzp1p1 A B 1 A B + 1 1 + 1
10 8 9 syl φ A B + 1 1 + 1
11 df-2 2 = 1 + 1
12 11 fveq2i 2 = 1 + 1
13 10 12 eleqtrrdi φ A B + 1 2
14 4 13 eqeltrd φ N 2
15 eluzelre N 2 N
16 14 15 syl φ N
17 16 adantr φ q q N N
18 1 nnred φ A
19 18 resqcld φ A 2
20 19 adantr φ q q N A 2
21 prmnn q q
22 21 ad2antrl φ q q N q
23 22 nnred φ q q N q
24 23 resqcld φ q q N q 2
25 2 nnred φ B
26 1 nngt0d φ 0 < A
27 ltmul2 B A A 0 < A B < A A B < A A
28 25 18 18 26 27 syl112anc φ B < A A B < A A
29 3 28 mpbid φ A B < A A
30 1 1 nnmulcld φ A A
31 nnltp1le A B A A A B < A A A B + 1 A A
32 6 30 31 syl2anc φ A B < A A A B + 1 A A
33 29 32 mpbid φ A B + 1 A A
34 1 nncnd φ A
35 34 sqvald φ A 2 = A A
36 33 4 35 3brtr4d φ N A 2
37 36 adantr φ q q N N A 2
38 5 adantr φ q q N p p A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1
39 prmnn p p
40 39 ad2antrl φ q q N p p pCnt A p
41 40 nncnd φ q q N p p pCnt A p
42 41 exp1d φ q q N p p pCnt A p 1 = p
43 nnge1 p pCnt A 1 p pCnt A
44 43 ad2antll φ q q N p p pCnt A 1 p pCnt A
45 simprl φ q q N p p pCnt A p
46 1 nnzd φ A
47 46 ad2antrr φ q q N p p pCnt A A
48 1nn0 1 0
49 48 a1i φ q q N p p pCnt A 1 0
50 pcdvdsb p A 1 0 1 p pCnt A p 1 A
51 45 47 49 50 syl3anc φ q q N p p pCnt A 1 p pCnt A p 1 A
52 44 51 mpbid φ q q N p p pCnt A p 1 A
53 42 52 eqbrtrrd φ q q N p p pCnt A p A
54 simpl1 φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 φ
55 54 1 syl φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 A
56 54 2 syl φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 B
57 54 3 syl φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 B < A
58 54 4 syl φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 N = A B + 1
59 simpl2l φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 q
60 simpl2r φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 q N
61 simpl3l φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 p
62 simpl3r φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 p pCnt A
63 simprl φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 x
64 simprrl φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 x N 1 mod N = 1
65 simprrr φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 x N 1 p 1 gcd N = 1
66 55 56 57 58 59 60 61 62 63 64 65 pockthlem φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 p pCnt A p pCnt q 1
67 66 rexlimdvaa φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 p pCnt A p pCnt q 1
68 67 3expa φ q q N p p pCnt A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 p pCnt A p pCnt q 1
69 53 68 embantd φ q q N p p pCnt A p A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 p pCnt A p pCnt q 1
70 69 expr φ q q N p p pCnt A p A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 p pCnt A p pCnt q 1
71 id p p
72 prmuz2 q q 2
73 uz2m1nn q 2 q 1
74 72 73 syl q q 1
75 74 ad2antrl φ q q N q 1
76 pccl p q 1 p pCnt q 1 0
77 71 75 76 syl2anr φ q q N p p pCnt q 1 0
78 77 nn0ge0d φ q q N p 0 p pCnt q 1
79 breq1 p pCnt A = 0 p pCnt A p pCnt q 1 0 p pCnt q 1
80 78 79 syl5ibrcom φ q q N p p pCnt A = 0 p pCnt A p pCnt q 1
81 80 a1dd φ q q N p p pCnt A = 0 p A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 p pCnt A p pCnt q 1
82 simpr φ q q N p p
83 1 ad2antrr φ q q N p A
84 82 83 pccld φ q q N p p pCnt A 0
85 elnn0 p pCnt A 0 p pCnt A p pCnt A = 0
86 84 85 sylib φ q q N p p pCnt A p pCnt A = 0
87 70 81 86 mpjaod φ q q N p p A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 p pCnt A p pCnt q 1
88 87 ralimdva φ q q N p p A x x N 1 mod N = 1 x N 1 p 1 gcd N = 1 p p pCnt A p pCnt q 1
89 38 88 mpd φ q q N p p pCnt A p pCnt q 1
90 75 nnzd φ q q N q 1
91 pc2dvds A q 1 A q 1 p p pCnt A p pCnt q 1
92 46 90 91 syl2an2r φ q q N A q 1 p p pCnt A p pCnt q 1
93 89 92 mpbird φ q q N A q 1
94 dvdsle A q 1 A q 1 A q 1
95 46 75 94 syl2an2r φ q q N A q 1 A q 1
96 93 95 mpd φ q q N A q 1
97 1 nnnn0d φ A 0
98 22 nnnn0d φ q q N q 0
99 nn0ltlem1 A 0 q 0 A < q A q 1
100 97 98 99 syl2an2r φ q q N A < q A q 1
101 96 100 mpbird φ q q N A < q
102 18 adantr φ q q N A
103 97 nn0ge0d φ 0 A
104 103 adantr φ q q N 0 A
105 98 nn0ge0d φ q q N 0 q
106 102 23 104 105 lt2sqd φ q q N A < q A 2 < q 2
107 101 106 mpbid φ q q N A 2 < q 2
108 17 20 24 37 107 lelttrd φ q q N N < q 2
109 17 24 ltnled φ q q N N < q 2 ¬ q 2 N
110 108 109 mpbid φ q q N ¬ q 2 N
111 110 expr φ q q N ¬ q 2 N
112 111 con2d φ q q 2 N ¬ q N
113 112 ralrimiva φ q q 2 N ¬ q N
114 isprm5 N N 2 q q 2 N ¬ q N
115 14 113 114 sylanbrc φ N