Zulip Chat Archive

Stream: Is there code for X?

Topic: Trace of linear maps on EuclideanSpace


Ivรกn Renison (May 23 2025 at 14:19):

Hi, do we have something like this?

import Mathlib.Analysis.InnerProductSpace.PiL2

variable {ฮน ๐•œ : Type*} [RCLike ๐•œ]
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ๐•œ E]
variable [Fintype ฮน]

lemma aux : โˆƒs : Finset (EuclideanSpace ๐•œ ฮน), Nonempty (Basis { x // x โˆˆ s } ๐•œ (EuclideanSpace ๐•œ ฮน)) :=
  sorry

I so there are some things about bases of the EuclideanSpace, but not proving that in particular.

The reason for witch I want this is to work with the trace of a linear mal of type EuclideanSpace ๐•œ ฮน โ†’โ‚—[๐•œ] EuclideanSpace ๐•œ ฮน, because the definition of LinearMap.trace makes cases with that existential
In particular I'm working with ฮน = Fin 2 and I want to prove the traces of concrete linear maps, so if you have any suggestions for that they are welcome

Aaron Liu (May 23 2025 at 14:26):

import Mathlib.Analysis.InnerProductSpace.PiL2

noncomputable example {ฮน ๐•œ : Type*} [RCLike ๐•œ] [Fintype ฮน] : Basis ฮน ๐•œ (EuclideanSpace ๐•œ ฮน) :=
  PiLp.basisFun 2 ๐•œ ฮน

Ivรกn Renison (May 23 2025 at 14:42):

And how would you prove the โˆƒ using that? I have not being able

Eric Wieser (May 23 2025 at 14:47):

Why do you need the exists?

Eric Wieser (May 23 2025 at 14:47):

(the answer is going to be something like Finset.univ.image theBasisAaronPosted as the witness)

Ivรกn Renison (May 23 2025 at 14:57):

Here is a simplified version of what I'm, trying to prove:

import Mathlib

section outerProduct

variable (๐•œ : Type*) {E : Type*} [RCLike ๐•œ]
variable [NormedAddCommGroup E] [InnerProductSpace ๐•œ E] [FiniteDimensional ๐•œ E]

/-- The outer product of two vectors -/
def outerProduct (x : E) (y : E) : E โ†’โ‚—[๐•œ] E where
  toFun := fun z => (inner ๐•œ y z) โ€ข x
  map_add' z w := by
    rw [โ† Module.add_smul, inner_add_right y z w]
  map_smul' m z := by
    rw [RingHom.id_apply, inner_smul_right_eq_smul y z m]
    exact IsScalarTower.smul_assoc m (inner ๐•œ y z) x

end outerProduct

variable {๐•œ : Type*} [RCLike ๐•œ]
local notation "๐•œยฒ" => EuclideanSpace ๐•œ (Fin 2)

def ket0 : ๐•œยฒ := !โ‚‚[1, 0]
def ketbra0 : ๐•œยฒ โ†’โ‚—[๐•œ] ๐•œยฒ := outerProduct ๐•œ ket0 ket0

example : LinearMap.trace ๐•œ ๐•œยฒ ketbra0 = 1 :=
  sorry

So I what to somehow unfold thing, and the โˆƒ is in an if in LinearMap.trace

Ivรกn Renison (May 23 2025 at 14:57):

I can use Finset.univ.image (PiLp.basisFun 2 ๐•œ ฮน), but then I'm not able to prove that that set satisfies the โˆƒ

Eric Wieser (May 23 2025 at 15:15):

You shouldn't care that the exists is in there

Eric Wieser (May 23 2025 at 15:15):

There should be a theorem that you can use instead

Eric Wieser (May 23 2025 at 15:15):

@loogle LinearMap.trace, Basis

loogle (May 23 2025 at 15:15):

:search: LinearMap.trace.eq_1, LinearMap.trace_eq_matrix_trace, and 3 more

Eric Wieser (May 23 2025 at 15:15):

It's the second one

Ivรกn Renison (May 23 2025 at 15:40):

Ok, thanks


Last updated: Dec 20 2025 at 21:32 UTC