Zulip Chat Archive

Stream: mathlib4

Topic: simp discharging


Reid Barton (Dec 24 2022 at 17:01):

When there is a side condition to a simp lemma, simp will apparently apply more simp lemmas to simplify the condition before trying to apply something passed in. It means simp [h] becomes fragile. Was it like this in Lean 3 as well?

Reid Barton (Dec 24 2022 at 17:04):

Contrived mwe

theorem T (a b : Nat) (h : ¬ (a < 0 + b)) : (a - b) + b = a :=
  sorry

theorem U (a b : Nat) (h : ¬ (a < 0 + b)) : (a - b) + b = a := by
  simp [T, h] -- no effect

Reid Barton (Dec 24 2022 at 17:04):

Here Nat.zero_add kicks in to mess up the side condition before simp tries applying h

Reid Barton (Dec 24 2022 at 17:05):

Obviously T is dumb here, but in practice it can show up when the side condition in a simp lemma is no longer in simp normal form after stuff gets substituted for the variables

Reid Barton (Dec 24 2022 at 17:07):

In Lean 3 the second simp works though I don't know if it is just luck.

Yury G. Kudryashov (Feb 23 2024 at 00:40):

Is there a way to make simp automatically discharge goals like (1 : Real) < 5? Some special disch argument?

Eric Rodriguez (Feb 23 2024 at 00:41):

decide for that one I think?

Yury G. Kudryashov (Feb 23 2024 at 01:15):

Doesn't work for Reals I think

Yury G. Kudryashov (Feb 23 2024 at 01:21):

Also, how do I add a discharger without loosing default ones?


Last updated: May 02 2025 at 03:31 UTC