Zulip Chat Archive

Stream: Is there code for X?

Topic: Ioo_inter_Ioi


Jireh Loreaux (Mar 15 2024 at 16:33):

Are we really missing this one? I couldn't find it (or the LinearOrder variant with max)

import Mathlib

lemma Set.Ioo_inter_Ioi_of_le {α : Type*} [Preorder α] {a b c : α} (h : a ≤ c) :
    Set.Ioo a b ∩ Set.Ioi c = Set.Ioo c b := by
  ext x
  simp only [mem_inter_iff, mem_Ioo, mem_Ioi, and_comm (a := c < x), and_congr_left_iff,
    and_iff_right_iff_imp]
  exact fun hc _ ↦ h.trans_lt hc

Anatole Dedecker (Mar 15 2024 at 18:51):

I can't find it, but here's a golf:

import Mathlib

lemma Set.Ioo_inter_Ioi_of_le {α : Type*} [Preorder α] {a b c : α} (h : a ≤ c) :
    Set.Ioo a b ∩ Set.Ioi c = Set.Ioo c b := by
  rw [← Ioi_inter_Iio, ← Ioi_inter_Iio, inter_comm, ← inter_assoc,
      inter_eq_left.mpr (Ioi_subset_Ioi h)]

Last updated: Feb 28 2026 at 14:05 UTC