Zulip Chat Archive

Stream: general

Topic: bad simp lemmas (split from: doc-gen is failing)


Gabriel Ebner (Feb 24 2021 at 14:17):

Oh wow, there's even a non-terminal simp there...

Rob Lewis (Feb 24 2021 at 14:18):

An extremely slow nonterminal simp

Gabriel Ebner (Feb 24 2021 at 14:20):

#6401

Rob Lewis (Feb 24 2021 at 14:21):

Ah, you beat me by 10 sec

Rob Lewis (Feb 24 2021 at 14:21):

https://github.com/leanprover-community/mathlib/tree/speedup-cau-seq-filter

Rob Lewis (Feb 24 2021 at 14:21):

Curious that we came up with different simp onlys

Gabriel Ebner (Feb 24 2021 at 14:22):

At first squeeze_simp timed out for me, so I tried simp?. But that didn't give me all lemmas, so I had to do squeeze_simp afterwards and merge the two.

Rob Lewis (Feb 24 2021 at 14:23):

Great minds think alike! I did the same, but after simp? wasn't enough I just guessed that ge_iff_le was missing

Gabriel Ebner (Feb 24 2021 at 14:29):

As far as I can tell from the trace messages, there's more conditional simp lemmas here than I'd like.

  • forall_prop_of_true seems to trigger at every implication
  • even better, forall_prop_of_false triggers a second time...
  • exists_prop_of_true is not as bad, but still triggers way too often
  • function.injective.eq_iff triggers at every function
  • wtf is imp_iff_right a simp lemma?!?!?!?

Gabriel Ebner (Feb 24 2021 at 14:31):

It doesn't help that conditional simplification does not seem to be cached. (Maybe that's because we're simplifying under binders here and get a different local constant every time, I didn't check.)

Rob Lewis (Feb 24 2021 at 14:33):

wtf is imp_iff_right a simp lemma?!?!?!?

This will never fire, right? If it fires successfully then simp proves a, which means a simplifies to true, which means a → b has already simplified to b?

Gabriel Ebner (Feb 24 2021 at 14:34):

Well, it will always fire but never rewrite, which is even worse.

Rob Lewis (Feb 24 2021 at 14:35):

Right, that's what I meant... ugh

Kevin Buzzard (Feb 24 2021 at 14:39):

I love what has happened to this topic

Rob Lewis (Feb 24 2021 at 14:40):

#6402

Gabriel Ebner (Feb 24 2021 at 14:45):

BTW, if I disable all of the lemmas that I've listed, then simp only takes 740ms instead of 6600ms.

Rob Lewis (Feb 24 2021 at 14:50):

I have no clue what the first three are doing. Removing the last two seems like an obvious good move...

Rob Lewis (Feb 24 2021 at 14:51):

There was a little breakage from function.injective.eq_iff early on, not sure how much more is coming.

Gabriel Ebner (Feb 24 2021 at 14:58):

The *_prop_of_* lemmas are a hack because we can't define multiple congruence lemmas for a function symbol (and probably none for forall). They only help with uber-dependently typed goals such as ∀ x : none.is_some, get x = a. In general you don't want to rewrite the domain of a pi, because then you get an ugly term in the codomain. But for propositions, this doesn't matter.
These lemmas should be removed from the simp set. I don't think that would break much, because we avoid dependent types anyhow. And if it does, it's better to fix this in the simplifier (on the c++ side).

Rob Lewis (Feb 24 2021 at 15:20):

There's a little more breakage so far from the *_prop_of_* but not too much. And I'm guessing it's all at the bottom. I'll make a second PR once I get a little farther locally

Rob Lewis (Feb 24 2021 at 15:23):

#6404

Bryan Gin-ge Chen (Feb 24 2021 at 16:18):

I do remember seeing a lot of *_prop_of_* in the output of squeeze_simp so I do think it is something we rely on quite a bit.


Last updated: Dec 20 2023 at 11:08 UTC