We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a3e6d95 commit 8d13b97Copy full SHA for 8d13b97
src/Init/Data/BitVec/Bitblast.lean
@@ -1964,6 +1964,10 @@ def clzAuxRec {w : Nat} (x : BitVec w) (n : Nat) : BitVec w :=
1964
| 0 => if x.getLsbD 0 then BitVec.ofNat w (w - 1) else BitVec.ofNat w w
1965
| n' + 1 => if x.getLsbD n then BitVec.ofNat w (w - 1 - n) else clzAuxRec x n'
1966
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
+-/
1971
theorem clz_eq_clzAuxRec_of_forall_getLsbD_false (x : BitVec w) (h : ∀ i, n < i → x.getLsbD i = false) :
1972
x.clz = x.clzAuxRec n := by
1973
have := Nat.lt_pow_self (a := 2) (n := w) (by omega)
0 commit comments