l3lab/ntp-mathlib huggingface dataset:
/-- A finite family of vectors is linearly independent if and only if
its cardinality equals the dimension of its span. -/
theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
    LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by
  constructor
  · intro h
    exact (finrank_span_eq_card h).symm
  · intro hc
    let f := Submodule.subtype (span K (Set.range b))
    let b' : ι → span K (Set.range b) := fun i =>
      ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
    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
        

Proof state:
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 : ↥(span K (Set.range b)) →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → ↥(span K (Set.range b)) := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
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

Next tactic:
simp [Set.mem_image, Set.mem_range]
/-- A finite family of vectors is linearly independent if and only if
its cardinality equals the dimension of its span. -/
theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
    LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by
  constructor
  · intro h
    exact (finrank_span_eq_card h).symm
  · intro hc
    let f := Submodule.subtype (span K (Set.range b))
    let b' : ι → span K (Set.range b) := fun i =>
      ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
    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]
      

Proof state:
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 : ↥(span K (Set.range b)) →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → ↥(span K (Set.range b)) := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
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')

Next tactic:
rw [hf] at h
/-- A finite family of vectors is linearly independent if and only if
its cardinality equals the dimension of its span. -/
theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
    LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by
  constructor
  · intro h
    exact (finrank_span_eq_card h).symm
  · intro hc
    let f := Submodule.subtype (span K (Set.range b))
    let b' : ι → span K (Set.range b) := fun i =>
      ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
    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
      

Proof state:
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 : ↥(span K (Set.range b)) →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → ↥(span K (Set.range b)) := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
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')

Next tactic:
have hx : (x : V) ∈ span K (Set.range b) := x.property
/-- A finite family of vectors is linearly independent if and only if
its cardinality equals the dimension of its span. -/
theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
    LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by
  constructor
  · intro h
    exact (finrank_span_eq_card h).symm
  · intro hc
    let f := Submodule.subtype (span K (Set.range b))
    let b' : ι → span K (Set.range b) := fun i =>
      ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
    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
      

Proof state:
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 : ↥(span K (Set.range b)) →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → ↥(span K (Set.range b)) := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
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')

Next tactic:
conv at hx =>
        arg 2
        rw [h]
/-- A finite family of vectors is linearly independent if and only if
its cardinality equals the dimension of its span. -/
theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
    LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by
  constructor
  · intro h
    exact (finrank_span_eq_card h).symm
  · intro hc
    let f := Submodule.subtype (span K (Set.range b))
    let b' : ι → span K (Set.range b) := fun i =>
      ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
    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 =>
        

Proof state:
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 : ↥(span K (Set.range b)) →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → ↥(span K (Set.range b)) := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
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 ∈ span K (Set.range b)

Next tactic:
arg 2
        rw [h]
/-- A finite family of vectors is linearly independent if and only if
its cardinality equals the dimension of its span. -/
theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
    LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by
  constructor
  · intro h
    exact (finrank_span_eq_card h).symm
  · intro hc
    let f := Submodule.subtype (span K (Set.range b))
    let b' : ι → span K (Set.range b) := fun i =>
      ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
    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 =>
        

Proof state:
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 : ↥(span K (Set.range b)) →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → ↥(span K (Set.range b)) := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
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 ∈ span K (Set.range b)

Next tactic:
arg 2
/-- A finite family of vectors is linearly independent if and only if
its cardinality equals the dimension of its span. -/
theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
    LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by
  constructor
  · intro h
    exact (finrank_span_eq_card h).symm
  · intro hc
    let f := Submodule.subtype (span K (Set.range b))
    let b' : ι → span K (Set.range b) := fun i =>
      ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
    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
        

Proof state:
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 : ↥(span K (Set.range b)) →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → ↥(span K (Set.range b)) := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
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)
| span K (Set.range b)

Next tactic:
rw [h]
/-- A finite family of vectors is linearly independent if and only if
its cardinality equals the dimension of its span. -/
theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
    LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by
  constructor
  · intro h
    exact (finrank_span_eq_card h).symm
  · intro hc
    let f := Submodule.subtype (span K (Set.range b))
    let b' : ι → span K (Set.range b) := fun i =>
      ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
    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]
      

Proof state:
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 : ↥(span K (Set.range b)) →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → ↥(span K (Set.range b)) := fun i => { val := b i, property := (_ : b i ∈ span K (Set.range b)) }
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')

Next tactic:
simpa [mem_map] using hx
/-- A finite family of vectors is linearly independent if and only if
its cardinality equals the dimension of its span. -/
theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
    LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by
  constructor
  · intro h
    exact (finrank_span_eq_card h).symm
  · intro hc
    let f := Submodule.subtype (span K (Set.range b))
    let b' : ι → span K (Set.range b) := fun i =>
      ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
    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
    

Proof state:
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 : ↥(span K (Set.range b)) →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → ↥(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

Next tactic:
have hi : LinearMap.ker f = ⊥ := ker_subtype _
/-- A finite family of vectors is linearly independent if and only if
its cardinality equals the dimension of its span. -/
theorem linearIndependent_iff_card_eq_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
    LinearIndependent K b ↔ Fintype.card ι = (Set.range b).finrank K := by
  constructor
  · intro h
    exact (finrank_span_eq_card h).symm
  · intro hc
    let f := Submodule.subtype (span K (Set.range b))
    let b' : ι → span K (Set.range b) := fun i =>
      ⟨b i, mem_span.2 fun p hp => hp (Set.mem_range_self _)⟩
    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
    have hi : LinearMap.ker f = ⊥ := ker_subtype _
    

Proof state:
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 : ↥(span K (Set.range b)) →ₗ[K] V := Submodule.subtype (span K (Set.range b))
b' : ι → ↥(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

Next tactic:
convert (linearIndependent_of_top_le_span_of_card_eq_finrank hs hc).map' _ hi
theorem linearIndependent_iff_card_le_finrank_span {ι : Type*} [Fintype ι] {b : ι → V} :
    LinearIndependent K b ↔ Fintype.card ι ≤ (Set.range b).finrank K := by
  

Proof state:
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)

Next tactic:
rw [linearIndependent_iff_card_eq_finrank_span, finrank_range_le_card.le_iff_eq]
/-- If there is a nonzero vector and every other vector is a multiple of it,
then the module has dimension one. -/
theorem finrank_eq_one (v : V) (n : v ≠ 0) (h : ∀ w : V, ∃ c : K, c • v = w) : finrank K V = 1 := by
  

Proof state:
K : Type u
V : Type v
inst✝⁴ : Ring K
inst✝³ : AddCommGroup V
inst✝² : Module K V
inst✝¹ : NoZeroSMulDivisors K V
inst✝ : StrongRankCondition K
v : V
n : v ≠ 0
h : ∀ (w : V), ∃ c, c • v = w
⊢ finrank K V = 1

Next tactic:
haveI := nontrivial_of_invariantBasisNumber K
/-- If there is a nonzero vector and every other vector is a multiple of it,
then the module has dimension one. -/
theorem finrank_eq_one (v : V) (n : v ≠ 0) (h : ∀ w : V, ∃ c : K, c • v = w) : finrank K V = 1 := by
  haveI := nontrivial_of_invariantBasisNumber K
  

Proof state:
K : Type u
V : Type v
inst✝⁴ : Ring K
inst✝³ : AddCommGroup V
inst✝² : Module K V
inst✝¹ : NoZeroSMulDivisors K V
inst✝ : StrongRankCondition K
v : V
n : v ≠ 0
h : ∀ (w : V), ∃ c, c • v = w
this : Nontrivial K
⊢ finrank K V = 1

Next tactic:
obtain ⟨b⟩ := (Basis.basis_singleton_iff.{u} PUnit).mpr ⟨v, n, h⟩
/-- If there is a nonzero vector and every other vector is a multiple of it,
then the module has dimension one. -/
theorem finrank_eq_one (v : V) (n : v ≠ 0) (h : ∀ w : V, ∃ c : K, c • v = w) : finrank K V = 1 := by
  haveI := nontrivial_of_invariantBasisNumber K
  obtain ⟨b⟩ := (Basis.basis_singleton_iff.{u} PUnit).mpr ⟨v, n, h⟩
  

Proof state:
case intro
K : Type u
V : Type v
inst✝⁴ : Ring K
inst✝³ : AddCommGroup V
inst✝² : Module K V
inst✝¹ : NoZeroSMulDivisors K V
inst✝ : StrongRankCondition K
v : V
n : v ≠ 0
h : ∀ (w : V), ∃ c, c • v = w
this : Nontrivial K
b : Basis PUnit.{u + 1} K V
⊢ finrank K V = 1

Next tactic:
rw [finrank_eq_card_basis b, Fintype.card_punit]
/-- If every vector is a multiple of some `v : V`, then `V` has dimension at most one.
-/
theorem finrank_le_one (v : V) (h : ∀ w : V, ∃ c : K, c • v = w) : finrank K V ≤ 1 := by
  

Proof state:
K : Type u
V : Type v
inst✝⁴ : Ring K
inst✝³ : AddCommGroup V
inst✝² : Module K V
inst✝¹ : NoZeroSMulDivisors K V
inst✝ : StrongRankCondition K
v : V
h : ∀ (w : V), ∃ c, c • v = w
⊢ finrank K V ≤ 1

Next tactic:
haveI := nontrivial_of_invariantBasisNumber K
/-- If every vector is a multiple of some `v : V`, then `V` has dimension at most one.
-/
theorem finrank_le_one (v : V) (h : ∀ w : V, ∃ c : K, c • v = w) : finrank K V ≤ 1 := by
  haveI := nontrivial_of_invariantBasisNumber K
  

Proof state:
K : Type u
V : Type v
inst✝⁴ : Ring K
inst✝³ : AddCommGroup V
inst✝² : Module K V
inst✝¹ : NoZeroSMulDivisors K V
inst✝ : StrongRankCondition K
v : V
h : ∀ (w : V), ∃ c, c • v = w
this : Nontrivial K
⊢ finrank K V ≤ 1

Next tactic:
rcases eq_or_ne v 0 with (rfl | hn)
/-- If every vector is a multiple of some `v : V`, then `V` has dimension at most one.
-/
theorem finrank_le_one (v : V) (h : ∀ w : V, ∃ c : K, c • v = w) : finrank K V ≤ 1 := by
  haveI := nontrivial_of_invariantBasisNumber K
  rcases eq_or_ne v 0 with (rfl | hn)
  · 

Proof state:
case inl
K : Type u
V : Type v
inst✝⁴ : Ring K
inst✝³ : AddCommGroup V
inst✝² : Module K V
inst✝¹ : NoZeroSMulDivisors K V
inst✝ : StrongRankCondition K
this : Nontrivial K
h : ∀ (w : V), ∃ c, c • 0 = w
⊢ finrank K V ≤ 1

Next tactic:
haveI :=
      subsingleton_of_forall_eq (0 : V) fun w => by
        obtain ⟨c, rfl⟩ := h w
        simp
/-- If every vector is a multiple of some `v : V`, then `V` has dimension at most one.
-/
theorem finrank_le_one (v : V) (h : ∀ w : V, ∃ c : K, c • v = w) : finrank K V ≤ 1 := by
  haveI := nontrivial_of_invariantBasisNumber K
  rcases eq_or_ne v 0 with (rfl | hn)
  · haveI :=
      subsingleton_of_forall_eq (0 : V) fun w => by
        

Proof state:
K : Type u
V : Type v
inst✝⁴ : Ring K
inst✝³ : AddCommGroup V
inst✝² : Module K V
inst✝¹ : NoZeroSMulDivisors K V
inst✝ : StrongRankCondition K
this : Nontrivial K
h : ∀ (w : V), ∃ c, c • 0 = w
w : V
⊢ w = 0

Next tactic:
obtain ⟨c, rfl⟩ := h w
/-- If every vector is a multiple of some `v : V`, then `V` has dimension at most one.
-/
theorem finrank_le_one (v : V) (h : ∀ w : V, ∃ c : K, c • v = w) : finrank K V ≤ 1 := by
  haveI := nontrivial_of_invariantBasisNumber K
  rcases eq_or_ne v 0 with (rfl | hn)
  · haveI :=
      subsingleton_of_forall_eq (0 : V) fun w => by
        obtain ⟨c, rfl⟩ := h w
        

Proof state:
case intro
K : Type u
V : Type v
inst✝⁴ : Ring K
inst✝³ : AddCommGroup V
inst✝² : Module K V
inst✝¹ : NoZeroSMulDivisors K V
inst✝ : StrongRankCondition K
this : Nontrivial K
h : ∀ (w : V), ∃ c, c • 0 = w
c : K
⊢ c • 0 = 0

Next tactic:
simp
/-- If every vector is a multiple of some `v : V`, then `V` has dimension at most one.
-/
theorem finrank_le_one (v : V) (h : ∀ w : V, ∃ c : K, c • v = w) : finrank K V ≤ 1 := by
  haveI := nontrivial_of_invariantBasisNumber K
  rcases eq_or_ne v 0 with (rfl | hn)
  · haveI :=
      subsingleton_of_forall_eq (0 : V) fun w => by
        obtain ⟨c, rfl⟩ := h w
        simp
    

Proof state:
case inl
K : Type u
V : Type v
inst✝⁴ : Ring K
inst✝³ : AddCommGroup V
inst✝² : Module K V
inst✝¹ : NoZeroSMulDivisors K V
inst✝ : StrongRankCondition K
this✝ : Nontrivial K
h : ∀ (w : V), ∃ c, c • 0 = w
this : Subsingleton V
⊢ finrank K V ≤ 1

Next tactic:
rw [finrank_zero_of_subsingleton]
/-- If every vector is a multiple of some `v : V`, then `V` has dimension at most one.
-/
theorem finrank_le_one (v : V) (h : ∀ w : V, ∃ c : K, c • v = w) : finrank K V ≤ 1 := by
  haveI := nontrivial_of_invariantBasisNumber K
  rcases eq_or_ne v 0 with (rfl | hn)
  · haveI :=
      subsingleton_of_forall_eq (0 : V) fun w => by
        obtain ⟨c, rfl⟩ := h w
        simp
    rw [finrank_zero_of_subsingleton]
    

Proof state:
case inl
K : Type u
V : Type v
inst✝⁴ : Ring K
inst✝³ : AddCommGroup V
inst✝² : Module K V
inst✝¹ : NoZeroSMulDivisors K V
inst✝ : StrongRankCondition K
this✝ : Nontrivial K
h : ∀ (w : V), ∃ c, c • 0 = w
this : Subsingleton V
⊢ 0 ≤ 1

Next tactic:
exact zero_le_one
/-- If every vector is a multiple of some `v : V`, then `V` has dimension at most one.
-/
theorem finrank_le_one (v : V) (h : ∀ w : V, ∃ c : K, c • v = w) : finrank K V ≤ 1 := by
  haveI := nontrivial_of_invariantBasisNumber K
  rcases eq_or_ne v 0 with (rfl | hn)
  · haveI :=
      subsingleton_of_forall_eq (0 : V) fun w => by
        obtain ⟨c, rfl⟩ := h w
        simp
    rw [finrank_zero_of_subsingleton]
    exact zero_le_one
  · 

Proof state:
case inr
K : Type u
V : Type v
inst✝⁴ : Ring K
inst✝³ : AddCommGroup V
inst✝² : Module K V
inst✝¹ : NoZeroSMulDivisors K V
inst✝ : StrongRankCondition K
v : V
h : ∀ (w : V), ∃ c, c • v = w
this : Nontrivial K
hn : v ≠ 0
⊢ finrank K V ≤ 1

Next tactic:
exact (finrank_eq_one v hn h).le
theorem subalgebra_top_rank_eq_submodule_top_rank :
    Module.rank F (⊤ : Subalgebra F E) = Module.rank F (⊤ : Submodule F E) := by
  

Proof state:
K : Type u
V : Type v
F : Type u_1
E : Type u_2
inst✝² : CommRing F
inst✝¹ : Ring E
inst✝ : Algebra F E
⊢ Module.rank F ↥⊤ = Module.rank F ↥⊤

Next tactic:
rw [← Algebra.top_toSubmodule]
theorem subalgebra_top_rank_eq_submodule_top_rank :
    Module.rank F (⊤ : Subalgebra F E) = Module.rank F (⊤ : Submodule F E) := by
  rw [← Algebra.top_toSubmodule]
  

Proof state:
K : Type u
V : Type v
F : Type u_1
E : Type u_2
inst✝² : CommRing F
inst✝¹ : Ring E
inst✝ : Algebra F E
⊢ Module.rank F ↥⊤ = Module.rank F ↥(Subalgebra.toSubmodule ⊤)

Next tactic:
rfl
theorem subalgebra_top_finrank_eq_submodule_top_finrank :
    finrank F (⊤ : Subalgebra F E) = finrank F (⊤ : Submodule F E) := by
  

Proof state:
K : Type u
V : Type v
F : Type u_1
E : Type u_2
inst✝² : CommRing F
inst✝¹ : Ring E
inst✝ : Algebra F E
⊢ finrank F ↥⊤ = finrank F ↥⊤

Next tactic:
rw [← Algebra.top_toSubmodule]
theorem subalgebra_top_finrank_eq_submodule_top_finrank :
    finrank F (⊤ : Subalgebra F E) = finrank F (⊤ : Submodule F E) := by
  rw [← Algebra.top_toSubmodule]
  

Proof state:
K : Type u
V : Type v
F : Type u_1
E : Type u_2
inst✝² : CommRing F
inst✝¹ : Ring E
inst✝ : Algebra F E
⊢ finrank F ↥⊤ = finrank F ↥(Subalgebra.toSubmodule ⊤)

Next tactic:
rfl
theorem Subalgebra.rank_top : Module.rank F (⊤ : Subalgebra F E) = Module.rank F E := by
  

Proof state:
K : Type u
V : Type v
F : Type u_1
E : Type u_2
inst✝² : CommRing F
inst✝¹ : Ring E
inst✝ : Algebra F E
⊢ Module.rank F ↥⊤ = Module.rank F E

Next tactic:
rw [subalgebra_top_rank_eq_submodule_top_rank]
theorem Subalgebra.rank_top : Module.rank F (⊤ : Subalgebra F E) = Module.rank F E := by
  rw [subalgebra_top_rank_eq_submodule_top_rank]
  

Proof state:
K : Type u
V : Type v
F : Type u_1
E : Type u_2
inst✝² : CommRing F
inst✝¹ : Ring E
inst✝ : Algebra F E
⊢ Module.rank F ↥⊤ = Module.rank F E

Next tactic:
exact _root_.rank_top F E