Zulip Chat Archive

Stream: Is there code for X?

Topic: equal of le and not lt


Eric Wieser (Dec 10 2021 at 16:11):

Do we have this anywhere more public than docs#linarith.eq_of_not_lt_of_not_gt? Is it true more generally?

example (a b : ) (h : a  b) (hb : ¬a < b) : a = b :=
linarith.eq_of_not_lt_of_not_gt _ _ hb h.not_lt

Anne Baanen (Dec 10 2021 at 16:13):

This should hold in any partial_order by contraposition of lt_of_le_of_ne, right?

Anne Baanen (Dec 10 2021 at 16:16):

That is:

example {α : Type*} (a b : α) [partial_order α] (h : a  b) (hb : ¬a < b) : a = b :=
not_not.mp (mt h.lt_of_ne hb)

Eric Wieser (Dec 10 2021 at 16:23):

Do you think we should have eq_of_le_of_not_lt for convenience?

Anne Baanen (Dec 10 2021 at 16:24):

Sure, maybe calling it has_le.le.eq_of_not_lt for dot notation?

Yury G. Kudryashov (Dec 11 2021 at 13:00):

You can also do hle.eq_or_lt.resolve_right hlt.

Yaël Dillies (Dec 11 2021 at 13:49):

I find myself needing it as well so #10676 adds it to order.basic


Last updated: Dec 20 2023 at 11:08 UTC