Zulip Chat Archive

Stream: mathlib4

Topic: aesop.warn.applyIff


Kim Morrison (Sep 24 2024 at 00:01):

Aesop has just introduced a new warning in https://github.com/leanprover-community/aesop/commit/29cf094e84ae9852f0011b47b6ddc684ffe4be5f, which is triggering in Mathlib, generating warnings that look like

warning: ././././Mathlib/Data/Finset/Sups.lean:632:8: Apply builder was used for a theorem with conclusion A  B. You probably want to use the simp builder.
Use `set_option aesop.warn.applyIff false` to disable this warning.

in many files.

For now in #17067 I'm just disabling this warning in Mathlib.

However I'm hoping someone could take over from here, and understand why these warnings are being generated, and if there is something we should be changing in Mathlib to avoid them.

Eric Wieser (Sep 24 2024 at 00:13):

Can you link to a CI log with those warnings?

Eric Wieser (Sep 24 2024 at 00:14):

I think this particular warning is fixed by the unmerged PR that provoked the addition of this warning flag

Eric Wieser (Sep 24 2024 at 00:15):

(#16927)

Kim Morrison (Sep 24 2024 at 00:16):

Eric Wieser said:

Can you link to a CI log with those warnings?

All the recent nightly-testing failures

Eric Wieser (Sep 24 2024 at 00:20):

You probably want to use the simp builder.

This was largely not the approach used in #16927. @Jannis Limperg, was the approach in that PR unusual, or should the warning message suggest creating aliases of apply lemmas as another alternative?

Yaël Dillies (Sep 24 2024 at 06:31):

That might be a question for me

Yaël Dillies (Sep 24 2024 at 06:58):

The reason we couldn't use the simp builder here is that proveFinsetNonempty calls aesop with simp disabled, for performance. Whether that's an usual situation, I don't know. I would guess not.

Yaël Dillies (Sep 24 2024 at 06:58):

Certainly the warning could suggest adding apply aliases as an alternative. That shouldn't hurt

Jannis Limperg (Sep 24 2024 at 09:01):

Eric Wieser said:

You probably want to use the simp builder.

This was largely not the approach used in #16927. Jannis Limperg, was the approach in that PR unusual, or should the warning message suggest creating aliases of apply lemmas as another alternative?

Good point, I'll add this as an alternative suggestion.

Jannis Limperg (Sep 24 2024 at 09:06):

Yaël Dillies said:

The reason we couldn't use the simp builder here is that proveFinsetNonempty calls aesop with simp disabled, for performance. Whether that's an usual situation, I don't know. I would guess not.

You could try disabling the default simp set (aesop (config := { useDefaultSimpSet := false })) and tagging the iff lemmas with @[aesop simp (rule_sets := [...])]. That way, Aesop's simp will only apply the iff lemmas, which should be quite fast. (Of course, the current strategy is even faster, but it is also a bit less powerful.)

Jannis Limperg (Sep 24 2024 at 09:07):

Sorry for introducing this warning without warning. I should have notified you all of the likely breakage.

Yaël Dillies (Sep 24 2024 at 09:39):

Jannis Limperg said:

Of course, the current strategy is even faster, but it is also a bit less powerful.

Given that proveFinsetNonempty is used in positivity (every time some finset operation appears, like Finset.sum), which is itself used in gcongr, I think I want to keep disabling simp entirely for now. Once we have more uses of positivity on finset operations, we will be able to run some benchmark.

Jannis Limperg (Sep 24 2024 at 10:48):

Makes sense. simp is indeed by far the most expensive thing Aesop does.


Last updated: May 02 2025 at 03:31 UTC