-- Mathlib/LinearAlgebra/AffineSpace/Independent.lean
theorem sign_eq_of_affineCombination_mem_affineSpan_single_lineMap {p : ι → P}
    (h : AffineIndependent k p) {w : ι → k} {s : Finset ι} (hw : ∑ i ∈ s, w i = 1) {i₁ i₂ i₃ : ι}
    (h₁ : i₁ ∈ s) (h₂ : i₂ ∈ s) (h₃ : i₃ ∈ s) (h₁₂ : i₁ ≠ i₂) (h₁₃ : i₁ ≠ i₃) (h₂₃ : i₂ ≠ i₃)
    {c : k} (hc0 : 0 < c) (hc1 : c < 1)
    (hs : s.affineCombination k p w ∈ line[k, p i₁, AffineMap.lineMap (p i₂) (p i₃) c]) :
    SignType.sign (w i₂) = SignType.sign (w i₃)

Proof state:
k : Type u_1
V : Type u_2
P : Type u_3
inst✝³ : LinearOrderedRing k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type u_4
p : ι → P
h : AffineIndependent k p
w : ι → k
s : Finset ι
hw : ∑ i ∈ s, w i = 1
i₁ i₂ i₃ : ι
h₁ : i₁ ∈ s
h₂ : i₂ ∈ s
h₃ : i₃ ∈ s
h₁₂ : i₁ ≠ i₂
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
c : k
hc0 : 0 < c
hc1 : c < 1
hs :
  (affineCombination k s p) w ∈
    affineSpan k
      {(affineCombination k s p) (affineCombinationSingleWeights k i₁),
        (affineCombination k s p) (affineCombinationLineMapWeights i₂ i₃ c)}
⊢ SignType.sign (w i₂) = SignType.sign (w i₃)

Tactic:
refine
  sign_eq_of_affineCombination_mem_affineSpan_pair h hw
    (s.sum_affineCombinationSingleWeights k h₁)
    (s.sum_affineCombinationLineMapWeights h₂ h₃ c) hs h₂ h₃
    (Finset.affineCombinationSingleWeights_apply_of_ne k h₁₂.symm)
    (Finset.affineCombinationSingleWeights_apply_of_ne k h₁₃.symm) ?_

Result:
k : Type u_1
V : Type u_2
P : Type u_3
inst✝³ : LinearOrderedRing k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type u_4
p : ι → P
h : AffineIndependent k p
w : ι → k
s : Finset ι
hw : ∑ i ∈ s, w i = 1
i₁ i₂ i₃ : ι
h₁ : i₁ ∈ s
h₂ : i₂ ∈ s
h₃ : i₃ ∈ s
h₁₂ : i₁ ≠ i₂
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
c : k
hc0 : 0 < c
hc1 : c < 1
hs :
  (affineCombination k s p) w ∈
    affineSpan k
      {(affineCombination k s p) (affineCombinationSingleWeights k i₁),
        (affineCombination k s p) (affineCombinationLineMapWeights i₂ i₃ c)}
⊢ SignType.sign (affineCombinationLineMapWeights i₂ i₃ c i₂) =
    SignType.sign (affineCombinationLineMapWeights i₂ i₃ c i₃)

Proof state:
k : Type u_1
V : Type u_2
P : Type u_3
inst✝³ : LinearOrderedRing k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type u_4
p : ι → P
h : AffineIndependent k p
w : ι → k
s : Finset ι
hw : ∑ i ∈ s, w i = 1
i₁ i₂ i₃ : ι
h₁ : i₁ ∈ s
h₂ : i₂ ∈ s
h₃ : i₃ ∈ s
h₁₂ : i₁ ≠ i₂
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
c : k
hc0 : 0 < c
hc1 : c < 1
hs : (affineCombination k s p) w ∈ affineSpan k {p i₁, (AffineMap.lineMap (p i₂) (p i₃)) c}
⊢ SignType.sign (w i₂) = SignType.sign (w i₃)

Tactic:
rw [← s.affineCombination_affineCombinationSingleWeights k p h₁, ←
  s.affineCombination_affineCombinationLineMapWeights p h₂ h₃ c] at hs

Result:
k : Type u_1
V : Type u_2
P : Type u_3
inst✝³ : LinearOrderedRing k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type u_4
p : ι → P
h : AffineIndependent k p
w : ι → k
s : Finset ι
hw : ∑ i ∈ s, w i = 1
i₁ i₂ i₃ : ι
h₁ : i₁ ∈ s
h₂ : i₂ ∈ s
h₃ : i₃ ∈ s
h₁₂ : i₁ ≠ i₂
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
c : k
hc0 : 0 < c
hc1 : c < 1
hs :
  (affineCombination k s p) w ∈
    affineSpan k
      {(affineCombination k s p) (affineCombinationSingleWeights k i₁),
        (affineCombination k s p) (affineCombinationLineMapWeights i₂ i₃ c)}
⊢ SignType.sign (w i₂) = SignType.sign (w i₃)

Proof state:
k : Type u_1
V : Type u_2
P : Type u_3
inst✝³ : LinearOrderedRing k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type u_4
p : ι → P
h : AffineIndependent k p
w : ι → k
s : Finset ι
hw : ∑ i ∈ s, w i = 1
i₁ i₂ i₃ : ι
h₁ : i₁ ∈ s
h₂ : i₂ ∈ s
h₃ : i₃ ∈ s
h₁₂ : i₁ ≠ i₂
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
c : k
hc0 : 0 < c
hc1 : c < 1
hs :
  (affineCombination k s p) w ∈
    affineSpan k
      {(affineCombination k s p) (affineCombinationSingleWeights k i₁),
        (affineCombination k s p) (affineCombinationLineMapWeights i₂ i₃ c)}
⊢ SignType.sign (affineCombinationLineMapWeights i₂ i₃ c i₂) =
    SignType.sign (affineCombinationLineMapWeights i₂ i₃ c i₃)

Tactic:
rw [Finset.affineCombinationLineMapWeights_apply_left h₂₃,
  Finset.affineCombinationLineMapWeights_apply_right h₂₃]

Result:
k : Type u_1
V : Type u_2
P : Type u_3
inst✝³ : LinearOrderedRing k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type u_4
p : ι → P
h : AffineIndependent k p
w : ι → k
s : Finset ι
hw : ∑ i ∈ s, w i = 1
i₁ i₂ i₃ : ι
h₁ : i₁ ∈ s
h₂ : i₂ ∈ s
h₃ : i₃ ∈ s
h₁₂ : i₁ ≠ i₂
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
c : k
hc0 : 0 < c
hc1 : c < 1
hs :
  (affineCombination k s p) w ∈
    affineSpan k
      {(affineCombination k s p) (affineCombinationSingleWeights k i₁),
        (affineCombination k s p) (affineCombinationLineMapWeights i₂ i₃ c)}
⊢ SignType.sign (1 - c) = SignType.sign c

Proof state:
k : Type u_1
V : Type u_2
P : Type u_3
inst✝³ : LinearOrderedRing k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type u_4
p : ι → P
h : AffineIndependent k p
w : ι → k
s : Finset ι
hw : ∑ i ∈ s, w i = 1
i₁ i₂ i₃ : ι
h₁ : i₁ ∈ s
h₂ : i₂ ∈ s
h₃ : i₃ ∈ s
h₁₂ : i₁ ≠ i₂
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
c : k
hc0 : 0 < c
hc1 : c < 1
hs : (affineCombination k s p) w ∈ affineSpan k {p i₁, (AffineMap.lineMap (p i₂) (p i₃)) c}
⊢ SignType.sign (w i₂) = SignType.sign (w i₃)

Tactic:
classical
  rw [← s.affineCombination_affineCombinationSingleWeights k p h₁, ←
    s.affineCombination_affineCombinationLineMapWeights p h₂ h₃ c] at hs
  refine
    sign_eq_of_affineCombination_mem_affineSpan_pair h hw
      (s.sum_affineCombinationSingleWeights k h₁)
      (s.sum_affineCombinationLineMapWeights h₂ h₃ c) hs h₂ h₃
      (Finset.affineCombinationSingleWeights_apply_of_ne k h₁₂.symm)
      (Finset.affineCombinationSingleWeights_apply_of_ne k h₁₃.symm) ?_
  rw [Finset.affineCombinationLineMapWeights_apply_left h₂₃,
    Finset.affineCombinationLineMapWeights_apply_right h₂₃]
  simp_all only [sub_pos, sign_pos]

Result:
no goals

Proof state:
k : Type u_1
V : Type u_2
P : Type u_3
inst✝³ : LinearOrderedRing k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type u_4
p : ι → P
h : AffineIndependent k p
w : ι → k
s : Finset ι
hw : ∑ i ∈ s, w i = 1
i₁ i₂ i₃ : ι
h₁ : i₁ ∈ s
h₂ : i₂ ∈ s
h₃ : i₃ ∈ s
h₁₂ : i₁ ≠ i₂
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
c : k
hc0 : 0 < c
hc1 : c < 1
hs :
  (affineCombination k s p) w ∈
    affineSpan k
      {(affineCombination k s p) (affineCombinationSingleWeights k i₁),
        (affineCombination k s p) (affineCombinationLineMapWeights i₂ i₃ c)}
⊢ SignType.sign (1 - c) = SignType.sign c

Tactic:
simp_all only [sub_pos, sign_pos]

Result:
no goals