Zulip Chat Archive
Stream: Is there code for X?
Topic: Prod.Lex.lt_of_le_of_lt
Violeta Hernández (Oct 31 2024 at 04:15):
I feel like I've asked for this before, but I can't find it.
Violeta Hernández (Oct 31 2024 at 04:15):
Basically, I want a ≤ c → b < d → (a, b) < (c, d)
Kim Morrison (Oct 31 2024 at 04:23):
import Mathlib
example {α} [LinearOrder α] (a b c d : α) : a ≤ c → b < d → (a, b) < (c, d) := by
intros h1 h2
exact?
Kim Morrison (Oct 31 2024 at 04:24):
When asking for something that you're sure must be there, I think a good strategy is to post the by exact?
command that fails. Or, in many cases, such as this one, discover that it in fact succeeds, and you don't need to ask. :-)
Notification Bot (Oct 31 2024 at 04:29):
Violeta Hernández has marked this topic as resolved.
Violeta Hernández (Oct 31 2024 at 04:41):
Wait no, that's not the correct lemma
Notification Bot (Oct 31 2024 at 04:41):
Violeta Hernández has marked this topic as unresolved.
Violeta Hernández (Oct 31 2024 at 04:41):
What I actually want is:
import Mathlib
example {α} [LinearOrder α] (a b c d : α) : a ≤ c → b < d → toLex (a, b) < toLex (c, d) := by
intros h1 h2
exact?
And here exact?
comes up with nothing
Violeta Hernández (Oct 31 2024 at 04:45):
theorem Prod.Lex.lt_of_le_of_lt {α β} [PartialOrder α] [LT β] {a b : α} {c d : β}
(h₁ : a ≤ b) (h₂ : c < d) : toLex (a, c) < toLex (b, d) := by
obtain h₁ | rfl := h₁.lt_or_eq
· exact Prod.Lex.left _ _ h₁
· exact Prod.Lex.right _ h₂
Violeta Hernández (Oct 31 2024 at 04:45):
This is a huge deja-vu... I swear I've asked this before?
Violeta Hernández (Oct 31 2024 at 04:50):
I guess I'd also like to mention that when faced with a goal of the form toLex (a, b) < toLex (c, d)
, decreasing_tactic
eagerly reduces this to a < c
which isn't necessarily true
Violeta Hernández (Oct 31 2024 at 05:13):
Yaël Dillies (Oct 31 2024 at 07:28):
docs#Prod.Lex.toLex_strictMono
Violeta Hernández (Oct 31 2024 at 07:40):
I see
Violeta Hernández (Oct 31 2024 at 07:40):
I still think we should have this specific instance of the theorem
Violeta Hernández (Oct 31 2024 at 07:41):
Or otherwise I'll just ask about it again two months from now :zany_face:
Violeta Hernández (Oct 31 2024 at 07:48):
Violeta Hernández said:
theorem Prod.Lex.lt_of_le_of_lt {α β} [PartialOrder α] [LT β] {a b : α} {c d : β} (h₁ : a ≤ b) (h₂ : c < d) : toLex (a, c) < toLex (b, d) := by obtain h₁ | rfl := h₁.lt_or_eq · exact Prod.Lex.left _ _ h₁ · exact Prod.Lex.right _ h₂
This version only assumes LT beta
rather than Preorder beta
, but maybe that same change can be made to the StrictMono
lemma
Violeta Hernández (Oct 31 2024 at 07:48):
Not like it matters much anyways
Yaël Dillies (Oct 31 2024 at 08:10):
No sorry I think we really should channel these kinds of arguments through Prod.Lex.toLex_mono
and Prod.Lex.toLex_strictMono
Yaël Dillies (Oct 31 2024 at 08:11):
... if only because I don't want a ton of versions for (a, b, c) < (d, e, f)
Violeta Hernández (Oct 31 2024 at 08:13):
If so, could we document this approach somewhere?
Violeta Hernández (Oct 31 2024 at 08:14):
My first instinct when proving an inequality involving lexicographic ordering isn't usually "the type alias map between these two different kinds of product orderings is strictly monotonic"
Last updated: May 02 2025 at 03:31 UTC