Skip to content

Commit

Permalink
fix: panic at reducePow
Browse files Browse the repository at this point in the history
closes #4947
  • Loading branch information
leodemoura committed Aug 12, 2024
1 parent 4236d8a commit aa4dfbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Lean/Meta/Tactic/Simp/BuiltinSimprocs/Nat.lean
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ builtin_dsimproc [simp, seval] reduceDiv ((_ / _ : Nat)) := reduceBin ``HDiv.hDi
builtin_dsimproc [simp, seval] reduceMod ((_ % _ : Nat)) := reduceBin ``HMod.hMod 6 (· % ·)

builtin_dsimproc [simp, seval] reducePow ((_ ^ _ : Nat)) := fun e => do
let some n ← fromExpr? e.appFn!.appArg! | return .continue
let some m ← fromExpr? e.appArg! | return .continue
let_expr HPow.hPow _ _ _ _ n m := e | return .continue
let some n ← fromExpr? n | return .continue
let some m ← fromExpr? m | return .continue
unless (← checkExponent m) do return .continue
return .done <| toExpr (n ^ m)

Expand Down
6 changes: 6 additions & 0 deletions tests/lean/run/4947.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
universe u
class G (A : outParam Nat) where Z : Type u
export G (Z)
abbrev f (a : Nat) : Nat := 2 ^ a
variable [G (f 0)]
example {s : Z} : s = s := by simp only [Nat.reducePow]

0 comments on commit aa4dfbb

Please sign in to comment.