Users' Mathboxes Mathbox for Alexander van der Vekens < Previous   Next >
Nearby theorems
Mirrors  >  Home  >  MPE Home  >  Th. List  >   Mathboxes  >  blenval Structured version   Visualization version   GIF version

Theorem blenval 46629
Description: The binary length of an integer. (Contributed by AV, 20-May-2020.)
Assertion
Ref Expression
blenval (𝑁𝑉 → (#b𝑁) = if(𝑁 = 0, 1, ((⌊‘(2 logb (abs‘𝑁))) + 1)))

Proof of Theorem blenval
Dummy variable 𝑛 is distinct from all other variables.
StepHypRef Expression
1 df-blen 46628 . 2 #b = (𝑛 ∈ V ↦ if(𝑛 = 0, 1, ((⌊‘(2 logb (abs‘𝑛))) + 1)))
2 eqeq1 2740 . . 3 (𝑛 = 𝑁 → (𝑛 = 0 ↔ 𝑁 = 0))
3 fveq2 6842 . . . . . 6 (𝑛 = 𝑁 → (abs‘𝑛) = (abs‘𝑁))
43oveq2d 7372 . . . . 5 (𝑛 = 𝑁 → (2 logb (abs‘𝑛)) = (2 logb (abs‘𝑁)))
54fveq2d 6846 . . . 4 (𝑛 = 𝑁 → (⌊‘(2 logb (abs‘𝑛))) = (⌊‘(2 logb (abs‘𝑁))))
65oveq1d 7371 . . 3 (𝑛 = 𝑁 → ((⌊‘(2 logb (abs‘𝑛))) + 1) = ((⌊‘(2 logb (abs‘𝑁))) + 1))
72, 6ifbieq2d 4512 . 2 (𝑛 = 𝑁 → if(𝑛 = 0, 1, ((⌊‘(2 logb (abs‘𝑛))) + 1)) = if(𝑁 = 0, 1, ((⌊‘(2 logb (abs‘𝑁))) + 1)))
8 elex 3463 . 2 (𝑁𝑉𝑁 ∈ V)
9 1ex 11150 . . . 4 1 ∈ V
10 ovex 7389 . . . 4 ((⌊‘(2 logb (abs‘𝑁))) + 1) ∈ V
119, 10ifex 4536 . . 3 if(𝑁 = 0, 1, ((⌊‘(2 logb (abs‘𝑁))) + 1)) ∈ V
1211a1i 11 . 2 (𝑁𝑉 → if(𝑁 = 0, 1, ((⌊‘(2 logb (abs‘𝑁))) + 1)) ∈ V)
131, 7, 8, 12fvmptd3 6971 1 (𝑁𝑉 → (#b𝑁) = if(𝑁 = 0, 1, ((⌊‘(2 logb (abs‘𝑁))) + 1)))
Colors of variables: wff setvar class
Syntax hints:  wi 4   = wceq 1541  wcel 2106  Vcvv 3445  ifcif 4486  cfv 6496  (class class class)co 7356  0cc0 11050  1c1 11051   + caddc 11053  2c2 12207  cfl 13694  abscabs 15118   logb clogb 26112  #bcblen 46627
This theorem was proved from axioms:  ax-mp 5  ax-1 6  ax-2 7  ax-3 8  ax-gen 1797  ax-4 1811  ax-5 1913  ax-6 1971  ax-7 2011  ax-8 2108  ax-9 2116  ax-10 2137  ax-11 2154  ax-12 2171  ax-ext 2707  ax-sep 5256  ax-nul 5263  ax-pr 5384  ax-1cn 11108
This theorem depends on definitions:  df-bi 206  df-an 397  df-or 846  df-3an 1089  df-tru 1544  df-fal 1554  df-ex 1782  df-nf 1786  df-sb 2068  df-mo 2538  df-eu 2567  df-clab 2714  df-cleq 2728  df-clel 2814  df-nfc 2889  df-ne 2944  df-ral 3065  df-rex 3074  df-rab 3408  df-v 3447  df-dif 3913  df-un 3915  df-in 3917  df-ss 3927  df-nul 4283  df-if 4487  df-sn 4587  df-pr 4589  df-op 4593  df-uni 4866  df-br 5106  df-opab 5168  df-mpt 5189  df-id 5531  df-xp 5639  df-rel 5640  df-cnv 5641  df-co 5642  df-dm 5643  df-iota 6448  df-fun 6498  df-fv 6504  df-ov 7359  df-blen 46628
This theorem is referenced by:  blen0  46630  blenn0  46631
  Copyright terms: Public domain W3C validator