Metamath Proof Explorer


Theorem pcmpt

Description: Construct a function with given prime count characteristics. (Contributed by Mario Carneiro, 12-Mar-2014)

Ref Expression
Hypotheses pcmpt.1 F = n if n n A 1
pcmpt.2 φ n A 0
pcmpt.3 φ N
pcmpt.4 φ P
pcmpt.5 n = P A = B
Assertion pcmpt φ P pCnt seq 1 × F N = if P N B 0

Proof

Step Hyp Ref Expression
1 pcmpt.1 F = n if n n A 1
2 pcmpt.2 φ n A 0
3 pcmpt.3 φ N
4 pcmpt.4 φ P
5 pcmpt.5 n = P A = B
6 fveq2 p = 1 seq 1 × F p = seq 1 × F 1
7 6 oveq2d p = 1 P pCnt seq 1 × F p = P pCnt seq 1 × F 1
8 breq2 p = 1 P p P 1
9 8 ifbid p = 1 if P p B 0 = if P 1 B 0
10 7 9 eqeq12d p = 1 P pCnt seq 1 × F p = if P p B 0 P pCnt seq 1 × F 1 = if P 1 B 0
11 10 imbi2d p = 1 φ P pCnt seq 1 × F p = if P p B 0 φ P pCnt seq 1 × F 1 = if P 1 B 0
12 fveq2 p = k seq 1 × F p = seq 1 × F k
13 12 oveq2d p = k P pCnt seq 1 × F p = P pCnt seq 1 × F k
14 breq2 p = k P p P k
15 14 ifbid p = k if P p B 0 = if P k B 0
16 13 15 eqeq12d p = k P pCnt seq 1 × F p = if P p B 0 P pCnt seq 1 × F k = if P k B 0
17 16 imbi2d p = k φ P pCnt seq 1 × F p = if P p B 0 φ P pCnt seq 1 × F k = if P k B 0
18 fveq2 p = k + 1 seq 1 × F p = seq 1 × F k + 1
19 18 oveq2d p = k + 1 P pCnt seq 1 × F p = P pCnt seq 1 × F k + 1
20 breq2 p = k + 1 P p P k + 1
21 20 ifbid p = k + 1 if P p B 0 = if P k + 1 B 0
22 19 21 eqeq12d p = k + 1 P pCnt seq 1 × F p = if P p B 0 P pCnt seq 1 × F k + 1 = if P k + 1 B 0
23 22 imbi2d p = k + 1 φ P pCnt seq 1 × F p = if P p B 0 φ P pCnt seq 1 × F k + 1 = if P k + 1 B 0
24 fveq2 p = N seq 1 × F p = seq 1 × F N
25 24 oveq2d p = N P pCnt seq 1 × F p = P pCnt seq 1 × F N
26 breq2 p = N P p P N
27 26 ifbid p = N if P p B 0 = if P N B 0
28 25 27 eqeq12d p = N P pCnt seq 1 × F p = if P p B 0 P pCnt seq 1 × F N = if P N B 0
29 28 imbi2d p = N φ P pCnt seq 1 × F p = if P p B 0 φ P pCnt seq 1 × F N = if P N B 0
30 1z 1
31 seq1 1 seq 1 × F 1 = F 1
32 30 31 ax-mp seq 1 × F 1 = F 1
33 1nn 1
34 1nprm ¬ 1
35 eleq1 n = 1 n 1
36 34 35 mtbiri n = 1 ¬ n
37 36 iffalsed n = 1 if n n A 1 = 1
38 1ex 1 V
39 37 1 38 fvmpt 1 F 1 = 1
40 33 39 ax-mp F 1 = 1
41 32 40 eqtri seq 1 × F 1 = 1
42 41 oveq2i P pCnt seq 1 × F 1 = P pCnt 1
43 pc1 P P pCnt 1 = 0
44 42 43 eqtrid P P pCnt seq 1 × F 1 = 0
45 prmgt1 P 1 < P
46 1re 1
47 prmuz2 P P 2
48 eluzelre P 2 P
49 47 48 syl P P
50 ltnle 1 P 1 < P ¬ P 1
51 46 49 50 sylancr P 1 < P ¬ P 1
52 45 51 mpbid P ¬ P 1
53 52 iffalsed P if P 1 B 0 = 0
54 44 53 eqtr4d P P pCnt seq 1 × F 1 = if P 1 B 0
55 4 54 syl φ P pCnt seq 1 × F 1 = if P 1 B 0
56 4 adantr φ k k + 1 = P P
57 1 2 pcmptcl φ F : seq 1 × F :
58 57 simpld φ F :
59 peano2nn k k + 1
60 ffvelrn F : k + 1 F k + 1
61 58 59 60 syl2an φ k F k + 1
62 61 adantrr φ k k + 1 = P F k + 1
63 56 62 pccld φ k k + 1 = P P pCnt F k + 1 0
64 63 nn0cnd φ k k + 1 = P P pCnt F k + 1
65 64 addid2d φ k k + 1 = P 0 + P pCnt F k + 1 = P pCnt F k + 1
66 59 ad2antrl φ k k + 1 = P k + 1
67 ovex n A V
68 67 38 ifex if n n A 1 V
69 68 csbex k + 1 / n if n n A 1 V
70 1 fvmpts k + 1 k + 1 / n if n n A 1 V F k + 1 = k + 1 / n if n n A 1
71 ovex k + 1 V
72 nfv n k + 1
73 nfcv _ n k + 1
74 nfcv _ n ^
75 nfcsb1v _ n k + 1 / n A
76 73 74 75 nfov _ n k + 1 k + 1 / n A
77 nfcv _ n 1
78 72 76 77 nfif _ n if k + 1 k + 1 k + 1 / n A 1
79 eleq1 n = k + 1 n k + 1
80 id n = k + 1 n = k + 1
81 csbeq1a n = k + 1 A = k + 1 / n A
82 80 81 oveq12d n = k + 1 n A = k + 1 k + 1 / n A
83 79 82 ifbieq1d n = k + 1 if n n A 1 = if k + 1 k + 1 k + 1 / n A 1
84 71 78 83 csbief k + 1 / n if n n A 1 = if k + 1 k + 1 k + 1 / n A 1
85 70 84 eqtrdi k + 1 k + 1 / n if n n A 1 V F k + 1 = if k + 1 k + 1 k + 1 / n A 1
86 66 69 85 sylancl φ k k + 1 = P F k + 1 = if k + 1 k + 1 k + 1 / n A 1
87 simprr φ k k + 1 = P k + 1 = P
88 87 56 eqeltrd φ k k + 1 = P k + 1
89 88 iftrued φ k k + 1 = P if k + 1 k + 1 k + 1 / n A 1 = k + 1 k + 1 / n A
90 87 csbeq1d φ k k + 1 = P k + 1 / n A = P / n A
91 nfcvd P _ n B
92 91 5 csbiegf P P / n A = B
93 56 92 syl φ k k + 1 = P P / n A = B
94 90 93 eqtrd φ k k + 1 = P k + 1 / n A = B
95 87 94 oveq12d φ k k + 1 = P k + 1 k + 1 / n A = P B
96 86 89 95 3eqtrd φ k k + 1 = P F k + 1 = P B
97 96 oveq2d φ k k + 1 = P P pCnt F k + 1 = P pCnt P B
98 5 eleq1d n = P A 0 B 0
99 98 rspcv P n A 0 B 0
100 4 2 99 sylc φ B 0
101 100 adantr φ k k + 1 = P B 0
102 pcidlem P B 0 P pCnt P B = B
103 56 101 102 syl2anc φ k k + 1 = P P pCnt P B = B
104 65 97 103 3eqtrd φ k k + 1 = P 0 + P pCnt F k + 1 = B
105 oveq1 P pCnt seq 1 × F k = 0 P pCnt seq 1 × F k + P pCnt F k + 1 = 0 + P pCnt F k + 1
106 105 eqeq1d P pCnt seq 1 × F k = 0 P pCnt seq 1 × F k + P pCnt F k + 1 = B 0 + P pCnt F k + 1 = B
107 104 106 syl5ibrcom φ k k + 1 = P P pCnt seq 1 × F k = 0 P pCnt seq 1 × F k + P pCnt F k + 1 = B
108 nnre k k
109 108 ad2antrl φ k k + 1 = P k
110 ltp1 k k < k + 1
111 peano2re k k + 1
112 ltnle k k + 1 k < k + 1 ¬ k + 1 k
113 111 112 mpdan k k < k + 1 ¬ k + 1 k
114 110 113 mpbid k ¬ k + 1 k
115 109 114 syl φ k k + 1 = P ¬ k + 1 k
116 87 breq1d φ k k + 1 = P k + 1 k P k
117 115 116 mtbid φ k k + 1 = P ¬ P k
118 117 iffalsed φ k k + 1 = P if P k B 0 = 0
119 118 eqeq2d φ k k + 1 = P P pCnt seq 1 × F k = if P k B 0 P pCnt seq 1 × F k = 0
120 simpr φ k k
121 nnuz = 1
122 120 121 eleqtrdi φ k k 1
123 seqp1 k 1 seq 1 × F k + 1 = seq 1 × F k F k + 1
124 122 123 syl φ k seq 1 × F k + 1 = seq 1 × F k F k + 1
125 124 oveq2d φ k P pCnt seq 1 × F k + 1 = P pCnt seq 1 × F k F k + 1
126 4 adantr φ k P
127 57 simprd φ seq 1 × F :
128 127 ffvelrnda φ k seq 1 × F k
129 nnz seq 1 × F k seq 1 × F k
130 nnne0 seq 1 × F k seq 1 × F k 0
131 129 130 jca seq 1 × F k seq 1 × F k seq 1 × F k 0
132 128 131 syl φ k seq 1 × F k seq 1 × F k 0
133 nnz F k + 1 F k + 1
134 nnne0 F k + 1 F k + 1 0
135 133 134 jca F k + 1 F k + 1 F k + 1 0
136 61 135 syl φ k F k + 1 F k + 1 0
137 pcmul P seq 1 × F k seq 1 × F k 0 F k + 1 F k + 1 0 P pCnt seq 1 × F k F k + 1 = P pCnt seq 1 × F k + P pCnt F k + 1
138 126 132 136 137 syl3anc φ k P pCnt seq 1 × F k F k + 1 = P pCnt seq 1 × F k + P pCnt F k + 1
139 125 138 eqtrd φ k P pCnt seq 1 × F k + 1 = P pCnt seq 1 × F k + P pCnt F k + 1
140 139 adantrr φ k k + 1 = P P pCnt seq 1 × F k + 1 = P pCnt seq 1 × F k + P pCnt F k + 1
141 prmnn P P
142 4 141 syl φ P
143 142 nnred φ P
144 143 adantr φ k k + 1 = P P
145 144 leidd φ k k + 1 = P P P
146 145 87 breqtrrd φ k k + 1 = P P k + 1
147 146 iftrued φ k k + 1 = P if P k + 1 B 0 = B
148 140 147 eqeq12d φ k k + 1 = P P pCnt seq 1 × F k + 1 = if P k + 1 B 0 P pCnt seq 1 × F k + P pCnt F k + 1 = B
149 107 119 148 3imtr4d φ k k + 1 = P P pCnt seq 1 × F k = if P k B 0 P pCnt seq 1 × F k + 1 = if P k + 1 B 0
150 149 expr φ k k + 1 = P P pCnt seq 1 × F k = if P k B 0 P pCnt seq 1 × F k + 1 = if P k + 1 B 0
151 139 adantrr φ k k + 1 P P pCnt seq 1 × F k + 1 = P pCnt seq 1 × F k + P pCnt F k + 1
152 simplrr φ k k + 1 P k + 1 k + 1 P
153 152 necomd φ k k + 1 P k + 1 P k + 1
154 4 ad2antrr φ k k + 1 P k + 1 P
155 simpr φ k k + 1 P k + 1 k + 1
156 2 ad2antrr φ k k + 1 P k + 1 n A 0
157 75 nfel1 n k + 1 / n A 0
158 81 eleq1d n = k + 1 A 0 k + 1 / n A 0
159 157 158 rspc k + 1 n A 0 k + 1 / n A 0
160 155 156 159 sylc φ k k + 1 P k + 1 k + 1 / n A 0
161 prmdvdsexpr P k + 1 k + 1 / n A 0 P k + 1 k + 1 / n A P = k + 1
162 154 155 160 161 syl3anc φ k k + 1 P k + 1 P k + 1 k + 1 / n A P = k + 1
163 162 necon3ad φ k k + 1 P k + 1 P k + 1 ¬ P k + 1 k + 1 / n A
164 153 163 mpd φ k k + 1 P k + 1 ¬ P k + 1 k + 1 / n A
165 59 ad2antrl φ k k + 1 P k + 1
166 165 69 85 sylancl φ k k + 1 P F k + 1 = if k + 1 k + 1 k + 1 / n A 1
167 iftrue k + 1 if k + 1 k + 1 k + 1 / n A 1 = k + 1 k + 1 / n A
168 166 167 sylan9eq φ k k + 1 P k + 1 F k + 1 = k + 1 k + 1 / n A
169 168 breq2d φ k k + 1 P k + 1 P F k + 1 P k + 1 k + 1 / n A
170 164 169 mtbird φ k k + 1 P k + 1 ¬ P F k + 1
171 58 adantr φ k k + 1 P F :
172 171 165 60 syl2anc φ k k + 1 P F k + 1
173 172 adantr φ k k + 1 P k + 1 F k + 1
174 pceq0 P F k + 1 P pCnt F k + 1 = 0 ¬ P F k + 1
175 154 173 174 syl2anc φ k k + 1 P k + 1 P pCnt F k + 1 = 0 ¬ P F k + 1
176 170 175 mpbird φ k k + 1 P k + 1 P pCnt F k + 1 = 0
177 iffalse ¬ k + 1 if k + 1 k + 1 k + 1 / n A 1 = 1
178 166 177 sylan9eq φ k k + 1 P ¬ k + 1 F k + 1 = 1
179 178 oveq2d φ k k + 1 P ¬ k + 1 P pCnt F k + 1 = P pCnt 1
180 4 43 syl φ P pCnt 1 = 0
181 180 ad2antrr φ k k + 1 P ¬ k + 1 P pCnt 1 = 0
182 179 181 eqtrd φ k k + 1 P ¬ k + 1 P pCnt F k + 1 = 0
183 176 182 pm2.61dan φ k k + 1 P P pCnt F k + 1 = 0
184 183 oveq2d φ k k + 1 P P pCnt seq 1 × F k + P pCnt F k + 1 = P pCnt seq 1 × F k + 0
185 4 adantr φ k k + 1 P P
186 128 adantrr φ k k + 1 P seq 1 × F k
187 185 186 pccld φ k k + 1 P P pCnt seq 1 × F k 0
188 187 nn0cnd φ k k + 1 P P pCnt seq 1 × F k
189 188 addid1d φ k k + 1 P P pCnt seq 1 × F k + 0 = P pCnt seq 1 × F k
190 151 184 189 3eqtrd φ k k + 1 P P pCnt seq 1 × F k + 1 = P pCnt seq 1 × F k
191 142 adantr φ k k + 1 P P
192 191 nnred φ k k + 1 P P
193 165 nnred φ k k + 1 P k + 1
194 192 193 ltlend φ k k + 1 P P < k + 1 P k + 1 k + 1 P
195 simprl φ k k + 1 P k
196 nnleltp1 P k P k P < k + 1
197 191 195 196 syl2anc φ k k + 1 P P k P < k + 1
198 simprr φ k k + 1 P k + 1 P
199 198 biantrud φ k k + 1 P P k + 1 P k + 1 k + 1 P
200 194 197 199 3bitr4rd φ k k + 1 P P k + 1 P k
201 200 ifbid φ k k + 1 P if P k + 1 B 0 = if P k B 0
202 190 201 eqeq12d φ k k + 1 P P pCnt seq 1 × F k + 1 = if P k + 1 B 0 P pCnt seq 1 × F k = if P k B 0
203 202 biimprd φ k k + 1 P P pCnt seq 1 × F k = if P k B 0 P pCnt seq 1 × F k + 1 = if P k + 1 B 0
204 203 expr φ k k + 1 P P pCnt seq 1 × F k = if P k B 0 P pCnt seq 1 × F k + 1 = if P k + 1 B 0
205 150 204 pm2.61dne φ k P pCnt seq 1 × F k = if P k B 0 P pCnt seq 1 × F k + 1 = if P k + 1 B 0
206 205 expcom k φ P pCnt seq 1 × F k = if P k B 0 P pCnt seq 1 × F k + 1 = if P k + 1 B 0
207 206 a2d k φ P pCnt seq 1 × F k = if P k B 0 φ P pCnt seq 1 × F k + 1 = if P k + 1 B 0
208 11 17 23 29 55 207 nnind N φ P pCnt seq 1 × F N = if P N B 0
209 3 208 mpcom φ P pCnt seq 1 × F N = if P N B 0