Metamath Proof Explorer


Theorem bitsfzo

Description: The bits of a number are all less than M iff the number is nonnegative and less than 2 ^ M . (Contributed by Mario Carneiro, 5-Sep-2016) (Proof shortened by AV, 1-Oct-2020)

Ref Expression
Assertion bitsfzo N M 0 N 0 ..^ 2 M bits N 0 ..^ M

Proof

Step Hyp Ref Expression
1 bitsval m bits N N m 0 ¬ 2 N 2 m
2 simp32 N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m m 0
3 nn0uz 0 = 0
4 2 3 eleqtrdi N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m m 0
5 simp1r N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m M 0
6 5 nn0zd N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m M
7 2re 2
8 7 a1i N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 2
9 8 2 reexpcld N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 2 m
10 simp1l N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m N
11 10 zred N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m N
12 8 5 reexpcld N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 2 M
13 9 recnd N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 2 m
14 13 mulid2d N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 1 2 m = 2 m
15 simp33 N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m ¬ 2 N 2 m
16 2rp 2 +
17 16 a1i N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 2 +
18 2 nn0zd N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m m
19 17 18 rpexpcld N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 2 m +
20 11 19 rerpdivcld N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m N 2 m
21 1red N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 1
22 20 21 ltnled N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m N 2 m < 1 ¬ 1 N 2 m
23 0p1e1 0 + 1 = 1
24 23 breq2i N 2 m < 0 + 1 N 2 m < 1
25 elfzole1 N 0 ..^ 2 M 0 N
26 25 3ad2ant2 N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 0 N
27 11 19 26 divge0d N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 0 N 2 m
28 0z 0
29 flbi N 2 m 0 N 2 m = 0 0 N 2 m N 2 m < 0 + 1
30 20 28 29 sylancl N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m N 2 m = 0 0 N 2 m N 2 m < 0 + 1
31 z0even 2 0
32 id N 2 m = 0 N 2 m = 0
33 31 32 breqtrrid N 2 m = 0 2 N 2 m
34 30 33 syl6bir N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 0 N 2 m N 2 m < 0 + 1 2 N 2 m
35 27 34 mpand N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m N 2 m < 0 + 1 2 N 2 m
36 24 35 syl5bir N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m N 2 m < 1 2 N 2 m
37 22 36 sylbird N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m ¬ 1 N 2 m 2 N 2 m
38 15 37 mt3d N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 1 N 2 m
39 21 11 19 lemuldivd N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 1 2 m N 1 N 2 m
40 38 39 mpbird N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 1 2 m N
41 14 40 eqbrtrrd N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 2 m N
42 elfzolt2 N 0 ..^ 2 M N < 2 M
43 42 3ad2ant2 N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m N < 2 M
44 9 11 12 41 43 lelttrd N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 2 m < 2 M
45 1lt2 1 < 2
46 45 a1i N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m 1 < 2
47 8 18 6 46 ltexp2d N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m m < M 2 m < 2 M
48 44 47 mpbird N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m m < M
49 elfzo2 m 0 ..^ M m 0 M m < M
50 4 6 48 49 syl3anbrc N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m m 0 ..^ M
51 50 3expia N M 0 N 0 ..^ 2 M N m 0 ¬ 2 N 2 m m 0 ..^ M
52 1 51 syl5bi N M 0 N 0 ..^ 2 M m bits N m 0 ..^ M
53 52 ssrdv N M 0 N 0 ..^ 2 M bits N 0 ..^ M
54 simpr N M 0 bits N 0 ..^ M N N
55 54 nnred N M 0 bits N 0 ..^ M N N
56 simpllr N M 0 bits N 0 ..^ M N M 0
57 56 nn0red N M 0 bits N 0 ..^ M N M
58 max2 N M M if N M M N
59 55 57 58 syl2anc N M 0 bits N 0 ..^ M N M if N M M N
60 simplr N M 0 bits N 0 ..^ M N bits N 0 ..^ M
61 n2dvdsm1 ¬ 2 -1
62 simplll N M 0 bits N 0 ..^ M N N
63 62 zred N M 0 bits N 0 ..^ M N N
64 2nn 2
65 64 a1i N M 0 bits N 0 ..^ M N 2
66 54 nnnn0d N M 0 bits N 0 ..^ M N N 0
67 56 66 ifcld N M 0 bits N 0 ..^ M N if N M M N 0
68 65 67 nnexpcld N M 0 bits N 0 ..^ M N 2 if N M M N
69 63 68 nndivred N M 0 bits N 0 ..^ M N N 2 if N M M N
70 1red N M 0 bits N 0 ..^ M N 1
71 62 zcnd N M 0 bits N 0 ..^ M N N
72 68 nncnd N M 0 bits N 0 ..^ M N 2 if N M M N
73 2cnd N M 0 bits N 0 ..^ M N 2
74 2ne0 2 0
75 74 a1i N M 0 bits N 0 ..^ M N 2 0
76 67 nn0zd N M 0 bits N 0 ..^ M N if N M M N
77 73 75 76 expne0d N M 0 bits N 0 ..^ M N 2 if N M M N 0
78 71 72 77 divnegd N M 0 bits N 0 ..^ M N N 2 if N M M N = N 2 if N M M N
79 67 nn0red N M 0 bits N 0 ..^ M N if N M M N
80 68 nnred N M 0 bits N 0 ..^ M N 2 if N M M N
81 max1 N M N if N M M N
82 55 57 81 syl2anc N M 0 bits N 0 ..^ M N N if N M M N
83 2z 2
84 uzid 2 2 2
85 83 84 ax-mp 2 2
86 bernneq3 2 2 if N M M N 0 if N M M N < 2 if N M M N
87 85 67 86 sylancr N M 0 bits N 0 ..^ M N if N M M N < 2 if N M M N
88 79 80 87 ltled N M 0 bits N 0 ..^ M N if N M M N 2 if N M M N
89 55 79 80 82 88 letrd N M 0 bits N 0 ..^ M N N 2 if N M M N
90 72 mulid1d N M 0 bits N 0 ..^ M N 2 if N M M N 1 = 2 if N M M N
91 89 90 breqtrrd N M 0 bits N 0 ..^ M N N 2 if N M M N 1
92 68 nnrpd N M 0 bits N 0 ..^ M N 2 if N M M N +
93 55 70 92 ledivmuld N M 0 bits N 0 ..^ M N N 2 if N M M N 1 N 2 if N M M N 1
94 91 93 mpbird N M 0 bits N 0 ..^ M N N 2 if N M M N 1
95 78 94 eqbrtrd N M 0 bits N 0 ..^ M N N 2 if N M M N 1
96 69 70 95 lenegcon1d N M 0 bits N 0 ..^ M N 1 N 2 if N M M N
97 54 nngt0d N M 0 bits N 0 ..^ M N 0 < N
98 68 nngt0d N M 0 bits N 0 ..^ M N 0 < 2 if N M M N
99 55 80 97 98 divgt0d N M 0 bits N 0 ..^ M N 0 < N 2 if N M M N
100 99 78 breqtrrd N M 0 bits N 0 ..^ M N 0 < N 2 if N M M N
101 69 lt0neg1d N M 0 bits N 0 ..^ M N N 2 if N M M N < 0 0 < N 2 if N M M N
102 100 101 mpbird N M 0 bits N 0 ..^ M N N 2 if N M M N < 0
103 ax-1cn 1
104 neg1cn 1
105 1pneg1e0 1 + -1 = 0
106 103 104 105 addcomli - 1 + 1 = 0
107 102 106 breqtrrdi N M 0 bits N 0 ..^ M N N 2 if N M M N < - 1 + 1
108 neg1z 1
109 flbi N 2 if N M M N 1 N 2 if N M M N = 1 1 N 2 if N M M N N 2 if N M M N < - 1 + 1
110 69 108 109 sylancl N M 0 bits N 0 ..^ M N N 2 if N M M N = 1 1 N 2 if N M M N N 2 if N M M N < - 1 + 1
111 96 107 110 mpbir2and N M 0 bits N 0 ..^ M N N 2 if N M M N = 1
112 111 breq2d N M 0 bits N 0 ..^ M N 2 N 2 if N M M N 2 -1
113 61 112 mtbiri N M 0 bits N 0 ..^ M N ¬ 2 N 2 if N M M N
114 bitsval2 N if N M M N 0 if N M M N bits N ¬ 2 N 2 if N M M N
115 62 67 114 syl2anc N M 0 bits N 0 ..^ M N if N M M N bits N ¬ 2 N 2 if N M M N
116 113 115 mpbird N M 0 bits N 0 ..^ M N if N M M N bits N
117 60 116 sseldd N M 0 bits N 0 ..^ M N if N M M N 0 ..^ M
118 elfzolt2 if N M M N 0 ..^ M if N M M N < M
119 117 118 syl N M 0 bits N 0 ..^ M N if N M M N < M
120 79 57 ltnled N M 0 bits N 0 ..^ M N if N M M N < M ¬ M if N M M N
121 119 120 mpbid N M 0 bits N 0 ..^ M N ¬ M if N M M N
122 59 121 pm2.65da N M 0 bits N 0 ..^ M ¬ N
123 122 intnand N M 0 bits N 0 ..^ M ¬ N N
124 simpll N M 0 bits N 0 ..^ M N
125 elznn0nn N N 0 N N
126 124 125 sylib N M 0 bits N 0 ..^ M N 0 N N
127 126 ord N M 0 bits N 0 ..^ M ¬ N 0 N N
128 123 127 mt3d N M 0 bits N 0 ..^ M N 0
129 simplr N M 0 bits N 0 ..^ M M 0
130 simpr N M 0 bits N 0 ..^ M bits N 0 ..^ M
131 eqid sup n 0 | N < 2 n < = sup n 0 | N < 2 n <
132 128 129 130 131 bitsfzolem N M 0 bits N 0 ..^ M N 0 ..^ 2 M
133 53 132 impbida N M 0 N 0 ..^ 2 M bits N 0 ..^ M