Documentation

Mathlib.LinearAlgebra.Finsupp.LinearCombination

Finsupp.linearCombination #

Main definitions #

Tags #

function with finite support, module, linear algebra

noncomputable 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
Instances For
    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 = ∑ i ∈ s, 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) ↔ ∃ l ∈ supported 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} :
    (linearCombination R fun (i : α × α') => w i.2 • v i.1) = ↑R (linearCombination S v) ∘ₗ mapRange.linearMap (linearCombination R w) ∘ₗ ↑(curryLinearEquiv R)
    @[simp]
    theorem Finsupp.linearCombination_fin_zero {M : Type u_2} (R : Type u_5) [Semiring R] [AddCommMonoid M] [Module R M] (f : Fin 0 → M) :
    noncomputable 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
    Instances For
      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) = ∑ i ∈ l.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 ≠ 0 → a ∈ s) :
      (linearCombination R g) (onFinset s f hf) = ∑ x ∈ s, f x • g x
      noncomputable 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
      Instances For
        @[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
        Instances For
          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
          Instances For
            @[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 : ↥t → R), ∑ i : ↥t, c i • v ↑i = x
            theorem Submodule.mem_span_image_finset_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 : Finset α} :
            x ∈ span R (v '' ↑s) ↔ ∃ (c : ↥s → R), ∑ i : ↥s, c i • v ↑i = x
            theorem Submodule.mem_span_image_finset_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 : Finset α} :
            x ∈ span R (v '' ↑s) ↔ ∃ (c : α → R), ∑ i ∈ s, 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 : ↑s → R), ∑ i : ↑s, c i • v ↑i = x
            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
            @[irreducible]
            noncomputable 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
            Instances For
              @[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 : M → R) (t : Finset M), ↑t ⊆ s ∧ Function.support f ⊆ ↑t ∧ ∑ a ∈ t, 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 : M → R), Function.support f ⊆ ↑s ∧ ∑ a ∈ s, f a • a = x
              theorem Submodule.mem_span_iff_of_fintype {R : Type u_1} {M : Type u_2} [Semiring R] [AddCommMonoid M] [Module R M] {s : Set M} [Fintype ↑s] {x : M} :
              x ∈ span R s ↔ ∃ (f : ↑s → R), ∑ a : ↑s, 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 : ↥s → R), ∑ a : ↥s, f a • ↑a = x

              A variant of Submodule.mem_span_finset using s as the index type.

              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 n → R) (g : Fin n → ↑s), ∑ 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 n → R × M) => ∑ i : Fin n, (f i).1 • (f i).2) '' {f : Fin n → R × 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.

              noncomputable 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.
              Instances For
                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)