Skip to content

Commit

Permalink
clean up proof
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkeizer committed Dec 16, 2024
1 parent ff2c391 commit 9f43c0c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Init/Data/BitVec/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2586,9 +2586,10 @@ private theorem Nat.div_add_le_right {z : Nat} (h : 0 < z) (x y : Nat) :
theorem msb_udiv (x y : BitVec w) :
(x / y).msb = (x.msb && y == 1#w) := by
cases msb_x : x.msb
· simp [msb_eq_decide] at *
have : x.toNat / y.toNat ≤ x.toNat := Nat.div_le_self ..
omega
· suffices x.toNat / y.toNat < 2 ^ (w - 1) by simpa [msb_eq_decide]
calc
x.toNat / y.toNat ≤ x.toNat := by apply Nat.div_le_self
_ < 2 ^ (w - 1) := by simpa [msb_eq_decide] using msb_x
. rcases w with _|w
· contradiction
· have : (y == 1#_) = decide (y.toNat = 1) := by
Expand Down

0 comments on commit 9f43c0c

Please sign in to comment.