-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: GuessLex: print inferred termination argument (#3012)
With set_option showInferredTerminationBy true this prints a message like Inferred termination argument: termination_by ackermann n m => (sizeOf n, sizeOf m) it tries hard to use names that * match the names that the user used, if present * have no daggers (so that it can be copied) * do not shadow each other * do not shadow anything from the environment (just to be nice) it does so by appending sufficient `'` to the name. Some of the emitted `sizeOf` calls are unnecessary, but they are needed sometimes with dependent parameters. A follow-up PR will not emit them for non-dependent arguments, so that in most cases the output is pretty. Somewhen down the road we also want a code action, maybe triggered by `termination_by?`. This should come after #2921, as that simplifies that feature (no need to merge termination arguments from different cliques for example.)
- Loading branch information
Showing
8 changed files
with
137 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
Inferred termination argument: | ||
termination_by | ||
ackermann n m => (sizeOf n, sizeOf m) | ||
Inferred termination argument: | ||
termination_by | ||
ackermann2 n m => (sizeOf m, sizeOf n) | ||
Inferred termination argument: | ||
termination_by | ||
ackermannList n m => (sizeOf n, sizeOf m) | ||
Inferred termination argument: | ||
termination_by | ||
foo2 x1 x2 => (sizeOf x2, sizeOf x1) | ||
Inferred termination argument: | ||
termination_by | ||
even x1 => sizeOf x1 | ||
odd x1 => sizeOf x1 | ||
Inferred termination argument: | ||
termination_by | ||
evenWithFixed x1 => sizeOf x1 | ||
oddWithFixed x1 => sizeOf x1 | ||
Inferred termination argument: | ||
termination_by | ||
ping.pong x1 => (sizeOf x1, 0) | ||
ping n => (sizeOf n, 1) | ||
Inferred termination argument: | ||
termination_by | ||
hasForbiddenArg n _h m => (sizeOf m, sizeOf n) | ||
Inferred termination argument: | ||
termination_by | ||
blowup x1 x2 x3 x4 x5 x6 x7 x8 => | ||
(sizeOf x8, sizeOf x7, sizeOf x6, sizeOf x5, sizeOf x4, sizeOf x3, sizeOf x2, sizeOf x1) | ||
Inferred termination argument: | ||
termination_by | ||
dependent x1 x2 => (sizeOf x1, sizeOf x2) | ||
Inferred termination argument: | ||
termination_by | ||
eval a => (sizeOf a, 1) | ||
eval_add a => (sizeOf a, 0) | ||
Inferred termination argument: | ||
termination_by | ||
shadow1 x2 x2' => sizeOf x2' | ||
Inferred termination argument: | ||
termination_by | ||
shadow2 some_n' x2 => sizeOf x2 | ||
Inferred termination argument: | ||
termination_by | ||
shadow3 sizeOf' x2 => sizeOf x2 | ||
Inferred termination argument: | ||
termination_by | ||
qualifiedSizeOf m x2 => SizeOf.sizeOf x2 |
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,5 @@ | ||
Inferred termination argument: | ||
termination_by | ||
prod x y z => (sizeOf y, 1, 0) | ||
oprod x y z => (sizeOf y, 0, 1) | ||
eprod x y z => (sizeOf y, 0, 0) |
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,4 @@ | ||
Inferred termination argument: | ||
termination_by | ||
pedal x1 x2 x3 => (sizeOf x1, sizeOf x2, 0) | ||
coast x1 x2 x3 => (sizeOf x1, sizeOf x2, 1) |