bookshelf/Common/Set/Intervals.lean

47 lines
1.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import Common.Logic.Basic
import Mathlib.Data.Set.Function
import Mathlib.Data.Set.Intervals.Basic
namespace Set
/-! # Common.Set.Intervals
Additional theorems around intervals.
-/
/--
If `m < n` then `{0, …, m - 1} ⊂ {0, …, n - 1}`.
-/
theorem Iio_nat_lt_ssubset {m n : } (h : m < n)
: Iio m ⊂ Iio n := by
rw [ssubset_def]
apply And.intro
· unfold Iio
simp only [setOf_subset_setOf]
intro x hx
calc x
_ < m := hx
_ < n := h
· show ¬ ∀ x, x < n → x < m
simp only [not_forall, not_lt, exists_prop]
exact ⟨m, h, by simp⟩
/--
It is never the case that the emptyset is surjective
-/
theorem SurjOn_emptyset_Iio_iff_eq_zero {n : } {f : α}
: SurjOn f ∅ (Set.Iio n) ↔ n = 0 := by
apply Iff.intro
· intro h
unfold SurjOn at h
rw [subset_def] at h
simp only [mem_Iio, image_empty, mem_empty_iff_false] at h
by_contra nh
exact h 0 (Nat.pos_of_ne_zero nh)
· intro hn
unfold SurjOn
rw [hn, subset_def]
intro x hx
exact absurd hx (Nat.not_lt_zero x)
end Set