Metamath Proof Explorer


Theorem blenval

Description: The binary length of an integer. (Contributed by AV, 20-May-2020)

Ref Expression
Assertion blenval NV#b N = ifN=01log2N+1

Proof

Step Hyp Ref Expression
1 df-blen #b = nVifn=01log2n+1
2 eqeq1 n=Nn=0N=0
3 fveq2 n=Nn=N
4 3 oveq2d n=Nlog2n=log2N
5 4 fveq2d n=Nlog2n=log2N
6 5 oveq1d n=Nlog2n+1=log2N+1
7 2 6 ifbieq2d n=Nifn=01log2n+1=ifN=01log2N+1
8 elex NVNV
9 1ex 1V
10 ovex log2N+1V
11 9 10 ifex ifN=01log2N+1V
12 11 a1i NVifN=01log2N+1V
13 1 7 8 12 fvmptd3 NV#b N = ifN=01log2N+1