-- Mathlib/Analysis/Convex/Between.lean
theorem sbtw_of_sbtw_of_sbtw_of_mem_affineSpan_pair [NoZeroSMulDivisors R V]
    {t : Affine.Triangle R P} {i₁ i₂ i₃ : Fin 3} (h₁₂ : i₁ ≠ i₂) {p₁ p₂ p : P}
    (h₁ : Sbtw R (t.points i₂) p₁ (t.points i₃)) (h₂ : Sbtw R (t.points i₁) p₂ (t.points i₃))
    (h₁' : p ∈ line[R, t.points i₁, p₁]) (h₂' : p ∈ line[R, t.points i₂, p₂]) :
    Sbtw R (t.points i₁) p p₁

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro
R : Type u_1
V : Type u_2
P : Type u_4
inst✝⁴ : LinearOrderedRing R
inst✝³ : AddCommGroup V
inst✝² : Module R V
inst✝¹ : AddTorsor V P
inst✝ : NoZeroSMulDivisors R V
t : Affine.Triangle R P
i₁ i₂ i₃ : Fin 3
h₁₂ : i₁ ≠ i₂
this : DecidableRel fun x1 x2 => x1 < x2 := LinearOrderedRing.decidableLT
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
h3 : ∀ (i : Fin 3), i = i₁ ∨ i = i₂ ∨ i = i₃
hu : Finset.univ = {i₁, i₂, i₃}
r₁ : R
hr₁0 : 0 < r₁
hr₁1 : r₁ < 1
h₁ : Sbtw R (t.points i₂) ((lineMap (t.points i₂) (t.points i₃)) r₁) (t.points i₃)
r₂ : R
hr₂0 : 0 < r₂
hr₂1 : r₂ < 1
h₂ : Sbtw R (t.points i₁) ((lineMap (t.points i₁) (t.points i₃)) r₂) (t.points i₃)
w : Fin (2 + 1) → R
hw : w i₁ + (w i₂ + w i₃) = 1
hp : (Finset.affineCombination R Finset.univ t.points) w ∈ affineSpan R (Set.range t.points)
h₁' :
  (Finset.affineCombination R Finset.univ t.points) w ∈
    affineSpan R
      {(Finset.affineCombination R Finset.univ t.points) (Finset.affineCombinationSingleWeights R i₁),
        (Finset.affineCombination R Finset.univ t.points) (Finset.affineCombinationLineMapWeights i₂ i₃ r₁)}
h₂' :
  (Finset.affineCombination R Finset.univ t.points) w ∈
    affineSpan R {t.points i₂, (lineMap (t.points i₁) (t.points i₃)) r₂}
h₁s : SignType.sign (w i₂) = SignType.sign (w i₃)
h₂s : SignType.sign (w i₁) = SignType.sign (w i₃)
hss : SignType.sign (w i₃) = 1
hs' : SignType.sign (∑ i : Fin 3, w i) = SignType.sign (w i₃)
hs : ∀ (i : Fin 3), 0 < w i
⊢ w i₁ < 1

Tactic:
by_contra hle

Result:
case intro.intro.intro.intro.intro.intro.intro.intro
R : Type u_1
V : Type u_2
P : Type u_4
inst✝⁴ : LinearOrderedRing R
inst✝³ : AddCommGroup V
inst✝² : Module R V
inst✝¹ : AddTorsor V P
inst✝ : NoZeroSMulDivisors R V
t : Affine.Triangle R P
i₁ i₂ i₃ : Fin 3
h₁₂ : i₁ ≠ i₂
this : DecidableRel fun x1 x2 => x1 < x2 := LinearOrderedRing.decidableLT
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
h3 : ∀ (i : Fin 3), i = i₁ ∨ i = i₂ ∨ i = i₃
hu : Finset.univ = {i₁, i₂, i₃}
r₁ : R
hr₁0 : 0 < r₁
hr₁1 : r₁ < 1
h₁ : Sbtw R (t.points i₂) ((lineMap (t.points i₂) (t.points i₃)) r₁) (t.points i₃)
r₂ : R
hr₂0 : 0 < r₂
hr₂1 : r₂ < 1
h₂ : Sbtw R (t.points i₁) ((lineMap (t.points i₁) (t.points i₃)) r₂) (t.points i₃)
w : Fin (2 + 1) → R
hw : w i₁ + (w i₂ + w i₃) = 1
hp : (Finset.affineCombination R Finset.univ t.points) w ∈ affineSpan R (Set.range t.points)
h₁' :
  (Finset.affineCombination R Finset.univ t.points) w ∈
    affineSpan R
      {(Finset.affineCombination R Finset.univ t.points) (Finset.affineCombinationSingleWeights R i₁),
        (Finset.affineCombination R Finset.univ t.points) (Finset.affineCombinationLineMapWeights i₂ i₃ r₁)}
h₂' :
  (Finset.affineCombination R Finset.univ t.points) w ∈
    affineSpan R {t.points i₂, (lineMap (t.points i₁) (t.points i₃)) r₂}
h₁s : SignType.sign (w i₂) = SignType.sign (w i₃)
h₂s : SignType.sign (w i₁) = SignType.sign (w i₃)
hss : SignType.sign (w i₃) = 1
hs' : SignType.sign (∑ i : Fin 3, w i) = SignType.sign (w i₃)
hs : ∀ (i : Fin 3), 0 < w i
hle : ¬w i₁ < 1
⊢ False

Proof state:
case intro.intro.intro.intro.intro.intro
R : Type u_1
V : Type u_2
P : Type u_4
inst✝⁴ : LinearOrderedRing R
inst✝³ : AddCommGroup V
inst✝² : Module R V
inst✝¹ : AddTorsor V P
inst✝ : NoZeroSMulDivisors R V
t : Affine.Triangle R P
i₁ i₂ i₃ : Fin 3
h₁₂ : i₁ ≠ i₂
p : P
this : DecidableRel fun x1 x2 => x1 < x2 := LinearOrderedRing.decidableLT
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
h3 : ∀ (i : Fin 3), i = i₁ ∨ i = i₂ ∨ i = i₃
hu : Finset.univ = {i₁, i₂, i₃}
hp : p ∈ affineSpan R (Set.range t.points)
r₁ : R
hr₁0 : 0 < r₁
hr₁1 : r₁ < 1
h₁ : Sbtw R (t.points i₂) ((lineMap (t.points i₂) (t.points i₃)) r₁) (t.points i₃)
h₁' : p ∈ affineSpan R {t.points i₁, (lineMap (t.points i₂) (t.points i₃)) r₁}
r₂ : R
hr₂0 : 0 < r₂
hr₂1 : r₂ < 1
h₂ : Sbtw R (t.points i₁) ((lineMap (t.points i₁) (t.points i₃)) r₂) (t.points i₃)
h₂' : p ∈ affineSpan R {t.points i₂, (lineMap (t.points i₁) (t.points i₃)) r₂}
⊢ Sbtw R (t.points i₁) p ((lineMap (t.points i₂) (t.points i₃)) r₁)

Tactic:
rcases eq_affineCombination_of_mem_affineSpan_of_fintype hp with ⟨w, hw, rfl⟩

Result:
case intro.intro.intro.intro.intro.intro.intro.intro
R : Type u_1
V : Type u_2
P : Type u_4
inst✝⁴ : LinearOrderedRing R
inst✝³ : AddCommGroup V
inst✝² : Module R V
inst✝¹ : AddTorsor V P
inst✝ : NoZeroSMulDivisors R V
t : Affine.Triangle R P
i₁ i₂ i₃ : Fin 3
h₁₂ : i₁ ≠ i₂
this : DecidableRel fun x1 x2 => x1 < x2 := LinearOrderedRing.decidableLT
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
h3 : ∀ (i : Fin 3), i = i₁ ∨ i = i₂ ∨ i = i₃
hu : Finset.univ = {i₁, i₂, i₃}
r₁ : R
hr₁0 : 0 < r₁
hr₁1 : r₁ < 1
h₁ : Sbtw R (t.points i₂) ((lineMap (t.points i₂) (t.points i₃)) r₁) (t.points i₃)
r₂ : R
hr₂0 : 0 < r₂
hr₂1 : r₂ < 1
h₂ : Sbtw R (t.points i₁) ((lineMap (t.points i₁) (t.points i₃)) r₂) (t.points i₃)
w : Fin (2 + 1) → R
hw : ∑ i : Fin (2 + 1), w i = 1
hp : (Finset.affineCombination R Finset.univ t.points) w ∈ affineSpan R (Set.range t.points)
h₁' :
  (Finset.affineCombination R Finset.univ t.points) w ∈
    affineSpan R {t.points i₁, (lineMap (t.points i₂) (t.points i₃)) r₁}
h₂' :
  (Finset.affineCombination R Finset.univ t.points) w ∈
    affineSpan R {t.points i₂, (lineMap (t.points i₁) (t.points i₃)) r₂}
⊢ Sbtw R (t.points i₁) ((Finset.affineCombination R Finset.univ t.points) w) ((lineMap (t.points i₂) (t.points i₃)) r₁)

Proof state:
R : Type u_1
V : Type u_2
P : Type u_4
inst✝⁴ : LinearOrderedRing R
inst✝³ : AddCommGroup V
inst✝² : Module R V
inst✝¹ : AddTorsor V P
inst✝ : NoZeroSMulDivisors R V
t : Affine.Triangle R P
i₁ i₂ i₃ : Fin 3
h₁₂ : i₁ ≠ i₂
p₁ p₂ p : P
h₁ : Sbtw R (t.points i₂) p₁ (t.points i₃)
h₂ : Sbtw R (t.points i₁) p₂ (t.points i₃)
h₁' : p ∈ affineSpan R {t.points i₁, p₁}
h₂' : p ∈ affineSpan R {t.points i₂, p₂}
this : DecidableRel fun x1 x2 => x1 < x2 := LinearOrderedRing.decidableLT
h₁₃ : i₁ ≠ i₃
h₂₃ : i₂ ≠ i₃
h3 : ∀ (i : Fin 3), i = i₁ ∨ i = i₂ ∨ i = i₃
hu : Finset.univ = {i₁, i₂, i₃}
hle : ∀ p ∈ affineSpan R {t.points i₂, t.points i₃}, p ∈ affineSpan R (Set.range t.points)
⊢ p₁ ∈ affineSpan R (Set.range t.points)

Tactic:
exact hle _ h₁.wbtw.mem_affineSpan

Result:
no goals