Metamath Proof Explorer


Theorem pockthlem

Description: Lemma for pockthg . (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
pockthlem.5 φ P
pockthlem.6 φ P N
pockthlem.7 φ Q
pockthlem.8 φ Q pCnt A
pockthlem.9 φ C
pockthlem.10 φ C N 1 mod N = 1
pockthlem.11 φ C N 1 Q 1 gcd N = 1
Assertion pockthlem φ Q pCnt A Q pCnt P 1

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 pockthlem.5 φ P
6 pockthlem.6 φ P N
7 pockthlem.7 φ Q
8 pockthlem.8 φ Q pCnt A
9 pockthlem.9 φ C
10 pockthlem.10 φ C N 1 mod N = 1
11 pockthlem.11 φ C N 1 Q 1 gcd N = 1
12 prmnn Q Q
13 7 12 syl φ Q
14 8 nnnn0d φ Q pCnt A 0
15 13 14 nnexpcld φ Q Q pCnt A
16 15 nnzd φ Q Q pCnt A
17 prmnn P P
18 5 17 syl φ P
19 18 nnzd φ P
20 gcddvds C P C gcd P C C gcd P P
21 9 19 20 syl2anc φ C gcd P C C gcd P P
22 21 simpld φ C gcd P C
23 9 19 gcdcld φ C gcd P 0
24 23 nn0zd φ C gcd P
25 1 2 nnmulcld φ A B
26 nnuz = 1
27 25 26 eleqtrdi φ A B 1
28 eluzp1p1 A B 1 A B + 1 1 + 1
29 27 28 syl φ A B + 1 1 + 1
30 4 29 eqeltrd φ N 1 + 1
31 df-2 2 = 1 + 1
32 31 fveq2i 2 = 1 + 1
33 30 32 eleqtrrdi φ N 2
34 eluz2b2 N 2 N 1 < N
35 33 34 sylib φ N 1 < N
36 35 simpld φ N
37 36 nnzd φ N
38 21 simprd φ C gcd P P
39 24 19 37 38 6 dvdstrd φ C gcd P N
40 36 nnne0d φ N 0
41 simpr C = 0 N = 0 N = 0
42 41 necon3ai N 0 ¬ C = 0 N = 0
43 40 42 syl φ ¬ C = 0 N = 0
44 dvdslegcd C gcd P C N ¬ C = 0 N = 0 C gcd P C C gcd P N C gcd P C gcd N
45 24 9 37 43 44 syl31anc φ C gcd P C C gcd P N C gcd P C gcd N
46 22 39 45 mp2and φ C gcd P C gcd N
47 10 oveq1d φ C N 1 mod N gcd N = 1 gcd N
48 1z 1
49 eluzp1m1 1 N 1 + 1 N 1 1
50 48 30 49 sylancr φ N 1 1
51 50 26 eleqtrrdi φ N 1
52 51 nnnn0d φ N 1 0
53 zexpcl C N 1 0 C N 1
54 9 52 53 syl2anc φ C N 1
55 modgcd C N 1 N C N 1 mod N gcd N = C N 1 gcd N
56 54 36 55 syl2anc φ C N 1 mod N gcd N = C N 1 gcd N
57 gcdcom 1 N 1 gcd N = N gcd 1
58 48 37 57 sylancr φ 1 gcd N = N gcd 1
59 gcd1 N N gcd 1 = 1
60 37 59 syl φ N gcd 1 = 1
61 58 60 eqtrd φ 1 gcd N = 1
62 47 56 61 3eqtr3d φ C N 1 gcd N = 1
63 rpexp C N N 1 C N 1 gcd N = 1 C gcd N = 1
64 9 37 51 63 syl3anc φ C N 1 gcd N = 1 C gcd N = 1
65 62 64 mpbid φ C gcd N = 1
66 46 65 breqtrd φ C gcd P 1
67 18 nnne0d φ P 0
68 simpr C = 0 P = 0 P = 0
69 68 necon3ai P 0 ¬ C = 0 P = 0
70 67 69 syl φ ¬ C = 0 P = 0
71 gcdn0cl C P ¬ C = 0 P = 0 C gcd P
72 9 19 70 71 syl21anc φ C gcd P
73 nnle1eq1 C gcd P C gcd P 1 C gcd P = 1
74 72 73 syl φ C gcd P 1 C gcd P = 1
75 66 74 mpbid φ C gcd P = 1
76 odzcl P C C gcd P = 1 od P C
77 18 9 75 76 syl3anc φ od P C
78 77 nnzd φ od P C
79 prmuz2 P P 2
80 5 79 syl φ P 2
81 80 32 eleqtrdi φ P 1 + 1
82 eluzp1m1 1 P 1 + 1 P 1 1
83 48 81 82 sylancr φ P 1 1
84 83 26 eleqtrrdi φ P 1
85 84 nnzd φ P 1
86 1 nnzd φ A
87 51 nnzd φ N 1
88 pcdvds Q A Q Q pCnt A A
89 7 1 88 syl2anc φ Q Q pCnt A A
90 2 nnzd φ B
91 dvdsmul1 A B A A B
92 86 90 91 syl2anc φ A A B
93 4 oveq1d φ N 1 = A B + 1 - 1
94 25 nncnd φ A B
95 ax-1cn 1
96 pncan A B 1 A B + 1 - 1 = A B
97 94 95 96 sylancl φ A B + 1 - 1 = A B
98 93 97 eqtrd φ N 1 = A B
99 92 98 breqtrrd φ A N 1
100 16 86 87 89 99 dvdstrd φ Q Q pCnt A N 1
101 15 nnne0d φ Q Q pCnt A 0
102 dvdsval2 Q Q pCnt A Q Q pCnt A 0 N 1 Q Q pCnt A N 1 N 1 Q Q pCnt A
103 16 101 87 102 syl3anc φ Q Q pCnt A N 1 N 1 Q Q pCnt A
104 100 103 mpbid φ N 1 Q Q pCnt A
105 peano2zm C N 1 C N 1 1
106 54 105 syl φ C N 1 1
107 36 nnred φ N
108 35 simprd φ 1 < N
109 1mod N 1 < N 1 mod N = 1
110 107 108 109 syl2anc φ 1 mod N = 1
111 10 110 eqtr4d φ C N 1 mod N = 1 mod N
112 1zzd φ 1
113 moddvds N C N 1 1 C N 1 mod N = 1 mod N N C N 1 1
114 36 54 112 113 syl3anc φ C N 1 mod N = 1 mod N N C N 1 1
115 111 114 mpbid φ N C N 1 1
116 19 37 106 6 115 dvdstrd φ P C N 1 1
117 odzdvds P C C gcd P = 1 N 1 0 P C N 1 1 od P C N 1
118 18 9 75 52 117 syl31anc φ P C N 1 1 od P C N 1
119 116 118 mpbid φ od P C N 1
120 51 nncnd φ N 1
121 15 nncnd φ Q Q pCnt A
122 120 121 101 divcan1d φ N 1 Q Q pCnt A Q Q pCnt A = N 1
123 119 122 breqtrrd φ od P C N 1 Q Q pCnt A Q Q pCnt A
124 nprmdvds1 P ¬ P 1
125 5 124 syl φ ¬ P 1
126 13 nnzd φ Q
127 iddvdsexp Q Q pCnt A Q Q Q pCnt A
128 126 8 127 syl2anc φ Q Q Q pCnt A
129 126 16 87 128 100 dvdstrd φ Q N 1
130 13 nnne0d φ Q 0
131 dvdsval2 Q Q 0 N 1 Q N 1 N 1 Q
132 126 130 87 131 syl3anc φ Q N 1 N 1 Q
133 129 132 mpbid φ N 1 Q
134 52 nn0ge0d φ 0 N 1
135 51 nnred φ N 1
136 13 nnred φ Q
137 13 nngt0d φ 0 < Q
138 ge0div N 1 Q 0 < Q 0 N 1 0 N 1 Q
139 135 136 137 138 syl3anc φ 0 N 1 0 N 1 Q
140 134 139 mpbid φ 0 N 1 Q
141 elnn0z N 1 Q 0 N 1 Q 0 N 1 Q
142 133 140 141 sylanbrc φ N 1 Q 0
143 zexpcl C N 1 Q 0 C N 1 Q
144 9 142 143 syl2anc φ C N 1 Q
145 peano2zm C N 1 Q C N 1 Q 1
146 144 145 syl φ C N 1 Q 1
147 dvdsgcd P C N 1 Q 1 N P C N 1 Q 1 P N P C N 1 Q 1 gcd N
148 19 146 37 147 syl3anc φ P C N 1 Q 1 P N P C N 1 Q 1 gcd N
149 6 148 mpan2d φ P C N 1 Q 1 P C N 1 Q 1 gcd N
150 odzdvds P C C gcd P = 1 N 1 Q 0 P C N 1 Q 1 od P C N 1 Q
151 18 9 75 142 150 syl31anc φ P C N 1 Q 1 od P C N 1 Q
152 13 nncnd φ Q
153 8 nnzd φ Q pCnt A
154 152 130 153 expm1d φ Q Q pCnt A 1 = Q Q pCnt A Q
155 154 oveq2d φ N 1 Q Q pCnt A Q Q pCnt A 1 = N 1 Q Q pCnt A Q Q pCnt A Q
156 135 15 nndivred φ N 1 Q Q pCnt A
157 156 recnd φ N 1 Q Q pCnt A
158 157 121 152 130 divassd φ N 1 Q Q pCnt A Q Q pCnt A Q = N 1 Q Q pCnt A Q Q pCnt A Q
159 122 oveq1d φ N 1 Q Q pCnt A Q Q pCnt A Q = N 1 Q
160 155 158 159 3eqtr2d φ N 1 Q Q pCnt A Q Q pCnt A 1 = N 1 Q
161 160 breq2d φ od P C N 1 Q Q pCnt A Q Q pCnt A 1 od P C N 1 Q
162 151 161 bitr4d φ P C N 1 Q 1 od P C N 1 Q Q pCnt A Q Q pCnt A 1
163 11 breq2d φ P C N 1 Q 1 gcd N P 1
164 149 162 163 3imtr3d φ od P C N 1 Q Q pCnt A Q Q pCnt A 1 P 1
165 125 164 mtod φ ¬ od P C N 1 Q Q pCnt A Q Q pCnt A 1
166 prmpwdvds N 1 Q Q pCnt A od P C Q Q pCnt A od P C N 1 Q Q pCnt A Q Q pCnt A ¬ od P C N 1 Q Q pCnt A Q Q pCnt A 1 Q Q pCnt A od P C
167 104 78 7 8 123 165 166 syl222anc φ Q Q pCnt A od P C
168 odzphi P C C gcd P = 1 od P C ϕ P
169 18 9 75 168 syl3anc φ od P C ϕ P
170 phiprm P ϕ P = P 1
171 5 170 syl φ ϕ P = P 1
172 169 171 breqtrd φ od P C P 1
173 16 78 85 167 172 dvdstrd φ Q Q pCnt A P 1
174 pcdvdsb Q P 1 Q pCnt A 0 Q pCnt A Q pCnt P 1 Q Q pCnt A P 1
175 7 85 14 174 syl3anc φ Q pCnt A Q pCnt P 1 Q Q pCnt A P 1
176 173 175 mpbird φ Q pCnt A Q pCnt P 1