Metamath Proof Explorer


Theorem nnpw2pb

Description: A number is a positive integer iff it can be represented as the sum of a power of 2 and a "remainder" smaller than the power. (Contributed by AV, 31-May-2020)

Ref Expression
Assertion nnpw2pb N i 0 r 0 ..^ 2 i N = 2 i + r

Proof

Step Hyp Ref Expression
1 nnpw2p N i 0 r 0 ..^ 2 i N = 2 i + r
2 2nn 2
3 nnexpcl 2 i 0 2 i
4 2 3 mpan i 0 2 i
5 elfzonn0 r 0 ..^ 2 i r 0
6 nnnn0addcl 2 i r 0 2 i + r
7 4 5 6 syl2an i 0 r 0 ..^ 2 i 2 i + r
8 eleq1 N = 2 i + r N 2 i + r
9 7 8 syl5ibrcom i 0 r 0 ..^ 2 i N = 2 i + r N
10 9 rexlimivv i 0 r 0 ..^ 2 i N = 2 i + r N
11 1 10 impbii N i 0 r 0 ..^ 2 i N = 2 i + r