Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds an ability to control the threshold that determines when the pretty printer "memoizes" a term (that is, creates a let-bound "x@" variable). As the help string says "Set the number times a subterm must be shared for it to be let-bound in printer output."
My original thought was that I could tweak this to make formulas more readable, but it is really hard to find the right number---too high and the type parameters that appear in terms can obscure the information, too low and there is still too much indirection in the printer output.
It has, however, proven to be useful in the following situation: after some changes to a specification, some proofs break. You can set this number very high, then
print_goal
in the old proof, and similarly in the new proof, and then usediff
on the outputs to get a sense of what's changed. With the memoized variables, typically the whole formula is different, but with the expanded, unmemoized output it is pretty easy to see the differences.