l3lab/ntp-mathlib huggingface dataset:
theorem inf_sup {κ : ι → Type*} (s : Finset ι) (t : ∀ i, Finset (κ i)) (f : ∀ i, κ i → α) :
    (s.inf fun i => (t i).sup (f i)) =
      (s.pi t).sup fun g => s.attach.inf fun i => f _ <| g _ i.2 := by
  induction' s using Finset.induction with i s hi ih
  · simp
  rw [inf_insert, ih, attach_insert, sup_inf_sup]
  refine' eq_of_forall_ge_iff fun c => _
  simp only [Finset.sup_le_iff, mem_product, mem_pi, and_imp, Prod.forall,
    inf_insert, inf_image]
  refine'
    ⟨fun h g hg =>
      h (g i <| mem_insert_self _ _) (fun j hj => g j <| mem_insert_of_mem hj)
        (hg _ <| mem_insert_self _ _) fun j hj => hg _ <| mem_insert_of_mem hj,
      fun h a g ha hg => _⟩
  -- TODO: This `have` must be named to prevent it being shadowed by the internal `this` in `simpa`
  have aux : ∀ j : { x // x ∈ s }, ↑j ≠ i := fun j : s => ne_of_mem_of_not_mem j.2 hi
  -- porting note: `simpa` doesn't support placeholders in proof terms
  have := h (fun j hj => if hji : j = i then cast (congr_arg κ hji.symm) a
      else g _ <| mem_of_mem_insert_of_ne hj hji) (fun j hj => ?_)
  simpa only [cast_eq, dif_pos, Function.comp, Subtype.coe_mk, dif_neg, aux] using this
  rw [mem_insert] at hj
  obtain (rfl | hj) := hj
  · simpa
  · 

Proof state:
case insert.refine_1.inr
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ✝ : Type u_6
inst✝² : DistribLattice α
inst✝¹ : BoundedOrder α
inst✝ : DecidableEq ι
κ : ι → Type u_7
t : (i : ι) → Finset (κ i)
f : (i : ι) → κ i → α
i : ι
s : Finset ι
hi : i ∉ s
ih : (inf s fun i => sup (t i) (f i)) = sup (pi s t) fun g => inf (attach s) fun i => f (↑i) (g ↑i (_ : ↑i ∈ s))
c : α
h :
  ∀ (b : (a : ι) → a ∈ insert i s → κ a),
    (∀ (a : ι) (h : a ∈ insert i s), b a h ∈ t a) →
      f i
            (b ↑{ val := i, property := (_ : i ∈ insert i s) }
              (_ : ↑{ val := i, property := (_ : i ∈ insert i s) } ∈ insert i s)) ⊓
          inf (attach s)
            ((fun i_1 => f (↑i_1) (b ↑i_1 (_ : ↑i_1 ∈ insert i s))) ∘ fun x =>
              { val := ↑x, property := (_ : ↑x ∈ insert i s) }) ≤
        c
a : κ i
g : (a : ι) → a ∈ s → κ a
ha : a ∈ t i
hg : ∀ (a : ι) (h : a ∈ s), g a h ∈ t a
aux : ∀ (j : { x // x ∈ s }), ↑j ≠ i
j : ι
hj✝ : j ∈ insert i s
hj : j ∈ s
⊢ (fun j hj => if hji : j = i then cast (_ : κ i = κ j) a else g j (_ : j ∈ s)) j hj✝ ∈ t j

Next tactic:
simpa [ne_of_mem_of_not_mem hj hi] using hg _ _
theorem sup_sdiff_left (s : Finset ι) (f : ι → α) (a : α) :
    (s.sup fun b => a \ f b) = a \ s.inf f := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : BooleanAlgebra α
s✝ s : Finset ι
f : ι → α
a : α
⊢ (sup s fun b => a \ f b) = a \ inf s f

Next tactic:
refine' Finset.cons_induction_on s _ fun b t _ h => _
theorem sup_sdiff_left (s : Finset ι) (f : ι → α) (a : α) :
    (s.sup fun b => a \ f b) = a \ s.inf f := by
  refine' Finset.cons_induction_on s _ fun b t _ h => _
  · 

Proof state:
case refine'_1
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : BooleanAlgebra α
s✝ s : Finset ι
f : ι → α
a : α
⊢ (sup ∅ fun b => a \ f b) = a \ inf ∅ f

Next tactic:
rw [sup_empty, inf_empty, sdiff_top]
theorem sup_sdiff_left (s : Finset ι) (f : ι → α) (a : α) :
    (s.sup fun b => a \ f b) = a \ s.inf f := by
  refine' Finset.cons_induction_on s _ fun b t _ h => _
  · rw [sup_empty, inf_empty, sdiff_top]
  · 

Proof state:
case refine'_2
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : BooleanAlgebra α
s✝ s : Finset ι
f : ι → α
a : α
b : ι
t : Finset ι
x✝ : b ∉ t
h : (sup t fun b => a \ f b) = a \ inf t f
⊢ (sup (cons b t x✝) fun b => a \ f b) = a \ inf (cons b t x✝) f

Next tactic:
rw [sup_cons, inf_cons, h, sdiff_inf]
theorem inf_sdiff_left (hs : s.Nonempty) (f : ι → α) (a : α) :
    (s.inf fun b => a \ f b) = a \ s.sup f := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : BooleanAlgebra α
s : Finset ι
hs : Finset.Nonempty s
f : ι → α
a : α
⊢ (inf s fun b => a \ f b) = a \ sup s f

Next tactic:
induction' hs using Finset.Nonempty.cons_induction with b b t _ _ h
theorem inf_sdiff_left (hs : s.Nonempty) (f : ι → α) (a : α) :
    (s.inf fun b => a \ f b) = a \ s.sup f := by
  induction' hs using Finset.Nonempty.cons_induction with b b t _ _ h
  · 

Proof state:
case h₀
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : BooleanAlgebra α
s : Finset ι
f : ι → α
a : α
b : ι
⊢ (inf {b} fun b => a \ f b) = a \ sup {b} f

Next tactic:
rw [sup_singleton, inf_singleton]
theorem inf_sdiff_left (hs : s.Nonempty) (f : ι → α) (a : α) :
    (s.inf fun b => a \ f b) = a \ s.sup f := by
  induction' hs using Finset.Nonempty.cons_induction with b b t _ _ h
  · rw [sup_singleton, inf_singleton]
  · 

Proof state:
case h₁
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : BooleanAlgebra α
s : Finset ι
f : ι → α
a : α
b : ι
t : Finset ι
h✝ : b ∉ t
hs✝ : Finset.Nonempty t
h : (inf t fun b => a \ f b) = a \ sup t f
⊢ (inf (cons b t h✝) fun b => a \ f b) = a \ sup (cons b t h✝) f

Next tactic:
rw [sup_cons, inf_cons, h, sdiff_sup]
theorem inf_sdiff_right (hs : s.Nonempty) (f : ι → α) (a : α) :
    (s.inf fun b => f b \ a) = s.inf f \ a := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : BooleanAlgebra α
s : Finset ι
hs : Finset.Nonempty s
f : ι → α
a : α
⊢ (inf s fun b => f b \ a) = inf s f \ a

Next tactic:
induction' hs using Finset.Nonempty.cons_induction with b b t _ _ h
theorem inf_sdiff_right (hs : s.Nonempty) (f : ι → α) (a : α) :
    (s.inf fun b => f b \ a) = s.inf f \ a := by
  induction' hs using Finset.Nonempty.cons_induction with b b t _ _ h
  · 

Proof state:
case h₀
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : BooleanAlgebra α
s : Finset ι
f : ι → α
a : α
b : ι
⊢ (inf {b} fun b => f b \ a) = inf {b} f \ a

Next tactic:
rw [inf_singleton, inf_singleton]
theorem inf_sdiff_right (hs : s.Nonempty) (f : ι → α) (a : α) :
    (s.inf fun b => f b \ a) = s.inf f \ a := by
  induction' hs using Finset.Nonempty.cons_induction with b b t _ _ h
  · rw [inf_singleton, inf_singleton]
  · 

Proof state:
case h₁
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : BooleanAlgebra α
s : Finset ι
f : ι → α
a : α
b : ι
t : Finset ι
h✝ : b ∉ t
hs✝ : Finset.Nonempty t
h : (inf t fun b => f b \ a) = inf t f \ a
⊢ (inf (cons b t h✝) fun b => f b \ a) = inf (cons b t h✝) f \ a

Next tactic:
rw [inf_cons, inf_cons, h, inf_sdiff]
@[simp]
protected theorem le_sup_iff (ha : ⊥ < a) : a ≤ s.sup f ↔ ∃ b ∈ s, a ≤ f b := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
ha : ⊥ < a
⊢ a ≤ sup s f ↔ ∃ b ∈ s, a ≤ f b

Next tactic:
apply Iff.intro
@[simp]
protected theorem le_sup_iff (ha : ⊥ < a) : a ≤ s.sup f ↔ ∃ b ∈ s, a ≤ f b := by
  apply Iff.intro
  · 

Proof state:
case mp
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
ha : ⊥ < a
⊢ a ≤ sup s f → ∃ b ∈ s, a ≤ f b

Next tactic:
induction s using cons_induction with
    | empty => exact (absurd · (not_le_of_lt ha))
    | @cons c t hc ih =>
      rw [sup_cons, le_sup_iff]
      exact fun
      | Or.inl h => ⟨c, mem_cons.2 (Or.inl rfl), h⟩
      | Or.inr h => let ⟨b, hb, hle⟩ := ih h; ⟨b, mem_cons.2 (Or.inr hb), hle⟩
@[simp]
protected theorem le_sup_iff (ha : ⊥ < a) : a ≤ s.sup f ↔ ∃ b ∈ s, a ≤ f b := by
  apply Iff.intro
  · induction s using cons_induction with
    

Proof state:
case mp.empty
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
ha : ⊥ < a
⊢ a ≤ sup ∅ f → ∃ b ∈ ∅, a ≤ f b

Next tactic:
| empty => exact (absurd · (not_le_of_lt ha))
@[simp]
protected theorem le_sup_iff (ha : ⊥ < a) : a ≤ s.sup f ↔ ∃ b ∈ s, a ≤ f b := by
  apply Iff.intro
  · induction s using cons_induction with
    | empty => 

Proof state:
case mp.empty
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
ha : ⊥ < a
⊢ a ≤ sup ∅ f → ∃ b ∈ ∅, a ≤ f b

Next tactic:
exact (absurd · (not_le_of_lt ha))
@[simp]
protected theorem le_sup_iff (ha : ⊥ < a) : a ≤ s.sup f ↔ ∃ b ∈ s, a ≤ f b := by
  apply Iff.intro
  · induction s using cons_induction with
    | empty => exact (absurd · (not_le_of_lt ha))
    

Proof state:
case mp.cons
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
ha : ⊥ < a
c : ι
t : Finset ι
hc : c ∉ t
ih : a ≤ sup t f → ∃ b ∈ t, a ≤ f b
⊢ a ≤ sup (cons c t hc) f → ∃ b ∈ cons c t hc, a ≤ f b

Next tactic:
| @cons c t hc ih =>
      rw [sup_cons, le_sup_iff]
      exact fun
      | Or.inl h => ⟨c, mem_cons.2 (Or.inl rfl), h⟩
      | Or.inr h => let ⟨b, hb, hle⟩ := ih h; ⟨b, mem_cons.2 (Or.inr hb), hle⟩
@[simp]
protected theorem le_sup_iff (ha : ⊥ < a) : a ≤ s.sup f ↔ ∃ b ∈ s, a ≤ f b := by
  apply Iff.intro
  · induction s using cons_induction with
    | empty => exact (absurd · (not_le_of_lt ha))
    | @cons c t hc ih =>
      

Proof state:
case mp.cons
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
ha : ⊥ < a
c : ι
t : Finset ι
hc : c ∉ t
ih : a ≤ sup t f → ∃ b ∈ t, a ≤ f b
⊢ a ≤ sup (cons c t hc) f → ∃ b ∈ cons c t hc, a ≤ f b

Next tactic:
rw [sup_cons, le_sup_iff]
@[simp]
protected theorem le_sup_iff (ha : ⊥ < a) : a ≤ s.sup f ↔ ∃ b ∈ s, a ≤ f b := by
  apply Iff.intro
  · induction s using cons_induction with
    | empty => exact (absurd · (not_le_of_lt ha))
    | @cons c t hc ih =>
      rw [sup_cons, le_sup_iff]
      

Proof state:
case mp.cons
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
ha : ⊥ < a
c : ι
t : Finset ι
hc : c ∉ t
ih : a ≤ sup t f → ∃ b ∈ t, a ≤ f b
⊢ a ≤ f c ∨ a ≤ sup t f → ∃ b ∈ cons c t hc, a ≤ f b

Next tactic:
exact fun
      | Or.inl h => ⟨c, mem_cons.2 (Or.inl rfl), h⟩
      | Or.inr h => let ⟨b, hb, hle⟩ := ih h; ⟨b, mem_cons.2 (Or.inr hb), hle⟩
@[simp]
protected theorem le_sup_iff (ha : ⊥ < a) : a ≤ s.sup f ↔ ∃ b ∈ s, a ≤ f b := by
  apply Iff.intro
  · induction s using cons_induction with
    | empty => exact (absurd · (not_le_of_lt ha))
    | @cons c t hc ih =>
      rw [sup_cons, le_sup_iff]
      exact fun
      | Or.inl h => ⟨c, mem_cons.2 (Or.inl rfl), h⟩
      | Or.inr h => let ⟨b, hb, hle⟩ := ih h; ⟨b, mem_cons.2 (Or.inr hb), hle⟩
  · 

Proof state:
case mpr
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
ha : ⊥ < a
⊢ (∃ b ∈ s, a ≤ f b) → a ≤ sup s f

Next tactic:
exact fun ⟨b, hb, hle⟩ => le_trans hle (le_sup hb)
@[simp]
protected theorem lt_sup_iff : a < s.sup f ↔ ∃ b ∈ s, a < f b := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
⊢ a < sup s f ↔ ∃ b ∈ s, a < f b

Next tactic:
apply Iff.intro
@[simp]
protected theorem lt_sup_iff : a < s.sup f ↔ ∃ b ∈ s, a < f b := by
  apply Iff.intro
  · 

Proof state:
case mp
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
⊢ a < sup s f → ∃ b ∈ s, a < f b

Next tactic:
induction s using cons_induction with
    | empty => exact (absurd · not_lt_bot)
    | @cons c t hc ih =>
      rw [sup_cons, lt_sup_iff]
      exact fun
      | Or.inl h => ⟨c, mem_cons.2 (Or.inl rfl), h⟩
      | Or.inr h => let ⟨b, hb, hlt⟩ := ih h; ⟨b, mem_cons.2 (Or.inr hb), hlt⟩
@[simp]
protected theorem lt_sup_iff : a < s.sup f ↔ ∃ b ∈ s, a < f b := by
  apply Iff.intro
  · induction s using cons_induction with
    

Proof state:
case mp.empty
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
⊢ a < sup ∅ f → ∃ b ∈ ∅, a < f b

Next tactic:
| empty => exact (absurd · not_lt_bot)
@[simp]
protected theorem lt_sup_iff : a < s.sup f ↔ ∃ b ∈ s, a < f b := by
  apply Iff.intro
  · induction s using cons_induction with
    | empty => 

Proof state:
case mp.empty
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
⊢ a < sup ∅ f → ∃ b ∈ ∅, a < f b

Next tactic:
exact (absurd · not_lt_bot)
@[simp]
protected theorem lt_sup_iff : a < s.sup f ↔ ∃ b ∈ s, a < f b := by
  apply Iff.intro
  · induction s using cons_induction with
    | empty => exact (absurd · not_lt_bot)
    

Proof state:
case mp.cons
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
c : ι
t : Finset ι
hc : c ∉ t
ih : a < sup t f → ∃ b ∈ t, a < f b
⊢ a < sup (cons c t hc) f → ∃ b ∈ cons c t hc, a < f b

Next tactic:
| @cons c t hc ih =>
      rw [sup_cons, lt_sup_iff]
      exact fun
      | Or.inl h => ⟨c, mem_cons.2 (Or.inl rfl), h⟩
      | Or.inr h => let ⟨b, hb, hlt⟩ := ih h; ⟨b, mem_cons.2 (Or.inr hb), hlt⟩
@[simp]
protected theorem lt_sup_iff : a < s.sup f ↔ ∃ b ∈ s, a < f b := by
  apply Iff.intro
  · induction s using cons_induction with
    | empty => exact (absurd · not_lt_bot)
    | @cons c t hc ih =>
      

Proof state:
case mp.cons
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
c : ι
t : Finset ι
hc : c ∉ t
ih : a < sup t f → ∃ b ∈ t, a < f b
⊢ a < sup (cons c t hc) f → ∃ b ∈ cons c t hc, a < f b

Next tactic:
rw [sup_cons, lt_sup_iff]
@[simp]
protected theorem lt_sup_iff : a < s.sup f ↔ ∃ b ∈ s, a < f b := by
  apply Iff.intro
  · induction s using cons_induction with
    | empty => exact (absurd · not_lt_bot)
    | @cons c t hc ih =>
      rw [sup_cons, lt_sup_iff]
      

Proof state:
case mp.cons
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
c : ι
t : Finset ι
hc : c ∉ t
ih : a < sup t f → ∃ b ∈ t, a < f b
⊢ a < f c ∨ a < sup t f → ∃ b ∈ cons c t hc, a < f b

Next tactic:
exact fun
      | Or.inl h => ⟨c, mem_cons.2 (Or.inl rfl), h⟩
      | Or.inr h => let ⟨b, hb, hlt⟩ := ih h; ⟨b, mem_cons.2 (Or.inr hb), hlt⟩
@[simp]
protected theorem lt_sup_iff : a < s.sup f ↔ ∃ b ∈ s, a < f b := by
  apply Iff.intro
  · induction s using cons_induction with
    | empty => exact (absurd · not_lt_bot)
    | @cons c t hc ih =>
      rw [sup_cons, lt_sup_iff]
      exact fun
      | Or.inl h => ⟨c, mem_cons.2 (Or.inl rfl), h⟩
      | Or.inr h => let ⟨b, hb, hlt⟩ := ih h; ⟨b, mem_cons.2 (Or.inr hb), hlt⟩
  · 

Proof state:
case mpr
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
⊢ (∃ b ∈ s, a < f b) → a < sup s f

Next tactic:
exact fun ⟨b, hb, hlt⟩ => lt_of_lt_of_le hlt (le_sup hb)
@[simp]
protected theorem sup_lt_iff (ha : ⊥ < a) : s.sup f < a ↔ ∀ b ∈ s, f b < a :=
  ⟨fun hs b hb => lt_of_le_of_lt (le_sup hb) hs,
    Finset.cons_induction_on s (fun _ => ha) fun c t hc => by
      

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : LinearOrder α
inst✝ : OrderBot α
s : Finset ι
f : ι → α
a : α
ha : ⊥ < a
c : ι
t : Finset ι
hc : c ∉ t
⊢ ((∀ b ∈ t, f b < a) → sup t f < a) → (∀ b ∈ cons c t hc, f b < a) → sup (cons c t hc) f < a

Next tactic:
simpa only [sup_cons, sup_lt_iff, mem_cons, forall_eq_or_imp] using And.imp_right
/-- Given nonempty finset `s` then `s.sup' H f` is the supremum of its image under `f` in (possibly
unbounded) join-semilattice `α`, where `H` is a proof of nonemptiness. If `α` has a bottom element
you may instead use `Finset.sup` which does not require `s` nonempty. -/
def sup' (s : Finset β) (H : s.Nonempty) (f : β → α) : α :=
  WithBot.unbot (s.sup ((↑) ∘ f)) (by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
⊢ sup s (WithBot.some ∘ f) ≠ ⊥

Next tactic:
simpa using H
@[simp]
theorem coe_sup' : ((s.sup' H f : α) : WithBot α) = s.sup ((↑) ∘ f) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
⊢ ↑(sup' s H f) = sup s (WithBot.some ∘ f)

Next tactic:
rw [sup', WithBot.coe_unbot]
@[simp]
theorem sup'_cons {b : β} {hb : b ∉ s} {h : (cons b s hb).Nonempty} :
    (cons b s hb).sup' h f = f b ⊔ s.sup' H f := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
b : β
hb : b ∉ s
h : Finset.Nonempty (cons b s hb)
⊢ sup' (cons b s hb) h f = f b ⊔ sup' s H f

Next tactic:
rw [← WithBot.coe_eq_coe]
@[simp]
theorem sup'_cons {b : β} {hb : b ∉ s} {h : (cons b s hb).Nonempty} :
    (cons b s hb).sup' h f = f b ⊔ s.sup' H f := by
  rw [← WithBot.coe_eq_coe]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
b : β
hb : b ∉ s
h : Finset.Nonempty (cons b s hb)
⊢ ↑(sup' (cons b s hb) h f) = ↑(f b ⊔ sup' s H f)

Next tactic:
simp [WithBot.coe_sup]
@[simp]
theorem sup'_insert [DecidableEq β] {b : β} {h : (insert b s).Nonempty} :
    (insert b s).sup' h f = f b ⊔ s.sup' H f := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
inst✝ : DecidableEq β
b : β
h : Finset.Nonempty (insert b s)
⊢ sup' (insert b s) h f = f b ⊔ sup' s H f

Next tactic:
rw [← WithBot.coe_eq_coe]
@[simp]
theorem sup'_insert [DecidableEq β] {b : β} {h : (insert b s).Nonempty} :
    (insert b s).sup' h f = f b ⊔ s.sup' H f := by
  rw [← WithBot.coe_eq_coe]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
inst✝ : DecidableEq β
b : β
h : Finset.Nonempty (insert b s)
⊢ ↑(sup' (insert b s) h f) = ↑(f b ⊔ sup' s H f)

Next tactic:
simp [WithBot.coe_sup]
theorem sup'_le {a : α} (hs : ∀ b ∈ s, f b ≤ a) : s.sup' H f ≤ a := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
a : α
hs : ∀ b ∈ s, f b ≤ a
⊢ sup' s H f ≤ a

Next tactic:
rw [← WithBot.coe_le_coe, coe_sup']
theorem sup'_le {a : α} (hs : ∀ b ∈ s, f b ≤ a) : s.sup' H f ≤ a := by
  rw [← WithBot.coe_le_coe, coe_sup']
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
a : α
hs : ∀ b ∈ s, f b ≤ a
⊢ sup s (WithBot.some ∘ f) ≤ ↑a

Next tactic:
exact Finset.sup_le fun b h => WithBot.coe_le_coe.2 <| hs b h
theorem le_sup' {b : β} (h : b ∈ s) : f b ≤ s.sup' ⟨b, h⟩ f := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
b : β
h : b ∈ s
⊢ f b ≤ sup' s (_ : ∃ x, x ∈ s) f

Next tactic:
rw [← WithBot.coe_le_coe, coe_sup']
theorem le_sup' {b : β} (h : b ∈ s) : f b ≤ s.sup' ⟨b, h⟩ f := by
  rw [← WithBot.coe_le_coe, coe_sup']
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
b : β
h : b ∈ s
⊢ ↑(f b) ≤ sup s (WithBot.some ∘ f)

Next tactic:
exact le_sup (f := fun c => WithBot.some (f c)) h
@[simp]
theorem sup'_const (a : α) : s.sup' H (fun _ => a) = a := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
a : α
⊢ (sup' s H fun x => a) = a

Next tactic:
apply le_antisymm
@[simp]
theorem sup'_const (a : α) : s.sup' H (fun _ => a) = a := by
  apply le_antisymm
  · 

Proof state:
case a
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
a : α
⊢ (sup' s H fun x => a) ≤ a

Next tactic:
apply sup'_le
@[simp]
theorem sup'_const (a : α) : s.sup' H (fun _ => a) = a := by
  apply le_antisymm
  · apply sup'_le
    

Proof state:
case a.hs
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
a : α
⊢ ∀ b ∈ s, a ≤ a

Next tactic:
intros
@[simp]
theorem sup'_const (a : α) : s.sup' H (fun _ => a) = a := by
  apply le_antisymm
  · apply sup'_le
    intros
    

Proof state:
case a.hs
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
a : α
b✝ : β
a✝ : b✝ ∈ s
⊢ a ≤ a

Next tactic:
exact le_rfl
@[simp]
theorem sup'_const (a : α) : s.sup' H (fun _ => a) = a := by
  apply le_antisymm
  · apply sup'_le
    intros
    exact le_rfl
  · 

Proof state:
case a
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f : β → α
a : α
⊢ a ≤ sup' s H fun x => a

Next tactic:
apply le_sup' (fun _ => a) H.choose_spec
theorem sup'_union [DecidableEq β] {s₁ s₂ : Finset β} (h₁ : s₁.Nonempty) (h₂ : s₂.Nonempty)
    (f : β → α) :
    (s₁ ∪ s₂).sup' (h₁.mono <| subset_union_left _ _) f = s₁.sup' h₁ f ⊔ s₂.sup' h₂ f :=
  eq_of_forall_ge_iff fun a => by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f✝ : β → α
inst✝ : DecidableEq β
s₁ s₂ : Finset β
h₁ : Finset.Nonempty s₁
h₂ : Finset.Nonempty s₂
f : β → α
a : α
⊢ sup' (s₁ ∪ s₂) (_ : Finset.Nonempty (s₁ ∪ s₂)) f ≤ a ↔ sup' s₁ h₁ f ⊔ sup' s₂ h₂ f ≤ a

Next tactic:
simp [or_imp, forall_and]
theorem sup'_biUnion [DecidableEq β] {s : Finset γ} (Hs : s.Nonempty) {t : γ → Finset β}
    (Ht : ∀ b, (t b).Nonempty) :
    (s.biUnion t).sup' (Hs.biUnion fun b _ => Ht b) f = s.sup' Hs (fun b => (t b).sup' (Ht b) f) :=
  eq_of_forall_ge_iff fun c => by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : SemilatticeSup α
s✝ : Finset β
H : Finset.Nonempty s✝
f : β → α
inst✝ : DecidableEq β
s : Finset γ
Hs : Finset.Nonempty s
t : γ → Finset β
Ht : ∀ (b : γ), Finset.Nonempty (t b)
c : α
⊢ sup' (Finset.biUnion s t) (_ : Finset.Nonempty (Finset.biUnion s t)) f ≤ c ↔
    (sup' s Hs fun b => sup' (t b) (_ : Finset.Nonempty (t b)) f) ≤ c

Next tactic:
simp [@forall_swap _ β]
protected theorem sup'_comm {t : Finset γ} (hs : s.Nonempty) (ht : t.Nonempty) (f : β → γ → α) :
    (s.sup' hs fun b => t.sup' ht (f b)) = t.sup' ht fun c => s.sup' hs fun b => f b c :=
  eq_of_forall_ge_iff fun a => by 

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝ : SemilatticeSup α
s : Finset β
H : Finset.Nonempty s
f✝ : β → α
t : Finset γ
hs : Finset.Nonempty s
ht : Finset.Nonempty t
f : β → γ → α
a : α
⊢ (sup' s hs fun b => sup' t ht (f b)) ≤ a ↔ (sup' t ht fun c => sup' s hs fun b => f b c) ≤ a

Next tactic:
simpa using forall₂_swap