Theorem: linearIndependent_iff_card_eq_finrank_span
File: Mathlib/LinearAlgebra/Finrank.lean

tactic: constructor
state_before: K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
⊢ LinearIndependent K b ↔ Fintype.card ι = Set.finrank K (Set.range b)

tactic: intro h
state_before: case mp
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
⊢ LinearIndependent K b → Fintype.card ι = Set.finrank K (Set.range b)

tactic: exact (finrank_span_eq_card h).symm
state_before: case mp
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
h : LinearIndependent K b
⊢ Fintype.card ι = Set.finrank K (Set.range b)

tactic: intro hc
state_before: case mpr
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
⊢ Fintype.card ι = Set.finrank K (Set.range b) → LinearIndependent K b

tactic: let f := Submodule.subtype (span K (Set.range b))
state_before: case mpr
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
⊢ LinearIndependent K b

tactic: let b' : ι → span K (Set.range b) := fun i =>
  ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
state_before: case mpr
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
⊢ LinearIndependent K b

tactic: have hs : ⊤ ≤ span K (Set.range b') := by
  intro x
  have h : span K (f '' Set.range b') = map f (span K (Set.range b')) := span_image f
  have hf : f '' Set.range b' = Set.range b := by
    ext x
    simp [Set.mem_image, Set.mem_range]
  rw [hf] at h
  have hx : (x : V) ∈ span K (Set.range b) := x.property
  conv at hx =>
    arg 2
    rw [h]
  simpa [mem_map] using hx
state_before: case mpr
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
⊢ LinearIndependent K b

tactic: have hi : LinearMap.ker f = ⊥ := ker_subtype _
state_before: case mpr
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
hs : ⊤ ≤ span K (Set.range b')
⊢ LinearIndependent K b

tactic: convert (linearIndependent_of_top_le_span_of_card_eq_finrank hs hc).map' _ hi
state_before: case mpr
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
hs : ⊤ ≤ span K (Set.range b')
hi : LinearMap.ker f = ⊥
⊢ LinearIndependent K b

tactic: intro x
state_before: K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
⊢ ⊤ ≤ span K (Set.range b')

tactic: have h : span K (f '' Set.range b') = map f (span K (Set.range b')) := span_image f
state_before: K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
x : { x // x ∈ span K (Set.range b) }
⊢ x ∈ ⊤ → x ∈ span K (Set.range b')

tactic: have hf : f '' Set.range b' = Set.range b := by
  ext x
  simp [Set.mem_image, Set.mem_range]
state_before: K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
x : { x // x ∈ span K (Set.range b) }
h : span K (↑f '' Set.range b') = Submodule.map f (span K (Set.range b'))
⊢ x ∈ ⊤ → x ∈ span K (Set.range b')

tactic: rw [hf] at h
state_before: K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
x : { x // x ∈ span K (Set.range b) }
h : span K (↑f '' Set.range b') = Submodule.map f (span K (Set.range b'))
hf : ↑f '' Set.range b' = Set.range b
⊢ x ∈ ⊤ → x ∈ span K (Set.range b')

tactic: have hx : (x : V) ∈ span K (Set.range b) := x.property
state_before: K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
x : { x // x ∈ span K (Set.range b) }
h : span K (Set.range b) = Submodule.map f (span K (Set.range b'))
hf : ↑f '' Set.range b' = Set.range b
⊢ x ∈ ⊤ → x ∈ span K (Set.range b')

tactic: conv at hx =>
  arg 2
  rw [h]
state_before: K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
x : { x // x ∈ span K (Set.range b) }
h : span K (Set.range b) = Submodule.map f (span K (Set.range b'))
hf : ↑f '' Set.range b' = Set.range b
hx : ↑x ∈ span K (Set.range b)
⊢ x ∈ ⊤ → x ∈ span K (Set.range b')

tactic: simpa [mem_map] using hx
state_before: K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
x : { x // x ∈ span K (Set.range b) }
h : span K (Set.range b) = Submodule.map f (span K (Set.range b'))
hf : ↑f '' Set.range b' = Set.range b
hx : ↑x ∈ Submodule.map f (span K (Set.range b'))
⊢ x ∈ ⊤ → x ∈ span K (Set.range b')

tactic: ext x
state_before: K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
x : { x // x ∈ span K (Set.range b) }
h : span K (↑f '' Set.range b') = Submodule.map f (span K (Set.range b'))
⊢ ↑f '' Set.range b' = Set.range b

tactic: simp [Set.mem_image, Set.mem_range]
state_before: case h
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Fintype ι
b : ι → V
hc : Fintype.card ι = Set.finrank K (Set.range b)
f : { x // x ∈ span K (Set.range b) } →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → { x // x ∈ span K (Set.range b) } := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
x✝ : { x // x ∈ span K (Set.range b) }
h : span K (↑f '' Set.range b') = Submodule.map f (span K (Set.range b'))
x : V
⊢ x ∈ ↑f '' Set.range b' ↔ x ∈ Set.range b