Zulip Chat Archive
Stream: lean4
Topic: The result of simp? gives a different result to simp
Bhavik Mehta (Sep 11 2024 at 00:07):
Here's my mathlib-free mwe:
def nothing (T : Nat → Prop) : Prop := sorry
def bar (T : Nat → Prop) : Nat := sorry
def foo (x : Nat) : Prop :=
∃ (S : Nat → Prop) (_ : nothing S) (_ : ∀ T, (∀ x, T x → S x) → nothing T), x = bar S
theorem foo_zero (n : Nat) : foo n := by
rw [foo]
simp?
The goal after simp
or simp?
is of the form ∃ S, _ ∧ nothing S ∧ _
, but the goal after applying the code action is of the form ∃ S, nothing S ∧ _ ∧ _
.
Kim Morrison (Sep 11 2024 at 02:22):
What does simp?
say?
Kim Morrison (Sep 11 2024 at 02:22):
Creating an issue from this would be useful!
Bhavik Mehta (Sep 11 2024 at 07:34):
Expanding the simp?
says simp only [exists_prop', nonempty_prop, exists_and_left]
Bhavik Mehta (Sep 11 2024 at 07:40):
exists_and_left
isn't necessary but it's believable that it's used somewhere
Bhavik Mehta (Sep 11 2024 at 07:49):
Kim Morrison said:
Creating an issue from this would be useful!
Kim Morrison (Sep 11 2024 at 08:04):
Oof:
@[simp] theorem forall_const (α : Sort _) [i : Nonempty α] : (α → b) ↔ b :=
⟨i.elim, fun hb _ => hb⟩
looks like a bad idea!
Kim Morrison (Sep 11 2024 at 08:05):
(It applies everywhere, and generates a Nonempty \a
goal, and then if \a
is a Prop that simplifies to just \a
.)
Bhavik Mehta (Sep 11 2024 at 08:12):
Hmm, I agree that looks like a bad idea but how do we know that that's responsible here?
Bhavik Mehta (Sep 11 2024 at 08:12):
I thought exists_prop'
is the thing generating the Nonempty bits
Kim Morrison (Sep 11 2024 at 08:12):
set_option trace.Meta.Tactic.simp true
Kim Morrison (Sep 11 2024 at 08:13):
exists_prop' is generating Nonempty
is a good way that we like: the rhs of the simp lemma
Kim Morrison (Sep 11 2024 at 08:14):
forall_const
is generating it as a side goal
Bhavik Mehta (Sep 11 2024 at 08:15):
I agree forall_const
is getting applied and a bunch of side goals like this are getting generated and this is a bad simp lemma, but turning it off doesn't fix the actual issue here; so I don't see how it's actually the culprit
Kim Morrison (Sep 11 2024 at 08:16):
Agreed, but I'm now distracted by fixing forall_const
, which I suspect is an even bigger problem. :-)
Last updated: May 02 2025 at 03:31 UTC