Zulip Chat Archive

Stream: new members

Topic: matrix about smul


Hbz (Aug 09 2025 at 14:58):

import Mathlib

open Matrix

theorem eigenvectors_linear_independent {k : Type*} [Field k]
    {n : } (A : Matrix (Fin n) (Fin n) k)
    {m : } (f : Fin m  k) (v : Fin m  Fin n  k)
    (distinct :  i j, i  j  f i  f j)
    (eigen :  i, A.mulVec (v i) = f i  v i)
    (nonzero :  i, v i  0) :
    LinearIndependent k (v : Fin m  (Fin n  k)) := by
  rw[linearIndependent_iff']
  intro s g h
  induction' m with d hd
  · simp
  ·
    intro i
    intro hi
    specialize eigen i
    have h1 :  i, f i  g i  v i = 0 := by
      have h10 : A.mulVec (g i  v i) = g i  (A.mulVec (v i)) := by exact Matrix.mulVec_smul A (g i) (v i)
      have hh1 : A.mulVec (g i  v i) = f i  g i  v i := by
        rw[h10]
        rw[eigen]
        exact smul_comm (g i) (f i) (v i)
      have h11 : A.mulVec ( i, g i  v i) =  i, A.mulVec (g i  v i):= by
        sorry
      sorry
    sorry
#check map_sum

I don't know how to complete the proof of \( A.mulVec \left( \sum_i g_i \cdot v_i \right) = \sum_i A.mulVec \left( g_i \cdot v_i \right) \). Should I use additive group homomorphisms? (I'm not really sure how to use them.) Or is there another method?

Kenny Lau (Aug 09 2025 at 15:51):

can you minimize it to be one lemma with sorry?

Kenny Lau (Aug 09 2025 at 15:51):

#mwe

Eric Wieser (Aug 09 2025 at 16:07):

I have an open PR, #28130, with a missing lemma about mulVec and smul

Hbz (Aug 10 2025 at 02:33):

Kenny Lau said:

can you minimize it to be one lemma with sorry?

lemma mulVec_sum {k : Type*} [Field k] {n : } {m : } (A : Matrix (Fin n) (Fin n) k)
  (g : Fin m  k) (v : Fin m  Fin n  k):
  A.mulVec ( i, g i  v i) =  i, A.mulVec (g i  v i) := by
  sorry

Aaron Liu (Aug 10 2025 at 02:40):

import Mathlib

lemma mulVec_sum {k : Type*} [Field k] {n : } {m : } (A : Matrix (Fin n) (Fin n) k)
    (g : Fin m  k) (v : Fin m  Fin n  k):
    A.mulVec ( i, g i  v i) =  i, A.mulVec (g i  v i) := by
  rw [ Matrix.coe_mulVecLin, map_sum]

Aaron Liu (Aug 10 2025 at 02:41):

the trick is to convert it to a linear map, which distributes over sums

Hbz (Aug 10 2025 at 02:47):

Ah, right! I remember now. I always forget that in Lean 4, matrix operations should be converted to linear map operations. Thank you very much! :+1:

Eric Wieser (Aug 10 2025 at 08:31):

This lemma (after sufficient generalization) should probably be in mathlib

Wuyang (Aug 10 2025 at 20:03):

turning mulVec into a linear map makes it much easier to apply map_sum.
You can also explore similar lemmas in LeanFinder (www.leanfinder.org).

Wuyang (Aug 10 2025 at 20:03):

(deleted)

leanfinder (Aug 10 2025 at 20:03):

Failure! Bot is unavailable

Wuyang (Aug 10 2025 at 20:05):

@leanfinder Lean 4 proof that mulVec distributes over sums by converting to linear map and using map_sum

leanfinder (Aug 10 2025 at 20:05):

Here’s what I found:


Last updated: Dec 20 2025 at 21:32 UTC