Skip to content

Commit

Permalink
feat(Data/Set/Intervals): Ioo_union_both (#7133)
Browse files Browse the repository at this point in the history
If `a ≤ b`, then `(a, b) ∪ {a, b} = [a, b]`.

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
  • Loading branch information
shuxuezhuyi and eric-wieser committed Sep 14, 2023
1 parent 6ad7d2f commit 7dd3aa2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Mathlib/Data/Set/Intervals/Basic.lean
Expand Up @@ -871,6 +871,12 @@ theorem Ioo_union_right (hab : a < b) : Ioo a b ∪ {b} = Ioc a b := by
simpa only [dual_Ioo, dual_Ico] using Ioo_union_left hab.dual
#align set.Ioo_union_right Set.Ioo_union_right

theorem Ioo_union_both (h : a ≤ b) : Ioo a b ∪ {a, b} = Icc a b := by
have : (Icc a b \ {a, b}) ∪ {a, b} = Icc a b := diff_union_of_subset fun
| x, .inl rfl => left_mem_Icc.mpr h
| x, .inr rfl => right_mem_Icc.mpr h
rw [← this, Icc_diff_both]

theorem Ioc_union_left (hab : a ≤ b) : Ioc a b ∪ {a} = Icc a b := by
rw [← Icc_diff_left, diff_union_self,
union_eq_self_of_subset_right (singleton_subset_iff.2 <| left_mem_Icc.2 hab)]
Expand Down

0 comments on commit 7dd3aa2

Please sign in to comment.