Skip to content

Commit

Permalink
chore: account for UInt refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
hargoniX committed Sep 23, 2024
1 parent 2c8ae45 commit 6e87b74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion Qq/ForLean/ReduceEval.lean
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,20 @@ instance : ReduceEval (Fin (n+1)) where
else
throwFailedToEval e

instance {n : Nat} : ReduceEval (BitVec n) where
reduceEval := fun e => do
let e ← whnf e
if e.isAppOfArity ``BitVec.ofFin 2 then
have : 2^n - 1 + 1 = 2^n := Nat.sub_one_add_one_eq_of_pos (Nat.two_pow_pos n)
let _ : ReduceEval (Fin (2^n)) := this ▸ (inferInstanceAs <| ReduceEval (Fin (2^n - 1 + 1)))
pure ⟨(← reduceEval (e.getArg! 1))⟩
else
throwFailedToEval e

instance : ReduceEval UInt64 where
reduceEval := fun e => do
let e ← whnf e
if e.isAppOfArity ``UInt64.mk 1 then
let _ : ReduceEval (Fin UInt64.size) := inferInstanceAs <| ReduceEval (Fin (_ + 1))
pure ⟨(← reduceEval (e.getArg! 0))⟩
else
throwFailedToEval e
Expand Down
2 changes: 1 addition & 1 deletion lean-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
leanprover/lean4:v4.12.0-rc1
leanprover/lean4-pr-releases:pr-release-5323

0 comments on commit 6e87b74

Please sign in to comment.