-
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.
fix: Fix/GuessLex: refine through more casesOnApp/matcherApp (#3176)
there was a check if !Structural.recArgHasLooseBVarsAt recFnName fixedPrefixSize e then that would avoid going through `.refineThrough`/`.addArg` for matcher/casesOn applications. It seems it tries to detect when refining the motive/param is pointless, but it was too eager, and cause confusion with, for example, this reasonably reasonable function: def foo : (n : Nat) → (i : Fin n) → Bool | 0, _ => false | 1, _ => false | _+2, _ => foo 1 ⟨0, Nat.zero_lt_one⟩ decreasing_by simp_wf; simp_arith In particular, the `GuessLex` code later expects that the (implict) `PProd.casesOn` in the implementation of `foo._unary` will refine the paramter, because else the (rather picky) `unpackArg` fails. But it also prevents this from being provable. So let's try without this shortcut. Fixing this also revealed that `withRecApps` wasn’t looking in all corners of a matcherApp/casesOnApp. Fixes #3175
- Loading branch information
Showing
4 changed files
with
38 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
def foo : (n : Nat) → (i : Fin n) → Bool | ||
| 0, _ => false | ||
| 1, _ => false | ||
| _+2, _ => foo 1 ⟨0, Nat.zero_lt_one⟩ | ||
decreasing_by simp_wf; simp_arith | ||
|
||
def bar : (n : Nat) → (i : Fin n) → Bool | ||
| 0, _ => false | ||
| 1, _ => false | ||
| _+2, _ => bar 1 ⟨0, Nat.zero_lt_one⟩ | ||
termination_by n i => n | ||
decreasing_by simp_wf; simp_arith |
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