l3lab/ntp-mathlib huggingface dataset:
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
⊢ (x, y) ∈
    {x | ∃ ι t_1 w z, (∀ i ∈ t_1, 0 ≤ w i) ∧ ∑ i in t_1, w i = 1 ∧ (∀ i ∈ t_1, z i ∈ s ×ˢ t) ∧ centerMass t_1 w z = x}

Next tactic:
refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · 

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_1
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
p : ι × κ
hp : p ∈ a ×ˢ b
⊢ 0 ≤ (fun p => w p.1 * v p.2) p

Next tactic:
rw [mem_product] at hp
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · rw [mem_product] at hp
    

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_1
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
p : ι × κ
hp : p.1 ∈ a ∧ p.2 ∈ b
⊢ 0 ≤ (fun p => w p.1 * v p.2) p

Next tactic:
exact mul_nonneg (hw p.1 hp.1) (hv p.2 hp.2)
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · rw [mem_product] at hp
    exact mul_nonneg (hw p.1 hp.1) (hv p.2 hp.2)
  · 

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_2
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
p : ι × κ
hp : p ∈ a ×ˢ b
⊢ (fun p => (S p.1, T p.2)) p ∈ s ×ˢ t

Next tactic:
rw [mem_product] at hp
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · rw [mem_product] at hp
    exact mul_nonneg (hw p.1 hp.1) (hv p.2 hp.2)
  · rw [mem_product] at hp
    

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_2
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
p : ι × κ
hp : p.1 ∈ a ∧ p.2 ∈ b
⊢ (fun p => (S p.1, T p.2)) p ∈ s ×ˢ t

Next tactic:
exact ⟨hS p.1 hp.1, hT p.2 hp.2⟩
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · rw [mem_product] at hp
    exact mul_nonneg (hw p.1 hp.1) (hv p.2 hp.2)
  · rw [mem_product] at hp
    exact ⟨hS p.1 hp.1, hT p.2 hp.2⟩
  

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
⊢ (centerMass (a ×ˢ b) (fun p => w p.1 * v p.2) fun p => (S p.1, T p.2)) = (x, y)

Next tactic:
ext
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · rw [mem_product] at hp
    exact mul_nonneg (hw p.1 hp.1) (hv p.2 hp.2)
  · rw [mem_product] at hp
    exact ⟨hS p.1 hp.1, hT p.2 hp.2⟩
  ext
  · 

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.a
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
⊢ (centerMass (a ×ˢ b) (fun p => w p.1 * v p.2) fun p => (S p.1, T p.2)).1 = (x, y).1

Next tactic:
rw [← hSp, Finset.centerMass_eq_of_sum_1 _ _ hw', Finset.centerMass_eq_of_sum_1 _ _ h_sum]
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · rw [mem_product] at hp
    exact mul_nonneg (hw p.1 hp.1) (hv p.2 hp.2)
  · rw [mem_product] at hp
    exact ⟨hS p.1 hp.1, hT p.2 hp.2⟩
  ext
  · rw [← hSp, Finset.centerMass_eq_of_sum_1 _ _ hw', Finset.centerMass_eq_of_sum_1 _ _ h_sum]
    

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.a
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
⊢ (∑ i in a ×ˢ b, (w i.1 * v i.2) • (S i.1, T i.2)).1 = (∑ i in a, w i • S i, y).1

Next tactic:
simp_rw [Prod.fst_sum, Prod.smul_mk]
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · rw [mem_product] at hp
    exact mul_nonneg (hw p.1 hp.1) (hv p.2 hp.2)
  · rw [mem_product] at hp
    exact ⟨hS p.1 hp.1, hT p.2 hp.2⟩
  ext
  · rw [← hSp, Finset.centerMass_eq_of_sum_1 _ _ hw', Finset.centerMass_eq_of_sum_1 _ _ h_sum]
    simp_rw [Prod.fst_sum, Prod.smul_mk]
    

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.a
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
⊢ ∑ x in a ×ˢ b, (w x.1 * v x.2) • S x.1 = ∑ i in a, w i • S i

Next tactic:
rw [Finset.sum_product]
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · rw [mem_product] at hp
    exact mul_nonneg (hw p.1 hp.1) (hv p.2 hp.2)
  · rw [mem_product] at hp
    exact ⟨hS p.1 hp.1, hT p.2 hp.2⟩
  ext
  · rw [← hSp, Finset.centerMass_eq_of_sum_1 _ _ hw', Finset.centerMass_eq_of_sum_1 _ _ h_sum]
    simp_rw [Prod.fst_sum, Prod.smul_mk]
    rw [Finset.sum_product]
    

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.a
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
⊢ ∑ x in a, ∑ y in b, (w (x, y).1 * v (x, y).2) • S (x, y).1 = ∑ i in a, w i • S i

Next tactic:
congr
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · rw [mem_product] at hp
    exact mul_nonneg (hw p.1 hp.1) (hv p.2 hp.2)
  · rw [mem_product] at hp
    exact ⟨hS p.1 hp.1, hT p.2 hp.2⟩
  ext
  · rw [← hSp, Finset.centerMass_eq_of_sum_1 _ _ hw', Finset.centerMass_eq_of_sum_1 _ _ h_sum]
    simp_rw [Prod.fst_sum, Prod.smul_mk]
    rw [Finset.sum_product]
    congr
    

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.a.e_f
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
⊢ (fun x => ∑ y in b, (w (x, y).1 * v (x, y).2) • S (x, y).1) = fun i => w i • S i

Next tactic:
ext i
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · rw [mem_product] at hp
    exact mul_nonneg (hw p.1 hp.1) (hv p.2 hp.2)
  · rw [mem_product] at hp
    exact ⟨hS p.1 hp.1, hT p.2 hp.2⟩
  ext
  · rw [← hSp, Finset.centerMass_eq_of_sum_1 _ _ hw', Finset.centerMass_eq_of_sum_1 _ _ h_sum]
    simp_rw [Prod.fst_sum, Prod.smul_mk]
    rw [Finset.sum_product]
    congr
    ext i
    

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine'_3.a.e_f.h
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i✝ j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
i : ι
⊢ ∑ y in b, (w (i, y).1 * v (i, y).2) • S (i, y).1 = w i • S i

Next tactic:
have : (∑ j : κ in b, (w i * v j) • S i) = ∑ j : κ in b, v j • w i • S i := by
      congr
      ext
      rw [mul_smul, smul_comm]
theorem mk_mem_convexHull_prod {t : Set F} {x : E} {y : F} (hx : x ∈ convexHull R s)
    (hy : y ∈ convexHull R t) : (x, y) ∈ convexHull R (s ×ˢ t) := by
  rw [_root_.convexHull_eq] at hx hy ⊢
  obtain ⟨ι, a, w, S, hw, hw', hS, hSp⟩ := hx
  obtain ⟨κ, b, v, T, hv, hv', hT, hTp⟩ := hy
  have h_sum : ∑ i : ι × κ in a ×ˢ b, w i.fst * v i.snd = 1 := by
    rw [Finset.sum_product, ← hw']
    congr
    ext i
    have : ∑ y : κ in b, w i * v y = ∑ y : κ in b, v y * w i := by
      congr
      ext
      simp [mul_comm]
    rw [this, ← Finset.sum_mul, hv']
    simp
  refine'
    ⟨ι × κ, a ×ˢ b, fun p => w p.1 * v p.2, fun p => (S p.1, T p.2), fun p hp => _, h_sum,
      fun p hp => _, _⟩
  · rw [mem_product] at hp
    exact mul_nonneg (hw p.1 hp.1) (hv p.2 hp.2)
  · rw [mem_product] at hp
    exact ⟨hS p.1 hp.1, hT p.2 hp.2⟩
  ext
  · rw [← hSp, Finset.centerMass_eq_of_sum_1 _ _ hw', Finset.centerMass_eq_of_sum_1 _ _ h_sum]
    simp_rw [Prod.fst_sum, Prod.smul_mk]
    rw [Finset.sum_product]
    congr
    ext i
    have : (∑ j : κ in b, (w i * v j) • S i) = ∑ j : κ in b, v j • w i • S i := by
      

Proof state:
R : Type u_1
R' : Type u_2
E : Type u_3
F : Type u_4
ι✝ : Type u_5
ι' : Type u_6
α : Type u_7
inst✝⁸ : LinearOrderedField R
inst✝⁷ : LinearOrderedField R'
inst✝⁶ : AddCommGroup E
inst✝⁵ : AddCommGroup F
inst✝⁴ : LinearOrderedAddCommGroup α
inst✝³ : Module R E
inst✝² : Module R F
inst✝¹ : Module R α
inst✝ : OrderedSMul R α
s : Set E
i✝ j : ι✝
c : R
t✝ : Finset ι✝
w✝ : ι✝ → R
z : ι✝ → E
t : Set F
x : E
y : F
ι : Type
a : Finset ι
w : ι → R
S : ι → E
hw : ∀ i ∈ a, 0 ≤ w i
hw' : ∑ i in a, w i = 1
hS : ∀ i ∈ a, S i ∈ s
hSp : centerMass a w S = x
κ : Type
b : Finset κ
v : κ → R
T : κ → F
hv : ∀ i ∈ b, 0 ≤ v i
hv' : ∑ i in b, v i = 1
hT : ∀ i ∈ b, T i ∈ t
hTp : centerMass b v T = y
h_sum : ∑ i in a ×ˢ b, w i.1 * v i.2 = 1
i : ι
⊢ ∑ j in b, (w i * v j) • S i = ∑ j in b, v j • w i • S i

Next tactic:
congr