Metamath Proof Explorer


Theorem bitscmp

Description: The bit complement of N is -u N - 1 . (Thus, by bitsfi , all negative numbers have cofinite bits representations.) (Contributed by Mario Carneiro, 5-Sep-2016)

Ref Expression
Assertion bitscmp N 0 bits N = bits - N - 1

Proof

Step Hyp Ref Expression
1 bitsval2 N m 0 m bits N ¬ 2 N 2 m
2 2z 2
3 2 a1i N m 0 2
4 simpl N m 0 N
5 4 zred N m 0 N
6 2nn 2
7 6 a1i N m 0 2
8 simpr N m 0 m 0
9 7 8 nnexpcld N m 0 2 m
10 5 9 nndivred N m 0 N 2 m
11 10 flcld N m 0 N 2 m
12 dvdsnegb 2 N 2 m 2 N 2 m 2 N 2 m
13 3 11 12 syl2anc N m 0 2 N 2 m 2 N 2 m
14 13 notbid N m 0 ¬ 2 N 2 m ¬ 2 N 2 m
15 11 znegcld N m 0 N 2 m
16 oddm1even N 2 m ¬ 2 N 2 m 2 - N 2 m - 1
17 15 16 syl N m 0 ¬ 2 N 2 m 2 - N 2 m - 1
18 flltp1 N 2 m N 2 m < N 2 m + 1
19 10 18 syl N m 0 N 2 m < N 2 m + 1
20 11 zred N m 0 N 2 m
21 1red N m 0 1
22 20 21 readdcld N m 0 N 2 m + 1
23 10 22 ltnegd N m 0 N 2 m < N 2 m + 1 N 2 m + 1 < N 2 m
24 19 23 mpbid N m 0 N 2 m + 1 < N 2 m
25 20 recnd N m 0 N 2 m
26 21 recnd N m 0 1
27 25 26 negdi2d N m 0 N 2 m + 1 = - N 2 m - 1
28 5 recnd N m 0 N
29 9 nncnd N m 0 2 m
30 9 nnne0d N m 0 2 m 0
31 28 29 30 divnegd N m 0 N 2 m = N 2 m
32 24 27 31 3brtr3d N m 0 - N 2 m - 1 < N 2 m
33 1zzd N m 0 1
34 15 33 zsubcld N m 0 - N 2 m - 1
35 34 zred N m 0 - N 2 m - 1
36 5 renegcld N m 0 N
37 9 nnrpd N m 0 2 m +
38 35 36 37 ltmuldivd N m 0 - N 2 m - 1 2 m < N - N 2 m - 1 < N 2 m
39 32 38 mpbird N m 0 - N 2 m - 1 2 m < N
40 9 nnzd N m 0 2 m
41 34 40 zmulcld N m 0 - N 2 m - 1 2 m
42 4 znegcld N m 0 N
43 zltlem1 - N 2 m - 1 2 m N - N 2 m - 1 2 m < N - N 2 m - 1 2 m - N - 1
44 41 42 43 syl2anc N m 0 - N 2 m - 1 2 m < N - N 2 m - 1 2 m - N - 1
45 39 44 mpbid N m 0 - N 2 m - 1 2 m - N - 1
46 36 21 resubcld N m 0 - N - 1
47 35 46 37 lemuldivd N m 0 - N 2 m - 1 2 m - N - 1 - N 2 m - 1 - N - 1 2 m
48 45 47 mpbid N m 0 - N 2 m - 1 - N - 1 2 m
49 flle N 2 m N 2 m N 2 m
50 10 49 syl N m 0 N 2 m N 2 m
51 20 10 lenegd N m 0 N 2 m N 2 m N 2 m N 2 m
52 50 51 mpbid N m 0 N 2 m N 2 m
53 31 52 eqbrtrrd N m 0 N 2 m N 2 m
54 20 renegcld N m 0 N 2 m
55 36 54 37 ledivmuld N m 0 N 2 m N 2 m N 2 m N 2 m
56 53 55 mpbid N m 0 N 2 m N 2 m
57 40 15 zmulcld N m 0 2 m N 2 m
58 zlem1lt N 2 m N 2 m N 2 m N 2 m - N - 1 < 2 m N 2 m
59 42 57 58 syl2anc N m 0 N 2 m N 2 m - N - 1 < 2 m N 2 m
60 56 59 mpbid N m 0 - N - 1 < 2 m N 2 m
61 46 54 37 ltdivmuld N m 0 - N - 1 2 m < N 2 m - N - 1 < 2 m N 2 m
62 60 61 mpbird N m 0 - N - 1 2 m < N 2 m
63 25 negcld N m 0 N 2 m
64 63 26 npcand N m 0 N 2 m - 1 + 1 = N 2 m
65 62 64 breqtrrd N m 0 - N - 1 2 m < N 2 m - 1 + 1
66 46 9 nndivred N m 0 - N - 1 2 m
67 flbi - N - 1 2 m - N 2 m - 1 - N - 1 2 m = - N 2 m - 1 - N 2 m - 1 - N - 1 2 m - N - 1 2 m < N 2 m - 1 + 1
68 66 34 67 syl2anc N m 0 - N - 1 2 m = - N 2 m - 1 - N 2 m - 1 - N - 1 2 m - N - 1 2 m < N 2 m - 1 + 1
69 48 65 68 mpbir2and N m 0 - N - 1 2 m = - N 2 m - 1
70 69 breq2d N m 0 2 - N - 1 2 m 2 - N 2 m - 1
71 17 70 bitr4d N m 0 ¬ 2 N 2 m 2 - N - 1 2 m
72 1 14 71 3bitrd N m 0 m bits N 2 - N - 1 2 m
73 72 notbid N m 0 ¬ m bits N ¬ 2 - N - 1 2 m
74 73 pm5.32da N m 0 ¬ m bits N m 0 ¬ 2 - N - 1 2 m
75 znegcl N N
76 1zzd N 1
77 75 76 zsubcld N - N - 1
78 77 biantrurd N m 0 ¬ 2 - N - 1 2 m - N - 1 m 0 ¬ 2 - N - 1 2 m
79 74 78 bitrd N m 0 ¬ m bits N - N - 1 m 0 ¬ 2 - N - 1 2 m
80 eldif m 0 bits N m 0 ¬ m bits N
81 bitsval m bits - N - 1 - N - 1 m 0 ¬ 2 - N - 1 2 m
82 3anass - N - 1 m 0 ¬ 2 - N - 1 2 m - N - 1 m 0 ¬ 2 - N - 1 2 m
83 81 82 bitri m bits - N - 1 - N - 1 m 0 ¬ 2 - N - 1 2 m
84 79 80 83 3bitr4g N m 0 bits N m bits - N - 1
85 84 eqrdv N 0 bits N = bits - N - 1