Module docstring
{"# Order structures and monotonicity lemmas for Set
","### Monotone lemmas for sets "}
{"# Order structures and monotonicity lemmas for Set
","### Monotone lemmas for sets "}
Set.monotoneOn_iff_monotone
      theorem
     : MonotoneOn f s ↔ Monotone fun a : s => f a
        theorem monotoneOn_iff_monotone : MonotoneOnMonotoneOn f s ↔
    Monotone fun a : s => f a := by
  simp [Monotone, MonotoneOn]
        Set.antitoneOn_iff_antitone
      theorem
     : AntitoneOn f s ↔ Antitone fun a : s => f a
        theorem antitoneOn_iff_antitone : AntitoneOnAntitoneOn f s ↔
    Antitone fun a : s => f a := by
  simp [Antitone, AntitoneOn]
        Set.strictMonoOn_iff_strictMono
      theorem
     : StrictMonoOn f s ↔ StrictMono fun a : s => f a
        theorem strictMonoOn_iff_strictMono : StrictMonoOnStrictMonoOn f s ↔
    StrictMono fun a : s => f a := by
  simp [StrictMono, StrictMonoOn]
        Set.strictAntiOn_iff_strictAnti
      theorem
     : StrictAntiOn f s ↔ StrictAnti fun a : s => f a
        theorem strictAntiOn_iff_strictAnti : StrictAntiOnStrictAntiOn f s ↔
    StrictAnti fun a : s => f a := by
  simp [StrictAnti, StrictAntiOn]
        Set.not_monotoneOn_not_antitoneOn_iff_exists_le_le
      theorem
     :
  ¬MonotoneOn f s ∧ ¬AntitoneOn f s ↔
    ∃ᵉ (a ∈ s) (b ∈ s) (c ∈ s), a ≤ b ∧ b ≤ c ∧ (f a < f b ∧ f c < f b ∨ f b < f a ∧ f b < f c)
        /-- A function between linear orders which is neither monotone nor antitone makes a dent upright or
downright. -/
theorem not_monotoneOn_not_antitoneOn_iff_exists_le_le :
    ¬MonotoneOn f s¬MonotoneOn f s ∧ ¬AntitoneOn f s¬MonotoneOn f s ∧ ¬AntitoneOn f s ↔
      ∃ᵉ (a ∈ s) (b ∈ s) (c ∈ s), a ≤ b ∧ b ≤ c ∧
        (f a < f b ∧ f c < f b ∨ f b < f a ∧ f b < f c) := by
  simp [monotoneOn_iff_monotone, antitoneOn_iff_antitone, and_assoc, exists_and_left,
    not_monotone_not_antitone_iff_exists_le_le, @and_left_comm (_ ∈ s)]
        Set.not_monotoneOn_not_antitoneOn_iff_exists_lt_lt
      theorem
     :
  ¬MonotoneOn f s ∧ ¬AntitoneOn f s ↔
    ∃ᵉ (a ∈ s) (b ∈ s) (c ∈ s), a < b ∧ b < c ∧ (f a < f b ∧ f c < f b ∨ f b < f a ∧ f b < f c)
        /-- A function between linear orders which is neither monotone nor antitone makes a dent upright or
downright. -/
theorem not_monotoneOn_not_antitoneOn_iff_exists_lt_lt :
    ¬MonotoneOn f s¬MonotoneOn f s ∧ ¬AntitoneOn f s¬MonotoneOn f s ∧ ¬AntitoneOn f s ↔
      ∃ᵉ (a ∈ s) (b ∈ s) (c ∈ s), a < b ∧ b < c ∧
        (f a < f b ∧ f c < f b ∨ f b < f a ∧ f b < f c) := by
  simp [monotoneOn_iff_monotone, antitoneOn_iff_antitone, and_assoc, exists_and_left,
    not_monotone_not_antitone_iff_exists_lt_lt, @and_left_comm (_ ∈ s)]
        Monotone.inter
      theorem
     [Preorder β] {f g : β → Set α} (hf : Monotone f) (hg : Monotone g) : Monotone fun x => f x ∩ g x
        
      MonotoneOn.inter
      theorem
     [Preorder β] {f g : β → Set α} {s : Set β} (hf : MonotoneOn f s) (hg : MonotoneOn g s) :
  MonotoneOn (fun x => f x ∩ g x) s
        theorem MonotoneOn.inter [Preorder β] {f g : β → Set α} {s : Set β} (hf : MonotoneOn f s)
    (hg : MonotoneOn g s) : MonotoneOn (fun x => f x ∩ g x) s :=
  hf.inf hg
        Antitone.inter
      theorem
     [Preorder β] {f g : β → Set α} (hf : Antitone f) (hg : Antitone g) : Antitone fun x => f x ∩ g x
        
      AntitoneOn.inter
      theorem
     [Preorder β] {f g : β → Set α} {s : Set β} (hf : AntitoneOn f s) (hg : AntitoneOn g s) :
  AntitoneOn (fun x => f x ∩ g x) s
        theorem AntitoneOn.inter [Preorder β] {f g : β → Set α} {s : Set β} (hf : AntitoneOn f s)
    (hg : AntitoneOn g s) : AntitoneOn (fun x => f x ∩ g x) s :=
  hf.inf hg
        Monotone.union
      theorem
     [Preorder β] {f g : β → Set α} (hf : Monotone f) (hg : Monotone g) : Monotone fun x => f x ∪ g x
        
      MonotoneOn.union
      theorem
     [Preorder β] {f g : β → Set α} {s : Set β} (hf : MonotoneOn f s) (hg : MonotoneOn g s) :
  MonotoneOn (fun x => f x ∪ g x) s
        theorem MonotoneOn.union [Preorder β] {f g : β → Set α} {s : Set β} (hf : MonotoneOn f s)
    (hg : MonotoneOn g s) : MonotoneOn (fun x => f x ∪ g x) s :=
  hf.sup hg
        Antitone.union
      theorem
     [Preorder β] {f g : β → Set α} (hf : Antitone f) (hg : Antitone g) : Antitone fun x => f x ∪ g x
        
      AntitoneOn.union
      theorem
     [Preorder β] {f g : β → Set α} {s : Set β} (hf : AntitoneOn f s) (hg : AntitoneOn g s) :
  AntitoneOn (fun x => f x ∪ g x) s
        theorem AntitoneOn.union [Preorder β] {f g : β → Set α} {s : Set β} (hf : AntitoneOn f s)
    (hg : AntitoneOn g s) : AntitoneOn (fun x => f x ∪ g x) s :=
  hf.sup hg
        Set.monotone_setOf
      theorem
     [Preorder α] {p : α → β → Prop} (hp : ∀ b, Monotone fun a => p a b) : Monotone fun a => {b | p a b}
        theorem monotone_setOf [Preorder α] {p : α → β → Prop} (hp : ∀ b, Monotone fun a => p a b) :
    Monotone fun a => { b | p a b } := fun _ _ h b => hp b h
        Set.antitone_setOf
      theorem
     [Preorder α] {p : α → β → Prop} (hp : ∀ b, Antitone fun a => p a b) : Antitone fun a => {b | p a b}
        theorem antitone_setOf [Preorder α] {p : α → β → Prop} (hp : ∀ b, Antitone fun a => p a b) :
    Antitone fun a => { b | p a b } := fun _ _ h b => hp b h
        Set.antitone_bforall
      theorem
     {P : α → Prop} : Antitone fun s : Set α => ∀ x ∈ s, P x
        /-- Quantifying over a set is antitone in the set -/
theorem antitone_bforall {P : α → Prop} : Antitone fun s : Set α => ∀ x ∈ s, P x :=
  fun _ _ hst h x hx => h x <| hst hx