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 46777
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 46776 . 2 #b = (𝑛 ∈ V ↦ if(𝑛 = 0, 1, ((⌊‘(2 logb (abs‘𝑛))) + 1)))
2 eqeq1 2735 . . 3 (𝑛 = 𝑁 → (𝑛 = 0 ↔ 𝑁 = 0))
3 fveq2 6847 . . . . . 6 (𝑛 = 𝑁 → (abs‘𝑛) = (abs‘𝑁))
43oveq2d 7378 . . . . 5 (𝑛 = 𝑁 → (2 logb (abs‘𝑛)) = (2 logb (abs‘𝑁)))
54fveq2d 6851 . . . 4 (𝑛 = 𝑁 → (⌊‘(2 logb (abs‘𝑛))) = (⌊‘(2 logb (abs‘𝑁))))
65oveq1d 7377 . . 3 (𝑛 = 𝑁 → ((⌊‘(2 logb (abs‘𝑛))) + 1) = ((⌊‘(2 logb (abs‘𝑁))) + 1))
72, 6ifbieq2d 4517 . 2 (𝑛 = 𝑁 → if(𝑛 = 0, 1, ((⌊‘(2 logb (abs‘𝑛))) + 1)) = if(𝑁 = 0, 1, ((⌊‘(2 logb (abs‘𝑁))) + 1)))
8 elex 3464 . 2 (𝑁𝑉𝑁 ∈ V)
9 1ex 11160 . . . 4 1 ∈ V
10 ovex 7395 . . . 4 ((⌊‘(2 logb (abs‘𝑁))) + 1) ∈ V
119, 10ifex 4541 . . 3 if(𝑁 = 0, 1, ((⌊‘(2 logb (abs‘𝑁))) + 1)) ∈ V
1211a1i 11 . 2 (𝑁𝑉 → if(𝑁 = 0, 1, ((⌊‘(2 logb (abs‘𝑁))) + 1)) ∈ V)
131, 7, 8, 12fvmptd3 6976 1 (𝑁𝑉 → (#b𝑁) = if(𝑁 = 0, 1, ((⌊‘(2 logb (abs‘𝑁))) + 1)))
Colors of variables: wff setvar class
Syntax hints:  wi 4   = wceq 1541  wcel 2106  Vcvv 3446  ifcif 4491  cfv 6501  (class class class)co 7362  0cc0 11060  1c1 11061   + caddc 11063  2c2 12217  cfl 13705  abscabs 15131   logb clogb 26151  #bcblen 46775
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 2702  ax-sep 5261  ax-nul 5268  ax-pr 5389  ax-1cn 11118
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 2533  df-eu 2562  df-clab 2709  df-cleq 2723  df-clel 2809  df-nfc 2884  df-ne 2940  df-ral 3061  df-rex 3070  df-rab 3406  df-v 3448  df-dif 3916  df-un 3918  df-in 3920  df-ss 3930  df-nul 4288  df-if 4492  df-sn 4592  df-pr 4594  df-op 4598  df-uni 4871  df-br 5111  df-opab 5173  df-mpt 5194  df-id 5536  df-xp 5644  df-rel 5645  df-cnv 5646  df-co 5647  df-dm 5648  df-iota 6453  df-fun 6503  df-fv 6509  df-ov 7365  df-blen 46776
This theorem is referenced by:  blen0  46778  blenn0  46779
  Copyright terms: Public domain W3C validator