l3lab/ntp-mathlib huggingface dataset:
theorem inf_union [DecidableEq β] : (s₁ ∪ s₂).inf f = s₁.inf f ⊓ s₂.inf f :=
  eq_of_forall_le_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✝² : SemilatticeInf α
inst✝¹ : OrderTop α
s s₁ s₂ : Finset β
f g : β → α
a : α
inst✝ : DecidableEq β
c : α
⊢ c ≤ inf (s₁ ∪ s₂) f ↔ c ≤ inf s₁ f ⊓ inf s₂ f

Next tactic:
simp [or_imp, forall_and]
theorem _root_.List.foldr_inf_eq_inf_toFinset [DecidableEq α] (l : List α) :
    l.foldr (· ⊓ ·) ⊤ = l.toFinset.inf id := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝² : SemilatticeInf α
inst✝¹ : OrderTop α
s s₁ s₂ : Finset β
f g : β → α
a : α
inst✝ : DecidableEq α
l : List α
⊢ List.foldr (fun x x_1 => x ⊓ x_1) ⊤ l = inf (List.toFinset l) id

Next tactic:
rw [← coe_fold_r, ← Multiset.fold_dedup_idem, inf_def, ← List.toFinset_coe, toFinset_val,
    Multiset.map_id]
theorem _root_.List.foldr_inf_eq_inf_toFinset [DecidableEq α] (l : List α) :
    l.foldr (· ⊓ ·) ⊤ = l.toFinset.inf id := by
  rw [← coe_fold_r, ← Multiset.fold_dedup_idem, inf_def, ← List.toFinset_coe, toFinset_val,
    Multiset.map_id]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝² : SemilatticeInf α
inst✝¹ : OrderTop α
s s₁ s₂ : Finset β
f g : β → α
a : α
inst✝ : DecidableEq α
l : List α
⊢ Multiset.fold (fun x x_1 => x ⊓ x_1) ⊤ (dedup ↑l) = Multiset.inf (dedup ↑l)

Next tactic:
rfl
theorem sup_inf_distrib_left (s : Finset ι) (f : ι → α) (a : α) :
    a ⊓ s.sup f = s.sup fun i => a ⊓ f i := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : DistribLattice α
inst✝ : OrderBot α
s✝ : Finset ι
t : Finset κ
f✝ : ι → α
g : κ → α
a✝ : α
s : Finset ι
f : ι → α
a : α
⊢ a ⊓ sup s f = sup s fun i => a ⊓ f i

Next tactic:
induction' s using Finset.cons_induction with i s hi h
theorem sup_inf_distrib_left (s : Finset ι) (f : ι → α) (a : α) :
    a ⊓ s.sup f = s.sup fun i => a ⊓ f i := by
  induction' s using Finset.cons_induction with i s hi h
  · 

Proof state:
case empty
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : DistribLattice α
inst✝ : OrderBot α
s : Finset ι
t : Finset κ
f✝ : ι → α
g : κ → α
a✝ : α
f : ι → α
a : α
⊢ a ⊓ sup ∅ f = sup ∅ fun i => a ⊓ f i

Next tactic:
simp_rw [Finset.sup_empty, inf_bot_eq]
theorem sup_inf_distrib_left (s : Finset ι) (f : ι → α) (a : α) :
    a ⊓ s.sup f = s.sup fun i => a ⊓ f i := by
  induction' s using Finset.cons_induction with i s hi h
  · simp_rw [Finset.sup_empty, inf_bot_eq]
  · 

Proof state:
case cons
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : DistribLattice α
inst✝ : OrderBot α
s✝ : Finset ι
t : Finset κ
f✝ : ι → α
g : κ → α
a✝ : α
f : ι → α
a : α
i : ι
s : Finset ι
hi : i ∉ s
h : a ⊓ sup s f = sup s fun i => a ⊓ f i
⊢ a ⊓ sup (cons i s hi) f = sup (cons i s hi) fun i => a ⊓ f i

Next tactic:
rw [sup_cons, sup_cons, inf_sup_left, h]
theorem sup_inf_distrib_right (s : Finset ι) (f : ι → α) (a : α) :
    s.sup f ⊓ a = s.sup fun i => f i ⊓ a := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : DistribLattice α
inst✝ : OrderBot α
s✝ : Finset ι
t : Finset κ
f✝ : ι → α
g : κ → α
a✝ : α
s : Finset ι
f : ι → α
a : α
⊢ sup s f ⊓ a = sup s fun i => f i ⊓ a

Next tactic:
rw [_root_.inf_comm, s.sup_inf_distrib_left]
theorem sup_inf_distrib_right (s : Finset ι) (f : ι → α) (a : α) :
    s.sup f ⊓ a = s.sup fun i => f i ⊓ a := by
  rw [_root_.inf_comm, s.sup_inf_distrib_left]
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : DistribLattice α
inst✝ : OrderBot α
s✝ : Finset ι
t : Finset κ
f✝ : ι → α
g : κ → α
a✝ : α
s : Finset ι
f : ι → α
a : α
⊢ (sup s fun i => a ⊓ f i) = sup s fun i => f i ⊓ a

Next tactic:
simp_rw [_root_.inf_comm]
protected theorem disjoint_sup_right : Disjoint a (s.sup f) ↔ ∀ ⦃i⦄, i ∈ s → Disjoint a (f i) := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : DistribLattice α
inst✝ : OrderBot α
s : Finset ι
t : Finset κ
f : ι → α
g : κ → α
a : α
⊢ _root_.Disjoint a (sup s f) ↔ ∀ ⦃i : ι⦄, i ∈ s → _root_.Disjoint a (f i)

Next tactic:
simp only [disjoint_iff, sup_inf_distrib_left, Finset.sup_eq_bot_iff]
protected theorem disjoint_sup_left : Disjoint (s.sup f) a ↔ ∀ ⦃i⦄, i ∈ s → Disjoint (f i) a := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : DistribLattice α
inst✝ : OrderBot α
s : Finset ι
t : Finset κ
f : ι → α
g : κ → α
a : α
⊢ _root_.Disjoint (sup s f) a ↔ ∀ ⦃i : ι⦄, i ∈ s → _root_.Disjoint (f i) a

Next tactic:
simp only [disjoint_iff, sup_inf_distrib_right, Finset.sup_eq_bot_iff]
theorem sup_inf_sup (s : Finset ι) (t : Finset κ) (f : ι → α) (g : κ → α) :
    s.sup f ⊓ t.sup g = (s ×ˢ t).sup fun i => f i.1 ⊓ g i.2 := by
  

Proof state:
F : Type u_1
α : Type u_2
β : Type u_3
γ : Type u_4
ι : Type u_5
κ : Type u_6
inst✝¹ : DistribLattice α
inst✝ : OrderBot α
s✝ : Finset ι
t✝ : Finset κ
f✝ : ι → α
g✝ : κ → α
a : α
s : Finset ι
t : Finset κ
f : ι → α
g : κ → α
⊢ sup s f ⊓ sup t g = sup (s ×ˢ t) fun i => f i.1 ⊓ g i.2

Next tactic:
simp_rw [Finset.sup_inf_distrib_right, Finset.sup_inf_distrib_left, sup_product_left]
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
  

Proof state:
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
s : Finset ι
t : (i : ι) → Finset (κ i)
f : (i : ι) → κ i → α
⊢ (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))

Next tactic:
induction' s using Finset.induction with i s hi ih
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
  · 

Proof state:
case empty
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 → α
⊢ (inf ∅ fun i => sup (t i) (f i)) = sup (pi ∅ t) fun g => inf (attach ∅) fun i => f (↑i) (g ↑i (_ : ↑i ∈ ∅))

Next tactic:
simp
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
  

Proof state:
case insert
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))
⊢ (inf (insert i s) fun i => sup (t i) (f i)) =
    sup (pi (insert i s) t) fun g => inf (attach (insert i s)) fun i_1 => f (↑i_1) (g ↑i_1 (_ : ↑i_1 ∈ insert i s))

Next tactic:
rw [inf_insert, ih, attach_insert, sup_inf_sup]
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]
  

Proof state:
case insert
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))
⊢ (sup (t i ×ˢ pi s t) fun i_1 => f i i_1.1 ⊓ inf (attach s) fun i_2 => f (↑i_2) (i_1.2 ↑i_2 (_ : ↑i_2 ∈ s))) =
    sup (pi (insert i s) t) fun g =>
      inf
        (insert { val := i, property := (_ : i ∈ insert i s) }
          (image (fun x => { val := ↑x, property := (_ : ↑x ∈ insert i s) }) (attach s)))
        fun i_1 => f (↑i_1) (g ↑i_1 (_ : ↑i_1 ∈ insert i s))

Next tactic:
refine' eq_of_forall_ge_iff fun c => _
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 => _
  

Proof state:
case insert
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 : α
⊢ (sup (t i ×ˢ pi s t) fun i_1 => f i i_1.1 ⊓ inf (attach s) fun i_2 => f (↑i_2) (i_1.2 ↑i_2 (_ : ↑i_2 ∈ s))) ≤ c ↔
    (sup (pi (insert i s) t) fun g =>
        inf
          (insert { val := i, property := (_ : i ∈ insert i s) }
            (image (fun x => { val := ↑x, property := (_ : ↑x ∈ insert i s) }) (attach s)))
          fun i_1 => f (↑i_1) (g ↑i_1 (_ : ↑i_1 ∈ insert i s))) ≤
      c

Next tactic:
simp only [Finset.sup_le_iff, mem_product, mem_pi, and_imp, Prod.forall,
    inf_insert, inf_image]
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]
  

Proof state:
case insert
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 : α
⊢ (∀ (a : κ i) (b : (a : ι) → a ∈ s → κ a),
      a ∈ t i →
        (∀ (a : ι) (h : a ∈ s), b a h ∈ t a) → (f i a ⊓ inf (attach s) fun i => f (↑i) (b ↑i (_ : ↑i ∈ s))) ≤ c) ↔
    ∀ (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

Next tactic:
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 => _⟩
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`
  

Proof state:
case insert
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
⊢ (f i a ⊓ inf (attach s) fun i => f (↑i) (g ↑i (_ : ↑i ∈ s))) ≤ c

Next tactic:
have aux : ∀ j : { x // x ∈ s }, ↑j ≠ i := fun j : s => ne_of_mem_of_not_mem j.2 hi
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
  

Proof state:
case insert
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
⊢ (f i a ⊓ inf (attach s) fun i => f (↑i) (g ↑i (_ : ↑i ∈ s))) ≤ c

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

Proof state:
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:
rw [mem_insert] at hj
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
  

Proof state:
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
hj : j = i ∨ 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:
obtain (rfl | hj) := hj
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
  · 

Proof state:
case insert.refine_1.inl
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 → α
s : Finset ι
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 : α
g : (a : ι) → a ∈ s → κ a
hg : ∀ (a : ι) (h : a ∈ s), g a h ∈ t a
j : ι
hi : j ∉ s
h :
  ∀ (b : (a : ι) → a ∈ insert j s → κ a),
    (∀ (a : ι) (h : a ∈ insert j s), b a h ∈ t a) →
      f j
            (b ↑{ val := j, property := (_ : j ∈ insert j s) }
              (_ : ↑{ val := j, property := (_ : j ∈ insert j s) } ∈ insert j s)) ⊓
          inf (attach s)
            ((fun i => f (↑i) (b ↑i (_ : ↑i ∈ insert j s))) ∘ fun x =>
              { val := ↑x, property := (_ : ↑x ∈ insert j s) }) ≤
        c
a : κ j
ha : a ∈ t j
aux : ∀ (j_1 : { x // x ∈ s }), ↑j_1 ≠ j
hj : j ∈ insert j s
⊢ (fun j_1 hj => if hji : j_1 = j then cast (_ : κ j = κ j_1) a else g j_1 (_ : j_1 ∈ s)) j hj ∈ t j

Next tactic:
simpa