Skip to content

refactor: elimate string manipulation in TacticAnalysis.verifyTryThisSuggestions#37917

Open
chenson2018 wants to merge 4 commits intoleanprover-community:masterfrom
chenson2018:string-manip
Open

refactor: elimate string manipulation in TacticAnalysis.verifyTryThisSuggestions#37917
chenson2018 wants to merge 4 commits intoleanprover-community:masterfrom
chenson2018:string-manip

Conversation

@chenson2018
Copy link
Copy Markdown
Contributor

This change should be compatible with, but independent from, #37916. Instead of manipulating pretty-printed strings to identify when grind? uses hashes or approx, search for the corresponding syntax kinds.


Open in Gitpod

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 11, 2026

PR summary 9b51fe6ec0

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ approx

You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions bot added the t-meta Tactics, attributes or user commands label Apr 11, 2026
@JovanGerb JovanGerb removed their assignment Apr 13, 2026
@joneugster
Copy link
Copy Markdown
Contributor

I couldn't find any tests about verifyTryThisSuggestions in MathlibTest/TacticAnalysis.lean. Could you add some so I can test this easier?

Concretely I do see tests about set_option linter.tacticAnalysis.verifyGrind true in but I didn't see one which would trigger the modified "[...] suggestion failed: [...]" warning.

@joneugster joneugster assigned joneugster and unassigned dwrensha Apr 17, 2026
Comment on lines -647 to -650
let suggPP ← try
liftCoreM <| PrettyPrinter.ppTactic suggestedTac
catch _ => pure s!"{suggestedTac}"
let suggStr := suggPP.pretty
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't yet understand why removing the pretty-printing is desired? But maybe an added test makes this obvious

Copy link
Copy Markdown
Contributor Author

@chenson2018 chenson2018 Apr 17, 2026

Choose a reason for hiding this comment

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

I feel like this is inherently hacky, I believe added by Claude when first written. It's just using the pretty-printed tactic to check for hash codes and approx in grind =>. Besides being less maintainable and clear in my opinion, I think it will skip any usage of grind that uses a declaration with the substring "approx".

@joneugster joneugster added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 17, 2026
@chenson2018
Copy link
Copy Markdown
Contributor Author

I couldn't find any tests about verifyTryThisSuggestions in MathlibTest/TacticAnalysis.lean. Could you add some so I can test this easier?

Concretely I do see tests about set_option linter.tacticAnalysis.verifyGrind true in but I didn't see one which would trigger the modified "[...] suggestion failed: [...]" warning.

I have added a test of a suggestion failed warning that would be incorrectly skipped given the current use of strings versus the typed syntax. I'm not sure that any testing around this will be great however, as it's checking behavior that in the hopefully near future will be resolved in core.

@chenson2018
Copy link
Copy Markdown
Contributor Author

-awaiting-author

@github-actions github-actions bot removed the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants