Theorem: affineIndependent_set_iff_linearIndependent_vsub
File: Mathlib/LinearAlgebra/AffineSpace/Independent.lean

tactic: rw [affineIndependent_iff_linearIndependent_vsub k (fun p => p : s → P) ⟨p₁, hp₁⟩]
state_before: k : Type u_2
V : Type u_3
P : Type u_1
inst✝³ : Ring k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type ?u.62032
s : Set P
p₁ : P
hp₁ : p₁ ∈ s
⊢ (AffineIndependent k fun p => ↑p) ↔ LinearIndependent k fun v => ↑v

tactic: constructor
state_before: k : Type u_2
V : Type u_3
P : Type u_1
inst✝³ : Ring k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type ?u.62032
s : Set P
p₁ : P
hp₁ : p₁ ∈ s
⊢ (LinearIndependent k fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }) ↔ LinearIndependent k fun v => ↑v

tactic: intro h
state_before: case mp
k : Type u_2
V : Type u_3
P : Type u_1
inst✝³ : Ring k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type ?u.62032
s : Set P
p₁ : P
hp₁ : p₁ ∈ s
⊢ (LinearIndependent k fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }) → LinearIndependent k fun v => ↑v

tactic: have hv : ∀ v : (fun p => (p -ᵥ p₁ : V)) '' (s \ {p₁}), (v : V) +ᵥ p₁ ∈ s \ {p₁} := fun v =>
  (vsub_left_injective p₁).mem_set_image.1 ((vadd_vsub (v : V) p₁).symm ▸ v.property)
state_before: case mp
k : Type u_2
V : Type u_3
P : Type u_1
inst✝³ : Ring k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type ?u.62032
s : Set P
p₁ : P
hp₁ : p₁ ∈ s
h : LinearIndependent k fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }
⊢ LinearIndependent k fun v => ↑v

tactic: let f : (fun p : P => (p -ᵥ p₁ : V)) '' (s \ {p₁}) → { x : s // x ≠ ⟨p₁, hp₁⟩ } := fun x =>
  ⟨⟨(x : V) +ᵥ p₁, Set.mem_of_mem_diff (hv x)⟩, fun hx =>
    Set.not_mem_of_mem_diff (hv x) (Subtype.ext_iff.1 hx)⟩
state_before: case mp
k : Type u_2
V : Type u_3
P : Type u_1
inst✝³ : Ring k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type ?u.62032
s : Set P
p₁ : P
hp₁ : p₁ ∈ s
h : LinearIndependent k fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }
hv : ∀ (v : ↑((fun p => p -ᵥ p₁) '' (s \ {p₁}))), ↑v +ᵥ p₁ ∈ s \ {p₁}
⊢ LinearIndependent k fun v => ↑v

tactic: convert h.comp f fun x1 x2 hx =>
    Subtype.ext (vadd_right_cancel p₁ (Subtype.ext_iff.1 (Subtype.ext_iff.1 hx)))
state_before: case mp
k : Type u_2
V : Type u_3
P : Type u_1
inst✝³ : Ring k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type ?u.62032
s : Set P
p₁ : P
hp₁ : p₁ ∈ s
h : LinearIndependent k fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }
hv : ∀ (v : ↑((fun p => p -ᵥ p₁) '' (s \ {p₁}))), ↑v +ᵥ p₁ ∈ s \ {p₁}
f : ↑((fun p => p -ᵥ p₁) '' (s \ {p₁})) → { x // x ≠ { val := p₁, property := hp₁ } } :=
  fun x =>
    { val := { val := ↑x +ᵥ p₁, property := (_ : ↑x +ᵥ p₁ ∈ s) },
      property := (_ : { val := ↑x +ᵥ p₁, property := (_ : ↑x +ᵥ p₁ ∈ s) } = { val := p₁, property := hp₁ } → False) }
⊢ LinearIndependent k fun v => ↑v

tactic: ext v
state_before: case h.e'_4.h.h.e
k : Type u_2
V : Type u_3
P : Type u_1
inst✝³ : Ring k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type ?u.62032
s : Set P
p₁ : P
hp₁ : p₁ ∈ s
h : LinearIndependent k fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }
hv : ∀ (v : ↑((fun p => p -ᵥ p₁) '' (s \ {p₁}))), ↑v +ᵥ p₁ ∈ s \ {p₁}
f : ↑((fun p => p -ᵥ p₁) '' (s \ {p₁})) → { x // x ≠ { val := p₁, property := hp₁ } } :=
  fun x =>
    { val := { val := ↑x +ᵥ p₁, property := (_ : ↑x +ᵥ p₁ ∈ s) },
      property := (_ : { val := ↑x +ᵥ p₁, property := (_ : ↑x +ᵥ p₁ ∈ s) } = { val := p₁, property := hp₁ } → False) }
x✝ : ↑((fun p => p -ᵥ p₁) '' (s \ {p₁}))
⊢ Subtype.val = (fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }) ∘ f

tactic: exact (vadd_vsub (v : V) p₁).symm
state_before: case h.e'_4.h.h.e.h
k : Type u_2
V : Type u_3
P : Type u_1
inst✝³ : Ring k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type ?u.62032
s : Set P
p₁ : P
hp₁ : p₁ ∈ s
h : LinearIndependent k fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }
hv : ∀ (v : ↑((fun p => p -ᵥ p₁) '' (s \ {p₁}))), ↑v +ᵥ p₁ ∈ s \ {p₁}
f : ↑((fun p => p -ᵥ p₁) '' (s \ {p₁})) → { x // x ≠ { val := p₁, property := hp₁ } } :=
  fun x =>
    { val := { val := ↑x +ᵥ p₁, property := (_ : ↑x +ᵥ p₁ ∈ s) },
      property := (_ : { val := ↑x +ᵥ p₁, property := (_ : ↑x +ᵥ p₁ ∈ s) } = { val := p₁, property := hp₁ } → False) }
x✝ : ↑((fun p => p -ᵥ p₁) '' (s \ {p₁}))
v : { x // x ∈ (fun p => p -ᵥ p₁) '' (s \ {p₁}) }
⊢ ↑v = ((fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }) ∘ f) v

tactic: intro h
state_before: case mpr
k : Type u_2
V : Type u_3
P : Type u_1
inst✝³ : Ring k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type ?u.62032
s : Set P
p₁ : P
hp₁ : p₁ ∈ s
⊢ (LinearIndependent k fun v => ↑v) → LinearIndependent k fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }

tactic: let f : { x : s // x ≠ ⟨p₁, hp₁⟩ } → (fun p : P => (p -ᵥ p₁ : V)) '' (s \ {p₁}) := fun x =>
  ⟨((x : s) : P) -ᵥ p₁, ⟨x, ⟨⟨(x : s).property, fun hx => x.property (Subtype.ext hx)⟩, rfl⟩⟩⟩
state_before: case mpr
k : Type u_2
V : Type u_3
P : Type u_1
inst✝³ : Ring k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type ?u.62032
s : Set P
p₁ : P
hp₁ : p₁ ∈ s
h : LinearIndependent k fun v => ↑v
⊢ LinearIndependent k fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }

tactic: convert h.comp f fun x1 x2 hx =>
    Subtype.ext (Subtype.ext (vsub_left_cancel (Subtype.ext_iff.1 hx)))
state_before: case mpr
k : Type u_2
V : Type u_3
P : Type u_1
inst✝³ : Ring k
inst✝² : AddCommGroup V
inst✝¹ : Module k V
inst✝ : AffineSpace V P
ι : Type ?u.62032
s : Set P
p₁ : P
hp₁ : p₁ ∈ s
h : LinearIndependent k fun v => ↑v
f : { x // x ≠ { val := p₁, property := hp₁ } } → ↑((fun p => p -ᵥ p₁) '' (s \ {p₁})) :=
  fun x => { val := ↑↑x -ᵥ p₁, property := (_ : ∃ a, a ∈ s \ {p₁} ∧ (fun p => p -ᵥ p₁) a = ↑↑x -ᵥ p₁) }
⊢ LinearIndependent k fun i => ↑↑i -ᵥ ↑{ val := p₁, property := hp₁ }