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 => ?_)
  

Proof state:
case insert.refine_2
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
this :
  f i
        ((fun j hj => if hji : j = i then cast (_ : κ i = κ j) a else g j (_ : j ∈ s))
          ↑{ 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)
              ((fun j hj => if hji : j = i then cast (_ : κ i = κ j) a else g j (_ : j ∈ s)) ↑i_1
                (_ : ↑i_1 ∈ insert i s))) ∘
          fun x => { val := ↑x, property := (_ : ↑x ∈ insert i s) }) ≤
    c
⊢ (f i a ⊓ inf (attach s) fun i => f (↑i) (g ↑i (_ : ↑i ∈ s))) ≤ c
case insert.refine_1
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
⊢ (fun j hj => if hji : j = i then cast (_ : κ i = κ j) a else g j (_ : j ∈ s)) j hj ∈ t j

Next tactic:
simpa only [cast_eq, dif_pos, Function.comp, Subtype.coe_mk, dif_neg, aux] using this