Zulip Chat Archive

Stream: general

Topic: Try this: suffices simpa


Johan Commelin (Mar 09 2024 at 06:10):

Besides squeezing simps, we should also consider the pattern

suffices "expr after simp" by simpa

Because often it will be shorter, more readable, and possibly more robust

Damiano Testa (Mar 09 2024 at 06:14):

Sure, should I add that as part of the warning message?

Johan Commelin (Mar 09 2024 at 07:35):

I think I would love to have a little tactic that replaces a simp call by such a suffices-simpa pattern.

Johan Commelin (Mar 09 2024 at 07:36):

Using Try this: etc

Damiano Testa (Mar 09 2024 at 07:36):

Ah, something like suffa?? :lol:

Johan Commelin (Mar 09 2024 at 07:36):

Right

Damiano Testa (Mar 09 2024 at 07:37):

Ok, that would not be a linter, though.

Damiano Testa (Mar 09 2024 at 07:37):

I like the idea, though.

Johan Commelin (Mar 09 2024 at 07:37):

But ideally it is a very small modification of simp. So that you just add one or two letters to a simp invocation to get the suggestion.

Damiano Testa (Mar 09 2024 at 07:37):

ssimp, for suffices simp?

Johan Commelin (Mar 09 2024 at 07:37):

sufsimp, maybe? Or simpsuf??

Damiano Testa (Mar 09 2024 at 07:38):

Shall we move this discussion to a separate thread, though?

Damiano Testa (Mar 09 2024 at 07:39):

Looking at the output of the linter, there are very few false positives. Almost by definition, I do not know how many false negatives there are.

Johan Commelin (Mar 09 2024 at 07:43):

simpa!? could generate a suffices simpa when called in a non-terminal spot

Notification Bot (Mar 09 2024 at 07:43):

14 messages were moved here from #PR reviews > #11247 non-terminal simp linter by Johan Commelin.

Damiano Testa (Mar 09 2024 at 07:50):

The part that I see will be tricky with this tactic is getting the syntax of the expected type to print right.

Eric Wieser (Mar 09 2024 at 13:07):

Could simp? just generate multiple try thiss?

Mario Carneiro (Mar 10 2024 at 12:24):

This isn't really simp-specific, you could always add a suffices block for any tactic which changes the goal state, or a show to any goal state. This seems like a general tactic code action

Damiano Testa (Apr 08 2024 at 14:09):

#12006 implements a version of this.

Damiano Testa (Apr 08 2024 at 14:11):

Although I am starting to wonder whether caching unwieldy squeezes is potentially a better approach. Something like

  simp? [...] says

except that the says part gets written to a cache file and says

  • retrieves the cache from file, if it exists, or
  • adds it to the file, if it does not.

Last updated: May 02 2025 at 03:31 UTC