Metamath Proof Explorer


Theorem iserodd

Description: Collect the odd terms in a sequence. (Contributed by Mario Carneiro, 7-Apr-2015) (Proof shortened by AV, 10-Jul-2022)

Ref Expression
Hypotheses iserodd.f φ k 0 C
iserodd.h n = 2 k + 1 B = C
Assertion iserodd φ seq 0 + k 0 C A seq 1 + n if 2 n 0 B A

Proof

Step Hyp Ref Expression
1 iserodd.f φ k 0 C
2 iserodd.h n = 2 k + 1 B = C
3 nn0uz 0 = 0
4 nnuz = 1
5 0zd φ 0
6 1zzd φ 1
7 2nn0 2 0
8 7 a1i φ 2 0
9 nn0mulcl 2 0 m 0 2 m 0
10 8 9 sylan φ m 0 2 m 0
11 nn0p1nn 2 m 0 2 m + 1
12 10 11 syl φ m 0 2 m + 1
13 12 fmpttd φ m 0 2 m + 1 : 0
14 nn0mulcl 2 0 i 0 2 i 0
15 8 14 sylan φ i 0 2 i 0
16 15 nn0red φ i 0 2 i
17 peano2nn0 i 0 i + 1 0
18 nn0mulcl 2 0 i + 1 0 2 i + 1 0
19 8 17 18 syl2an φ i 0 2 i + 1 0
20 19 nn0red φ i 0 2 i + 1
21 1red φ i 0 1
22 nn0re i 0 i
23 22 adantl φ i 0 i
24 23 ltp1d φ i 0 i < i + 1
25 1red i 0 1
26 22 25 readdcld i 0 i + 1
27 2rp 2 +
28 27 a1i i 0 2 +
29 22 26 28 ltmul2d i 0 i < i + 1 2 i < 2 i + 1
30 29 adantl φ i 0 i < i + 1 2 i < 2 i + 1
31 24 30 mpbid φ i 0 2 i < 2 i + 1
32 16 20 21 31 ltadd1dd φ i 0 2 i + 1 < 2 i + 1 + 1
33 oveq2 m = i 2 m = 2 i
34 33 oveq1d m = i 2 m + 1 = 2 i + 1
35 eqid m 0 2 m + 1 = m 0 2 m + 1
36 ovex 2 i + 1 V
37 34 35 36 fvmpt i 0 m 0 2 m + 1 i = 2 i + 1
38 37 adantl φ i 0 m 0 2 m + 1 i = 2 i + 1
39 17 adantl φ i 0 i + 1 0
40 oveq2 m = i + 1 2 m = 2 i + 1
41 40 oveq1d m = i + 1 2 m + 1 = 2 i + 1 + 1
42 ovex 2 i + 1 + 1 V
43 41 35 42 fvmpt i + 1 0 m 0 2 m + 1 i + 1 = 2 i + 1 + 1
44 39 43 syl φ i 0 m 0 2 m + 1 i + 1 = 2 i + 1 + 1
45 32 38 44 3brtr4d φ i 0 m 0 2 m + 1 i < m 0 2 m + 1 i + 1
46 eldifi n ran m 0 2 m + 1 n
47 simpr φ n n
48 0cnd φ n 2 n 0
49 nnz n n
50 49 adantl φ n n
51 odd2np1 n ¬ 2 n k 2 k + 1 = n
52 50 51 syl φ n ¬ 2 n k 2 k + 1 = n
53 simprl φ n k 2 k + 1 = n k
54 nnm1nn0 n n 1 0
55 54 ad2antlr φ n k 2 k + 1 = n n 1 0
56 55 nn0red φ n k 2 k + 1 = n n 1
57 27 a1i φ n k 2 k + 1 = n 2 +
58 55 nn0ge0d φ n k 2 k + 1 = n 0 n 1
59 56 57 58 divge0d φ n k 2 k + 1 = n 0 n 1 2
60 simprr φ n k 2 k + 1 = n 2 k + 1 = n
61 60 oveq1d φ n k 2 k + 1 = n 2 k + 1 - 1 = n 1
62 2cn 2
63 zcn k k
64 63 ad2antrl φ n k 2 k + 1 = n k
65 mulcl 2 k 2 k
66 62 64 65 sylancr φ n k 2 k + 1 = n 2 k
67 ax-1cn 1
68 pncan 2 k 1 2 k + 1 - 1 = 2 k
69 66 67 68 sylancl φ n k 2 k + 1 = n 2 k + 1 - 1 = 2 k
70 61 69 eqtr3d φ n k 2 k + 1 = n n 1 = 2 k
71 70 oveq1d φ n k 2 k + 1 = n n 1 2 = 2 k 2
72 2cnd φ n k 2 k + 1 = n 2
73 2ne0 2 0
74 73 a1i φ n k 2 k + 1 = n 2 0
75 64 72 74 divcan3d φ n k 2 k + 1 = n 2 k 2 = k
76 71 75 eqtrd φ n k 2 k + 1 = n n 1 2 = k
77 59 76 breqtrd φ n k 2 k + 1 = n 0 k
78 elnn0z k 0 k 0 k
79 53 77 78 sylanbrc φ n k 2 k + 1 = n k 0
80 79 ex φ n k 2 k + 1 = n k 0
81 simpr k 2 k + 1 = n 2 k + 1 = n
82 81 eqcomd k 2 k + 1 = n n = 2 k + 1
83 80 82 jca2 φ n k 2 k + 1 = n k 0 n = 2 k + 1
84 83 reximdv2 φ n k 2 k + 1 = n k 0 n = 2 k + 1
85 52 84 sylbid φ n ¬ 2 n k 0 n = 2 k + 1
86 2 eleq1d n = 2 k + 1 B C
87 1 86 syl5ibrcom φ k 0 n = 2 k + 1 B
88 87 rexlimdva φ k 0 n = 2 k + 1 B
89 88 adantr φ n k 0 n = 2 k + 1 B
90 85 89 syld φ n ¬ 2 n B
91 90 imp φ n ¬ 2 n B
92 48 91 ifclda φ n if 2 n 0 B
93 eqid n if 2 n 0 B = n if 2 n 0 B
94 93 fvmpt2 n if 2 n 0 B n if 2 n 0 B n = if 2 n 0 B
95 47 92 94 syl2anc φ n n if 2 n 0 B n = if 2 n 0 B
96 46 95 sylan2 φ n ran m 0 2 m + 1 n if 2 n 0 B n = if 2 n 0 B
97 eldif n ran m 0 2 m + 1 n ¬ n ran m 0 2 m + 1
98 oveq2 m = k 2 m = 2 k
99 98 oveq1d m = k 2 m + 1 = 2 k + 1
100 99 cbvmptv m 0 2 m + 1 = k 0 2 k + 1
101 100 elrnmpt n V n ran m 0 2 m + 1 k 0 n = 2 k + 1
102 101 elv n ran m 0 2 m + 1 k 0 n = 2 k + 1
103 85 102 syl6ibr φ n ¬ 2 n n ran m 0 2 m + 1
104 103 con1d φ n ¬ n ran m 0 2 m + 1 2 n
105 104 impr φ n ¬ n ran m 0 2 m + 1 2 n
106 97 105 sylan2b φ n ran m 0 2 m + 1 2 n
107 106 iftrued φ n ran m 0 2 m + 1 if 2 n 0 B = 0
108 96 107 eqtrd φ n ran m 0 2 m + 1 n if 2 n 0 B n = 0
109 108 ralrimiva φ n ran m 0 2 m + 1 n if 2 n 0 B n = 0
110 nfv j n if 2 n 0 B n = 0
111 nffvmpt1 _ n n if 2 n 0 B j
112 111 nfeq1 n n if 2 n 0 B j = 0
113 fveqeq2 n = j n if 2 n 0 B n = 0 n if 2 n 0 B j = 0
114 110 112 113 cbvralw n ran m 0 2 m + 1 n if 2 n 0 B n = 0 j ran m 0 2 m + 1 n if 2 n 0 B j = 0
115 109 114 sylib φ j ran m 0 2 m + 1 n if 2 n 0 B j = 0
116 115 r19.21bi φ j ran m 0 2 m + 1 n if 2 n 0 B j = 0
117 92 fmpttd φ n if 2 n 0 B :
118 117 ffvelrnda φ j n if 2 n 0 B j
119 simpr φ k 0 k 0
120 eqid k 0 C = k 0 C
121 120 fvmpt2 k 0 C k 0 C k = C
122 119 1 121 syl2anc φ k 0 k 0 C k = C
123 ovex 2 k + 1 V
124 99 35 123 fvmpt k 0 m 0 2 m + 1 k = 2 k + 1
125 124 adantl φ k 0 m 0 2 m + 1 k = 2 k + 1
126 125 fveq2d φ k 0 n if 2 n 0 B m 0 2 m + 1 k = n if 2 n 0 B 2 k + 1
127 breq2 n = 2 k + 1 2 n 2 2 k + 1
128 127 2 ifbieq2d n = 2 k + 1 if 2 n 0 B = if 2 2 k + 1 0 C
129 nn0mulcl 2 0 k 0 2 k 0
130 8 129 sylan φ k 0 2 k 0
131 nn0p1nn 2 k 0 2 k + 1
132 130 131 syl φ k 0 2 k + 1
133 2z 2
134 nn0z k 0 k
135 134 adantl φ k 0 k
136 dvdsmul1 2 k 2 2 k
137 133 135 136 sylancr φ k 0 2 2 k
138 130 nn0zd φ k 0 2 k
139 2nn 2
140 139 a1i φ k 0 2
141 1lt2 1 < 2
142 141 a1i φ k 0 1 < 2
143 ndvdsp1 2 k 2 1 < 2 2 2 k ¬ 2 2 k + 1
144 138 140 142 143 syl3anc φ k 0 2 2 k ¬ 2 2 k + 1
145 137 144 mpd φ k 0 ¬ 2 2 k + 1
146 145 iffalsed φ k 0 if 2 2 k + 1 0 C = C
147 146 1 eqeltrd φ k 0 if 2 2 k + 1 0 C
148 93 128 132 147 fvmptd3 φ k 0 n if 2 n 0 B 2 k + 1 = if 2 2 k + 1 0 C
149 126 148 146 3eqtrd φ k 0 n if 2 n 0 B m 0 2 m + 1 k = C
150 122 149 eqtr4d φ k 0 k 0 C k = n if 2 n 0 B m 0 2 m + 1 k
151 150 ralrimiva φ k 0 k 0 C k = n if 2 n 0 B m 0 2 m + 1 k
152 nfv i k 0 C k = n if 2 n 0 B m 0 2 m + 1 k
153 nffvmpt1 _ k k 0 C i
154 153 nfeq1 k k 0 C i = n if 2 n 0 B m 0 2 m + 1 i
155 fveq2 k = i k 0 C k = k 0 C i
156 2fveq3 k = i n if 2 n 0 B m 0 2 m + 1 k = n if 2 n 0 B m 0 2 m + 1 i
157 155 156 eqeq12d k = i k 0 C k = n if 2 n 0 B m 0 2 m + 1 k k 0 C i = n if 2 n 0 B m 0 2 m + 1 i
158 152 154 157 cbvralw k 0 k 0 C k = n if 2 n 0 B m 0 2 m + 1 k i 0 k 0 C i = n if 2 n 0 B m 0 2 m + 1 i
159 151 158 sylib φ i 0 k 0 C i = n if 2 n 0 B m 0 2 m + 1 i
160 159 r19.21bi φ i 0 k 0 C i = n if 2 n 0 B m 0 2 m + 1 i
161 3 4 5 6 13 45 116 118 160 isercoll2 φ seq 0 + k 0 C A seq 1 + n if 2 n 0 B A