Zulip Chat Archive

Stream: Is there code for X?

Topic: Partial order less than antisymmetry


Eric Paul (Dec 31 2024 at 02:51):

I often find myself in a situation like the following and this is my goto way to solve it. However, it takes more mental effort than I feel like should be required and so am wondering if there is an easier way:

import Mathlib

example {α : Type*} [PartialOrder α] {a b : α} (a_lt_b : a < b) (b_lt_a : b < a) : 2 < 1 := by
  exact False.elim ((lt_self_iff_false a).mp (gt_trans b_lt_a a_lt_b))

Matt Diamond (Dec 31 2024 at 02:54):

personally I would just do (a_lt_b.not_lt b_lt_a).elim

Matt Diamond (Dec 31 2024 at 02:57):

you could also do (lt_asymm a_lt_b b_lt_a).elim

Eric Paul (Dec 31 2024 at 03:02):

Those are both a fair bit simpler, thank you!

Yakov Pechersky (Dec 31 2024 at 03:15):

docs#absurd is also good for such situations

Yakov Pechersky (Dec 31 2024 at 03:17):

exact absurd a_lt_b b_lt_a.not_lt. or even simp [b_lt_a.not_lt] at a_lt_b for more complex situations

Zhang Qinchuan (Dec 31 2024 at 03:32):

After using absurd the goal can be closed by the output of exact?.

import Mathlib

example {α : Type*} [PartialOrder α] {a b : α} (a_lt_b : a < b) (b_lt_a : b < a) : 2 < 1 := by
  absurd a_lt_b
  -- `exact?` gives the following:
  exact not_lt_of_gt b_lt_a

Violeta Hernández (Jan 06 2025 at 02:03):

You can also replace False.elim by cases False if you want

Eric Paul (Jan 06 2025 at 02:23):

All great suggestions, thanks for the help. It’s super useful seeing all the different perspectives.

Eric Paul (Mar 05 2025 at 01:26):

As an update, thanks to Vasilii Nesterov, I can now just do

import Mathlib

example {α : Type*} [PartialOrder α] {a b : α} (a_lt_b : a < b) (b_lt_a : b < a) : 2 < 1 := by
  order

Last updated: May 02 2025 at 03:31 UTC