-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: lazy
ite
branch internalization in grind
(#6737)
This PR ensures that the branches of an `if-then-else` term are internalized only after establishing the truth value of the condition. This change makes its behavior consistent with the `match`-expression and dependent `if-then-else` behavior in `grind`. This feature is particularly important for recursive functions defined by well-founded recursion and `if-then-else`. Without lazy `if-then-else` branch internalization, the equation theorem for the recursive function would unfold until reaching the generation depth threshold, and before performing any case analysis. See new tests for an example.
- Loading branch information
1 parent
533af01
commit 9b74c07
Showing
3 changed files
with
30 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
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,24 @@ | ||
def f (n : Nat) (m : Nat) := | ||
if n < m then | ||
f (n+1) m + n | ||
else | ||
n | ||
|
||
/-- | ||
info: [grind.ematch.instance] f.eq_def: f 5 m = if 5 < m then f (5 + 1) m + 5 else 5 | ||
-/ | ||
#guard_msgs (info) in | ||
set_option trace.grind.ematch.instance true in | ||
example : f 5 m > 0 := by | ||
fail_if_success grind (splits := 0) [f.eq_def] | ||
sorry | ||
|
||
/-- | ||
info: [grind.ematch.instance] f.eq_def: f 5 m = if 5 < m then f (5 + 1) m + 5 else 5 | ||
[grind.ematch.instance] f.eq_def: f 6 m = if 6 < m then f (6 + 1) m + 6 else 6 | ||
-/ | ||
#guard_msgs (info) in | ||
set_option trace.grind.ematch.instance true in | ||
example : f 5 m > 0 := by | ||
fail_if_success grind (splits := 1) [f.eq_def] | ||
sorry |