Zulip Chat Archive

Stream: Is there code for X?

Topic: linear combination is in span


Vasily Ilin (Jul 01 2022 at 06:49):

It seems that this should be an existing theorem but I can't find it. docs#mem_span_finset seems relevant but I'm not sure how to use it, since I don't have a finset but set.range v instead.

import tactic
import linear_algebra.basis
import data.real.basic
import data.complex.basic
import data.complex.module
import data.matrix.notation

open_locale big_operators

example (n : ) (w : V) (v : fin n  V) (coeff : fin n  k) (w =  i : fin n, (coeff i  v i)) : w  submodule.span k (set.range v) :=

Eric Wieser (Jul 01 2022 at 07:04):

That ought to be straightforward via rw H, apply sum_mem, intro i, apply subset_span

Eric Wieser (Jul 01 2022 at 07:04):

docs#submodule.subset_span

Nikolas Kuhn (Jul 01 2022 at 21:58):

One could even make this into an if and only if :)

Eric Wieser (Jul 01 2022 at 22:39):

What statement are you thinking of?

Nikolas Kuhn (Jul 01 2022 at 23:35):

There are mem_span_iff_total and span_image_eq_map_total in docs#linear_algebra.finsupp which should pretty much do the job.

Jon Eugster (Nov 07 2022 at 11:04):

To take this up again, does anybody know some nice code to express an element in span as some sort of sum ? For example something like

lemma mem_span_iff_sum_coeff {v : V} {n : } {b : fin n  V} :
  v  span R (set.range b)   (coef : fin n  R), v =  i, (coef i)  (b i) :=
sorry

MWE preample

Backwards direction is okay (as above, although I don't get @Eric Wieser 's suggestion with sum_mem to work), but in the forward direction I'm getting hung up on different finiteness options (fin n → vs →₀, vs ∑ᶠ vs finsupp.total and similar stuff)

The main application for me is to show that some sets of vectors are generating a vector space (maybe there's a better way to do that, too?) :

example :   span  (set.range ![![(1: ), 0], ![1, 1]]) :=
begin
  intros v hv,
  rw mem_span_iff_sum_coeff,
  use ![v 0 - v 1, v 1],
  simp,
  funext i,
  fin_cases i;
  simp,
end

Jujian Zhang (Nov 07 2022 at 12:39):

Try span.repr https://leanprover-community.github.io/mathlib_docs/linear_algebra/finsupp.html#span.repr

Jujian Zhang (Nov 07 2022 at 12:43):

or maybe submodule.mem_span_finset https://leanprover-community.github.io/mathlib_docs/linear_algebra/finsupp.html#mem_span_finset

Eric Wieser (Nov 07 2022 at 13:39):

I would guess that you want to use docs#submodule.span_range_eq_supr

Jon Eugster (Nov 07 2022 at 18:07):

Thanks for the help, both of you! I ended up using mainly mem_span_iff_total, and with a bit more knowledge of how fin n and finset play together (which I don't have), your suggestions seem very useful, too.

MWE

Eric Wieser (Nov 08 2022 at 00:31):

docs#finsupp.range_total seems to be the really useful lemma here


Last updated: Dec 20 2023 at 11:08 UTC