Skip to content

Commit 8d13b97

Browse files
luisacicolinibollu
andauthored
chore: docstring
Co-authored-by: Siddharth <[email protected]>
1 parent a3e6d95 commit 8d13b97

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Init/Data/BitVec/Bitblast.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,6 +1964,10 @@ def clzAuxRec {w : Nat} (x : BitVec w) (n : Nat) : BitVec w :=
19641964
| 0 => if x.getLsbD 0 then BitVec.ofNat w (w - 1) else BitVec.ofNat w w
19651965
| n' + 1 => if x.getLsbD n then BitVec.ofNat w (w - 1 - n) else clzAuxRec x n'
19661966

1967+
/--
1968+
If `x : BitVec w` has all bits larger than index `n` equal to `false`,
1969+
then `clzAuxRec` starting from `n` will compute the `clz`.
1970+
-/
19671971
theorem clz_eq_clzAuxRec_of_forall_getLsbD_false (x : BitVec w) (h : ∀ i, n < i → x.getLsbD i = false) :
19681972
x.clz = x.clzAuxRec n := by
19691973
have := Nat.lt_pow_self (a := 2) (n := w) (by omega)

0 commit comments

Comments
 (0)