Theorem: Affine.Simplex.centroid_eq_iff
File: Mathlib/LinearAlgebra/AffineSpace/Independent.lean

Proof steps:
state_before: k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
⊢ centroid k fs₁ s.points = centroid k fs₂ s.points ↔ fs₁ = fs₂
state_after: k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h : centroid k fs₁ s.points = centroid k fs₂ s.points
⊢ fs₁ = fs₂
tactic: refine ⟨fun h => ?_, @congrArg _ _ fs₁ fs₂ (fun z => Finset.centroid k z s.points)⟩
state_before: k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h : centroid k fs₁ s.points = centroid k fs₂ s.points
⊢ fs₁ = fs₂
state_after: k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
⊢ fs₁ = fs₂
tactic: rw [Finset.centroid_eq_affineCombination_fintype,
    Finset.centroid_eq_affineCombination_fintype] at h
state_before: k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
⊢ fs₁ = fs₂
state_after: k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
ha : (↑univ).indicator (centroidWeightsIndicator k fs₁) = (↑univ).indicator (centroidWeightsIndicator k fs₂)
⊢ fs₁ = fs₂
tactic: have ha :=
    (affineIndependent_iff_indicator_eq_of_affineCombination_eq k s.points).1 s.independent _ _ _ _
      (fs₁.sum_centroidWeightsIndicator_eq_one_of_card_eq_add_one k h₁)
      (fs₂.sum_centroidWeightsIndicator_eq_one_of_card_eq_add_one k h₂) h
state_before: k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
ha : (↑univ).indicator (centroidWeightsIndicator k fs₁) = (↑univ).indicator (centroidWeightsIndicator k fs₂)
⊢ fs₁ = fs₂
state_after: k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
ha :
  ∀ (a : Fin (n + 1)),
    (↑fs₁).indicator (const (Fin (n + 1)) (↑(m₁ + 1))⁻¹) a = (↑fs₂).indicator (const (Fin (n + 1)) (↑(m₂ + 1))⁻¹) a
⊢ fs₁ = fs₂
tactic: simp_rw [Finset.coe_univ, Set.indicator_univ, Function.funext_iff,
    Finset.centroidWeightsIndicator_def, Finset.centroidWeights, h₁, h₂] at ha
state_before: k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
ha :
  ∀ (a : Fin (n + 1)),
    (↑fs₁).indicator (const (Fin (n + 1)) (↑(m₁ + 1))⁻¹) a = (↑fs₂).indicator (const (Fin (n + 1)) (↑(m₂ + 1))⁻¹) a
⊢ fs₁ = fs₂
state_after: case a
k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
ha :
  ∀ (a : Fin (n + 1)),
    (↑fs₁).indicator (const (Fin (n + 1)) (↑(m₁ + 1))⁻¹) a = (↑fs₂).indicator (const (Fin (n + 1)) (↑(m₂ + 1))⁻¹) a
i : Fin (n + 1)
⊢ i ∈ fs₁ ↔ i ∈ fs₂
tactic: ext i
state_before: case a
k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
ha :
  ∀ (a : Fin (n + 1)),
    (↑fs₁).indicator (const (Fin (n + 1)) (↑(m₁ + 1))⁻¹) a = (↑fs₂).indicator (const (Fin (n + 1)) (↑(m₂ + 1))⁻¹) a
i : Fin (n + 1)
⊢ i ∈ fs₁ ↔ i ∈ fs₂
state_after: case a
k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
i : Fin (n + 1)
ha : (↑fs₁).indicator (const (Fin (n + 1)) (↑(m₁ + 1))⁻¹) i = (↑fs₂).indicator (const (Fin (n + 1)) (↑(m₂ + 1))⁻¹) i
⊢ i ∈ fs₁ ↔ i ∈ fs₂
tactic: specialize ha i
state_before: case a
k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
i : Fin (n + 1)
ha : (↑fs₁).indicator (const (Fin (n + 1)) (↑(m₁ + 1))⁻¹) i = (↑fs₂).indicator (const (Fin (n + 1)) (↑(m₂ + 1))⁻¹) i
⊢ i ∈ fs₁ ↔ i ∈ fs₂
state_after: case a
k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
i : Fin (n + 1)
ha : (↑fs₁).indicator (const (Fin (n + 1)) (↑(m₁ + 1))⁻¹) i = (↑fs₂).indicator (const (Fin (n + 1)) (↑(m₂ + 1))⁻¹) i
key : ∀ (n : ℕ), ↑n + 1 ≠ 0
⊢ i ∈ fs₁ ↔ i ∈ fs₂
tactic: have key : ∀ n : ℕ, (n : k) + 1 ≠ 0 := fun n h => by norm_cast at h
state_before: case a
k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
i : Fin (n + 1)
ha : (↑fs₁).indicator (const (Fin (n + 1)) (↑(m₁ + 1))⁻¹) i = (↑fs₂).indicator (const (Fin (n + 1)) (↑(m₂ + 1))⁻¹) i
key : ∀ (n : ℕ), ↑n + 1 ≠ 0
⊢ i ∈ fs₁ ↔ i ∈ fs₂
state_after: case a.mp
k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
i : Fin (n + 1)
ha : (↑fs₁).indicator (const (Fin (n + 1)) (↑(m₁ + 1))⁻¹) i = (↑fs₂).indicator (const (Fin (n + 1)) (↑(m₂ + 1))⁻¹) i
key : ∀ (n : ℕ), ↑n + 1 ≠ 0
hi : i ∈ fs₁
hni : i ∉ fs₂
⊢ False

case a.mpr
k : Type u_1
V : Type u_2
P : Type u_3
inst✝⁴ : DivisionRing k
inst✝³ : AddCommGroup V
inst✝² : Module k V
inst✝¹ : AffineSpace V P
inst✝ : CharZero k
n : ℕ
s : Simplex k P n
fs₁ fs₂ : Finset (Fin (n + 1))
m₁ m₂ : ℕ
h₁ : fs₁.card = m₁ + 1
h₂ : fs₂.card = m₂ + 1
h :
  (affineCombination k univ s.points) (centroidWeightsIndicator k fs₁) =
    (affineCombination k univ s.points) (centroidWeightsIndicator k fs₂)
i : Fin (n + 1)
ha : (↑fs₁).indicator (const (Fin (n + 1)) (↑(m₁ + 1))⁻¹) i = (↑fs₂).indicator (const (Fin (n + 1)) (↑(m₂ + 1))⁻¹) i
key : ∀ (n : ℕ), ↑n + 1 ≠ 0
hi : i ∈ fs₂
hni : i ∉ fs₁
⊢ False
tactic: constructor <;> intro hi <;> by_contra hni