forked from leanprover/lean4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: guard against
Nat.reducePow
panicking
In the Carleson project a non-fatal PANIC occurring in the application of certain applications of `Nat.reducePow` was discovered (https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/PANIC.20at.20Lean.2EExpr.2EappArg!.20application.20expected/near/457037665). We fix this regression from leanprover#4637. Fixes leanprover#4947.
- Loading branch information
1 parent
6dd5023
commit 25e18b8
Showing
3 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/-! # Test that safe exponentiation does not cause a panic -/ | ||
|
||
universe u | ||
|
||
class G (A : outParam Nat) where Z : Type u | ||
|
||
export G (Z) | ||
|
||
/-! Define an abbrev which `reducePow` can work on -/ | ||
|
||
abbrev f (a : Nat) : Nat := 2 ^ a | ||
|
||
variable [G (f 0)] | ||
|
||
/-! This should not cause a panic -/ | ||
|
||
example {s : Z} : s = s := by simp only [Nat.reducePow] |
Empty file.