l3lab/ntp-mathlib huggingface dataset:
theorem span_eq_top_of_linearIndependent_of_card_eq_finrank {ι : Type*} [hι : Nonempty ι]
    [Fintype ι] {b : ι → V} (lin_ind : LinearIndependent K b)
    (card_eq : Fintype.card ι = finrank K V) : span K (Set.range b) = ⊤ := by
  by_cases fin : FiniteDimensional K V
  · by_contra ne_top
    have lt_top : span K (Set.range b) < ⊤ := lt_of_le_of_ne le_top ne_top
    

Proof state:
case pos
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
hι : Nonempty ι
inst✝ : Fintype ι
b : ι → V
lin_ind : LinearIndependent K b
card_eq : Fintype.card ι = finrank K V
fin : FiniteDimensional K V
ne_top : ¬span K (Set.range b) = ⊤
lt_top : span K (Set.range b) < ⊤
⊢ False

Next tactic:
exact ne_of_lt (Submodule.finrank_lt lt_top)
      (_root_.trans (finrank_span_eq_card lin_ind) card_eq)
theorem span_eq_top_of_linearIndependent_of_card_eq_finrank {ι : Type*} [hι : Nonempty ι]
    [Fintype ι] {b : ι → V} (lin_ind : LinearIndependent K b)
    (card_eq : Fintype.card ι = finrank K V) : span K (Set.range b) = ⊤ := by
  by_cases fin : FiniteDimensional K V
  · by_contra ne_top
    have lt_top : span K (Set.range b) < ⊤ := lt_of_le_of_ne le_top ne_top
    exact ne_of_lt (Submodule.finrank_lt lt_top)
      (_root_.trans (finrank_span_eq_card lin_ind) card_eq)
  · 

Proof state:
case neg
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
hι : Nonempty ι
inst✝ : Fintype ι
b : ι → V
lin_ind : LinearIndependent K b
card_eq : Fintype.card ι = finrank K V
fin : ¬FiniteDimensional K V
⊢ span K (Set.range b) = ⊤

Next tactic:
exfalso
theorem span_eq_top_of_linearIndependent_of_card_eq_finrank {ι : Type*} [hι : Nonempty ι]
    [Fintype ι] {b : ι → V} (lin_ind : LinearIndependent K b)
    (card_eq : Fintype.card ι = finrank K V) : span K (Set.range b) = ⊤ := by
  by_cases fin : FiniteDimensional K V
  · by_contra ne_top
    have lt_top : span K (Set.range b) < ⊤ := lt_of_le_of_ne le_top ne_top
    exact ne_of_lt (Submodule.finrank_lt lt_top)
      (_root_.trans (finrank_span_eq_card lin_ind) card_eq)
  · exfalso
    

Proof state:
case neg.h
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
hι : Nonempty ι
inst✝ : Fintype ι
b : ι → V
lin_ind : LinearIndependent K b
card_eq : Fintype.card ι = finrank K V
fin : ¬FiniteDimensional K V
⊢ False

Next tactic:
apply ne_of_lt (Fintype.card_pos_iff.mpr hι)
theorem span_eq_top_of_linearIndependent_of_card_eq_finrank {ι : Type*} [hι : Nonempty ι]
    [Fintype ι] {b : ι → V} (lin_ind : LinearIndependent K b)
    (card_eq : Fintype.card ι = finrank K V) : span K (Set.range b) = ⊤ := by
  by_cases fin : FiniteDimensional K V
  · by_contra ne_top
    have lt_top : span K (Set.range b) < ⊤ := lt_of_le_of_ne le_top ne_top
    exact ne_of_lt (Submodule.finrank_lt lt_top)
      (_root_.trans (finrank_span_eq_card lin_ind) card_eq)
  · exfalso
    apply ne_of_lt (Fintype.card_pos_iff.mpr hι)
    

Proof state:
case neg.h
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
hι : Nonempty ι
inst✝ : Fintype ι
b : ι → V
lin_ind : LinearIndependent K b
card_eq : Fintype.card ι = finrank K V
fin : ¬FiniteDimensional K V
⊢ 0 = Fintype.card ι

Next tactic:
symm
theorem span_eq_top_of_linearIndependent_of_card_eq_finrank {ι : Type*} [hι : Nonempty ι]
    [Fintype ι] {b : ι → V} (lin_ind : LinearIndependent K b)
    (card_eq : Fintype.card ι = finrank K V) : span K (Set.range b) = ⊤ := by
  by_cases fin : FiniteDimensional K V
  · by_contra ne_top
    have lt_top : span K (Set.range b) < ⊤ := lt_of_le_of_ne le_top ne_top
    exact ne_of_lt (Submodule.finrank_lt lt_top)
      (_root_.trans (finrank_span_eq_card lin_ind) card_eq)
  · exfalso
    apply ne_of_lt (Fintype.card_pos_iff.mpr hι)
    symm
    

Proof state:
case neg.h
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
hι : Nonempty ι
inst✝ : Fintype ι
b : ι → V
lin_ind : LinearIndependent K b
card_eq : Fintype.card ι = finrank K V
fin : ¬FiniteDimensional K V
⊢ Fintype.card ι = 0

Next tactic:
replace fin := (not_iff_not.2 IsNoetherian.iff_fg).2 fin
theorem span_eq_top_of_linearIndependent_of_card_eq_finrank {ι : Type*} [hι : Nonempty ι]
    [Fintype ι] {b : ι → V} (lin_ind : LinearIndependent K b)
    (card_eq : Fintype.card ι = finrank K V) : span K (Set.range b) = ⊤ := by
  by_cases fin : FiniteDimensional K V
  · by_contra ne_top
    have lt_top : span K (Set.range b) < ⊤ := lt_of_le_of_ne le_top ne_top
    exact ne_of_lt (Submodule.finrank_lt lt_top)
      (_root_.trans (finrank_span_eq_card lin_ind) card_eq)
  · exfalso
    apply ne_of_lt (Fintype.card_pos_iff.mpr hι)
    symm
    replace fin := (not_iff_not.2 IsNoetherian.iff_fg).2 fin
    

Proof state:
case neg.h
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
hι : Nonempty ι
inst✝ : Fintype ι
b : ι → V
lin_ind : LinearIndependent K b
card_eq : Fintype.card ι = finrank K V
fin : ¬IsNoetherian K V
⊢ Fintype.card ι = 0

Next tactic:
calc
      Fintype.card ι = finrank K V := card_eq
      _ = 0 := dif_neg (mt IsNoetherian.iff_rank_lt_aleph0.mpr fin)
@[simp]
theorem coe_finsetBasisOfLinearIndependentOfCardEqFinrank {s : Finset V} (hs : s.Nonempty)
    (lin_ind : LinearIndependent K ((↑) : s → V)) (card_eq : s.card = finrank K V) :
    ⇑(finsetBasisOfLinearIndependentOfCardEqFinrank hs lin_ind card_eq) = ((↑) : s → V) := by
  -- porting note: added to make the next line unify the `_`s
  

Proof state:
K : Type u
V : Type v
inst✝² : DivisionRing K
inst✝¹ : AddCommGroup V
inst✝ : Module K V
s : Finset V
hs : Finset.Nonempty s
lin_ind : LinearIndependent K Subtype.val
card_eq : Finset.card s = finrank K V
⊢ ⇑(finsetBasisOfLinearIndependentOfCardEqFinrank hs lin_ind card_eq) = Subtype.val

Next tactic:
rw [finsetBasisOfLinearIndependentOfCardEqFinrank]
@[simp]
theorem coe_finsetBasisOfLinearIndependentOfCardEqFinrank {s : Finset V} (hs : s.Nonempty)
    (lin_ind : LinearIndependent K ((↑) : s → V)) (card_eq : s.card = finrank K V) :
    ⇑(finsetBasisOfLinearIndependentOfCardEqFinrank hs lin_ind card_eq) = ((↑) : s → V) := by
  -- porting note: added to make the next line unify the `_`s
  rw [finsetBasisOfLinearIndependentOfCardEqFinrank]
  

Proof state:
K : Type u
V : Type v
inst✝² : DivisionRing K
inst✝¹ : AddCommGroup V
inst✝ : Module K V
s : Finset V
hs : Finset.Nonempty s
lin_ind : LinearIndependent K Subtype.val
card_eq : Finset.card s = finrank K V
⊢ ⇑(basisOfLinearIndependentOfCardEqFinrank lin_ind (_ : Fintype.card { x // x ∈ s } = finrank K V)) = Subtype.val

Next tactic:
exact Basis.coe_mk _ _
@[simp]
theorem coe_setBasisOfLinearIndependentOfCardEqFinrank {s : Set V} [Nonempty s] [Fintype s]
    (lin_ind : LinearIndependent K ((↑) : s → V)) (card_eq : s.toFinset.card = finrank K V) :
    ⇑(setBasisOfLinearIndependentOfCardEqFinrank lin_ind card_eq) = ((↑) : s → V) := by
  -- porting note: added to make the next line unify the `_`s
  

Proof state:
K : Type u
V : Type v
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : Module K V
s : Set V
inst✝¹ : Nonempty ↑s
inst✝ : Fintype ↑s
lin_ind : LinearIndependent (ι := { x // x ∈ s }) K Subtype.val
card_eq : Finset.card (Set.toFinset s) = finrank K V
⊢ ⇑(setBasisOfLinearIndependentOfCardEqFinrank lin_ind card_eq) = Subtype.val

Next tactic:
rw [setBasisOfLinearIndependentOfCardEqFinrank]
@[simp]
theorem coe_setBasisOfLinearIndependentOfCardEqFinrank {s : Set V} [Nonempty s] [Fintype s]
    (lin_ind : LinearIndependent K ((↑) : s → V)) (card_eq : s.toFinset.card = finrank K V) :
    ⇑(setBasisOfLinearIndependentOfCardEqFinrank lin_ind card_eq) = ((↑) : s → V) := by
  -- porting note: added to make the next line unify the `_`s
  rw [setBasisOfLinearIndependentOfCardEqFinrank]
  

Proof state:
K : Type u
V : Type v
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : Module K V
s : Set V
inst✝¹ : Nonempty ↑s
inst✝ : Fintype ↑s
lin_ind : LinearIndependent (ι := { x // x ∈ s }) K Subtype.val
card_eq : Finset.card (Set.toFinset s) = finrank K V
⊢ ⇑(basisOfLinearIndependentOfCardEqFinrank lin_ind (_ : Fintype.card ↑s = finrank K V)) = Subtype.val

Next tactic:
exact Basis.coe_mk _ _
/-- A vector space with a nonzero vector `v` has dimension 1 iff `v` spans.
-/
theorem finrank_eq_one_iff_of_nonzero (v : V) (nz : v ≠ 0) :
    finrank K V = 1 ↔ span K ({v} : Set V) = ⊤ :=
  -- porting note: need explicit universe on PUnit
  ⟨fun h => by 

Proof state:
K : Type u
V : Type v
inst✝² : DivisionRing K
inst✝¹ : AddCommGroup V
inst✝ : Module K V
v : V
nz : v ≠ 0
h : finrank K V = 1
⊢ span K {v} = ⊤

Next tactic:
simpa using (basisSingleton PUnit.{u+1} h v nz).span_eq
/-- A vector space with a nonzero vector `v` has dimension 1 iff `v` spans.
-/
theorem finrank_eq_one_iff_of_nonzero (v : V) (nz : v ≠ 0) :
    finrank K V = 1 ↔ span K ({v} : Set V) = ⊤ :=
  -- porting note: need explicit universe on PUnit
  ⟨fun h => by simpa using (basisSingleton PUnit.{u+1} h v nz).span_eq, fun s =>
    finrank_eq_card_basis
      (Basis.mk (linearIndependent_singleton nz)
        (by
          

Proof state:
K : Type u
V : Type v
inst✝² : DivisionRing K
inst✝¹ : AddCommGroup V
inst✝ : Module K V
v : V
nz : v ≠ 0
s : span K {v} = ⊤
⊢ ⊤ ≤ span K (Set.range fun x => ↑x)

Next tactic:
convert s.ge
/-- A vector space with a nonzero vector `v` has dimension 1 iff `v` spans.
-/
theorem finrank_eq_one_iff_of_nonzero (v : V) (nz : v ≠ 0) :
    finrank K V = 1 ↔ span K ({v} : Set V) = ⊤ :=
  -- porting note: need explicit universe on PUnit
  ⟨fun h => by simpa using (basisSingleton PUnit.{u+1} h v nz).span_eq, fun s =>
    finrank_eq_card_basis
      (Basis.mk (linearIndependent_singleton nz)
        (by
          convert s.ge  -- porting note: added `.ge` to make things easier for `convert`
          

Proof state:
case h.e'_4.h.e'_6
K : Type u
V : Type v
inst✝² : DivisionRing K
inst✝¹ : AddCommGroup V
inst✝ : Module K V
v : V
nz : v ≠ 0
s : span K {v} = ⊤
⊢ (Set.range fun x => ↑x) = {v}

Next tactic:
simp
/-- A module with a nonzero vector `v` has dimension 1 iff every vector is a multiple of `v`.
-/
theorem finrank_eq_one_iff_of_nonzero' (v : V) (nz : v ≠ 0) :
    finrank K V = 1 ↔ ∀ w : V, ∃ c : K, c • v = w := by
  

Proof state:
K : Type u
V : Type v
inst✝² : DivisionRing K
inst✝¹ : AddCommGroup V
inst✝ : Module K V
v : V
nz : v ≠ 0
⊢ finrank K V = 1 ↔ ∀ (w : V), ∃ c, c • v = w

Next tactic:
rw [finrank_eq_one_iff_of_nonzero v nz]
/-- A module with a nonzero vector `v` has dimension 1 iff every vector is a multiple of `v`.
-/
theorem finrank_eq_one_iff_of_nonzero' (v : V) (nz : v ≠ 0) :
    finrank K V = 1 ↔ ∀ w : V, ∃ c : K, c • v = w := by
  rw [finrank_eq_one_iff_of_nonzero v nz]
  

Proof state:
K : Type u
V : Type v
inst✝² : DivisionRing K
inst✝¹ : AddCommGroup V
inst✝ : Module K V
v : V
nz : v ≠ 0
⊢ span K {v} = ⊤ ↔ ∀ (w : V), ∃ c, c • v = w

Next tactic:
apply span_singleton_eq_top_iff
/-- A module has dimension 1 iff there is some `v : V` so `{v}` is a basis.
-/
theorem finrank_eq_one_iff (ι : Type*) [Unique ι] : finrank K V = 1 ↔ Nonempty (Basis ι K V) := by
  

Proof state:
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Unique ι
⊢ finrank K V = 1 ↔ Nonempty (Basis ι K V)

Next tactic:
constructor
/-- A module has dimension 1 iff there is some `v : V` so `{v}` is a basis.
-/
theorem finrank_eq_one_iff (ι : Type*) [Unique ι] : finrank K V = 1 ↔ Nonempty (Basis ι K V) := by
  constructor
  · 

Proof state:
case mp
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Unique ι
⊢ finrank K V = 1 → Nonempty (Basis ι K V)

Next tactic:
intro h
/-- A module has dimension 1 iff there is some `v : V` so `{v}` is a basis.
-/
theorem finrank_eq_one_iff (ι : Type*) [Unique ι] : finrank K V = 1 ↔ Nonempty (Basis ι K V) := by
  constructor
  · intro h
    

Proof state:
case mp
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Unique ι
h : finrank K V = 1
⊢ Nonempty (Basis ι K V)

Next tactic:
haveI := finiteDimensional_of_finrank (_root_.zero_lt_one.trans_le h.symm.le)
/-- A module has dimension 1 iff there is some `v : V` so `{v}` is a basis.
-/
theorem finrank_eq_one_iff (ι : Type*) [Unique ι] : finrank K V = 1 ↔ Nonempty (Basis ι K V) := by
  constructor
  · intro h
    haveI := finiteDimensional_of_finrank (_root_.zero_lt_one.trans_le h.symm.le)
    

Proof state:
case mp
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Unique ι
h : finrank K V = 1
this : FiniteDimensional K V
⊢ Nonempty (Basis ι K V)

Next tactic:
exact ⟨FiniteDimensional.basisUnique ι h⟩
/-- A module has dimension 1 iff there is some `v : V` so `{v}` is a basis.
-/
theorem finrank_eq_one_iff (ι : Type*) [Unique ι] : finrank K V = 1 ↔ Nonempty (Basis ι K V) := by
  constructor
  · intro h
    haveI := finiteDimensional_of_finrank (_root_.zero_lt_one.trans_le h.symm.le)
    exact ⟨FiniteDimensional.basisUnique ι h⟩
  · 

Proof state:
case mpr
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Unique ι
⊢ Nonempty (Basis ι K V) → finrank K V = 1

Next tactic:
rintro ⟨b⟩
/-- A module has dimension 1 iff there is some `v : V` so `{v}` is a basis.
-/
theorem finrank_eq_one_iff (ι : Type*) [Unique ι] : finrank K V = 1 ↔ Nonempty (Basis ι K V) := by
  constructor
  · intro h
    haveI := finiteDimensional_of_finrank (_root_.zero_lt_one.trans_le h.symm.le)
    exact ⟨FiniteDimensional.basisUnique ι h⟩
  · rintro ⟨b⟩
    

Proof state:
case mpr.intro
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
ι : Type u_1
inst✝ : Unique ι
b : Basis ι K V
⊢ finrank K V = 1

Next tactic:
simpa using finrank_eq_card_basis b
/-- A module has dimension 1 iff there is some nonzero `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_eq_one_iff' : finrank K V = 1 ↔ ∃ (v : V) (_n : v ≠ 0),
    ∀ w : V, ∃ c : K, c • v = w := by
  -- porting note: was a messy `convert` proof
  

Proof state:
K : Type u
V : Type v
inst✝² : DivisionRing K
inst✝¹ : AddCommGroup V
inst✝ : Module K V
⊢ finrank K V = 1 ↔ ∃ v, ∃ (_ : v ≠ 0), ∀ (w : V), ∃ c, c • v = w

Next tactic:
rw [finrank_eq_one_iff PUnit.{u+1}, Basis.basis_singleton_iff PUnit]
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  

Proof state:
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
⊢ finrank K V ≤ 1 ↔ ∃ v, ∀ (w : V), ∃ c, c • v = w

Next tactic:
constructor
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · 

Proof state:
case mp
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
⊢ finrank K V ≤ 1 → ∃ v, ∀ (w : V), ∃ c, c • v = w

Next tactic:
intro h
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    

Proof state:
case mp
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
h : finrank K V ≤ 1
⊢ ∃ v, ∀ (w : V), ∃ c, c • v = w

Next tactic:
by_cases h' : finrank K V = 0
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · 

Proof state:
case pos
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
h : finrank K V ≤ 1
h' : finrank K V = 0
⊢ ∃ v, ∀ (w : V), ∃ c, c • v = w

Next tactic:
use 0
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · use 0
      

Proof state:
case h
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
h : finrank K V ≤ 1
h' : finrank K V = 0
⊢ ∀ (w : V), ∃ c, c • 0 = w

Next tactic:
intro w
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · use 0
      intro w
      

Proof state:
case h
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
h : finrank K V ≤ 1
h' : finrank K V = 0
w : V
⊢ ∃ c, c • 0 = w

Next tactic:
use 0
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · use 0
      intro w
      use 0
      

Proof state:
case h
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
h : finrank K V ≤ 1
h' : finrank K V = 0
w : V
⊢ 0 • 0 = w

Next tactic:
haveI := finrank_zero_iff.mp h'
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · use 0
      intro w
      use 0
      haveI := finrank_zero_iff.mp h'
      

Proof state:
case h
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
h : finrank K V ≤ 1
h' : finrank K V = 0
w : V
this : Subsingleton V
⊢ 0 • 0 = w

Next tactic:
apply Subsingleton.elim
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · use 0
      intro w
      use 0
      haveI := finrank_zero_iff.mp h'
      apply Subsingleton.elim
    · 

Proof state:
case neg
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
h : finrank K V ≤ 1
h' : ¬finrank K V = 0
⊢ ∃ v, ∀ (w : V), ∃ c, c • v = w

Next tactic:
replace h' := zero_lt_iff.mpr h'
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · use 0
      intro w
      use 0
      haveI := finrank_zero_iff.mp h'
      apply Subsingleton.elim
    · replace h' := zero_lt_iff.mpr h'
      

Proof state:
case neg
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
h : finrank K V ≤ 1
h' : 0 < finrank K V
⊢ ∃ v, ∀ (w : V), ∃ c, c • v = w

Next tactic:
have : finrank K V = 1 := by linarith
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · use 0
      intro w
      use 0
      haveI := finrank_zero_iff.mp h'
      apply Subsingleton.elim
    · replace h' := zero_lt_iff.mpr h'
      have : finrank K V = 1 := by 

Proof state:
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
h : finrank K V ≤ 1
h' : 0 < finrank K V
⊢ finrank K V = 1

Next tactic:
linarith
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · use 0
      intro w
      use 0
      haveI := finrank_zero_iff.mp h'
      apply Subsingleton.elim
    · replace h' := zero_lt_iff.mpr h'
      have : finrank K V = 1 := by linarith
      

Proof state:
case neg
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
h : finrank K V ≤ 1
h' : 0 < finrank K V
this : finrank K V = 1
⊢ ∃ v, ∀ (w : V), ∃ c, c • v = w

Next tactic:
obtain ⟨v, -, p⟩ := finrank_eq_one_iff'.mp this
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · use 0
      intro w
      use 0
      haveI := finrank_zero_iff.mp h'
      apply Subsingleton.elim
    · replace h' := zero_lt_iff.mpr h'
      have : finrank K V = 1 := by linarith
      obtain ⟨v, -, p⟩ := finrank_eq_one_iff'.mp this
      

Proof state:
case neg.intro.intro
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
h : finrank K V ≤ 1
h' : 0 < finrank K V
this : finrank K V = 1
v : V
p : ∀ (w : V), ∃ c, c • v = w
⊢ ∃ v, ∀ (w : V), ∃ c, c • v = w

Next tactic:
use v, p
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · use 0
      intro w
      use 0
      haveI := finrank_zero_iff.mp h'
      apply Subsingleton.elim
    · replace h' := zero_lt_iff.mpr h'
      have : finrank K V = 1 := by linarith
      obtain ⟨v, -, p⟩ := finrank_eq_one_iff'.mp this
      use v, p
  · 

Proof state:
case mpr
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
⊢ (∃ v, ∀ (w : V), ∃ c, c • v = w) → finrank K V ≤ 1

Next tactic:
rintro ⟨v, p⟩
/-- A finite dimensional module has dimension at most 1 iff
there is some `v : V` so every vector is a multiple of `v`.
-/
theorem finrank_le_one_iff [FiniteDimensional K V] :
    finrank K V ≤ 1 ↔ ∃ v : V, ∀ w : V, ∃ c : K, c • v = w := by
  constructor
  · intro h
    by_cases h' : finrank K V = 0
    · use 0
      intro w
      use 0
      haveI := finrank_zero_iff.mp h'
      apply Subsingleton.elim
    · replace h' := zero_lt_iff.mpr h'
      have : finrank K V = 1 := by linarith
      obtain ⟨v, -, p⟩ := finrank_eq_one_iff'.mp this
      use v, p
  · rintro ⟨v, p⟩
    

Proof state:
case mpr.intro
K : Type u
V : Type v
inst✝³ : DivisionRing K
inst✝² : AddCommGroup V
inst✝¹ : Module K V
inst✝ : FiniteDimensional K V
v : V
p : ∀ (w : V), ∃ c, c • v = w
⊢ finrank K V ≤ 1

Next tactic:
exact finrank_le_one v p