l3lab/ntp-mathlib huggingface dataset:
theorem lub_Iio_eq_self_or_Iio_eq_Iic [PartialOrder γ] {j : γ} (i : γ) (hj : IsLUB (Iio i) j) :
    j = i ∨ Iio i = Iic j := by
  cases' eq_or_lt_of_le (lub_Iio_le i hj) with hj_eq_i hj_lt_i
  · 

Proof state:
case inl
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : PartialOrder γ
j i : γ
hj : IsLUB (Iio i) j
hj_eq_i : j = i
⊢ j = i ∨ Iio i = Iic j

Next tactic:
exact Or.inl hj_eq_i
theorem lub_Iio_eq_self_or_Iio_eq_Iic [PartialOrder γ] {j : γ} (i : γ) (hj : IsLUB (Iio i) j) :
    j = i ∨ Iio i = Iic j := by
  cases' eq_or_lt_of_le (lub_Iio_le i hj) with hj_eq_i hj_lt_i
  · exact Or.inl hj_eq_i
  · 

Proof state:
case inr
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : PartialOrder γ
j i : γ
hj : IsLUB (Iio i) j
hj_lt_i : j < i
⊢ j = i ∨ Iio i = Iic j

Next tactic:
right
theorem lub_Iio_eq_self_or_Iio_eq_Iic [PartialOrder γ] {j : γ} (i : γ) (hj : IsLUB (Iio i) j) :
    j = i ∨ Iio i = Iic j := by
  cases' eq_or_lt_of_le (lub_Iio_le i hj) with hj_eq_i hj_lt_i
  · exact Or.inl hj_eq_i
  · right
    

Proof state:
case inr.h
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : PartialOrder γ
j i : γ
hj : IsLUB (Iio i) j
hj_lt_i : j < i
⊢ Iio i = Iic j

Next tactic:
exact Set.ext fun k => ⟨fun hk_lt => hj.1 hk_lt, fun hk_le_j => lt_of_le_of_lt hk_le_j hj_lt_i⟩
theorem exists_lub_Iio (i : γ) : ∃ j, IsLUB (Iio i) j := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : LinearOrder γ
i : γ
⊢ ∃ j, IsLUB (Iio i) j

Next tactic:
by_cases h_exists_lt : ∃ j, j ∈ upperBounds (Iio i) ∧ j < i
theorem exists_lub_Iio (i : γ) : ∃ j, IsLUB (Iio i) j := by
  by_cases h_exists_lt : ∃ j, j ∈ upperBounds (Iio i) ∧ j < i
  · 

Proof state:
case pos
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : LinearOrder γ
i : γ
h_exists_lt : ∃ j ∈ upperBounds (Iio i), j < i
⊢ ∃ j, IsLUB (Iio i) j

Next tactic:
obtain ⟨j, hj_ub, hj_lt_i⟩ := h_exists_lt
theorem exists_lub_Iio (i : γ) : ∃ j, IsLUB (Iio i) j := by
  by_cases h_exists_lt : ∃ j, j ∈ upperBounds (Iio i) ∧ j < i
  · obtain ⟨j, hj_ub, hj_lt_i⟩ := h_exists_lt
    

Proof state:
case pos.intro.intro
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : LinearOrder γ
i j : γ
hj_ub : j ∈ upperBounds (Iio i)
hj_lt_i : j < i
⊢ ∃ j, IsLUB (Iio i) j

Next tactic:
exact ⟨j, hj_ub, fun k hk_ub => hk_ub hj_lt_i⟩
theorem exists_lub_Iio (i : γ) : ∃ j, IsLUB (Iio i) j := by
  by_cases h_exists_lt : ∃ j, j ∈ upperBounds (Iio i) ∧ j < i
  · obtain ⟨j, hj_ub, hj_lt_i⟩ := h_exists_lt
    exact ⟨j, hj_ub, fun k hk_ub => hk_ub hj_lt_i⟩
  · 

Proof state:
case neg
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : LinearOrder γ
i : γ
h_exists_lt : ¬∃ j ∈ upperBounds (Iio i), j < i
⊢ ∃ j, IsLUB (Iio i) j

Next tactic:
refine' ⟨i, fun j hj => le_of_lt hj, _⟩
theorem exists_lub_Iio (i : γ) : ∃ j, IsLUB (Iio i) j := by
  by_cases h_exists_lt : ∃ j, j ∈ upperBounds (Iio i) ∧ j < i
  · obtain ⟨j, hj_ub, hj_lt_i⟩ := h_exists_lt
    exact ⟨j, hj_ub, fun k hk_ub => hk_ub hj_lt_i⟩
  · refine' ⟨i, fun j hj => le_of_lt hj, _⟩
    

Proof state:
case neg
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : LinearOrder γ
i : γ
h_exists_lt : ¬∃ j ∈ upperBounds (Iio i), j < i
⊢ i ∈ lowerBounds (upperBounds (Iio i))

Next tactic:
rw [mem_lowerBounds]
theorem exists_lub_Iio (i : γ) : ∃ j, IsLUB (Iio i) j := by
  by_cases h_exists_lt : ∃ j, j ∈ upperBounds (Iio i) ∧ j < i
  · obtain ⟨j, hj_ub, hj_lt_i⟩ := h_exists_lt
    exact ⟨j, hj_ub, fun k hk_ub => hk_ub hj_lt_i⟩
  · refine' ⟨i, fun j hj => le_of_lt hj, _⟩
    rw [mem_lowerBounds]
    

Proof state:
case neg
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : LinearOrder γ
i : γ
h_exists_lt : ¬∃ j ∈ upperBounds (Iio i), j < i
⊢ ∀ x ∈ upperBounds (Iio i), i ≤ x

Next tactic:
by_contra h
theorem exists_lub_Iio (i : γ) : ∃ j, IsLUB (Iio i) j := by
  by_cases h_exists_lt : ∃ j, j ∈ upperBounds (Iio i) ∧ j < i
  · obtain ⟨j, hj_ub, hj_lt_i⟩ := h_exists_lt
    exact ⟨j, hj_ub, fun k hk_ub => hk_ub hj_lt_i⟩
  · refine' ⟨i, fun j hj => le_of_lt hj, _⟩
    rw [mem_lowerBounds]
    by_contra h
    

Proof state:
case neg
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : LinearOrder γ
i : γ
h_exists_lt : ¬∃ j ∈ upperBounds (Iio i), j < i
h : ¬∀ x ∈ upperBounds (Iio i), i ≤ x
⊢ False

Next tactic:
refine' h_exists_lt _
theorem exists_lub_Iio (i : γ) : ∃ j, IsLUB (Iio i) j := by
  by_cases h_exists_lt : ∃ j, j ∈ upperBounds (Iio i) ∧ j < i
  · obtain ⟨j, hj_ub, hj_lt_i⟩ := h_exists_lt
    exact ⟨j, hj_ub, fun k hk_ub => hk_ub hj_lt_i⟩
  · refine' ⟨i, fun j hj => le_of_lt hj, _⟩
    rw [mem_lowerBounds]
    by_contra h
    refine' h_exists_lt _
    

Proof state:
case neg
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : LinearOrder γ
i : γ
h_exists_lt : ¬∃ j ∈ upperBounds (Iio i), j < i
h : ¬∀ x ∈ upperBounds (Iio i), i ≤ x
⊢ ∃ j ∈ upperBounds (Iio i), j < i

Next tactic:
push_neg at h
theorem exists_lub_Iio (i : γ) : ∃ j, IsLUB (Iio i) j := by
  by_cases h_exists_lt : ∃ j, j ∈ upperBounds (Iio i) ∧ j < i
  · obtain ⟨j, hj_ub, hj_lt_i⟩ := h_exists_lt
    exact ⟨j, hj_ub, fun k hk_ub => hk_ub hj_lt_i⟩
  · refine' ⟨i, fun j hj => le_of_lt hj, _⟩
    rw [mem_lowerBounds]
    by_contra h
    refine' h_exists_lt _
    push_neg at h
    

Proof state:
case neg
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : LinearOrder γ
i : γ
h_exists_lt : ¬∃ j ∈ upperBounds (Iio i), j < i
h : ∃ x ∈ upperBounds (Iio i), x < i
⊢ ∃ j ∈ upperBounds (Iio i), j < i

Next tactic:
exact h
theorem isGLB_Ioo {a b : γ} (h : a < b) : IsGLB (Ioo a b) a :=
  ⟨fun x hx => hx.1.le, fun x hx => by
    

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝³ : Preorder α
inst✝² : Preorder β
s t : Set α
a✝ b✝ : α
inst✝¹ : SemilatticeSup γ
inst✝ : DenselyOrdered γ
a b : γ
h : a < b
x : γ
hx : x ∈ lowerBounds (Ioo a b)
⊢ x ≤ a

Next tactic:
cases' eq_or_lt_of_le (le_sup_right : a ≤ x ⊔ a) with h₁ h₂
theorem isGLB_Ioo {a b : γ} (h : a < b) : IsGLB (Ioo a b) a :=
  ⟨fun x hx => hx.1.le, fun x hx => by
    cases' eq_or_lt_of_le (le_sup_right : a ≤ x ⊔ a) with h₁ h₂
    · 

Proof state:
case inl
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝³ : Preorder α
inst✝² : Preorder β
s t : Set α
a✝ b✝ : α
inst✝¹ : SemilatticeSup γ
inst✝ : DenselyOrdered γ
a b : γ
h : a < b
x : γ
hx : x ∈ lowerBounds (Ioo a b)
h₁ : a = x ⊔ a
⊢ x ≤ a

Next tactic:
exact h₁.symm ▸ le_sup_left
theorem isGLB_Ioo {a b : γ} (h : a < b) : IsGLB (Ioo a b) a :=
  ⟨fun x hx => hx.1.le, fun x hx => by
    cases' eq_or_lt_of_le (le_sup_right : a ≤ x ⊔ a) with h₁ h₂
    · exact h₁.symm ▸ le_sup_left
    

Proof state:
case inr
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝³ : Preorder α
inst✝² : Preorder β
s t : Set α
a✝ b✝ : α
inst✝¹ : SemilatticeSup γ
inst✝ : DenselyOrdered γ
a b : γ
h : a < b
x : γ
hx : x ∈ lowerBounds (Ioo a b)
h₂ : a < x ⊔ a
⊢ x ≤ a

Next tactic:
obtain ⟨y, lty, ylt⟩ := exists_between h₂
theorem isGLB_Ioo {a b : γ} (h : a < b) : IsGLB (Ioo a b) a :=
  ⟨fun x hx => hx.1.le, fun x hx => by
    cases' eq_or_lt_of_le (le_sup_right : a ≤ x ⊔ a) with h₁ h₂
    · exact h₁.symm ▸ le_sup_left
    obtain ⟨y, lty, ylt⟩ := exists_between h₂
    

Proof state:
case inr.intro.intro
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝³ : Preorder α
inst✝² : Preorder β
s t : Set α
a✝ b✝ : α
inst✝¹ : SemilatticeSup γ
inst✝ : DenselyOrdered γ
a b : γ
h : a < b
x : γ
hx : x ∈ lowerBounds (Ioo a b)
h₂ : a < x ⊔ a
y : γ
lty : a < y
ylt : y < x ⊔ a
⊢ x ≤ a

Next tactic:
apply (not_lt_of_le (sup_le (hx ⟨lty, ylt.trans_le (sup_le _ h.le)⟩) lty.le) ylt).elim
theorem isGLB_Ioo {a b : γ} (h : a < b) : IsGLB (Ioo a b) a :=
  ⟨fun x hx => hx.1.le, fun x hx => by
    cases' eq_or_lt_of_le (le_sup_right : a ≤ x ⊔ a) with h₁ h₂
    · exact h₁.symm ▸ le_sup_left
    obtain ⟨y, lty, ylt⟩ := exists_between h₂
    apply (not_lt_of_le (sup_le (hx ⟨lty, ylt.trans_le (sup_le _ h.le)⟩) lty.le) ylt).elim
    

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝³ : Preorder α
inst✝² : Preorder β
s t : Set α
a✝ b✝ : α
inst✝¹ : SemilatticeSup γ
inst✝ : DenselyOrdered γ
a b : γ
h : a < b
x : γ
hx : x ∈ lowerBounds (Ioo a b)
h₂ : a < x ⊔ a
y : γ
lty : a < y
ylt : y < x ⊔ a
⊢ x ≤ b

Next tactic:
obtain ⟨u, au, ub⟩ := exists_between h
theorem isGLB_Ioo {a b : γ} (h : a < b) : IsGLB (Ioo a b) a :=
  ⟨fun x hx => hx.1.le, fun x hx => by
    cases' eq_or_lt_of_le (le_sup_right : a ≤ x ⊔ a) with h₁ h₂
    · exact h₁.symm ▸ le_sup_left
    obtain ⟨y, lty, ylt⟩ := exists_between h₂
    apply (not_lt_of_le (sup_le (hx ⟨lty, ylt.trans_le (sup_le _ h.le)⟩) lty.le) ylt).elim
    obtain ⟨u, au, ub⟩ := exists_between h
    

Proof state:
case intro.intro
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝³ : Preorder α
inst✝² : Preorder β
s t : Set α
a✝ b✝ : α
inst✝¹ : SemilatticeSup γ
inst✝ : DenselyOrdered γ
a b : γ
h : a < b
x : γ
hx : x ∈ lowerBounds (Ioo a b)
h₂ : a < x ⊔ a
y : γ
lty : a < y
ylt : y < x ⊔ a
u : γ
au : a < u
ub : u < b
⊢ x ≤ b

Next tactic:
apply (hx ⟨au, ub⟩).trans ub.le
theorem isLUB_Ioo {a b : γ} (hab : a < b) : IsLUB (Ioo a b) b := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝³ : Preorder α
inst✝² : Preorder β
s t : Set α
a✝ b✝ : α
inst✝¹ : SemilatticeInf γ
inst✝ : DenselyOrdered γ
a b : γ
hab : a < b
⊢ IsLUB (Ioo a b) b

Next tactic:
simpa only [dual_Ioo] using isGLB_Ioo hab.dual
theorem isLUB_Ico {a b : γ} (hab : a < b) : IsLUB (Ico a b) b := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝³ : Preorder α
inst✝² : Preorder β
s t : Set α
a✝ b✝ : α
inst✝¹ : SemilatticeInf γ
inst✝ : DenselyOrdered γ
a b : γ
hab : a < b
⊢ IsLUB (Ico a b) b

Next tactic:
simpa only [dual_Ioc] using isGLB_Ioc hab.dual
theorem bddBelow_bddAbove_iff_subset_Icc : BddBelow s ∧ BddAbove s ↔ ∃ a b, s ⊆ Icc a b := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
a b : α
⊢ BddBelow s ∧ BddAbove s ↔ ∃ a b, s ⊆ Icc a b

Next tactic:
simp [Ici_inter_Iic.symm, subset_inter_iff, bddBelow_iff_subset_Ici,
    bddAbove_iff_subset_Iic, exists_and_left, exists_and_right]
@[simp] theorem isGreatest_univ_iff : IsGreatest univ a ↔ IsTop a := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
a b : α
⊢ IsGreatest univ a ↔ IsTop a

Next tactic:
simp [IsGreatest, mem_upperBounds, IsTop]
@[simp]
theorem OrderTop.upperBounds_univ [PartialOrder γ] [OrderTop γ] :
    upperBounds (univ : Set γ) = {⊤} := by 

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝³ : Preorder α
inst✝² : Preorder β
s t : Set α
a b : α
inst✝¹ : PartialOrder γ
inst✝ : OrderTop γ
⊢ upperBounds univ = {⊤}

Next tactic:
rw [isGreatest_univ.upperBounds_eq, Ici_top]
@[simp]
theorem not_bddAbove_univ [NoMaxOrder α] : ¬BddAbove (univ : Set α) := by 

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : NoMaxOrder α
⊢ ¬BddAbove univ

Next tactic:
simp [BddAbove]
@[simp]
theorem upperBounds_empty : upperBounds (∅ : Set α) = univ := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
a b : α
⊢ upperBounds ∅ = univ

Next tactic:
simp only [upperBounds, eq_univ_iff_forall, mem_setOf_eq, ball_empty_iff, forall_true_iff]
@[simp]
theorem bddAbove_empty [Nonempty α] : BddAbove (∅ : Set α) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : Nonempty α
⊢ BddAbove ∅

Next tactic:
simp only [BddAbove, upperBounds_empty, univ_nonempty]
@[simp]
theorem bddBelow_empty [Nonempty α] : BddBelow (∅ : Set α) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : Nonempty α
⊢ BddBelow ∅

Next tactic:
simp only [BddBelow, lowerBounds_empty, univ_nonempty]
@[simp] theorem isGLB_empty_iff : IsGLB ∅ a ↔ IsTop a := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝¹ : Preorder α
inst✝ : Preorder β
s t : Set α
a b : α
⊢ IsGLB ∅ a ↔ IsTop a

Next tactic:
simp [IsGLB]
theorem IsLUB.nonempty [NoMinOrder α] (hs : IsLUB s a) : s.Nonempty :=
  let ⟨a', ha'⟩ := exists_lt a
  nonempty_iff_ne_empty.2 fun h =>
    not_le_of_lt ha' <| hs.right <| by 

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : NoMinOrder α
hs : IsLUB s a
a' : α
ha' : a' < a
h : s = ∅
⊢ a' ∈ upperBounds s

Next tactic:
rw [h, upperBounds_empty]
theorem IsLUB.nonempty [NoMinOrder α] (hs : IsLUB s a) : s.Nonempty :=
  let ⟨a', ha'⟩ := exists_lt a
  nonempty_iff_ne_empty.2 fun h =>
    not_le_of_lt ha' <| hs.right <| by rw [h, upperBounds_empty]; 

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s t : Set α
a b : α
inst✝ : NoMinOrder α
hs : IsLUB s a
a' : α
ha' : a' < a
h : s = ∅
⊢ a' ∈ univ

Next tactic:
exact mem_univ _
/-- Adding a point to a set preserves its boundedness above. -/
@[simp]
theorem bddAbove_insert [IsDirected α (· ≤ ·)] {s : Set α} {a : α} :
    BddAbove (insert a s) ↔ BddAbove s := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
a✝ b : α
inst✝ : IsDirected α fun x x_1 => x ≤ x_1
s : Set α
a : α
⊢ BddAbove (insert a s) ↔ BddAbove s

Next tactic:
simp only [insert_eq, bddAbove_union, bddAbove_singleton, true_and_iff]
/-- Adding a point to a set preserves its boundedness below.-/
@[simp]
theorem bddBelow_insert [IsDirected α (· ≥ ·)] {s : Set α} {a : α} :
    BddBelow (insert a s) ↔ BddBelow s := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
a✝ b : α
inst✝ : IsDirected α fun x x_1 => x ≥ x_1
s : Set α
a : α
⊢ BddBelow (insert a s) ↔ BddBelow s

Next tactic:
simp only [insert_eq, bddBelow_union, bddBelow_singleton, true_and_iff]
protected theorem IsLUB.insert [SemilatticeSup γ] (a) {b} {s : Set γ} (hs : IsLUB s b) :
    IsLUB (insert a s) (a ⊔ b) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
a✝ b✝ : α
inst✝ : SemilatticeSup γ
a b : γ
s : Set γ
hs : IsLUB s b
⊢ IsLUB (insert a s) (a ⊔ b)

Next tactic:
rw [insert_eq]
protected theorem IsLUB.insert [SemilatticeSup γ] (a) {b} {s : Set γ} (hs : IsLUB s b) :
    IsLUB (insert a s) (a ⊔ b) := by
  rw [insert_eq]
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
a✝ b✝ : α
inst✝ : SemilatticeSup γ
a b : γ
s : Set γ
hs : IsLUB s b
⊢ IsLUB ({a} ∪ s) (a ⊔ b)

Next tactic:
exact isLUB_singleton.union hs
protected theorem IsGLB.insert [SemilatticeInf γ] (a) {b} {s : Set γ} (hs : IsGLB s b) :
    IsGLB (insert a s) (a ⊓ b) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
a✝ b✝ : α
inst✝ : SemilatticeInf γ
a b : γ
s : Set γ
hs : IsGLB s b
⊢ IsGLB (insert a s) (a ⊓ b)

Next tactic:
rw [insert_eq]
protected theorem IsGLB.insert [SemilatticeInf γ] (a) {b} {s : Set γ} (hs : IsGLB s b) :
    IsGLB (insert a s) (a ⊓ b) := by
  rw [insert_eq]
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
a✝ b✝ : α
inst✝ : SemilatticeInf γ
a b : γ
s : Set γ
hs : IsGLB s b
⊢ IsGLB ({a} ∪ s) (a ⊓ b)

Next tactic:
exact isGLB_singleton.union hs
protected theorem IsGreatest.insert [LinearOrder γ] (a) {b} {s : Set γ} (hs : IsGreatest s b) :
    IsGreatest (insert a s) (max a b) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
a✝ b✝ : α
inst✝ : LinearOrder γ
a b : γ
s : Set γ
hs : IsGreatest s b
⊢ IsGreatest (insert a s) (max a b)

Next tactic:
rw [insert_eq]
protected theorem IsGreatest.insert [LinearOrder γ] (a) {b} {s : Set γ} (hs : IsGreatest s b) :
    IsGreatest (insert a s) (max a b) := by
  rw [insert_eq]
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
a✝ b✝ : α
inst✝ : LinearOrder γ
a b : γ
s : Set γ
hs : IsGreatest s b
⊢ IsGreatest ({a} ∪ s) (max a b)

Next tactic:
exact isGreatest_singleton.union hs
protected theorem IsLeast.insert [LinearOrder γ] (a) {b} {s : Set γ} (hs : IsLeast s b) :
    IsLeast (insert a s) (min a b) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
a✝ b✝ : α
inst✝ : LinearOrder γ
a b : γ
s : Set γ
hs : IsLeast s b
⊢ IsLeast (insert a s) (min a b)

Next tactic:
rw [insert_eq]
protected theorem IsLeast.insert [LinearOrder γ] (a) {b} {s : Set γ} (hs : IsLeast s b) :
    IsLeast (insert a s) (min a b) := by
  rw [insert_eq]
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
s✝ t : Set α
a✝ b✝ : α
inst✝ : LinearOrder γ
a b : γ
s : Set γ
hs : IsLeast s b
⊢ IsLeast ({a} ∪ s) (min a b)

Next tactic:
exact isLeast_singleton.union hs
@[simp]
theorem upperBounds_insert (a : α) (s : Set α) :
    upperBounds (insert a s) = Ici a ∩ upperBounds s := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t : Set α
a✝ b a : α
s : Set α
⊢ upperBounds (insert a s) = Ici a ∩ upperBounds s

Next tactic:
rw [insert_eq, upperBounds_union, upperBounds_singleton]
@[simp]
theorem lowerBounds_insert (a : α) (s : Set α) :
    lowerBounds (insert a s) = Iic a ∩ lowerBounds s := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝¹ : Preorder α
inst✝ : Preorder β
s✝ t : Set α
a✝ b a : α
s : Set α
⊢ lowerBounds (insert a s) = Iic a ∩ lowerBounds s

Next tactic:
rw [insert_eq, lowerBounds_union, lowerBounds_singleton]
theorem lt_isLUB_iff (h : IsLUB s a) : b < a ↔ ∃ c ∈ s, b < c := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝ : LinearOrder α
s : Set α
a b : α
h : IsLUB s a
⊢ b < a ↔ ∃ c ∈ s, b < c

Next tactic:
simp_rw [← not_le, isLUB_le_iff h, mem_upperBounds, not_forall, not_le, exists_prop]
theorem image_upperBounds_subset_upperBounds_image (Hst : s ⊆ t) :
    f '' (upperBounds s ∩ t) ⊆ upperBounds (f '' s) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝¹ : Preorder α
inst✝ : Preorder β
f : α → β
s t : Set α
Hf : MonotoneOn f t
a : α
Hst✝ Hst : s ⊆ t
⊢ f '' (upperBounds s ∩ t) ⊆ upperBounds (f '' s)

Next tactic:
rintro _ ⟨a, ha, rfl⟩
theorem image_upperBounds_subset_upperBounds_image (Hst : s ⊆ t) :
    f '' (upperBounds s ∩ t) ⊆ upperBounds (f '' s) := by
  rintro _ ⟨a, ha, rfl⟩
  

Proof state:
case intro.intro
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝¹ : Preorder α
inst✝ : Preorder β
f : α → β
s t : Set α
Hf : MonotoneOn f t
a✝ : α
Hst✝ Hst : s ⊆ t
a : α
ha : a ∈ upperBounds s ∩ t
⊢ f a ∈ upperBounds (f '' s)

Next tactic:
exact Hf.mem_upperBounds_image Hst ha.1 ha.2
theorem image_upperBounds_subset_upperBounds_image : f '' upperBounds s ⊆ upperBounds (f '' s) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝¹ : Preorder α
inst✝ : Preorder β
f : α → β
Hf : Monotone f
a : α
s : Set α
⊢ f '' upperBounds s ⊆ upperBounds (f '' s)

Next tactic:
rintro _ ⟨a, ha, rfl⟩
theorem image_upperBounds_subset_upperBounds_image : f '' upperBounds s ⊆ upperBounds (f '' s) := by
  rintro _ ⟨a, ha, rfl⟩
  

Proof state:
case intro.intro
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝¹ : Preorder α
inst✝ : Preorder β
f : α → β
Hf : Monotone f
a✝ : α
s : Set α
a : α
ha : a ∈ upperBounds s
⊢ f a ∈ upperBounds (f '' s)

Next tactic:
exact Hf.mem_upperBounds_image ha
theorem image2_upperBounds_upperBounds_subset :
    image2 f (upperBounds s) (upperBounds t) ⊆ upperBounds (image2 f s t) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
inst✝ : Preorder γ
f : α → β → γ
s : Set α
t : Set β
a : α
b : β
h₀ : ∀ (b : β), Monotone (swap f b)
h₁ : ∀ (a : α), Monotone (f a)
⊢ image2 f (upperBounds s) (upperBounds t) ⊆ upperBounds (image2 f s t)

Next tactic:
rintro _ ⟨a, b, ha, hb, rfl⟩
theorem image2_upperBounds_upperBounds_subset :
    image2 f (upperBounds s) (upperBounds t) ⊆ upperBounds (image2 f s t) := by
  rintro _ ⟨a, b, ha, hb, rfl⟩
  

Proof state:
case intro.intro.intro.intro
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
inst✝ : Preorder γ
f : α → β → γ
s : Set α
t : Set β
a✝ : α
b✝ : β
h₀ : ∀ (b : β), Monotone (swap f b)
h₁ : ∀ (a : α), Monotone (f a)
a : α
b : β
ha : a ∈ upperBounds s
hb : b ∈ upperBounds t
⊢ f a b ∈ upperBounds (image2 f s t)

Next tactic:
exact mem_upperBounds_image2 h₀ h₁ ha hb
theorem image2_lowerBounds_lowerBounds_subset :
    image2 f (lowerBounds s) (lowerBounds t) ⊆ lowerBounds (image2 f s t) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
inst✝ : Preorder γ
f : α → β → γ
s : Set α
t : Set β
a : α
b : β
h₀ : ∀ (b : β), Monotone (swap f b)
h₁ : ∀ (a : α), Monotone (f a)
⊢ image2 f (lowerBounds s) (lowerBounds t) ⊆ lowerBounds (image2 f s t)

Next tactic:
rintro _ ⟨a, b, ha, hb, rfl⟩
theorem image2_lowerBounds_lowerBounds_subset :
    image2 f (lowerBounds s) (lowerBounds t) ⊆ lowerBounds (image2 f s t) := by
  rintro _ ⟨a, b, ha, hb, rfl⟩
  

Proof state:
case intro.intro.intro.intro
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
inst✝ : Preorder γ
f : α → β → γ
s : Set α
t : Set β
a✝ : α
b✝ : β
h₀ : ∀ (b : β), Monotone (swap f b)
h₁ : ∀ (a : α), Monotone (f a)
a : α
b : β
ha : a ∈ lowerBounds s
hb : b ∈ lowerBounds t
⊢ f a b ∈ lowerBounds (image2 f s t)

Next tactic:
exact mem_lowerBounds_image2 h₀ h₁ ha hb
/-- See also `Monotone.map_bddAbove`. -/
theorem BddAbove.image2 : BddAbove s → BddAbove t → BddAbove (image2 f s t) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
inst✝ : Preorder γ
f : α → β → γ
s : Set α
t : Set β
a : α
b : β
h₀ : ∀ (b : β), Monotone (swap f b)
h₁ : ∀ (a : α), Monotone (f a)
⊢ BddAbove s → BddAbove t → BddAbove (Set.image2 f s t)

Next tactic:
rintro ⟨a, ha⟩ ⟨b, hb⟩
/-- See also `Monotone.map_bddAbove`. -/
theorem BddAbove.image2 : BddAbove s → BddAbove t → BddAbove (image2 f s t) := by
  rintro ⟨a, ha⟩ ⟨b, hb⟩
  

Proof state:
case intro.intro
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
inst✝ : Preorder γ
f : α → β → γ
s : Set α
t : Set β
a✝ : α
b✝ : β
h₀ : ∀ (b : β), Monotone (swap f b)
h₁ : ∀ (a : α), Monotone (f a)
a : α
ha : a ∈ upperBounds s
b : β
hb : b ∈ upperBounds t
⊢ BddAbove (Set.image2 f s t)

Next tactic:
exact ⟨f a b, mem_upperBounds_image2 h₀ h₁ ha hb⟩
/-- See also `Monotone.map_bddBelow`. -/
theorem BddBelow.image2 : BddBelow s → BddBelow t → BddBelow (image2 f s t) := by
  

Proof state:
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
inst✝ : Preorder γ
f : α → β → γ
s : Set α
t : Set β
a : α
b : β
h₀ : ∀ (b : β), Monotone (swap f b)
h₁ : ∀ (a : α), Monotone (f a)
⊢ BddBelow s → BddBelow t → BddBelow (Set.image2 f s t)

Next tactic:
rintro ⟨a, ha⟩ ⟨b, hb⟩
/-- See also `Monotone.map_bddBelow`. -/
theorem BddBelow.image2 : BddBelow s → BddBelow t → BddBelow (image2 f s t) := by
  rintro ⟨a, ha⟩ ⟨b, hb⟩
  

Proof state:
case intro.intro
α : Type u
β : Type v
γ : Type w
ι : Sort x
inst✝² : Preorder α
inst✝¹ : Preorder β
inst✝ : Preorder γ
f : α → β → γ
s : Set α
t : Set β
a✝ : α
b✝ : β
h₀ : ∀ (b : β), Monotone (swap f b)
h₁ : ∀ (a : α), Monotone (f a)
a : α
ha : a ∈ lowerBounds s
b : β
hb : b ∈ lowerBounds t
⊢ BddBelow (Set.image2 f s t)

Next tactic:
exact ⟨f a b, mem_lowerBounds_image2 h₀ h₁ ha hb⟩