Metamath Proof Explorer


Theorem dig2nn0

Description: A digit of a nonnegative integer N in a binary system is either 0 or 1. (Contributed by AV, 24-May-2020)

Ref Expression
Assertion dig2nn0 N 0 K K digit 2 N 0 1

Proof

Step Hyp Ref Expression
1 2nn 2
2 1 a1i N 0 K 2
3 simpr N 0 K K
4 nn0rp0 N 0 N 0 +∞
5 4 adantr N 0 K N 0 +∞
6 digval 2 K N 0 +∞ K digit 2 N = 2 K N mod 2
7 2 3 5 6 syl3anc N 0 K K digit 2 N = 2 K N mod 2
8 2re 2
9 8 a1i N 0 K 2
10 2ne0 2 0
11 10 a1i N 0 K 2 0
12 znegcl K K
13 12 adantl N 0 K K
14 9 11 13 reexpclzd N 0 K 2 K
15 nn0re N 0 N
16 15 adantr N 0 K N
17 14 16 remulcld N 0 K 2 K N
18 17 flcld N 0 K 2 K N
19 elmod2 2 K N 2 K N mod 2 0 1
20 18 19 syl N 0 K 2 K N mod 2 0 1
21 7 20 eqeltrd N 0 K K digit 2 N 0 1