Skip to content

Commit

Permalink
feat: generalize ReduceEval (Fin n) to use NeZero (#61)
Browse files Browse the repository at this point in the history
This requires a toolchain bump.
  • Loading branch information
eric-wieser authored Oct 18, 2024
1 parent fa3d73a commit 1357f4f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Qq/ForLean/ReduceEval.lean
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ private partial def evalList [ReduceEval α] (e : Expr) : MetaM (List α) := do

instance [ReduceEval α] : ReduceEval (List α) := ⟨evalList⟩

instance : ReduceEval (Fin (n+1)) where
instance [NeZero n] : ReduceEval (Fin n) where
reduceEval := fun e => do
let e ← whnf e
if e.isAppOfArity ``Fin.mk 3 then
return Fin.ofNat (← reduceEval (e.getArg! 1))
return Fin.ofNat' _ (← reduceEval (e.getArg! 1))
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:v4.13.0-rc3

0 comments on commit 1357f4f

Please sign in to comment.