Zulip Chat Archive

Stream: new members

Topic: Show the basis vectors of R^n sum to R^n


Arien Malec (May 17 2024 at 23:11):

It's been a while, but I'm working on Axler's LADL in Lean done natively in Mathlib (that is, using the actual Mathlib structures and proofs rather than recreating Axler's definitions).

I did a tour of MiL, then completed the proof that Axler's direct sum and Mathlib's notion of modeling \sup + IsCompl are equivalent.

Now we have the very basic notion that the canonical basis of R^n sums to R^n(in Axler's terms, the direct sum across all the subspaces formed form the span of each of the canonical vectors of R^n is R^n).

I see docs#Pi.basisFun ...

Arien Malec (May 17 2024 at 23:23):

There should probably have been a question: What's the Mathlib setup or statement to prove that the sum of all the submodules formed from the individual canonical basis vectors are \top (I guess).

Richard Copley (May 17 2024 at 23:26):

Do you mean like this?

import Mathlib.LinearAlgebra.StdBasis
import Mathlib.Data.Real.Basic

example (n : ) : Submodule.span  (Set.range (Pi.basisFun  (Fin n))) =  :=
  (Pi.basisFun  (Fin n)).span_eq

Richard Copley (May 17 2024 at 23:39):

Or this?

import Mathlib.LinearAlgebra.StdBasis
import Mathlib.Data.Real.Basic

example (n : ) : ( i,   (Pi.basisFun  (Fin n) i)) =  := by
  sorry

(R ∙ x is short for span R (singleton x); see docs#mem_span_singleton etc.)

Arien Malec (May 17 2024 at 23:58):

Perfect!

Arien Malec (May 18 2024 at 14:54):

Any hints for proving the last one?

Arien Malec (May 18 2024 at 15:04):

Obviously the first is the more natural formulation, but the second seems like it reveals better what's going on "under the covers".

Arien Malec (May 18 2024 at 15:40):

I think rw [← Submodule.span_range_eq_iSup] gets me close to the first form?

Arien Malec (May 18 2024 at 16:12):

Got it but had do do This One Weird Trick

import Mathlib.LinearAlgebra.StdBasis
import Mathlib.Data.Real.Basic

example (n : ) : ( i,   (Pi.basisFun  (Fin n) i)) =  := by
  rw [ Submodule.span_range_eq_iSup]
  have : (fun i => (Pi.basisFun  (Fin n)) i) = (Pi.basisFun  (Fin n)) := by rw [@DFunLike.coe_fn_eq]
  rw [this, (Pi.basisFun  (Fin n)).span_eq]

Arien Malec (May 18 2024 at 16:38):

Slightly Less Weird Trick

example (n : ) : ( i,   (Pi.basisFun  (Fin n) i)) =  := by
  rw [ Submodule.span_range_eq_iSup]
  simp only [DFunLike.coe_fn_eq, (Pi.basisFun  (Fin n)).span_eq]

Arien Malec (May 18 2024 at 16:47):

No tricks:

example (n : ) : ( i, F  (Pi.basisFun  (Fin n) i)) =  := by
  simp only [ Submodule.span_range_eq_iSup, (Pi.basisFun  (Fin n)).span_eq]

So the simp machinery knows how to handle the conversion in the background while rw doesn't?

Andrew Yang (May 18 2024 at 17:44):

There are cases involving dependent types where simp is stronger than rw, but I think in this case they both work?

import Mathlib.LinearAlgebra.StdBasis
import Mathlib.Data.Real.Basic

example (n : ) : ( i,   (Pi.basisFun  (Fin n) i)) =  := by
  rw [ Submodule.span_range_eq_iSup, (Pi.basisFun  (Fin n)).span_eq]

Arien Malec (May 18 2024 at 22:54):

So it does! I was trying to get the conversion to work and that wasn't working cleanly in rw without the hoops.

Arien Malec (May 18 2024 at 23:00):

Richard Copley said:

Or this?

import Mathlib.LinearAlgebra.StdBasis
import Mathlib.Data.Real.Basic

example (n : ) : ( i,   (Pi.basisFun  (Fin n) i)) =  := by
  sorry

(R ∙ x is short for span R (singleton x); see docs#mem_span_singleton etc.)

What dot is this? It's not \cdot or \smul

Arien Malec (May 18 2024 at 23:02):

I can't seem to get VS Code to tell me.

Arien Malec (May 18 2024 at 23:07):

Sometimes Unicode notation is great, sometimes:

  /- Note that the character `∙` U+2219 used below is different from the scalar multiplication
character `•` U+2022. -/
R " ∙ " x => span R (singleton x)

Kevin Buzzard (May 19 2024 at 00:16):

Indeed it's not in the VS Code list of abbreviations https://github.com/leanprover/vscode-lean/blob/master/src/abbreviation/abbreviations.json . Make a PR! You'll have to think of a good abbreviation for it :-)

Arien Malec (May 19 2024 at 00:40):

'\span'?

Kevin Buzzard (May 19 2024 at 00:44):

Looks good -- right now we have \spadesuit but nothing matching span.

Arien Malec (May 19 2024 at 15:10):

PR #447 to https://github.com/leanprover/vscode-lean4

I'll create a PR for Mathlib/LinearAlgebra/Span.lean itself, which has incorrect docu

Arien Malec (May 19 2024 at 18:05):

mathlib4#13039


Last updated: May 02 2025 at 03:31 UTC