Documentation

Mathlib.Data.Finsupp.Single

Finitely supported functions on exactly one point #

This file contains definitions and basic results on defining/updating/removing Finsupps using one point of the domain.

Main declarations #

Implementation notes #

This file is a noncomputable theory and uses classical logic throughout.

Declarations about single #

noncomputable def Finsupp.single {α : Type u_1} {M : Type u_5} [Zero M] (a : α) (b : M) :
α →₀ M

single a b is the finitely supported function with value b at a and zero otherwise.

Equations
Instances For
    theorem Finsupp.single_apply {α : Type u_1} {M : Type u_5} [Zero M] {a a' : α} {b : M} [Decidable (a = a')] :
    (single a b) a' = if a = a' then b else 0
    theorem Finsupp.single_apply_left {α : Type u_1} {β : Type u_2} {M : Type u_5} [Zero M] {f : αβ} (hf : Function.Injective f) (x z : α) (y : M) :
    (single (f x) y) (f z) = (single x y) z
    theorem Finsupp.single_eq_pi_single {α : Type u_1} {M : Type u_5} [Zero M] [DecidableEq α] (a : α) (b : M) :
    (single a b) = Pi.single a b
    theorem Finsupp.set_indicator_singleton {α : Type u_1} {M : Type u_5} [Zero M] (a : α) (f : αM) :
    {a}.indicator f = (single a (f a))
    @[deprecated Finsupp.set_indicator_singleton (since := "2026-04-27")]
    theorem Finsupp.single_eq_set_indicator {α : Type u_1} {M : Type u_5} [Zero M] {a : α} {b : M} :
    (single a b) = {a}.indicator fun (x : α) => b
    @[simp]
    theorem Finsupp.single_eq_same {α : Type u_1} {M : Type u_5} [Zero M] {a : α} {b : M} :
    (single a b) a = b
    @[simp]
    theorem Finsupp.single_eq_of_ne {α : Type u_1} {M : Type u_5} [Zero M] {a a' : α} {b : M} (h : a' a) :
    (single a b) a' = 0
    @[simp]
    theorem Finsupp.single_eq_of_ne' {α : Type u_1} {M : Type u_5} [Zero M] {a a' : α} {b : M} (h : a a') :
    (single a b) a' = 0
    theorem Finsupp.single_eq_update {α : Type u_1} {M : Type u_5} [Zero M] [DecidableEq α] (a : α) (b : M) :
    (single a b) = Function.update 0 a b
    @[simp]
    theorem Finsupp.single_zero {α : Type u_1} {M : Type u_5} [Zero M] (a : α) :
    single a 0 = 0
    theorem Finsupp.single_of_single_apply {α : Type u_1} {M : Type u_5} [Zero M] (a a' : α) (b : M) :
    single a ((single a' b) a) = (single a' (single a' b)) a
    @[simp]
    theorem Finsupp.support_single {α : Type u_1} {M : Type u_5} [Zero M] {b : M} (a : α) (hb : b 0) :
    @[deprecated Finsupp.support_single (since := "2026-05-05")]
    theorem Finsupp.support_single_ne_zero {α : Type u_1} {M : Type u_5} [Zero M] {b : M} (a : α) (hb : b 0) :

    Alias of Finsupp.support_single.

    theorem Finsupp.support_single_subset {α : Type u_1} {M : Type u_5} [Zero M] {a : α} {b : M} :
    theorem Finsupp.single_apply_mem {α : Type u_1} {M : Type u_5} [Zero M] {a : α} {b : M} (x : α) :
    (single a b) x {0, b}
    theorem Finsupp.range_single_subset {α : Type u_1} {M : Type u_5} [Zero M] {a : α} {b : M} :
    Set.range (single a b) {0, b}
    theorem Finsupp.single_injective {α : Type u_1} {M : Type u_5} [Zero M] (a : α) :

    Finsupp.single a b is injective in b. For the statement that it is injective in a, see Finsupp.single_left_injective

    theorem Finsupp.single_apply_eq_zero {α : Type u_1} {M : Type u_5} [Zero M] {a x : α} {b : M} :
    (single a b) x = 0 x = ab = 0
    theorem Finsupp.single_apply_ne_zero {α : Type u_1} {M : Type u_5} [Zero M] {a x : α} {b : M} :
    (single a b) x 0 x = a b 0
    theorem Finsupp.mem_support_single {α : Type u_1} {M : Type u_5} [Zero M] (a a' : α) (b : M) :
    a (single a' b).support a = a' b 0
    theorem Finsupp.eq_single_iff {α : Type u_1} {M : Type u_5} [Zero M] {f : α →₀ M} {a : α} {b : M} :
    f = single a b f.support {a} f a = b
    theorem Finsupp.single_eq_single_iff {α : Type u_1} {M : Type u_5} [Zero M] (a₁ a₂ : α) (b₁ b₂ : M) :
    single a₁ b₁ = single a₂ b₂ a₁ = a₂ b₁ = b₂ b₁ = 0 b₂ = 0
    theorem Finsupp.single_left_injective {α : Type u_1} {M : Type u_5} [Zero M] {b : M} (h : b 0) :
    Function.Injective fun (a : α) => single a b

    Finsupp.single a b is injective in a. For the statement that it is injective in b, see Finsupp.single_injective

    theorem Finsupp.single_left_inj {α : Type u_1} {M : Type u_5} [Zero M] {a a' : α} {b : M} (h : b 0) :
    single a b = single a' b a = a'
    theorem Finsupp.apply_surjective {α : Type u_1} {M : Type u_5} [Zero M] (a : α) :
    Function.Surjective fun (f : α →₀ M) => f a
    theorem Finsupp.support_single_ne_bot {α : Type u_1} {M : Type u_5} [Zero M] {b : M} (i : α) (h : b 0) :
    theorem Finsupp.support_single_disjoint {α : Type u_1} {M : Type u_5} [Zero M] {b b' : M} (hb : b 0) (hb' : b' 0) {i j : α} :
    @[simp]
    theorem Finsupp.single_eq_zero {α : Type u_1} {M : Type u_5} [Zero M] {a : α} {b : M} :
    single a b = 0 b = 0
    theorem Finsupp.single_ne_zero {α : Type u_1} {M : Type u_5} [Zero M] {a : α} {b : M} :
    single a b 0 b 0
    theorem Finsupp.single_swap {α : Type u_1} {M : Type u_5} [Zero M] (a₁ a₂ : α) (b : M) :
    (single a₁ b) a₂ = (single a₂ b) a₁
    instance Finsupp.instNontrivial {α : Type u_1} {M : Type u_5} [Zero M] [Nonempty α] [Nontrivial M] :
    theorem Finsupp.nontrivial_iff {α : Type u_1} {M : Type u_5} [Zero M] :
    theorem Finsupp.unique_single {α : Type u_1} {M : Type u_5} [Zero M] [Unique α] (x : α →₀ M) :
    @[simp]
    theorem Finsupp.unique_single_eq_iff {α : Type u_1} {M : Type u_5} [Zero M] {a a' : α} {b : M} [Unique α] {b' : M} :
    single a b = single a' b' b = b'
    theorem Finsupp.apply_single' {α : Type u_1} {N : Type u_7} {P : Type u_8} [Zero N] [Zero P] (e : NP) (he : e 0 = 0) (a : α) (n : N) (b : α) :
    e ((single a n) b) = (single a (e n)) b
    theorem Finsupp.support_eq_singleton {α : Type u_1} {M : Type u_5} [Zero M] {f : α →₀ M} {a : α} :
    f.support = {a} f a 0 f = single a (f a)
    theorem Finsupp.support_eq_singleton' {α : Type u_1} {M : Type u_5} [Zero M] {f : α →₀ M} {a : α} :
    f.support = {a} ∃ (b : M), b 0 f = single a b
    theorem Finsupp.card_support_eq_one {α : Type u_1} {M : Type u_5} [Zero M] {f : α →₀ M} :
    f.support.card = 1 ∃ (a : α), f a 0 f = single a (f a)
    theorem Finsupp.card_support_eq_one' {α : Type u_1} {M : Type u_5} [Zero M] {f : α →₀ M} :
    f.support.card = 1 ∃ (a : α) (b : M), b 0 f = single a b
    theorem Finsupp.support_subset_singleton {α : Type u_1} {M : Type u_5} [Zero M] {f : α →₀ M} {a : α} :
    f.support {a} f = single a (f a)
    theorem Finsupp.support_subset_singleton' {α : Type u_1} {M : Type u_5} [Zero M] {f : α →₀ M} {a : α} :
    f.support {a} ∃ (b : M), f = single a b
    theorem Finsupp.card_support_le_one {α : Type u_1} {M : Type u_5} [Zero M] [Nonempty α] {f : α →₀ M} :
    f.support.card 1 ∃ (a : α), f = single a (f a)
    theorem Finsupp.card_support_le_one' {α : Type u_1} {M : Type u_5} [Zero M] [Nonempty α] {f : α →₀ M} :
    f.support.card 1 ∃ (a : α) (b : M), f = single a b
    noncomputable def Finsupp.uniqueEquiv {α : Type u_1} {M : Type u_5} [Zero M] (a : α) [Subsingleton α] :
    (α →₀ M) M

    If α has a unique term, then finitely supported functions α →₀ M are in bijection with M.

    Equations
    Instances For
      @[simp]
      theorem Finsupp.uniqueEquiv_apply {α : Type u_1} {M : Type u_5} [Zero M] (a : α) [Subsingleton α] (f : α →₀ M) :
      (uniqueEquiv a) f = f a
      @[simp]
      theorem Finsupp.uniqueEquiv_symm_apply {α : Type u_1} {M : Type u_5} [Zero M] (a : α) [Subsingleton α] (b : M) :
      @[simp]
      theorem Finsupp.uniqueEquiv_symm_apply_apply {α : Type u_1} {M : Type u_5} [Zero M] (a : α) [Subsingleton α] (m : M) (b : α) :
      ((uniqueEquiv a).symm m) b = m
      @[deprecated Finsupp.uniqueEquiv (since := "2026-05-06")]
      noncomputable def Equiv.finsuppUnique {M : Type u_5} [Zero M] {ι : Type u_13} [Unique ι] :
      (ι →₀ M) M

      If α has a unique term, the type of finitely supported functions α →₀ β is equivalent to β.

      Equations
      Instances For
        @[simp]
        theorem Equiv.finsuppUnique_apply {M : Type u_5} [Zero M] {ι : Type u_13} [Unique ι] (a✝ : ι →₀ M) :
        @[simp]
        theorem Equiv.finsuppUnique_symm_apply_apply {M : Type u_5} [Zero M] {ι : Type u_13} [Unique ι] (a✝ : M) (a✝¹ : ι) :
        (finsuppUnique.symm a✝) a✝¹ = a✝
        @[simp]
        theorem Finsupp.equivFunOnFinite_single {α : Type u_1} {M : Type u_5} [Zero M] [DecidableEq α] [Finite α] (x : α) (m : M) :
        @[simp]
        theorem Finsupp.equivFunOnFinite_symm_single {α : Type u_1} {M : Type u_5} [Zero M] [DecidableEq α] [Finite α] (x : α) (m : M) :

        Declarations about update #

        noncomputable def Finsupp.update {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) (b : M) :
        α →₀ M

        Replace the value of a α →₀ M at a given point a : α by a given value b : M. If b = 0, this amounts to removing a from the Finsupp.support. Otherwise, if a was not in the Finsupp.support, it is added to it.

        This is the finitely-supported version of Function.update.

        Equations
        Instances For
          theorem Finsupp.update_apply {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) (b : M) (i : α) [DecidableEq α] :
          (f.update a b) i = if i = a then b else f i
          @[simp]
          theorem Finsupp.coe_update {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) (b : M) [DecidableEq α] :
          (f.update a b) = Function.update (⇑f) a b
          @[simp]
          theorem Finsupp.update_self {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) :
          f.update a (f a) = f
          @[simp]
          theorem Finsupp.zero_update {α : Type u_1} {M : Type u_5} [Zero M] (a : α) (b : M) :
          update 0 a b = single a b
          theorem Finsupp.support_update {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) (b : M) [DecidableEq α] [DecidableEq M] :
          @[simp]
          theorem Finsupp.support_update_zero {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) [DecidableEq α] :
          theorem Finsupp.support_update_ne_zero {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) {b : M} [DecidableEq α] (h : b 0) :
          theorem Finsupp.support_update_subset {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) {b : M} [DecidableEq α] :
          theorem Finsupp.update_comm {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) {a₁ a₂ : α} (h : a₁ a₂) (m₁ m₂ : M) :
          (f.update a₁ m₁).update a₂ m₂ = (f.update a₂ m₂).update a₁ m₁
          @[simp]
          theorem Finsupp.update_idem {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) (b c : M) :
          (f.update a b).update a c = f.update a c

          Declarations about erase #

          noncomputable def Finsupp.erase {α : Type u_1} {M : Type u_5} [Zero M] (a : α) (f : α →₀ M) :
          α →₀ M

          erase a f is the finitely supported function equal to f except at a where it is equal to 0. If a is not in the support of f then erase a f = f.

          Equations
          Instances For
            theorem Finsupp.erase_apply {α : Type u_1} {M : Type u_5} [Zero M] [DecidableEq α] {a a' : α} {f : α →₀ M} :
            (erase a f) a' = if a' = a then 0 else f a'
            @[simp]
            theorem Finsupp.support_erase {α : Type u_1} {M : Type u_5} [Zero M] [DecidableEq α] {a : α} {f : α →₀ M} :
            @[simp]
            theorem Finsupp.erase_same {α : Type u_1} {M : Type u_5} [Zero M] {a : α} {f : α →₀ M} :
            (erase a f) a = 0
            @[simp]
            theorem Finsupp.erase_ne {α : Type u_1} {M : Type u_5} [Zero M] {a a' : α} {f : α →₀ M} (h : a' a) :
            (erase a f) a' = f a'
            @[simp]
            theorem Finsupp.erase_single {α : Type u_1} {M : Type u_5} [Zero M] {a : α} {b : M} :
            erase a (single a b) = 0
            theorem Finsupp.erase_single_ne {α : Type u_1} {M : Type u_5} [Zero M] {a a' : α} {b : M} (h : a a') :
            erase a (single a' b) = single a' b
            @[simp]
            theorem Finsupp.erase_of_notMem_support {α : Type u_1} {M : Type u_5} [Zero M] {f : α →₀ M} {a : α} (haf : af.support) :
            erase a f = f
            theorem Finsupp.erase_zero {α : Type u_1} {M : Type u_5} [Zero M] (a : α) :
            erase a 0 = 0
            theorem Finsupp.erase_eq_update_zero {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) :
            erase a f = f.update a 0
            theorem Finsupp.erase_update_of_ne {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) {a a' : α} (ha : a a') (b : M) :
            erase a (f.update a' b) = (erase a f).update a' b
            theorem Finsupp.erase_idem {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) :
            erase a (erase a f) = erase a f
            @[simp]
            theorem Finsupp.update_erase_eq_update {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) (b : M) :
            (erase a f).update a b = f.update a b
            @[simp]
            theorem Finsupp.erase_update_eq_erase {α : Type u_1} {M : Type u_5} [Zero M] (f : α →₀ M) (a : α) (b : M) :
            erase a (f.update a b) = erase a f

            Declarations about mapRange #

            @[simp]
            theorem Finsupp.mapRange_single {α : Type u_1} {M : Type u_5} {N : Type u_7} [Zero M] [Zero N] {f : MN} {hf : f 0 = 0} {a : α} {b : M} :
            mapRange f hf (single a b) = single a (f b)

            Declarations about embDomain #

            theorem Finsupp.single_of_embDomain_single {α : Type u_1} {β : Type u_2} {M : Type u_5} [Zero M] (l : α →₀ M) (f : α β) (a : β) (b : M) (hb : b 0) (h : embDomain f l = single a b) :
            ∃ (x : α), l = single x b f x = a
            @[simp]
            theorem Finsupp.embDomain_single {α : Type u_1} {β : Type u_2} {M : Type u_5} [Zero M] (f : α β) (a : α) (m : M) :
            embDomain f (single a m) = single (f a) m

            Declarations about zipWith #

            @[simp]
            theorem Finsupp.zipWith_single_single {α : Type u_1} {M : Type u_5} {N : Type u_7} {P : Type u_8} [Zero M] [Zero N] [Zero P] (f : MNP) (hf : f 0 0 = 0) (a : α) (m : M) (n : N) :
            zipWith f hf (single a m) (single a n) = single a (f m n)