-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: better support for reducing
Nat.rec
(#3616)
closes #3022 With this commit, given the declaration ``` def foo : Nat → Nat | 0 => 2 | n + 1 => foo n ``` when we unfold `foo (n+1)`, we now obtain `foo n` instead of `foo (Nat.add n 0)`.
- Loading branch information
1 parent
f0a762e
commit 09bc477
Showing
8 changed files
with
55 additions
and
10 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
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
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
true | ||
(match Nat.add i 0 with | ||
(match i with | ||
| 0 => true | ||
| Nat.succ n => true) && | ||
f (Nat.add i 0) | ||
f i | ||
if i < 5 then 0 else 1 | ||
if i < 5 then 0 else g i (Nat.add j 0) | ||
if i < 5 then 0 else g i j | ||
i + 1 | ||
i + h i (Nat.add j 0) | ||
i + h i j | ||
i + 1 | ||
i + i * 2 | ||
i + i * r i (Nat.add j 0) | ||
i + i * r i j | ||
let z := s i (Nat.add j 0); | ||
i + i * r i j | ||
let z := s i j; | ||
z + z |
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,13 @@ | ||
def foo : Nat → Nat | ||
| 0 => 2 | ||
| n + 1 => foo n | ||
|
||
example (n : Nat) : foo (n + 1) = 2 := by | ||
unfold foo -- should not produce `⊢ foo (Nat.add n 0) = 2` | ||
guard_target =ₛ foo n = 2 | ||
sorry | ||
|
||
example (n : Nat) : foo (n + 1) = 2 := by | ||
simp only [foo] -- should not produce `⊢ foo (Nat.add n 0) = 2` | ||
guard_target =ₛ foo n = 2 | ||
sorry |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
x y : Nat | ||
h : Nat.add x 1 = Nat.add y 1 | ||
h : x + 1 = y + 1 | ||
⊢ x = y |
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