Skip to content

Commit b6e4203

Browse files
committed
chore: fix
1 parent 2c955fa commit b6e4203

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

src/Init/Data/BitVec/Bitblast.lean

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,7 +1966,7 @@ def clzAuxRec {w : Nat} (x : BitVec w) (n : Nat) : BitVec w :=
19661966

19671967
/--
19681968
If `x : BitVec w` has all bits larger than index `n` equal to `false`,
1969-
then `clzAuxRec` starting from `n` will compute the `clz`.
1969+
then `clzAuxRec` starting from `n` will compute the `clz`.
19701970
-/
19711971
theorem clz_eq_clzAuxRec_of_forall_getLsbD_false (x : BitVec w) (h : ∀ i, n < i → x.getLsbD i = false) :
19721972
x.clz = x.clzAuxRec n := by
@@ -2020,20 +2020,12 @@ theorem clz_eq_clzAuxRec_of_forall_getLsbD_false (x : BitVec w) (h : ∀ i, n <
20202020
· simp [show i = n + 1 by omega, hxn]
20212021

20222022
/--
2023-
`clzAuxRec` agrees with `clz` when `clzAuxRec` is started from an index `n` that is at least `w - 1`.
2023+
`clzAuxRec` agrees with `clz` when `clzAuxRec` is started from an index `n` that is at least `w - 1`.
20242024
-/
20252025
theorem clz_eq_clzAuxRec_of_le (x : BitVec w) (h : w - 1 ≤ n) :
20262026
x.clz = x.clzAuxRec n := by
20272027
rw [clz_eq_clzAuxRec_of_forall_getLsbD_false]
20282028
intro i hi
20292029
simp [show w ≤ i by omega]
20302030

2031-
theorem clzAuxRec_eq_of_le (x : BitVec w) (hn : w ≤ n) :
2032-
x.clzAuxRec n = x.clzAuxRec (w - 1) := by
2033-
rcases w with _|w
2034-
· simp [of_length_zero]
2035-
· rw [← clz_eq_clzAuxRec_of_le]
2036-
· rw [clz_eq_clzAuxRec_of_le]; omega
2037-
· omega
2038-
20392031
end BitVec

src/Std/Tactic/BVDecide/Bitblast/BVExpr/Circuit/Lemmas/Operations/Clz.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ theorem go_denote_eq {w : Nat} (aig : AIG α)
109109
simp only [show ¬curr = 0 by omega, reduceIte] at hacc
110110
by_cases hcw : curr = w
111111
· subst hcw; simp [hacc]
112-
· simp only [hacc];
113-
rw [BitVec.clzAuxRec_eq_of_le]
114-
omega
112+
· simp only [hacc]
113+
rw [BitVec.clz_eq_clzAuxRec_of_le (x := x) (n := curr - 1) (by omega),
114+
← BitVec.clz_eq_clzAuxRec_of_le (x := x) (n := w - 1) (by omega)]
115115

116116
end blastClz
117117

0 commit comments

Comments
 (0)