Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print sharing control #1330

Merged
merged 3 commits into from
Jul 1, 2021
Merged

Conversation

msaaltink
Copy link
Contributor

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 use diff 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.

Copy link
Contributor

@robdockins robdockins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a practical approach to me.

@robdockins
Copy link
Contributor

However, regarding finding differences between terms, maybe we should build a specific tool for this sort of thing. We could output two terms of interest into the external format and find some way to let users explore a tree-diff.

@nano-o nano-o added the PR: ready to merge Magic flag for pull requests to ask Mergify to merge given an approval and a successful CI run label Jul 1, 2021
@mergify mergify bot merged commit aaa27a9 into GaloisInc:master Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: ready to merge Magic flag for pull requests to ask Mergify to merge given an approval and a successful CI run
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants