l3lab/ntp-mathlib huggingface dataset:
/-- If a submodule has maximal dimension in a finite dimensional space, then it is equal to the
whole space. -/
theorem _root_.Submodule.eq_top_of_finrank_eq [FiniteDimensional K V] {S : Submodule K V}
    (h : finrank K S = finrank K V) : S = ⊤ := by
  haveI : IsNoetherian K V := iff_fg.2 inferInstance
  set bS := Basis.ofVectorSpace K S with bS_eq
  have : LinearIndependent K ((↑) : ((↑) '' Basis.ofVectorSpaceIndex K S : Set V) → V) :=
    LinearIndependent.image_subtype (f := Submodule.subtype S)
      (by simpa using bS.linearIndependent) (by simp)
  set b := Basis.extend this with b_eq
  -- porting note: `letI` now uses `this` so we need to give different names
  letI i1 : Fintype (this.extend _) :=
    (finite_of_linearIndependent (by simpa using b.linearIndependent)).fintype
  letI i2 : Fintype (((↑) : S → V) '' Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent this).fintype
  letI i3 : Fintype (Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent (by simpa using bS.linearIndependent)).fintype
  

Proof state:
K : Type u
V : Type v
inst✝⁵ : DivisionRing K
inst✝⁴ : AddCommGroup V
inst✝³ : Module K V
V₂ : Type v'
inst✝² : AddCommGroup V₂
inst✝¹ : Module K V₂
inst✝ : FiniteDimensional K V
S : Submodule K V
h : finrank K ↥S = finrank K V
this✝ : IsNoetherian K V
bS : Basis (↑(Basis.ofVectorSpaceIndex K ↥S)) K ↥S := Basis.ofVectorSpace K ↥S
bS_eq : bS = Basis.ofVectorSpace K ↥S
this : LinearIndependent (ι := { x // x ∈ Subtype.val '' Basis.ofVectorSpaceIndex K ↥S }) K Subtype.val
b : Basis (↑(LinearIndependent.extend this (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ))) K V :=
  Basis.extend this
b_eq : b = Basis.extend this
i1 : Fintype ↑(LinearIndependent.extend this (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)) :=
  Set.Finite.fintype
    (_ : Set.Finite (LinearIndependent.extend this (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)))
i2 : Fintype ↑(Subtype.val '' Basis.ofVectorSpaceIndex K ↥S) :=
  Set.Finite.fintype (_ : Set.Finite (Subtype.val '' Basis.ofVectorSpaceIndex K ↥S))
i3 : Fintype ↑(Basis.ofVectorSpaceIndex K ↥S) := Set.Finite.fintype (_ : Set.Finite (Basis.ofVectorSpaceIndex K ↥S))
⊢ S = ⊤

Next tactic:
have : (↑) '' Basis.ofVectorSpaceIndex K S = this.extend (Set.subset_univ _) :=
    Set.eq_of_subset_of_card_le (this.subset_extend _)
      (by
        rw [Set.card_image_of_injective _ Subtype.coe_injective, ← finrank_eq_card_basis bS, ←
            finrank_eq_card_basis b, h])
/-- If a submodule has maximal dimension in a finite dimensional space, then it is equal to the
whole space. -/
theorem _root_.Submodule.eq_top_of_finrank_eq [FiniteDimensional K V] {S : Submodule K V}
    (h : finrank K S = finrank K V) : S = ⊤ := by
  haveI : IsNoetherian K V := iff_fg.2 inferInstance
  set bS := Basis.ofVectorSpace K S with bS_eq
  have : LinearIndependent K ((↑) : ((↑) '' Basis.ofVectorSpaceIndex K S : Set V) → V) :=
    LinearIndependent.image_subtype (f := Submodule.subtype S)
      (by simpa using bS.linearIndependent) (by simp)
  set b := Basis.extend this with b_eq
  -- porting note: `letI` now uses `this` so we need to give different names
  letI i1 : Fintype (this.extend _) :=
    (finite_of_linearIndependent (by simpa using b.linearIndependent)).fintype
  letI i2 : Fintype (((↑) : S → V) '' Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent this).fintype
  letI i3 : Fintype (Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent (by simpa using bS.linearIndependent)).fintype
  have : (↑) '' Basis.ofVectorSpaceIndex K S = this.extend (Set.subset_univ _) :=
    Set.eq_of_subset_of_card_le (this.subset_extend _)
      (by
        

Proof state:
K : Type u
V : Type v
inst✝⁵ : DivisionRing K
inst✝⁴ : AddCommGroup V
inst✝³ : Module K V
V₂ : Type v'
inst✝² : AddCommGroup V₂
inst✝¹ : Module K V₂
inst✝ : FiniteDimensional K V
S : Submodule K V
h : finrank K ↥S = finrank K V
this✝ : IsNoetherian K V
bS : Basis (↑(Basis.ofVectorSpaceIndex K ↥S)) K ↥S := Basis.ofVectorSpace K ↥S
bS_eq : bS = Basis.ofVectorSpace K ↥S
this : LinearIndependent (ι := { x // x ∈ Subtype.val '' Basis.ofVectorSpaceIndex K ↥S }) K Subtype.val
b : Basis (↑(LinearIndependent.extend this (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ))) K V :=
  Basis.extend this
b_eq : b = Basis.extend this
i1 : Fintype ↑(LinearIndependent.extend this (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)) :=
  Set.Finite.fintype
    (_ : Set.Finite (LinearIndependent.extend this (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)))
i2 : Fintype ↑(Subtype.val '' Basis.ofVectorSpaceIndex K ↥S) :=
  Set.Finite.fintype (_ : Set.Finite (Subtype.val '' Basis.ofVectorSpaceIndex K ↥S))
i3 : Fintype ↑(Basis.ofVectorSpaceIndex K ↥S) := Set.Finite.fintype (_ : Set.Finite (Basis.ofVectorSpaceIndex K ↥S))
⊢ Fintype.card ↑(LinearIndependent.extend this (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)) ≤
    Fintype.card ↑(Subtype.val '' Basis.ofVectorSpaceIndex K ↥S)

Next tactic:
rw [Set.card_image_of_injective _ Subtype.coe_injective, ← finrank_eq_card_basis bS, ←
            finrank_eq_card_basis b, h]
/-- If a submodule has maximal dimension in a finite dimensional space, then it is equal to the
whole space. -/
theorem _root_.Submodule.eq_top_of_finrank_eq [FiniteDimensional K V] {S : Submodule K V}
    (h : finrank K S = finrank K V) : S = ⊤ := by
  haveI : IsNoetherian K V := iff_fg.2 inferInstance
  set bS := Basis.ofVectorSpace K S with bS_eq
  have : LinearIndependent K ((↑) : ((↑) '' Basis.ofVectorSpaceIndex K S : Set V) → V) :=
    LinearIndependent.image_subtype (f := Submodule.subtype S)
      (by simpa using bS.linearIndependent) (by simp)
  set b := Basis.extend this with b_eq
  -- porting note: `letI` now uses `this` so we need to give different names
  letI i1 : Fintype (this.extend _) :=
    (finite_of_linearIndependent (by simpa using b.linearIndependent)).fintype
  letI i2 : Fintype (((↑) : S → V) '' Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent this).fintype
  letI i3 : Fintype (Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent (by simpa using bS.linearIndependent)).fintype
  have : (↑) '' Basis.ofVectorSpaceIndex K S = this.extend (Set.subset_univ _) :=
    Set.eq_of_subset_of_card_le (this.subset_extend _)
      (by
        rw [Set.card_image_of_injective _ Subtype.coe_injective, ← finrank_eq_card_basis bS, ←
            finrank_eq_card_basis b, h])
  

Proof state:
K : Type u
V : Type v
inst✝⁵ : DivisionRing K
inst✝⁴ : AddCommGroup V
inst✝³ : Module K V
V₂ : Type v'
inst✝² : AddCommGroup V₂
inst✝¹ : Module K V₂
inst✝ : FiniteDimensional K V
S : Submodule K V
h : finrank K ↥S = finrank K V
this✝¹ : IsNoetherian K V
bS : Basis (↑(Basis.ofVectorSpaceIndex K ↥S)) K ↥S := Basis.ofVectorSpace K ↥S
bS_eq : bS = Basis.ofVectorSpace K ↥S
this✝ : LinearIndependent (ι := { x // x ∈ Subtype.val '' Basis.ofVectorSpaceIndex K ↥S }) K Subtype.val
b : Basis (↑(LinearIndependent.extend this✝ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ))) K V :=
  Basis.extend this✝
b_eq : b = Basis.extend this✝
i1 : Fintype ↑(LinearIndependent.extend this✝ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)) :=
  Set.Finite.fintype
    (_ : Set.Finite (LinearIndependent.extend this✝ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)))
i2 : Fintype ↑(Subtype.val '' Basis.ofVectorSpaceIndex K ↥S) :=
  Set.Finite.fintype (_ : Set.Finite (Subtype.val '' Basis.ofVectorSpaceIndex K ↥S))
i3 : Fintype ↑(Basis.ofVectorSpaceIndex K ↥S) := Set.Finite.fintype (_ : Set.Finite (Basis.ofVectorSpaceIndex K ↥S))
this :
  Subtype.val '' Basis.ofVectorSpaceIndex K ↥S =
    LinearIndependent.extend this✝ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)
⊢ S = ⊤

Next tactic:
rw [← b.span_eq, b_eq, Basis.coe_extend, Subtype.range_coe, ← this, ← Submodule.coeSubtype,
    span_image]
/-- If a submodule has maximal dimension in a finite dimensional space, then it is equal to the
whole space. -/
theorem _root_.Submodule.eq_top_of_finrank_eq [FiniteDimensional K V] {S : Submodule K V}
    (h : finrank K S = finrank K V) : S = ⊤ := by
  haveI : IsNoetherian K V := iff_fg.2 inferInstance
  set bS := Basis.ofVectorSpace K S with bS_eq
  have : LinearIndependent K ((↑) : ((↑) '' Basis.ofVectorSpaceIndex K S : Set V) → V) :=
    LinearIndependent.image_subtype (f := Submodule.subtype S)
      (by simpa using bS.linearIndependent) (by simp)
  set b := Basis.extend this with b_eq
  -- porting note: `letI` now uses `this` so we need to give different names
  letI i1 : Fintype (this.extend _) :=
    (finite_of_linearIndependent (by simpa using b.linearIndependent)).fintype
  letI i2 : Fintype (((↑) : S → V) '' Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent this).fintype
  letI i3 : Fintype (Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent (by simpa using bS.linearIndependent)).fintype
  have : (↑) '' Basis.ofVectorSpaceIndex K S = this.extend (Set.subset_univ _) :=
    Set.eq_of_subset_of_card_le (this.subset_extend _)
      (by
        rw [Set.card_image_of_injective _ Subtype.coe_injective, ← finrank_eq_card_basis bS, ←
            finrank_eq_card_basis b, h])
  rw [← b.span_eq, b_eq, Basis.coe_extend, Subtype.range_coe, ← this, ← Submodule.coeSubtype,
    span_image]
  

Proof state:
K : Type u
V : Type v
inst✝⁵ : DivisionRing K
inst✝⁴ : AddCommGroup V
inst✝³ : Module K V
V₂ : Type v'
inst✝² : AddCommGroup V₂
inst✝¹ : Module K V₂
inst✝ : FiniteDimensional K V
S : Submodule K V
h : finrank K ↥S = finrank K V
this✝¹ : IsNoetherian K V
bS : Basis (↑(Basis.ofVectorSpaceIndex K ↥S)) K ↥S := Basis.ofVectorSpace K ↥S
bS_eq : bS = Basis.ofVectorSpace K ↥S
this✝ : LinearIndependent (ι := { x // x ∈ Subtype.val '' Basis.ofVectorSpaceIndex K ↥S }) K Subtype.val
b : Basis (↑(LinearIndependent.extend this✝ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ))) K V :=
  Basis.extend this✝
b_eq : b = Basis.extend this✝
i1 : Fintype ↑(LinearIndependent.extend this✝ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)) :=
  Set.Finite.fintype
    (_ : Set.Finite (LinearIndependent.extend this✝ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)))
i2 : Fintype ↑(Subtype.val '' Basis.ofVectorSpaceIndex K ↥S) :=
  Set.Finite.fintype (_ : Set.Finite (Subtype.val '' Basis.ofVectorSpaceIndex K ↥S))
i3 : Fintype ↑(Basis.ofVectorSpaceIndex K ↥S) := Set.Finite.fintype (_ : Set.Finite (Basis.ofVectorSpaceIndex K ↥S))
this :
  Subtype.val '' Basis.ofVectorSpaceIndex K ↥S =
    LinearIndependent.extend this✝ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)
⊢ S = Submodule.map (Submodule.subtype S) (span K (Basis.ofVectorSpaceIndex K ↥S))

Next tactic:
have := bS.span_eq
/-- If a submodule has maximal dimension in a finite dimensional space, then it is equal to the
whole space. -/
theorem _root_.Submodule.eq_top_of_finrank_eq [FiniteDimensional K V] {S : Submodule K V}
    (h : finrank K S = finrank K V) : S = ⊤ := by
  haveI : IsNoetherian K V := iff_fg.2 inferInstance
  set bS := Basis.ofVectorSpace K S with bS_eq
  have : LinearIndependent K ((↑) : ((↑) '' Basis.ofVectorSpaceIndex K S : Set V) → V) :=
    LinearIndependent.image_subtype (f := Submodule.subtype S)
      (by simpa using bS.linearIndependent) (by simp)
  set b := Basis.extend this with b_eq
  -- porting note: `letI` now uses `this` so we need to give different names
  letI i1 : Fintype (this.extend _) :=
    (finite_of_linearIndependent (by simpa using b.linearIndependent)).fintype
  letI i2 : Fintype (((↑) : S → V) '' Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent this).fintype
  letI i3 : Fintype (Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent (by simpa using bS.linearIndependent)).fintype
  have : (↑) '' Basis.ofVectorSpaceIndex K S = this.extend (Set.subset_univ _) :=
    Set.eq_of_subset_of_card_le (this.subset_extend _)
      (by
        rw [Set.card_image_of_injective _ Subtype.coe_injective, ← finrank_eq_card_basis bS, ←
            finrank_eq_card_basis b, h])
  rw [← b.span_eq, b_eq, Basis.coe_extend, Subtype.range_coe, ← this, ← Submodule.coeSubtype,
    span_image]
  have := bS.span_eq
  

Proof state:
K : Type u
V : Type v
inst✝⁵ : DivisionRing K
inst✝⁴ : AddCommGroup V
inst✝³ : Module K V
V₂ : Type v'
inst✝² : AddCommGroup V₂
inst✝¹ : Module K V₂
inst✝ : FiniteDimensional K V
S : Submodule K V
h : finrank K ↥S = finrank K V
this✝² : IsNoetherian K V
bS : Basis (↑(Basis.ofVectorSpaceIndex K ↥S)) K ↥S := Basis.ofVectorSpace K ↥S
bS_eq : bS = Basis.ofVectorSpace K ↥S
this✝¹ : LinearIndependent (ι := { x // x ∈ Subtype.val '' Basis.ofVectorSpaceIndex K ↥S }) K Subtype.val
b : Basis (↑(LinearIndependent.extend this✝¹ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ))) K V :=
  Basis.extend this✝¹
b_eq : b = Basis.extend this✝¹
i1 : Fintype ↑(LinearIndependent.extend this✝¹ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)) :=
  Set.Finite.fintype
    (_ : Set.Finite (LinearIndependent.extend this✝¹ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)))
i2 : Fintype ↑(Subtype.val '' Basis.ofVectorSpaceIndex K ↥S) :=
  Set.Finite.fintype (_ : Set.Finite (Subtype.val '' Basis.ofVectorSpaceIndex K ↥S))
i3 : Fintype ↑(Basis.ofVectorSpaceIndex K ↥S) := Set.Finite.fintype (_ : Set.Finite (Basis.ofVectorSpaceIndex K ↥S))
this✝ :
  Subtype.val '' Basis.ofVectorSpaceIndex K ↥S =
    LinearIndependent.extend this✝¹ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)
this : span K (Set.range ⇑bS) = ⊤
⊢ S = Submodule.map (Submodule.subtype S) (span K (Basis.ofVectorSpaceIndex K ↥S))

Next tactic:
rw [bS_eq, Basis.coe_ofVectorSpace, Subtype.range_coe] at this
/-- If a submodule has maximal dimension in a finite dimensional space, then it is equal to the
whole space. -/
theorem _root_.Submodule.eq_top_of_finrank_eq [FiniteDimensional K V] {S : Submodule K V}
    (h : finrank K S = finrank K V) : S = ⊤ := by
  haveI : IsNoetherian K V := iff_fg.2 inferInstance
  set bS := Basis.ofVectorSpace K S with bS_eq
  have : LinearIndependent K ((↑) : ((↑) '' Basis.ofVectorSpaceIndex K S : Set V) → V) :=
    LinearIndependent.image_subtype (f := Submodule.subtype S)
      (by simpa using bS.linearIndependent) (by simp)
  set b := Basis.extend this with b_eq
  -- porting note: `letI` now uses `this` so we need to give different names
  letI i1 : Fintype (this.extend _) :=
    (finite_of_linearIndependent (by simpa using b.linearIndependent)).fintype
  letI i2 : Fintype (((↑) : S → V) '' Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent this).fintype
  letI i3 : Fintype (Basis.ofVectorSpaceIndex K S) :=
    (finite_of_linearIndependent (by simpa using bS.linearIndependent)).fintype
  have : (↑) '' Basis.ofVectorSpaceIndex K S = this.extend (Set.subset_univ _) :=
    Set.eq_of_subset_of_card_le (this.subset_extend _)
      (by
        rw [Set.card_image_of_injective _ Subtype.coe_injective, ← finrank_eq_card_basis bS, ←
            finrank_eq_card_basis b, h])
  rw [← b.span_eq, b_eq, Basis.coe_extend, Subtype.range_coe, ← this, ← Submodule.coeSubtype,
    span_image]
  have := bS.span_eq
  rw [bS_eq, Basis.coe_ofVectorSpace, Subtype.range_coe] at this
  

Proof state:
K : Type u
V : Type v
inst✝⁵ : DivisionRing K
inst✝⁴ : AddCommGroup V
inst✝³ : Module K V
V₂ : Type v'
inst✝² : AddCommGroup V₂
inst✝¹ : Module K V₂
inst✝ : FiniteDimensional K V
S : Submodule K V
h : finrank K ↥S = finrank K V
this✝² : IsNoetherian K V
bS : Basis (↑(Basis.ofVectorSpaceIndex K ↥S)) K ↥S := Basis.ofVectorSpace K ↥S
bS_eq : bS = Basis.ofVectorSpace K ↥S
this✝¹ : LinearIndependent (ι := { x // x ∈ Subtype.val '' Basis.ofVectorSpaceIndex K ↥S }) K Subtype.val
b : Basis (↑(LinearIndependent.extend this✝¹ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ))) K V :=
  Basis.extend this✝¹
b_eq : b = Basis.extend this✝¹
i1 : Fintype ↑(LinearIndependent.extend this✝¹ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)) :=
  Set.Finite.fintype
    (_ : Set.Finite (LinearIndependent.extend this✝¹ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)))
i2 : Fintype ↑(Subtype.val '' Basis.ofVectorSpaceIndex K ↥S) :=
  Set.Finite.fintype (_ : Set.Finite (Subtype.val '' Basis.ofVectorSpaceIndex K ↥S))
i3 : Fintype ↑(Basis.ofVectorSpaceIndex K ↥S) := Set.Finite.fintype (_ : Set.Finite (Basis.ofVectorSpaceIndex K ↥S))
this✝ :
  Subtype.val '' Basis.ofVectorSpaceIndex K ↥S =
    LinearIndependent.extend this✝¹ (_ : Subtype.val '' Basis.ofVectorSpaceIndex K ↥S ⊆ Set.univ)
this : span K (Basis.ofVectorSpaceIndex K ↥S) = ⊤
⊢ S = Submodule.map (Submodule.subtype S) (span K (Basis.ofVectorSpaceIndex K ↥S))

Next tactic:
rw [this, map_top (Submodule.subtype S), range_subtype]
instance finiteDimensional_self : FiniteDimensional K K := by 

Proof state:
K : Type u
V : Type v
inst✝⁴ : DivisionRing K
inst✝³ : AddCommGroup V
inst✝² : Module K V
V₂ : Type v'
inst✝¹ : AddCommGroup V₂
inst✝ : Module K V₂
⊢ FiniteDimensional K K

Next tactic:
infer_instance
/-- A slight strengthening of `exists_nontrivial_relation_sum_zero_of_rank_succ_lt_card`
available when working over an ordered field:
we can ensure a positive coefficient, not just a nonzero coefficient.
-/
theorem exists_relation_sum_zero_pos_coefficient_of_finrank_succ_lt_card [FiniteDimensional L W]
    {t : Finset W} (h : finrank L W + 1 < t.card) :
    ∃ f : W → L, ∑ e in t, f e • e = 0 ∧ ∑ e in t, f e = 0 ∧ ∃ x ∈ t, 0 < f x := by
  

Proof state:
K : Type u
V : Type v
inst✝⁸ : DivisionRing K
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module K V
V₂ : Type v'
inst✝⁵ : AddCommGroup V₂
inst✝⁴ : Module K V₂
L : Type u_1
inst✝³ : LinearOrderedField L
W : Type v
inst✝² : AddCommGroup W
inst✝¹ : Module L W
inst✝ : FiniteDimensional L W
t : Finset W
h : finrank L W + 1 < card t
⊢ ∃ f, ∑ e in t, f e • e = 0 ∧ ∑ e in t, f e = 0 ∧ ∃ x ∈ t, 0 < f x

Next tactic:
obtain ⟨f, sum, total, nonzero⟩ :=
    Module.exists_nontrivial_relation_sum_zero_of_finrank_succ_lt_card h
/-- A slight strengthening of `exists_nontrivial_relation_sum_zero_of_rank_succ_lt_card`
available when working over an ordered field:
we can ensure a positive coefficient, not just a nonzero coefficient.
-/
theorem exists_relation_sum_zero_pos_coefficient_of_finrank_succ_lt_card [FiniteDimensional L W]
    {t : Finset W} (h : finrank L W + 1 < t.card) :
    ∃ f : W → L, ∑ e in t, f e • e = 0 ∧ ∑ e in t, f e = 0 ∧ ∃ x ∈ t, 0 < f x := by
  obtain ⟨f, sum, total, nonzero⟩ :=
    Module.exists_nontrivial_relation_sum_zero_of_finrank_succ_lt_card h
  

Proof state:
case intro.intro.intro
K : Type u
V : Type v
inst✝⁸ : DivisionRing K
inst✝⁷ : AddCommGroup V
inst✝⁶ : Module K V
V₂ : Type v'
inst✝⁵ : AddCommGroup V₂
inst✝⁴ : Module K V₂
L : Type u_1
inst✝³ : LinearOrderedField L
W : Type v
inst✝² : AddCommGroup W
inst✝¹ : Module L W
inst✝ : FiniteDimensional L W
t : Finset W
h : finrank L W + 1 < card t
f : W → L
sum : ∑ e in t, f e • e = 0
total : ∑ e in t, f e = 0
nonzero : ∃ x ∈ t, f x ≠ 0
⊢ ∃ f, ∑ e in t, f e • e = 0 ∧ ∑ e in t, f e = 0 ∧ ∃ x ∈ t, 0 < f x

Next tactic:
exact ⟨f, sum, total, exists_pos_of_sum_zero_of_exists_nonzero f total nonzero⟩
/-- In a vector space with dimension 1, each set {v} is a basis for `v ≠ 0`. -/
@[simps repr_apply]
noncomputable def basisSingleton (ι : Type*) [Unique ι] (h : finrank K V = 1) (v : V)
    (hv : v ≠ 0) : Basis ι K V :=
  let b := FiniteDimensional.basisUnique ι h
  let h : b.repr v default ≠ 0 := mt FiniteDimensional.basisUnique_repr_eq_zero_iff.mp hv
  Basis.ofRepr
    { toFun := fun w => Finsupp.single default (b.repr w default / b.repr v default)
      invFun := fun f => f default • v
      map_add' := by 

Proof state:
K : Type u
V : Type v
inst✝⁵ : DivisionRing K
inst✝⁴ : AddCommGroup V
inst✝³ : Module K V
V₂ : Type v'
inst✝² : AddCommGroup V₂
inst✝¹ : Module K V₂
ι : Type u_1
inst✝ : Unique ι
h✝ : finrank K V = 1
v : V
hv : v ≠ 0
b : Basis ι K V := basisUnique ι h✝
h : (b.repr v) default ≠ 0 := mt basisUnique_repr_eq_zero_iff.mp hv
⊢ ∀ (x y : V),
    (fun w => fun₀ | default => (b.repr w) default / (b.repr v) default) (x + y) =
      (fun w => fun₀ | default => (b.repr w) default / (b.repr v) default) x +
        (fun w => fun₀ | default => (b.repr w) default / (b.repr v) default) y

Next tactic:
simp [add_div]
/-- In a vector space with dimension 1, each set {v} is a basis for `v ≠ 0`. -/
@[simps repr_apply]
noncomputable def basisSingleton (ι : Type*) [Unique ι] (h : finrank K V = 1) (v : V)
    (hv : v ≠ 0) : Basis ι K V :=
  let b := FiniteDimensional.basisUnique ι h
  let h : b.repr v default ≠ 0 := mt FiniteDimensional.basisUnique_repr_eq_zero_iff.mp hv
  Basis.ofRepr
    { toFun := fun w => Finsupp.single default (b.repr w default / b.repr v default)
      invFun := fun f => f default • v
      map_add' := by simp [add_div]
      map_smul' := by 

Proof state:
K : Type u
V : Type v
inst✝⁵ : DivisionRing K
inst✝⁴ : AddCommGroup V
inst✝³ : Module K V
V₂ : Type v'
inst✝² : AddCommGroup V₂
inst✝¹ : Module K V₂
ι : Type u_1
inst✝ : Unique ι
h✝ : finrank K V = 1
v : V
hv : v ≠ 0
b : Basis ι K V := basisUnique ι h✝
h : (b.repr v) default ≠ 0 := mt basisUnique_repr_eq_zero_iff.mp hv
⊢ ∀ (r : K) (x : V),
    AddHom.toFun
        { toFun := fun w => fun₀ | default => (b.repr w) default / (b.repr v) default,
          map_add' :=
            (_ :
              ∀ (a a_1 : V),
                (fun₀ | default => ((basisUnique ι h✝).repr (a + a_1)) default / ((basisUnique ι h✝).repr v) default) =
                  (fun₀ | default => ((basisUnique ι h✝).repr a) default / ((basisUnique ι h✝).repr v) default) +
                    fun₀ | default => ((basisUnique ι h✝).repr a_1) default / ((basisUnique ι h✝).repr v) default) }
        (r • x) =
      (RingHom.id K) r •
        AddHom.toFun
          { toFun := fun w => fun₀ | default => (b.repr w) default / (b.repr v) default,
            map_add' :=
              (_ :
                ∀ (a a_1 : V),
                  (fun₀
                      | default => ((basisUnique ι h✝).repr (a + a_1)) default / ((basisUnique ι h✝).repr v) default) =
                    (fun₀ | default => ((basisUnique ι h✝).repr a) default / ((basisUnique ι h✝).repr v) default) +
                      fun₀ | default => ((basisUnique ι h✝).repr a_1) default / ((basisUnique ι h✝).repr v) default) }
          x

Next tactic:
simp [mul_div]