Zulip Chat Archive

Stream: Is there code for X?

Topic: n < nat.succ m ↔ n ≤ m


Eric Wieser (Jul 08 2021 at 08:26):

Do we really not have this?

lemma lt_succ_iff_le {n m : } : n < nat.succ m  n  m :=
le_of_lt_succ, lt_succ_of_le

library_search couldn't find it with import data.nat.basic, but maybe I missed an import. Neither docs#nat.lt_succ_iff_le or docs#nat.le_iff_lt_succ exist.

Rémy Degenne (Jul 08 2021 at 08:30):

docs#nat.lt_succ_iff

Eric Wieser (Jul 08 2021 at 08:42):

Thanks, I guess it was defined lower down in the file than where I was trying to prove it

Anne Baanen (Jul 08 2021 at 08:53):

By the way, n < m.succ is defeq to n.succ ≤ m.succ, so you can golf your proof to succ_le_succ_iff.

Anne Baanen (Jul 08 2021 at 08:53):

(Which is in fact what the source code does :P)

Eric Wieser (Jul 08 2021 at 09:10):

In #8224 I actually ungolfed the proof, because it makes it easier to find the one-directional lemmas

Eric Wieser (Jul 08 2021 at 09:11):

My workflow is quite often:

  • Use the iff with an mp or mpr in my proof
  • Go to definition
  • Hope the proof is ⟨mp, mpr⟩ so I can use the more specific (and usually shorter) lemma

Last updated: Dec 20 2023 at 11:08 UTC