Documentation

Mathlib.LinearAlgebra.Finsupp.LinearCombination

Finsupp.linearCombination #

Main definitions #

Tags #

function with finite support, module, linear algebra

def Finsupp.linearCombination {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] (v : αM) :
(α →₀ R) →ₗ[R] M

Interprets (l : α →₀ R) as a linear combination of the elements in the family (v : α → M) and evaluates this linear combination.

Equations
theorem Finsupp.linearCombination_apply {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} (l : α →₀ R) :
(linearCombination R v) l = l.sum fun (i : α) (a : R) => a v i
theorem Finsupp.linearCombination_apply_of_mem_supported {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} {l : α →₀ R} {s : Finset α} (hs : l supported R R s) :
(linearCombination R v) l = is, l i v i
@[simp]
theorem Finsupp.linearCombination_single {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} (c : R) (a : α) :
(linearCombination R v) (single a c) = c v a
theorem Finsupp.linearCombination_zero_apply {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] (x : α →₀ R) :
@[simp]
theorem Finsupp.linearCombination_zero (α : Type u_1) (M : Type u_2) (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] :
@[simp]
theorem Finsupp.linearCombination_single_index (α : Type u_1) (M : Type u_2) (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] (c : M) (a : α) (f : α →₀ R) [DecidableEq α] :
(linearCombination R (Pi.single a c)) f = f a c
theorem Finsupp.linearCombination_linear_comp {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {M' : Type u_8} [AddCommMonoid M'] [Module R M'] {v : αM} (f : M →ₗ[R] M') :
theorem Finsupp.apply_linearCombination {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {M' : Type u_8} [AddCommMonoid M'] [Module R M'] (f : M →ₗ[R] M') (v : αM) (l : α →₀ R) :
f ((linearCombination R v) l) = (linearCombination R (f v)) l
theorem Finsupp.apply_linearCombination_id {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {M' : Type u_8} [AddCommMonoid M'] [Module R M'] (f : M →ₗ[R] M') (l : M →₀ R) :
theorem Finsupp.linearCombination_unique {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] [Unique α] (l : α →₀ R) (v : αM) :
theorem Finsupp.linearCombination_surjective {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} (h : Function.Surjective v) :
theorem Finsupp.linearCombination_range {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} (h : Function.Surjective v) :

Any module is a quotient of a free module. This is stated as surjectivity of Finsupp.linearCombination R id : (M →₀ R) →ₗ[R] M.

theorem Finsupp.range_linearCombination {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} :
theorem Finsupp.lmapDomain_linearCombination {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {α' : Type u_7} {M' : Type u_8} [AddCommMonoid M'] [Module R M'] {v : αM} {v' : α'M'} (f : αα') (g : M →ₗ[R] M') (h : ∀ (i : α), g (v i) = v' (f i)) :
theorem Finsupp.linearCombination_comp_lmapDomain {α : Type u_1} (R : Type u_5) [Semiring R] {α' : Type u_7} {M' : Type u_8} [AddCommMonoid M'] [Module R M'] {v' : α'M'} (f : αα') :
@[simp]
theorem Finsupp.linearCombination_embDomain {α : Type u_1} (R : Type u_5) [Semiring R] {α' : Type u_7} {M' : Type u_8} [AddCommMonoid M'] [Module R M'] {v' : α'M'} (f : α α') (l : α →₀ R) :
(linearCombination R v') (embDomain f l) = (linearCombination R (v' f)) l
@[simp]
theorem Finsupp.linearCombination_mapDomain {α : Type u_1} (R : Type u_5) [Semiring R] {α' : Type u_7} {M' : Type u_8} [AddCommMonoid M'] [Module R M'] {v' : α'M'} (f : αα') (l : α →₀ R) :
@[simp]
theorem Finsupp.linearCombination_equivMapDomain {α : Type u_1} (R : Type u_5) [Semiring R] {α' : Type u_7} {M' : Type u_8} [AddCommMonoid M'] [Module R M'] {v' : α'M'} (f : α α') (l : α →₀ R) :

A version of Finsupp.range_linearCombination which is useful for going in the other direction

theorem Finsupp.mem_span_iff_linearCombination {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] (s : Set M) (x : M) :
x Submodule.span R s ∃ (l : s →₀ R), (linearCombination R Subtype.val) l = x
theorem Finsupp.mem_span_range_iff_exists_finsupp {α : Type u_1} {M : Type u_2} {R : Type u_5} [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} {x : M} :
x Submodule.span R (Set.range v) ∃ (c : α →₀ R), (c.sum fun (i : α) (a : R) => a v i) = x
theorem Finsupp.span_image_eq_map_linearCombination {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} (s : Set α) :
theorem Finsupp.mem_span_image_iff_linearCombination {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} {s : Set α} {x : M} :
x Submodule.span R (v '' s) lsupported R R s, (linearCombination R v) l = x
theorem Finsupp.linearCombination_option {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] (v : Option αM) (f : Option α →₀ R) :
theorem Finsupp.linearCombination_linearCombination {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {α : Type u_9} {β : Type u_10} (A : αM) (B : βα →₀ R) (f : β →₀ R) :
(linearCombination R A) ((linearCombination R B) f) = (linearCombination R fun (b : β) => (linearCombination R A) (B b)) f
theorem Finsupp.linearCombination_smul {α : Type u_1} {M : Type u_2} (R : Type u_5) {S : Type u_6} [Semiring R] [Semiring S] [AddCommMonoid M] [Module R M] {α' : Type u_7} {v : αM} [Module R S] [Module S M] [IsScalarTower R S M] {w : α'S} :
@[simp]
theorem Finsupp.linearCombination_fin_zero {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] (f : Fin 0M) :
def Finsupp.linearCombinationOn (α : Type u_1) (M : Type u_2) (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] (v : αM) (s : Set α) :
(supported R R s) →ₗ[R] (Submodule.span R (v '' s))

Finsupp.linearCombinationOn M v s interprets p : α →₀ R as a linear combination of a subset of the vectors in v, mapping it to the span of those vectors.

The subset is indicated by a set s : Set α of indices.

Equations
theorem Finsupp.linearCombinationOn_range {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} (s : Set α) :
theorem Finsupp.linearCombination_restrict {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} (s : Set α) :
theorem Finsupp.linearCombination_comp {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {α' : Type u_7} {v : αM} (f : α'α) :
theorem Finsupp.linearCombination_comapDomain {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {α' : Type u_7} {v : αM} (f : αα') (l : α' →₀ R) (hf : Set.InjOn f (f ⁻¹' l.support)) :
(linearCombination R v) (comapDomain f l hf) = il.support.preimage f hf, l (f i) v i
theorem Finsupp.linearCombination_onFinset {α : Type u_1} {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] {s : Finset α} {f : αR} (g : αM) (hf : ∀ (a : α), f a 0a s) :
(linearCombination R g) (onFinset s f hf) = xs, f x g x
def Finsupp.bilinearCombination {α : Type u_1} {M : Type u_2} (R : Type u_5) (S : Type u_6) [Semiring R] [Semiring S] [AddCommMonoid M] [Module R M] [Module S M] [SMulCommClass R S M] :
(αM) →ₗ[S] (α →₀ R) →ₗ[R] M

Finsupp.bilinearCombination R S v f is the linear combination of vectors in v with weights in f, as a bilinear map of v and f. In the absence of SMulCommClass R S M, use Finsupp.linearCombination.

See note [bundled maps over different rings] for why separate R and S semirings are used.

Equations
@[simp]
theorem Finsupp.bilinearCombination_apply {α : Type u_1} {M : Type u_2} (R : Type u_5) {S : Type u_6} [Semiring R] [Semiring S] [AddCommMonoid M] [Module R M] {v : αM} [Module S M] [SMulCommClass R S M] :
def Fintype.linearCombination {α : Type u_1} {M : Type u_2} (R : Type u_3) [Fintype α] [Semiring R] [AddCommMonoid M] [Module R M] (v : αM) :
(αR) →ₗ[R] M

Fintype.linearCombination R v f is the linear combination of vectors in v with weights in f. This variant of Finsupp.linearCombination is defined on fintype indexed vectors.

This map is linear in v if R is commutative, and always linear in f. See note [bundled maps over different rings] for why separate R and S semirings are used.

Equations
theorem Fintype.linearCombination_apply {α : Type u_1} {M : Type u_2} (R : Type u_3) [Fintype α] [Semiring R] [AddCommMonoid M] [Module R M] (v : αM) (f : αR) :
(Fintype.linearCombination R v) f = i : α, f i v i
@[simp]
theorem Fintype.linearCombination_apply_single {α : Type u_1} {M : Type u_2} (R : Type u_3) [Fintype α] [Semiring R] [AddCommMonoid M] [Module R M] (v : αM) [DecidableEq α] (i : α) (r : R) :
theorem Finsupp.linearCombination_eq_fintype_linearCombination_apply {α : Type u_1} {M : Type u_2} (R : Type u_3) [Fintype α] [Semiring R] [AddCommMonoid M] [Module R M] (v : αM) (x : αR) :
@[simp]
theorem Fintype.range_linearCombination {α : Type u_1} {M : Type u_2} (R : Type u_3) [Fintype α] [Semiring R] [AddCommMonoid M] [Module R M] (v : αM) :
def Fintype.bilinearCombination {α : Type u_1} {M : Type u_2} (R : Type u_3) [Fintype α] [Semiring R] [AddCommMonoid M] [Module R M] (S : Type u_4) [Semiring S] [Module S M] [SMulCommClass R S M] :
(αM) →ₗ[S] (αR) →ₗ[R] M

Fintype.bilinearCombination R S v f is the linear combination of vectors in v with weights in f. This variant of Finsupp.linearCombination is defined on fintype indexed vectors.

This map is linear in v if R is commutative, and always linear in f. See note [bundled maps over different rings] for why separate R and S semirings are used.

Equations
@[simp]
theorem Fintype.bilinearCombination_apply {α : Type u_1} {M : Type u_2} (R : Type u_3) [Fintype α] [Semiring R] [AddCommMonoid M] [Module R M] {S : Type u_4} [Semiring S] [Module S M] [SMulCommClass R S M] (v : αM) :
theorem Fintype.bilinearCombination_apply_single {α : Type u_1} {M : Type u_2} (R : Type u_3) [Fintype α] [Semiring R] [AddCommMonoid M] [Module R M] {S : Type u_4} [Semiring S] [Module S M] [SMulCommClass R S M] (v : αM) [DecidableEq α] (i : α) (r : R) :
theorem Submodule.mem_span_range_iff_exists_fun {α : Type u_1} {M : Type u_2} (R : Type u_3) [Fintype α] [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} {x : M} :
x span R (Set.range v) ∃ (c : αR), i : α, c i v i = x

An element x lies in the span of v iff it can be written as sum ∑ cᵢ • vᵢ = x.

theorem Submodule.top_le_span_range_iff_forall_exists_fun {α : Type u_1} {M : Type u_2} (R : Type u_3) [Fintype α] [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} :
span R (Set.range v) ∀ (x : M), ∃ (c : αR), i : α, c i v i = x

A family v : α → V is generating V iff every element (x : V) can be written as sum ∑ cᵢ • vᵢ = x.

theorem Submodule.mem_span_image_iff_exists_fun {α : Type u_1} {M : Type u_2} (R : Type u_3) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} {x : M} {s : Set α} :
x span R (v '' s) ∃ (t : Finset α), t s ∃ (c : { x : α // x t }R), i : { x : α // x t }, c i v i = x
theorem Fintype.mem_span_image_iff_exists_fun {α : Type u_1} {M : Type u_2} (R : Type u_3) [Semiring R] [AddCommMonoid M] [Module R M] {v : αM} {x : M} {s : Set α} [Fintype s] :
x Submodule.span R (v '' s) ∃ (c : sR), i : s, c i v i = x
@[irreducible]
def Span.repr (R : Type u_4) {M : Type u_5} [Semiring R] [AddCommMonoid M] [Module R M] (w : Set M) (x : (Submodule.span R w)) :
w →₀ R

Pick some representation of x : span R w as a linear combination in w, ((Finsupp.mem_span_iff_linearCombination _ _ _).mp x.2).choose

Equations
theorem Span.repr_def (R : Type u_4) {M : Type u_5} [Semiring R] [AddCommMonoid M] [Module R M] (w : Set M) (x : (Submodule.span R w)) :
repr R w x = .choose
@[simp]
theorem Span.finsupp_linearCombination_repr (R : Type u_1) {M : Type u_2} [Semiring R] [AddCommMonoid M] [Module R M] {w : Set M} (x : (Submodule.span R w)) :
theorem LinearMap.map_finsupp_linearCombination {R : Type u_1} {M : Type u_2} {N : Type u_3} [Semiring R] [AddCommMonoid M] [Module R M] [AddCommMonoid N] [Module R N] (f : M →ₗ[R] N) {ι : Type u_4} {g : ιM} (l : ι →₀ R) :
theorem Submodule.mem_span_iff_exists_finset_subset {R : Type u_1} {M : Type u_2} [Semiring R] [AddCommMonoid M] [Module R M] {s : Set M} {x : M} :
x span R s ∃ (f : MR) (t : Finset M), t s Function.support f t at, f a a = x
theorem Submodule.mem_span_finset {R : Type u_1} {M : Type u_2} [Semiring R] [AddCommMonoid M] [Module R M] {s : Finset M} {x : M} :
x span R s ∃ (f : MR), Function.support f s as, f a a = x
theorem Submodule.mem_span_set {R : Type u_1} {M : Type u_2} [Semiring R] [AddCommMonoid M] [Module R M] {m : M} {s : Set M} :
m span R s ∃ (c : M →₀ R), c.support s (c.sum fun (mi : M) (r : R) => r mi) = m

An element m ∈ M is contained in the R-submodule spanned by a set s ⊆ M, if and only if m can be written as a finite R-linear combination of elements of s. The implementation uses Finsupp.sum.

theorem Submodule.mem_span_set' {R : Type u_1} {M : Type u_2} [Semiring R] [AddCommMonoid M] [Module R M] {m : M} {s : Set M} :
m span R s ∃ (n : ) (f : Fin nR) (g : Fin ns), i : Fin n, f i (g i) = m

An element m ∈ M is contained in the R-submodule spanned by a set s ⊆ M, if and only if m can be written as a finite R-linear combination of elements of s. The implementation uses a sum indexed by Fin n for some n.

theorem Submodule.span_eq_iUnion_nat {R : Type u_1} {M : Type u_2} [Semiring R] [AddCommMonoid M] [Module R M] (s : Set M) :
(span R s) = ⋃ (n : ), (fun (f : Fin nR × M) => i : Fin n, (f i).1 (f i).2) '' {f : Fin nR × M | ∀ (i : Fin n), (f i).2 s}

The span of a subset s is the union over all n of the set of linear combinations of at most n terms belonging to s.

def Finsupp.addSingleEquiv {R : Type u_4} {ι : Type u_6} [Ring R] (i : ι) (c : ιR) (h₀ : c i = 0) :
(ι →₀ R) ≃ₗ[R] ι →₀ R

Given c : ι → R and an index i such that c i = 0, this is the linear isomorphism sending the j-th standard basis vector to itself plus c j multiplied with the i-th standard basis vector (in particular, the i-th standard basis vector is kept invariant).

Equations
  • One or more equations did not get rendered due to their size.
theorem Finsupp.linearCombination_comp_addSingleEquiv {R : Type u_4} {M : Type u_5} {ι : Type u_6} [Ring R] [AddCommGroup M] [Module R M] (i : ι) (c : ιR) (h₀ : c i = 0) (v : ιM) :
linearCombination R v ∘ₗ (addSingleEquiv i c h₀) = linearCombination R (v + fun (x : ι) => c x v i)