-- Mathlib/Analysis/Convex/Caratheodory.lean
theorem affineIndependent_minCardFinsetOfMemConvexHull :
    AffineIndependent 𝕜 ((↑) : minCardFinsetOfMemConvexHull hx → E)

Proof state:
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
⊢ AffineIndependent 𝕜 Subtype.val

Tactic:
by_contra h

Result:
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
⊢ False

Proof state:
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
⊢ AffineIndependent 𝕜 Subtype.val

Tactic:
have hk : #(minCardFinsetOfMemConvexHull hx) = k + 1 :=
  (Nat.succ_pred_eq_of_pos (Finset.card_pos.mpr (minCardFinsetOfMemConvexHull_nonempty hx))).symm

Result:
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
⊢ AffineIndependent 𝕜 Subtype.val

Proof state:
case intro
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
p : ↑↑(minCardFinsetOfMemConvexHull hx)
hp : x ∈ (convexHull 𝕜) ↑((minCardFinsetOfMemConvexHull hx).erase ↑p)
⊢ False

Tactic:
have contra := minCardFinsetOfMemConvexHull_card_le_card hx (Set.Subset.trans
  (Finset.erase_subset (p : E) (minCardFinsetOfMemConvexHull hx))
  (minCardFinsetOfMemConvexHull_subseteq hx)) hp

Result:
case intro
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
p : ↑↑(minCardFinsetOfMemConvexHull hx)
hp : x ∈ (convexHull 𝕜) ↑((minCardFinsetOfMemConvexHull hx).erase ↑p)
contra : #(minCardFinsetOfMemConvexHull hx) ≤ #((minCardFinsetOfMemConvexHull hx).erase ↑p)
⊢ False

Proof state:
case intro
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
p : ↑↑(minCardFinsetOfMemConvexHull hx)
hp : x ∈ (convexHull 𝕜) ↑((minCardFinsetOfMemConvexHull hx).erase ↑p)
contra : #(minCardFinsetOfMemConvexHull hx) ≤ #((minCardFinsetOfMemConvexHull hx).erase ↑p)
⊢ False

Tactic:
rw [← not_lt] at contra

Result:
case intro
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
p : ↑↑(minCardFinsetOfMemConvexHull hx)
hp : x ∈ (convexHull 𝕜) ↑((minCardFinsetOfMemConvexHull hx).erase ↑p)
contra : ¬#((minCardFinsetOfMemConvexHull hx).erase ↑p) < #(minCardFinsetOfMemConvexHull hx)
⊢ False

Proof state:
case intro
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
p : ↑↑(minCardFinsetOfMemConvexHull hx)
hp : x ∈ (convexHull 𝕜) ↑((minCardFinsetOfMemConvexHull hx).erase ↑p)
contra : ¬#((minCardFinsetOfMemConvexHull hx).erase ↑p) < #(minCardFinsetOfMemConvexHull hx)
⊢ k + 1 - 1 < k + 1

Tactic:
exact lt_add_one _

Result:
no goals

Proof state:
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
⊢ AffineIndependent 𝕜 Subtype.val

Tactic:
classical
by_contra h
obtain ⟨p, hp⟩ := mem_convexHull_erase h (mem_minCardFinsetOfMemConvexHull hx)
have contra := minCardFinsetOfMemConvexHull_card_le_card hx (Set.Subset.trans
  (Finset.erase_subset (p : E) (minCardFinsetOfMemConvexHull hx))
  (minCardFinsetOfMemConvexHull_subseteq hx)) hp
rw [← not_lt] at contra
apply contra
rw [card_erase_of_mem p.2, hk]
exact lt_add_one _

Result:
no goals

Proof state:
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
⊢ False

Tactic:
obtain ⟨p, hp⟩ := mem_convexHull_erase h (mem_minCardFinsetOfMemConvexHull hx)

Result:
case intro
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
p : ↑↑(minCardFinsetOfMemConvexHull hx)
hp : x ∈ (convexHull 𝕜) ↑((minCardFinsetOfMemConvexHull hx).erase ↑p)
⊢ False

Proof state:
case intro
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
p : ↑↑(minCardFinsetOfMemConvexHull hx)
hp : x ∈ (convexHull 𝕜) ↑((minCardFinsetOfMemConvexHull hx).erase ↑p)
contra : ¬#((minCardFinsetOfMemConvexHull hx).erase ↑p) < #(minCardFinsetOfMemConvexHull hx)
⊢ #((minCardFinsetOfMemConvexHull hx).erase ↑p) < #(minCardFinsetOfMemConvexHull hx)

Tactic:
rw [card_erase_of_mem p.2, hk]

Result:
case intro
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
p : ↑↑(minCardFinsetOfMemConvexHull hx)
hp : x ∈ (convexHull 𝕜) ↑((minCardFinsetOfMemConvexHull hx).erase ↑p)
contra : ¬#((minCardFinsetOfMemConvexHull hx).erase ↑p) < #(minCardFinsetOfMemConvexHull hx)
⊢ k + 1 - 1 < k + 1

Proof state:
case intro
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
p : ↑↑(minCardFinsetOfMemConvexHull hx)
hp : x ∈ (convexHull 𝕜) ↑((minCardFinsetOfMemConvexHull hx).erase ↑p)
contra : ¬#((minCardFinsetOfMemConvexHull hx).erase ↑p) < #(minCardFinsetOfMemConvexHull hx)
⊢ False

Tactic:
apply contra

Result:
case intro
𝕜 : Type u_1
E : Type u
inst✝² : LinearOrderedField 𝕜
inst✝¹ : AddCommGroup E
inst✝ : Module 𝕜 E
s : Set E
x : E
hx : x ∈ (convexHull 𝕜) s
k : ℕ := #(minCardFinsetOfMemConvexHull hx) - 1
hk : #(minCardFinsetOfMemConvexHull hx) = k + 1
h : ¬AffineIndependent 𝕜 Subtype.val
p : ↑↑(minCardFinsetOfMemConvexHull hx)
hp : x ∈ (convexHull 𝕜) ↑((minCardFinsetOfMemConvexHull hx).erase ↑p)
contra : ¬#((minCardFinsetOfMemConvexHull hx).erase ↑p) < #(minCardFinsetOfMemConvexHull hx)
⊢ #((minCardFinsetOfMemConvexHull hx).erase ↑p) < #(minCardFinsetOfMemConvexHull hx)