Skip to content

Commit f2447c4

Browse files
committed
chore: add real toFin proof
1 parent 8ae3099 commit f2447c4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Init/Data/BitVec/Lemmas.lean

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,8 +1955,12 @@ theorem msb_concat {w : Nat} {b : Bool} {x : BitVec w} :
19551955
· cases b <;> simp <;> omega
19561956

19571957
@[simp] theorem toFin_concat (x : BitVec w) (b : Bool) :
1958-
(concat x b).toFin = x.toNat * 2 + b.toNat := by
1959-
simp
1958+
(concat x b).toFin = Fin.mk (x.toNat * 2 + b.toNat) (by
1959+
have := Bool.toNat_lt b
1960+
simp [← Nat.two_pow_pred_add_two_pow_pred, Bool.toNat_lt b]
1961+
omega
1962+
) := by
1963+
simp [← Fin.val_inj]
19601964

19611965
@[simp] theorem not_concat (x : BitVec w) (b : Bool) : ~~~(concat x b) = concat (~~~x) !b := by
19621966
ext i; cases i using Fin.succRecOn <;> simp [*, Nat.succ_lt_succ]

0 commit comments

Comments
 (0)