l3lab/ntp-mathlib huggingface dataset:
theorem exists_isLUB (S : Set ℝ) (hne : S.Nonempty) (hbdd : BddAbove S) : ∃ x, IsLUB S x := by
  rcases hne, hbdd with ⟨⟨L, hL⟩, ⟨U, hU⟩⟩
  have : ∀ d : ℕ, BddAbove { m : ℤ | ∃ y ∈ S, (m : ℝ) ≤ y * d } := by
    cases' exists_int_gt U with k hk
    refine' fun d => ⟨k * d, fun z h => _⟩
    rcases h with ⟨y, yS, hy⟩
    refine' Int.cast_le.1 (hy.trans _)
    push_cast
    exact mul_le_mul_of_nonneg_right ((hU yS).trans hk.le) d.cast_nonneg
  choose f hf using fun d : ℕ =>
    Int.exists_greatest_of_bdd (this d) ⟨⌊L * d⌋, L, hL, Int.floor_le _⟩
  have hf₁ : ∀ n > 0, ∃ y ∈ S, ((f n / n : ℚ) : ℝ) ≤ y := fun n n0 =>
    let ⟨y, yS, hy⟩ := (hf n).1
    ⟨y, yS, by simpa using (div_le_iff (Nat.cast_pos.2 n0 : (_ : ℝ) < _)).2 hy⟩
  have hf₂ : ∀ n > 0, ∀ y ∈ S, (y - ((n : ℕ) : ℝ)⁻¹) < (f n / n : ℚ) := by
    intro n n0 y yS
    have := (Int.sub_one_lt_floor _).trans_le (Int.cast_le.2 <| (hf n).2 _ ⟨y, yS, Int.floor_le _⟩)
    simp only [Rat.cast_div, Rat.cast_coe_int, Rat.cast_coe_nat, gt_iff_lt]
    rwa [lt_div_iff (Nat.cast_pos.2 n0 : (_ : ℝ) < _), sub_mul, _root_.inv_mul_cancel]
    exact ne_of_gt (Nat.cast_pos.2 n0)
  have hg : IsCauSeq abs (fun n => f n / n : ℕ → ℚ) := by
    intro ε ε0
    suffices ∀ j ≥ ⌈ε⁻¹⌉₊, ∀ k ≥ ⌈ε⁻¹⌉₊, (f j / j - f k / k : ℚ) < ε by
      refine' ⟨_, fun j ij => abs_lt.2 ⟨_, this _ ij _ le_rfl⟩⟩
      rw [neg_lt, neg_sub]
      exact this _ le_rfl _ ij
    intro j ij k ik
    replace ij := le_trans (Nat.le_ceil _) (Nat.cast_le.2 ij)
    replace ik := le_trans (Nat.le_ceil _) (Nat.cast_le.2 ik)
    have j0 := Nat.cast_pos.1 ((inv_pos.2 ε0).trans_le ij)
    have k0 := Nat.cast_pos.1 ((inv_pos.2 ε0).trans_le ik)
    rcases hf₁ _ j0 with ⟨y, yS, hy⟩
    refine' lt_of_lt_of_le ((@Rat.cast_lt ℝ _ _ _).1 _) ((inv_le ε0 (Nat.cast_pos.2 k0)).1 ik)
    simpa using sub_lt_iff_lt_add'.2 (lt_of_le_of_lt hy <| sub_lt_iff_lt_add.1 <| hf₂ _ k0 _ yS)
  let g : CauSeq ℚ abs := ⟨fun n => f n / n, hg⟩
  refine' ⟨mk g, ⟨fun x xS => _, fun y h => _⟩⟩
  · refine' le_of_forall_ge_of_dense fun z xz => _
    cases' exists_nat_gt (x - z)⁻¹ with K hK
    refine' le_mk_of_forall_le ⟨K, fun n nK => _⟩
    replace xz := sub_pos.2 xz
    replace hK := hK.le.trans (Nat.cast_le.2 nK)
    have n0 : 0 < n := Nat.cast_pos.1 ((inv_pos.2 xz).trans_le hK)
    refine' le_trans _ (hf₂ _ n0 _ xS).le
    

Proof state:
case intro.intro.refine'_1.intro
S : Set ℝ
L : ℝ
hL : L ∈ S
U : ℝ
hU : U ∈ upperBounds S
this : ∀ (d : ℕ), BddAbove {m | ∃ y ∈ S, ↑m ≤ y * ↑d}
f : ℕ → ℤ
hf : ∀ (d : ℕ), f d ∈ {m | ∃ y ∈ S, ↑m ≤ y * ↑d} ∧ ∀ z ∈ {m | ∃ y ∈ S, ↑m ≤ y * ↑d}, z ≤ f d
hf₁ : ∀ n > 0, ∃ y ∈ S, ↑(↑(f n) / ↑n) ≤ y
hf₂ : ∀ n > 0, ∀ y ∈ S, y - (↑n)⁻¹ < ↑(↑(f n) / ↑n)
hg : IsCauSeq abs fun n => ↑(f n) / ↑n
g : CauSeq ℚ abs := { val := fun n => ↑(f n) / ↑n, property := hg }
x : ℝ
xS : x ∈ S
z : ℝ
K n : ℕ
nK : n ≥ K
xz : 0 < x - z
hK : (x - z)⁻¹ ≤ ↑n
n0 : 0 < n
⊢ z ≤ x - (↑n)⁻¹

Next tactic:
rwa [le_sub_comm, inv_le (Nat.cast_pos.2 n0 : (_ : ℝ) < _) xz]
theorem exists_isLUB (S : Set ℝ) (hne : S.Nonempty) (hbdd : BddAbove S) : ∃ x, IsLUB S x := by
  rcases hne, hbdd with ⟨⟨L, hL⟩, ⟨U, hU⟩⟩
  have : ∀ d : ℕ, BddAbove { m : ℤ | ∃ y ∈ S, (m : ℝ) ≤ y * d } := by
    cases' exists_int_gt U with k hk
    refine' fun d => ⟨k * d, fun z h => _⟩
    rcases h with ⟨y, yS, hy⟩
    refine' Int.cast_le.1 (hy.trans _)
    push_cast
    exact mul_le_mul_of_nonneg_right ((hU yS).trans hk.le) d.cast_nonneg
  choose f hf using fun d : ℕ =>
    Int.exists_greatest_of_bdd (this d) ⟨⌊L * d⌋, L, hL, Int.floor_le _⟩
  have hf₁ : ∀ n > 0, ∃ y ∈ S, ((f n / n : ℚ) : ℝ) ≤ y := fun n n0 =>
    let ⟨y, yS, hy⟩ := (hf n).1
    ⟨y, yS, by simpa using (div_le_iff (Nat.cast_pos.2 n0 : (_ : ℝ) < _)).2 hy⟩
  have hf₂ : ∀ n > 0, ∀ y ∈ S, (y - ((n : ℕ) : ℝ)⁻¹) < (f n / n : ℚ) := by
    intro n n0 y yS
    have := (Int.sub_one_lt_floor _).trans_le (Int.cast_le.2 <| (hf n).2 _ ⟨y, yS, Int.floor_le _⟩)
    simp only [Rat.cast_div, Rat.cast_coe_int, Rat.cast_coe_nat, gt_iff_lt]
    rwa [lt_div_iff (Nat.cast_pos.2 n0 : (_ : ℝ) < _), sub_mul, _root_.inv_mul_cancel]
    exact ne_of_gt (Nat.cast_pos.2 n0)
  have hg : IsCauSeq abs (fun n => f n / n : ℕ → ℚ) := by
    intro ε ε0
    suffices ∀ j ≥ ⌈ε⁻¹⌉₊, ∀ k ≥ ⌈ε⁻¹⌉₊, (f j / j - f k / k : ℚ) < ε by
      refine' ⟨_, fun j ij => abs_lt.2 ⟨_, this _ ij _ le_rfl⟩⟩
      rw [neg_lt, neg_sub]
      exact this _ le_rfl _ ij
    intro j ij k ik
    replace ij := le_trans (Nat.le_ceil _) (Nat.cast_le.2 ij)
    replace ik := le_trans (Nat.le_ceil _) (Nat.cast_le.2 ik)
    have j0 := Nat.cast_pos.1 ((inv_pos.2 ε0).trans_le ij)
    have k0 := Nat.cast_pos.1 ((inv_pos.2 ε0).trans_le ik)
    rcases hf₁ _ j0 with ⟨y, yS, hy⟩
    refine' lt_of_lt_of_le ((@Rat.cast_lt ℝ _ _ _).1 _) ((inv_le ε0 (Nat.cast_pos.2 k0)).1 ik)
    simpa using sub_lt_iff_lt_add'.2 (lt_of_le_of_lt hy <| sub_lt_iff_lt_add.1 <| hf₂ _ k0 _ yS)
  let g : CauSeq ℚ abs := ⟨fun n => f n / n, hg⟩
  refine' ⟨mk g, ⟨fun x xS => _, fun y h => _⟩⟩
  · refine' le_of_forall_ge_of_dense fun z xz => _
    cases' exists_nat_gt (x - z)⁻¹ with K hK
    refine' le_mk_of_forall_le ⟨K, fun n nK => _⟩
    replace xz := sub_pos.2 xz
    replace hK := hK.le.trans (Nat.cast_le.2 nK)
    have n0 : 0 < n := Nat.cast_pos.1 ((inv_pos.2 xz).trans_le hK)
    refine' le_trans _ (hf₂ _ n0 _ xS).le
    rwa [le_sub_comm, inv_le (Nat.cast_pos.2 n0 : (_ : ℝ) < _) xz]
  · 

Proof state:
case intro.intro.refine'_2
S : Set ℝ
L : ℝ
hL : L ∈ S
U : ℝ
hU : U ∈ upperBounds S
this : ∀ (d : ℕ), BddAbove {m | ∃ y ∈ S, ↑m ≤ y * ↑d}
f : ℕ → ℤ
hf : ∀ (d : ℕ), f d ∈ {m | ∃ y ∈ S, ↑m ≤ y * ↑d} ∧ ∀ z ∈ {m | ∃ y ∈ S, ↑m ≤ y * ↑d}, z ≤ f d
hf₁ : ∀ n > 0, ∃ y ∈ S, ↑(↑(f n) / ↑n) ≤ y
hf₂ : ∀ n > 0, ∀ y ∈ S, y - (↑n)⁻¹ < ↑(↑(f n) / ↑n)
hg : IsCauSeq abs fun n => ↑(f n) / ↑n
g : CauSeq ℚ abs := { val := fun n => ↑(f n) / ↑n, property := hg }
y : ℝ
h : y ∈ upperBounds S
⊢ mk g ≤ y

Next tactic:
exact
      mk_le_of_forall_le
        ⟨1, fun n n1 =>
          let ⟨x, xS, hx⟩ := hf₁ _ n1
          le_trans hx (h xS)⟩
protected theorem isLUB_sSup (S : Set ℝ) (h₁ : S.Nonempty) (h₂ : BddAbove S) :
    IsLUB S (sSup S) := by
  

Proof state:
S : Set ℝ
h₁ : Set.Nonempty S
h₂ : BddAbove S
⊢ IsLUB S (sSup S)

Next tactic:
simp only [sSup_def, dif_pos (And.intro h₁ h₂)]
protected theorem isLUB_sSup (S : Set ℝ) (h₁ : S.Nonempty) (h₂ : BddAbove S) :
    IsLUB S (sSup S) := by
  simp only [sSup_def, dif_pos (And.intro h₁ h₂)]
  

Proof state:
S : Set ℝ
h₁ : Set.Nonempty S
h₂ : BddAbove S
⊢ IsLUB S (choose (_ : ∃ x, IsLUB S x))

Next tactic:
apply Classical.choose_spec
protected theorem is_glb_sInf (S : Set ℝ) (h₁ : S.Nonempty) (h₂ : BddBelow S) :
    IsGLB S (sInf S) := by
  

Proof state:
S : Set ℝ
h₁ : Set.Nonempty S
h₂ : BddBelow S
⊢ IsGLB S (sInf S)

Next tactic:
rw [sInf_def, ← isLUB_neg', neg_neg]
protected theorem is_glb_sInf (S : Set ℝ) (h₁ : S.Nonempty) (h₂ : BddBelow S) :
    IsGLB S (sInf S) := by
  rw [sInf_def, ← isLUB_neg', neg_neg]
  

Proof state:
S : Set ℝ
h₁ : Set.Nonempty S
h₂ : BddBelow S
⊢ IsLUB (-S) (sSup (-S))

Next tactic:
exact Real.isLUB_sSup _ h₁.neg h₂.neg
noncomputable instance : ConditionallyCompleteLinearOrder ℝ :=
  { Real.linearOrder, Real.lattice with
    sSup := SupSet.sSup
    sInf := InfSet.sInf
    le_csSup := fun s a hs ha => (Real.isLUB_sSup s ⟨a, ha⟩ hs).1 ha
    csSup_le := fun s a hs ha => (Real.isLUB_sSup s hs ⟨a, ha⟩).2 ha
    csInf_le := fun s a hs ha => (Real.is_glb_sInf s ⟨a, ha⟩ hs).1 ha
    le_csInf := fun s a hs ha => (Real.is_glb_sInf s hs ⟨a, ha⟩).2 ha
    csSup_of_not_bddAbove := fun s hs ↦ by 

Proof state:
src✝¹ : LinearOrder ℝ := linearOrder
src✝ : Lattice ℝ := lattice
s : Set ℝ
hs : ¬BddAbove s
⊢ sSup s = sSup ∅

Next tactic:
simp [hs, sSup_def]
noncomputable instance : ConditionallyCompleteLinearOrder ℝ :=
  { Real.linearOrder, Real.lattice with
    sSup := SupSet.sSup
    sInf := InfSet.sInf
    le_csSup := fun s a hs ha => (Real.isLUB_sSup s ⟨a, ha⟩ hs).1 ha
    csSup_le := fun s a hs ha => (Real.isLUB_sSup s hs ⟨a, ha⟩).2 ha
    csInf_le := fun s a hs ha => (Real.is_glb_sInf s ⟨a, ha⟩ hs).1 ha
    le_csInf := fun s a hs ha => (Real.is_glb_sInf s hs ⟨a, ha⟩).2 ha
    csSup_of_not_bddAbove := fun s hs ↦ by simp [hs, sSup_def]
    csInf_of_not_bddBelow := fun s hs ↦ by 

Proof state:
src✝¹ : LinearOrder ℝ := linearOrder
src✝ : Lattice ℝ := lattice
s : Set ℝ
hs : ¬BddBelow s
⊢ sInf s = sInf ∅

Next tactic:
simp [hs, sInf_def, sSup_def]
theorem sInf_le_iff {s : Set ℝ} (h : BddBelow s) (h' : s.Nonempty) {a : ℝ} :
    sInf s ≤ a ↔ ∀ ε, 0 < ε → ∃ x ∈ s, x < a + ε := by
  

Proof state:
s : Set ℝ
h : BddBelow s
h' : Set.Nonempty s
a : ℝ
⊢ sInf s ≤ a ↔ ∀ (ε : ℝ), 0 < ε → ∃ x ∈ s, x < a + ε

Next tactic:
rw [le_iff_forall_pos_lt_add]
theorem sInf_le_iff {s : Set ℝ} (h : BddBelow s) (h' : s.Nonempty) {a : ℝ} :
    sInf s ≤ a ↔ ∀ ε, 0 < ε → ∃ x ∈ s, x < a + ε := by
  rw [le_iff_forall_pos_lt_add]
  

Proof state:
s : Set ℝ
h : BddBelow s
h' : Set.Nonempty s
a : ℝ
⊢ (∀ (ε : ℝ), 0 < ε → sInf s < a + ε) ↔ ∀ (ε : ℝ), 0 < ε → ∃ x ∈ s, x < a + ε

Next tactic:
constructor
theorem sInf_le_iff {s : Set ℝ} (h : BddBelow s) (h' : s.Nonempty) {a : ℝ} :
    sInf s ≤ a ↔ ∀ ε, 0 < ε → ∃ x ∈ s, x < a + ε := by
  rw [le_iff_forall_pos_lt_add]
  constructor <;> 

Proof state:
case mp
s : Set ℝ
h : BddBelow s
h' : Set.Nonempty s
a : ℝ
⊢ (∀ (ε : ℝ), 0 < ε → sInf s < a + ε) → ∀ (ε : ℝ), 0 < ε → ∃ x ∈ s, x < a + ε

Next tactic:
intro H ε ε_pos
theorem sInf_le_iff {s : Set ℝ} (h : BddBelow s) (h' : s.Nonempty) {a : ℝ} :
    sInf s ≤ a ↔ ∀ ε, 0 < ε → ∃ x ∈ s, x < a + ε := by
  rw [le_iff_forall_pos_lt_add]
  constructor <;> 

Proof state:
case mpr
s : Set ℝ
h : BddBelow s
h' : Set.Nonempty s
a : ℝ
⊢ (∀ (ε : ℝ), 0 < ε → ∃ x ∈ s, x < a + ε) → ∀ (ε : ℝ), 0 < ε → sInf s < a + ε

Next tactic:
intro H ε ε_pos
theorem sInf_le_iff {s : Set ℝ} (h : BddBelow s) (h' : s.Nonempty) {a : ℝ} :
    sInf s ≤ a ↔ ∀ ε, 0 < ε → ∃ x ∈ s, x < a + ε := by
  rw [le_iff_forall_pos_lt_add]
  constructor <;> intro H ε ε_pos
  · 

Proof state:
case mp
s : Set ℝ
h : BddBelow s
h' : Set.Nonempty s
a : ℝ
H : ∀ (ε : ℝ), 0 < ε → sInf s < a + ε
ε : ℝ
ε_pos : 0 < ε
⊢ ∃ x ∈ s, x < a + ε

Next tactic:
exact exists_lt_of_csInf_lt h' (H ε ε_pos)
theorem sInf_le_iff {s : Set ℝ} (h : BddBelow s) (h' : s.Nonempty) {a : ℝ} :
    sInf s ≤ a ↔ ∀ ε, 0 < ε → ∃ x ∈ s, x < a + ε := by
  rw [le_iff_forall_pos_lt_add]
  constructor <;> intro H ε ε_pos
  · exact exists_lt_of_csInf_lt h' (H ε ε_pos)
  · 

Proof state:
case mpr
s : Set ℝ
h : BddBelow s
h' : Set.Nonempty s
a : ℝ
H : ∀ (ε : ℝ), 0 < ε → ∃ x ∈ s, x < a + ε
ε : ℝ
ε_pos : 0 < ε
⊢ sInf s < a + ε

Next tactic:
rcases H ε ε_pos with ⟨x, x_in, hx⟩
theorem sInf_le_iff {s : Set ℝ} (h : BddBelow s) (h' : s.Nonempty) {a : ℝ} :
    sInf s ≤ a ↔ ∀ ε, 0 < ε → ∃ x ∈ s, x < a + ε := by
  rw [le_iff_forall_pos_lt_add]
  constructor <;> intro H ε ε_pos
  · exact exists_lt_of_csInf_lt h' (H ε ε_pos)
  · rcases H ε ε_pos with ⟨x, x_in, hx⟩
    

Proof state:
case mpr.intro.intro
s : Set ℝ
h : BddBelow s
h' : Set.Nonempty s
a : ℝ
H : ∀ (ε : ℝ), 0 < ε → ∃ x ∈ s, x < a + ε
ε : ℝ
ε_pos : 0 < ε
x : ℝ
x_in : x ∈ s
hx : x < a + ε
⊢ sInf s < a + ε

Next tactic:
exact csInf_lt_of_lt h x_in hx
theorem le_sSup_iff {s : Set ℝ} (h : BddAbove s) (h' : s.Nonempty) {a : ℝ} :
    a ≤ sSup s ↔ ∀ ε, ε < 0 → ∃ x ∈ s, a + ε < x := by
  

Proof state:
s : Set ℝ
h : BddAbove s
h' : Set.Nonempty s
a : ℝ
⊢ a ≤ sSup s ↔ ∀ ε < 0, ∃ x ∈ s, a + ε < x

Next tactic:
rw [le_iff_forall_pos_lt_add]
theorem le_sSup_iff {s : Set ℝ} (h : BddAbove s) (h' : s.Nonempty) {a : ℝ} :
    a ≤ sSup s ↔ ∀ ε, ε < 0 → ∃ x ∈ s, a + ε < x := by
  rw [le_iff_forall_pos_lt_add]
  

Proof state:
s : Set ℝ
h : BddAbove s
h' : Set.Nonempty s
a : ℝ
⊢ (∀ (ε : ℝ), 0 < ε → a < sSup s + ε) ↔ ∀ ε < 0, ∃ x ∈ s, a + ε < x

Next tactic:
refine' ⟨fun H ε ε_neg => _, fun H ε ε_pos => _⟩
theorem le_sSup_iff {s : Set ℝ} (h : BddAbove s) (h' : s.Nonempty) {a : ℝ} :
    a ≤ sSup s ↔ ∀ ε, ε < 0 → ∃ x ∈ s, a + ε < x := by
  rw [le_iff_forall_pos_lt_add]
  refine' ⟨fun H ε ε_neg => _, fun H ε ε_pos => _⟩
  · 

Proof state:
case refine'_1
s : Set ℝ
h : BddAbove s
h' : Set.Nonempty s
a : ℝ
H : ∀ (ε : ℝ), 0 < ε → a < sSup s + ε
ε : ℝ
ε_neg : ε < 0
⊢ ∃ x ∈ s, a + ε < x

Next tactic:
exact exists_lt_of_lt_csSup h' (lt_sub_iff_add_lt.mp (H _ (neg_pos.mpr ε_neg)))
theorem le_sSup_iff {s : Set ℝ} (h : BddAbove s) (h' : s.Nonempty) {a : ℝ} :
    a ≤ sSup s ↔ ∀ ε, ε < 0 → ∃ x ∈ s, a + ε < x := by
  rw [le_iff_forall_pos_lt_add]
  refine' ⟨fun H ε ε_neg => _, fun H ε ε_pos => _⟩
  · exact exists_lt_of_lt_csSup h' (lt_sub_iff_add_lt.mp (H _ (neg_pos.mpr ε_neg)))
  · 

Proof state:
case refine'_2
s : Set ℝ
h : BddAbove s
h' : Set.Nonempty s
a : ℝ
H : ∀ ε < 0, ∃ x ∈ s, a + ε < x
ε : ℝ
ε_pos : 0 < ε
⊢ a < sSup s + ε

Next tactic:
rcases H _ (neg_lt_zero.mpr ε_pos) with ⟨x, x_in, hx⟩
theorem le_sSup_iff {s : Set ℝ} (h : BddAbove s) (h' : s.Nonempty) {a : ℝ} :
    a ≤ sSup s ↔ ∀ ε, ε < 0 → ∃ x ∈ s, a + ε < x := by
  rw [le_iff_forall_pos_lt_add]
  refine' ⟨fun H ε ε_neg => _, fun H ε ε_pos => _⟩
  · exact exists_lt_of_lt_csSup h' (lt_sub_iff_add_lt.mp (H _ (neg_pos.mpr ε_neg)))
  · rcases H _ (neg_lt_zero.mpr ε_pos) with ⟨x, x_in, hx⟩
    

Proof state:
case refine'_2.intro.intro
s : Set ℝ
h : BddAbove s
h' : Set.Nonempty s
a : ℝ
H : ∀ ε < 0, ∃ x ∈ s, a + ε < x
ε : ℝ
ε_pos : 0 < ε
x : ℝ
x_in : x ∈ s
hx : a + -ε < x
⊢ a < sSup s + ε

Next tactic:
exact sub_lt_iff_lt_add.mp (lt_csSup_of_lt h x_in hx)
@[simp]
theorem sSup_empty : sSup (∅ : Set ℝ) = 0 :=
  dif_neg <| by 

Proof state:
⊢ ¬(Set.Nonempty ∅ ∧ BddAbove ∅)

Next tactic:
simp
theorem ciSup_empty {α : Sort*} [IsEmpty α] (f : α → ℝ) : ⨆ i, f i = 0 := by
  

Proof state:
α : Sort u_1
inst✝ : IsEmpty α
f : α → ℝ
⊢ ⨆ i, f i = 0

Next tactic:
dsimp [iSup]
theorem ciSup_empty {α : Sort*} [IsEmpty α] (f : α → ℝ) : ⨆ i, f i = 0 := by
  dsimp [iSup]
  

Proof state:
α : Sort u_1
inst✝ : IsEmpty α
f : α → ℝ
⊢ sSup (Set.range fun i => f i) = 0

Next tactic:
convert Real.sSup_empty
theorem ciSup_empty {α : Sort*} [IsEmpty α] (f : α → ℝ) : ⨆ i, f i = 0 := by
  dsimp [iSup]
  convert Real.sSup_empty
  

Proof state:
case h.e'_2.h.e'_3
α : Sort u_1
inst✝ : IsEmpty α
f : α → ℝ
⊢ (Set.range fun i => f i) = ∅

Next tactic:
rw [Set.range_eq_empty_iff]
theorem ciSup_empty {α : Sort*} [IsEmpty α] (f : α → ℝ) : ⨆ i, f i = 0 := by
  dsimp [iSup]
  convert Real.sSup_empty
  rw [Set.range_eq_empty_iff]
  

Proof state:
case h.e'_2.h.e'_3
α : Sort u_1
inst✝ : IsEmpty α
f : α → ℝ
⊢ IsEmpty α

Next tactic:
infer_instance
@[simp]
theorem ciSup_const_zero {α : Sort*} : ⨆ _ : α, (0 : ℝ) = 0 := by
  

Proof state:
α : Sort u_1
⊢ ⨆ x, 0 = 0

Next tactic:
cases isEmpty_or_nonempty α
@[simp]
theorem ciSup_const_zero {α : Sort*} : ⨆ _ : α, (0 : ℝ) = 0 := by
  cases isEmpty_or_nonempty α
  · 

Proof state:
case inl
α : Sort u_1
h✝ : IsEmpty α
⊢ ⨆ x, 0 = 0

Next tactic:
exact Real.ciSup_empty _
@[simp]
theorem ciSup_const_zero {α : Sort*} : ⨆ _ : α, (0 : ℝ) = 0 := by
  cases isEmpty_or_nonempty α
  · exact Real.ciSup_empty _
  · 

Proof state:
case inr
α : Sort u_1
h✝ : Nonempty α
⊢ ⨆ x, 0 = 0

Next tactic:
exact ciSup_const
@[simp]
theorem sInf_empty : sInf (∅ : Set ℝ) = 0 := by 

Proof state:
⊢ sInf ∅ = 0

Next tactic:
simp [sInf_def, sSup_empty]
theorem ciInf_empty {α : Sort*} [IsEmpty α] (f : α → ℝ) : ⨅ i, f i = 0 := by
  

Proof state:
α : Sort u_1
inst✝ : IsEmpty α
f : α → ℝ
⊢ ⨅ i, f i = 0

Next tactic:
rw [iInf_of_empty', sInf_empty]
@[simp]
theorem ciInf_const_zero {α : Sort*} : ⨅ _ : α, (0 : ℝ) = 0 := by
  

Proof state:
α : Sort u_1
⊢ ⨅ x, 0 = 0

Next tactic:
cases isEmpty_or_nonempty α
@[simp]
theorem ciInf_const_zero {α : Sort*} : ⨅ _ : α, (0 : ℝ) = 0 := by
  cases isEmpty_or_nonempty α
  · 

Proof state:
case inl
α : Sort u_1
h✝ : IsEmpty α
⊢ ⨅ x, 0 = 0

Next tactic:
exact Real.ciInf_empty _
@[simp]
theorem ciInf_const_zero {α : Sort*} : ⨅ _ : α, (0 : ℝ) = 0 := by
  cases isEmpty_or_nonempty α
  · exact Real.ciInf_empty _
  · 

Proof state:
case inr
α : Sort u_1
h✝ : Nonempty α
⊢ ⨅ x, 0 = 0

Next tactic:
exact ciInf_const
/--
As `0` is the default value for `Real.sSup` of the empty set or sets which are not bounded above, it
suffices to show that `S` is bounded below by `0` to show that `0 ≤ sSup S`.
-/
theorem sSup_nonneg (S : Set ℝ) (hS : ∀ x ∈ S, (0 : ℝ) ≤ x) : 0 ≤ sSup S := by
  

Proof state:
S : Set ℝ
hS : ∀ x ∈ S, 0 ≤ x
⊢ 0 ≤ sSup S

Next tactic:
rcases S.eq_empty_or_nonempty with (rfl | ⟨y, hy⟩)
/--
As `0` is the default value for `Real.sSup` of the empty set or sets which are not bounded above, it
suffices to show that `S` is bounded below by `0` to show that `0 ≤ sSup S`.
-/
theorem sSup_nonneg (S : Set ℝ) (hS : ∀ x ∈ S, (0 : ℝ) ≤ x) : 0 ≤ sSup S := by
  rcases S.eq_empty_or_nonempty with (rfl | ⟨y, hy⟩)
  · 

Proof state:
case inl
hS : ∀ x ∈ ∅, 0 ≤ x
⊢ 0 ≤ sSup ∅

Next tactic:
exact sSup_empty.ge
/--
As `0` is the default value for `Real.sSup` of the empty set or sets which are not bounded above, it
suffices to show that `S` is bounded below by `0` to show that `0 ≤ sSup S`.
-/
theorem sSup_nonneg (S : Set ℝ) (hS : ∀ x ∈ S, (0 : ℝ) ≤ x) : 0 ≤ sSup S := by
  rcases S.eq_empty_or_nonempty with (rfl | ⟨y, hy⟩)
  · exact sSup_empty.ge
  · 

Proof state:
case inr.intro
S : Set ℝ
hS : ∀ x ∈ S, 0 ≤ x
y : ℝ
hy : y ∈ S
⊢ 0 ≤ sSup S

Next tactic:
apply dite _ (fun h => le_csSup_of_le h hy <| hS y hy) fun h => (sSup_of_not_bddAbove h).ge
/--
As `0` is the default value for `Real.sSup` of the empty set or sets which are not bounded above, it
suffices to show that all elements of `S` are bounded by a nonnegative number to show that `sSup S`
is bounded by this number.
-/
protected theorem sSup_le {S : Set ℝ} {a : ℝ} (hS : ∀ x ∈ S, x ≤ a) (ha : 0 ≤ a) : sSup S ≤ a := by
  

Proof state:
S : Set ℝ
a : ℝ
hS : ∀ x ∈ S, x ≤ a
ha : 0 ≤ a
⊢ sSup S ≤ a

Next tactic:
rcases S.eq_empty_or_nonempty with (rfl | hS₂)
/--
As `0` is the default value for `Real.sSup` of the empty set or sets which are not bounded above, it
suffices to show that all elements of `S` are bounded by a nonnegative number to show that `sSup S`
is bounded by this number.
-/
protected theorem sSup_le {S : Set ℝ} {a : ℝ} (hS : ∀ x ∈ S, x ≤ a) (ha : 0 ≤ a) : sSup S ≤ a := by
  rcases S.eq_empty_or_nonempty with (rfl | hS₂)
  

Proof state:
case inl
a : ℝ
ha : 0 ≤ a
hS : ∀ x ∈ ∅, x ≤ a
⊢ sSup ∅ ≤ a
case inr S : Set ℝ a : ℝ hS : ∀ x ∈ S, x ≤ a ha : 0 ≤ a hS₂ : Set.Nonempty S ⊢ sSup S ≤ a

Next tactic:
exacts [sSup_empty.trans_le ha, csSup_le hS₂ hS]
/-- As `0` is the default value for `Real.sInf` of the empty set, it suffices to show that `S` is
bounded below by `0` to show that `0 ≤ sInf S`.
-/
theorem sInf_nonneg (S : Set ℝ) (hS : ∀ x ∈ S, (0 : ℝ) ≤ x) : 0 ≤ sInf S := by
  

Proof state:
S : Set ℝ
hS : ∀ x ∈ S, 0 ≤ x
⊢ 0 ≤ sInf S

Next tactic:
rcases S.eq_empty_or_nonempty with (rfl | hS₂)
/-- As `0` is the default value for `Real.sInf` of the empty set, it suffices to show that `S` is
bounded below by `0` to show that `0 ≤ sInf S`.
-/
theorem sInf_nonneg (S : Set ℝ) (hS : ∀ x ∈ S, (0 : ℝ) ≤ x) : 0 ≤ sInf S := by
  rcases S.eq_empty_or_nonempty with (rfl | hS₂)
  

Proof state:
case inl
hS : ∀ x ∈ ∅, 0 ≤ x
⊢ 0 ≤ sInf ∅
case inr S : Set ℝ hS : ∀ x ∈ S, 0 ≤ x hS₂ : Set.Nonempty S ⊢ 0 ≤ sInf S

Next tactic:
exacts [sInf_empty.ge, le_csInf hS₂ hS]
/--
As `0` is the default value for `Real.sInf` of the empty set or sets which are not bounded below, it
suffices to show that `S` is bounded above by `0` to show that `sInf S ≤ 0`.
-/
theorem sInf_nonpos (S : Set ℝ) (hS : ∀ x ∈ S, x ≤ (0 : ℝ)) : sInf S ≤ 0 := by
  

Proof state:
S : Set ℝ
hS : ∀ x ∈ S, x ≤ 0
⊢ sInf S ≤ 0

Next tactic:
rcases S.eq_empty_or_nonempty with (rfl | ⟨y, hy⟩)
/--
As `0` is the default value for `Real.sInf` of the empty set or sets which are not bounded below, it
suffices to show that `S` is bounded above by `0` to show that `sInf S ≤ 0`.
-/
theorem sInf_nonpos (S : Set ℝ) (hS : ∀ x ∈ S, x ≤ (0 : ℝ)) : sInf S ≤ 0 := by
  rcases S.eq_empty_or_nonempty with (rfl | ⟨y, hy⟩)
  · 

Proof state:
case inl
hS : ∀ x ∈ ∅, x ≤ 0
⊢ sInf ∅ ≤ 0

Next tactic:
exact sInf_empty.le
/--
As `0` is the default value for `Real.sInf` of the empty set or sets which are not bounded below, it
suffices to show that `S` is bounded above by `0` to show that `sInf S ≤ 0`.
-/
theorem sInf_nonpos (S : Set ℝ) (hS : ∀ x ∈ S, x ≤ (0 : ℝ)) : sInf S ≤ 0 := by
  rcases S.eq_empty_or_nonempty with (rfl | ⟨y, hy⟩)
  · exact sInf_empty.le
  · 

Proof state:
case inr.intro
S : Set ℝ
hS : ∀ x ∈ S, x ≤ 0
y : ℝ
hy : y ∈ S
⊢ sInf S ≤ 0

Next tactic:
apply dite _ (fun h => csInf_le_of_le h hy <| hS y hy) fun h => (sInf_of_not_bddBelow h).le
theorem sInf_le_sSup (s : Set ℝ) (h₁ : BddBelow s) (h₂ : BddAbove s) : sInf s ≤ sSup s := by
  

Proof state:
s : Set ℝ
h₁ : BddBelow s
h₂ : BddAbove s
⊢ sInf s ≤ sSup s

Next tactic:
rcases s.eq_empty_or_nonempty with (rfl | hne)
theorem sInf_le_sSup (s : Set ℝ) (h₁ : BddBelow s) (h₂ : BddAbove s) : sInf s ≤ sSup s := by
  rcases s.eq_empty_or_nonempty with (rfl | hne)
  · 

Proof state:
case inl
h₁ : BddBelow ∅
h₂ : BddAbove ∅
⊢ sInf ∅ ≤ sSup ∅

Next tactic:
rw [sInf_empty, sSup_empty]
theorem sInf_le_sSup (s : Set ℝ) (h₁ : BddBelow s) (h₂ : BddAbove s) : sInf s ≤ sSup s := by
  rcases s.eq_empty_or_nonempty with (rfl | hne)
  · rw [sInf_empty, sSup_empty]
  · 

Proof state:
case inr
s : Set ℝ
h₁ : BddBelow s
h₂ : BddAbove s
hne : Set.Nonempty s
⊢ sInf s ≤ sSup s

Next tactic:
exact csInf_le_csSup h₁ h₂ hne
theorem cauSeq_converges (f : CauSeq ℝ abs) : ∃ x, f ≈ const abs x := by
  

Proof state:
f : CauSeq ℝ abs
⊢ ∃ x, f ≈ const abs x

Next tactic:
let S := { x : ℝ | const abs x < f }
theorem cauSeq_converges (f : CauSeq ℝ abs) : ∃ x, f ≈ const abs x := by
  let S := { x : ℝ | const abs x < f }
  

Proof state:
f : CauSeq ℝ abs
S : Set ℝ := {x | const abs x < f}
⊢ ∃ x, f ≈ const abs x

Next tactic:
have lb : ∃ x, x ∈ S := exists_lt f
theorem cauSeq_converges (f : CauSeq ℝ abs) : ∃ x, f ≈ const abs x := by
  let S := { x : ℝ | const abs x < f }
  have lb : ∃ x, x ∈ S := exists_lt f
  

Proof state:
f : CauSeq ℝ abs
S : Set ℝ := {x | const abs x < f}
lb : ∃ x, x ∈ S
⊢ ∃ x, f ≈ const abs x

Next tactic:
have ub' : ∀ x, f < const abs x → ∀ y ∈ S, y ≤ x := fun x h y yS =>
    le_of_lt <| const_lt.1 <| CauSeq.lt_trans yS h
theorem cauSeq_converges (f : CauSeq ℝ abs) : ∃ x, f ≈ const abs x := by
  let S := { x : ℝ | const abs x < f }
  have lb : ∃ x, x ∈ S := exists_lt f
  have ub' : ∀ x, f < const abs x → ∀ y ∈ S, y ≤ x := fun x h y yS =>
    le_of_lt <| const_lt.1 <| CauSeq.lt_trans yS h
  

Proof state:
f : CauSeq ℝ abs
S : Set ℝ := {x | const abs x < f}
lb : ∃ x, x ∈ S
ub' : ∀ (x : ℝ), f < const abs x → ∀ y ∈ S, y ≤ x
⊢ ∃ x, f ≈ const abs x

Next tactic:
have ub : ∃ x, ∀ y ∈ S, y ≤ x := (exists_gt f).imp ub'
theorem cauSeq_converges (f : CauSeq ℝ abs) : ∃ x, f ≈ const abs x := by
  let S := { x : ℝ | const abs x < f }
  have lb : ∃ x, x ∈ S := exists_lt f
  have ub' : ∀ x, f < const abs x → ∀ y ∈ S, y ≤ x := fun x h y yS =>
    le_of_lt <| const_lt.1 <| CauSeq.lt_trans yS h
  have ub : ∃ x, ∀ y ∈ S, y ≤ x := (exists_gt f).imp ub'
  

Proof state:
f : CauSeq ℝ abs
S : Set ℝ := {x | const abs x < f}
lb : ∃ x, x ∈ S
ub' : ∀ (x : ℝ), f < const abs x → ∀ y ∈ S, y ≤ x
ub : ∃ x, ∀ y ∈ S, y ≤ x
⊢ ∃ x, f ≈ const abs x

Next tactic:
refine' ⟨sSup S, ((lt_total _ _).resolve_left fun h => _).resolve_right fun h => _⟩
theorem cauSeq_converges (f : CauSeq ℝ abs) : ∃ x, f ≈ const abs x := by
  let S := { x : ℝ | const abs x < f }
  have lb : ∃ x, x ∈ S := exists_lt f
  have ub' : ∀ x, f < const abs x → ∀ y ∈ S, y ≤ x := fun x h y yS =>
    le_of_lt <| const_lt.1 <| CauSeq.lt_trans yS h
  have ub : ∃ x, ∀ y ∈ S, y ≤ x := (exists_gt f).imp ub'
  refine' ⟨sSup S, ((lt_total _ _).resolve_left fun h => _).resolve_right fun h => _⟩
  · 

Proof state:
case refine'_1
f : CauSeq ℝ abs
S : Set ℝ := {x | const abs x < f}
lb : ∃ x, x ∈ S
ub' : ∀ (x : ℝ), f < const abs x → ∀ y ∈ S, y ≤ x
ub : ∃ x, ∀ y ∈ S, y ≤ x
h : f < const abs (sSup S)
⊢ False

Next tactic:
rcases h with ⟨ε, ε0, i, ih⟩