The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V03. Sets, finite structures and big operators

Mathlib.Data.Finsupp.Single

79 declarations and 3 deprecated aliases. Mathlib docs · Source

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

  • Finsupp.single: The Finsupp which is nonzero in exactly one point.
  • Finsupp.update: Changes one value of a Finsupp.
  • Finsupp.erase: Replaces one value of a Finsupp by 0.

Implementation notes

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

Declarations about single

Declarations about update

Declarations about erase

Declarations about mapRange

Declarations about embDomain

Declarations about zipWith

theorem Finsupp.uniqueEquiv.congr_simp E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a a_1 : α),
  a = a_1 → ∀ [inst_1 : Subsingleton α], Finsupp.uniqueEquiv a = Finsupp.uniqueEquiv a_1

def Finsupp.single E3 #

{α : Type u_1} → {M : Type u_4} → [inst : Zero M] → α → M → α →₀ M

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

theorem Finsupp.single_apply E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a a' : α} {b : M} [inst_1 : Decidable (a = a')],
  (fun₀ | a => b) a' = if a = a' then b else 0

theorem Finsupp.single_apply_left E1 #

∀ {α : Type u_1} {β : Type u_2} {M : Type u_4} [inst : Zero M] {f : α → β},
  Function.Injective f → ∀ (x z : α) (y : M), (fun₀ | f x => y) (f z) = (fun₀ | x => y) z

theorem Finsupp.single_eq_pi_single E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] [inst_1 : DecidableEq α] (a : α) (b : M),
  (⇑fun₀ | a => b) = Pi.single a b

theorem Finsupp.set_indicator_singleton E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a : α) (f : α → M), {a}.indicator f = ⇑fun₀ | a => f a

theorem Finsupp.single_eq_same E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a : α} {b : M}, (fun₀ | a => b) a = b

theorem Finsupp.single_eq_of_ne E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a a' : α} {b : M}, a' ≠ a → (fun₀ | a => b) a' = 0

theorem Finsupp.single_eq_of_ne' E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a a' : α} {b : M}, a ≠ a' → (fun₀ | a => b) a' = 0

theorem Finsupp.single_eq_update E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] [inst_1 : DecidableEq α] (a : α) (b : M),
  (⇑fun₀ | a => b) = Function.update 0 a b

theorem Finsupp.single_zero E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a : α), (fun₀ | a => 0) = 0

theorem Finsupp.single_of_single_apply E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a a' : α) (b : M),
  (fun₀ | a => (fun₀ | a' => b) a) = (fun₀ | a' => fun₀ | a' => b) a

theorem Finsupp.support_single E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {b : M} (a : α), b ≠ 0 → (fun₀ | a => b).support = {a}

theorem Finsupp.support_single_subset E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a : α} {b : M}, (fun₀ | a => b).support ⊆ {a}

theorem Finsupp.single_apply_mem E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a : α} {b : M} (x : α), (fun₀ | a => b) x ∈ {0, b}

theorem Finsupp.range_single_subset E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a : α} {b : M}, (Set.range ⇑fun₀ | a => b) ⊆ {0, b}

theorem Finsupp.single_injective E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a : α), Function.Injective (Finsupp.single 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 E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a x : α} {b : M}, (fun₀ | a => b) x = 0 ↔ x = a → b = 0

theorem Finsupp.single_apply_ne_zero E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a x : α} {b : M}, (fun₀ | a => b) x ≠ 0 ↔ x = a ∧ b ≠ 0

theorem Finsupp.mem_support_single E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a a' : α) (b : M), a ∈ (fun₀ | a' => b).support ↔ a = a' ∧ b ≠ 0

theorem Finsupp.single_eq_single_iff E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a₁ a₂ : α) (b₁ b₂ : M),
  ((fun₀ | a₁ => b₁) = fun₀ | a₂ => b₂) ↔ a₁ = a₂ ∧ b₁ = b₂ ∨ b₁ = 0 ∧ b₂ = 0

theorem Finsupp.single_left_injective E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {b : M}, b ≠ 0 → Function.Injective fun a ↦ fun₀ | 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 E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a a' : α} {b : M},
  b ≠ 0 → (((fun₀ | a => b) = fun₀ | a' => b) ↔ a = a')

theorem Finsupp.apply_surjective E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a : α), Function.Surjective fun f ↦ f a

theorem Finsupp.support_single_disjoint E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {b b' : M},
  b ≠ 0 → b' ≠ 0 → ∀ {i j : α}, Disjoint (fun₀ | i => b).support (fun₀ | j => b').support ↔ i ≠ j

theorem Finsupp.single_eq_zero E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a : α} {b : M}, (fun₀ | a => b) = 0 ↔ b = 0

theorem Finsupp.single_ne_zero E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a : α} {b : M}, (fun₀ | a => b) ≠ 0 ↔ b ≠ 0

theorem Finsupp.single_swap E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a₁ a₂ : α) (b : M), (fun₀ | a₁ => b) a₂ = (fun₀ | a₂ => b) a₁

instance Finsupp.instNontrivial E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] [Nonempty α] [Nontrivial M], Nontrivial (α →₀ M)

theorem Finsupp.nontrivial_iff E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M], Nontrivial (α →₀ M) ↔ Nonempty α ∧ Nontrivial M

theorem Finsupp.unique_single E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] [inst_1 : Unique α] (x : α →₀ M), x = fun₀ | default => x default

theorem Finsupp.unique_single_eq_iff E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a a' : α} {b : M} [Unique α] {b' : M},
  ((fun₀ | a => b) = fun₀ | a' => b') ↔ b = b'

theorem Finsupp.apply_single' E1 #

∀ {α : Type u_1} {N : Type u_5} {P : Type u_6} [inst : Zero N] [inst_1 : Zero P] (e : N → P),
  e 0 = 0 → ∀ (a : α) (n : N) (b : α), e ((fun₀ | a => n) b) = (fun₀ | a => e n) b

theorem Finsupp.support_eq_singleton E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {f : α →₀ M} {a : α}, f.support = {a} ↔ f a ≠ 0 ∧ f = fun₀ | a => f a

theorem Finsupp.support_eq_singleton' E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {f : α →₀ M} {a : α}, f.support = {a} ↔ ∃ b, b ≠ 0 ∧ f = fun₀ | a => b

theorem Finsupp.card_support_eq_one E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {f : α →₀ M}, f.support.card = 1 ↔ ∃ a, f a ≠ 0 ∧ f = fun₀ | a => f a

theorem Finsupp.card_support_eq_one' E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {f : α →₀ M}, f.support.card = 1 ↔ ∃ a b, b ≠ 0 ∧ f = fun₀ | a => b

theorem Finsupp.support_subset_singleton E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {f : α →₀ M} {a : α}, f.support ⊆ {a} ↔ f = fun₀ | a => f a

theorem Finsupp.support_subset_singleton' E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {f : α →₀ M} {a : α}, f.support ⊆ {a} ↔ ∃ b, f = fun₀ | a => b

theorem Finsupp.card_support_le_one E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] [Nonempty α] {f : α →₀ M}, f.support.card ≤ 1 ↔ ∃ a, f = fun₀ | a => f a

theorem Finsupp.card_support_le_one' E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] [Nonempty α] {f : α →₀ M}, f.support.card ≤ 1 ↔ ∃ a b, f = fun₀ | a => b

def Finsupp.uniqueEquiv E1 #

{α : Type u_1} → {M : Type u_4} → [inst : Zero M] → α → [Subsingleton α] → (α →₀ M) ≃ M

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

theorem Finsupp.uniqueEquiv_symm_apply E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a : α) [inst_1 : Subsingleton α] (b : M),
  (Finsupp.uniqueEquiv a).symm b = fun₀ | a => b

theorem Finsupp.uniqueEquiv_apply E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a : α) [inst_1 : Subsingleton α] (f : α →₀ M),
  (Finsupp.uniqueEquiv a) f = f a

theorem Finsupp.uniqueEquiv_symm_apply_apply E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a : α) [inst_1 : Subsingleton α] (m : M) (b : α),
  ((Finsupp.uniqueEquiv a).symm m) b = m

theorem Equiv.finsuppUnique_symm_apply_support_val E0 #

∀ {M : Type u_4} [inst : Zero M] {ι : Type u_8} [inst_1 : Unique ι] (a : M),
  (Equiv.finsuppUnique.symm a).support.val =
    Multiset.map (⇑(Function.Embedding.subtype fun x ↦ x ∈ Function.support (uniqueElim a))) Finset.univ.val

theorem Equiv.finsuppUnique_apply E0 #

∀ {M : Type u_4} [inst : Zero M] {ι : Type u_8} [inst_1 : Unique ι] (a : ι →₀ M), Equiv.finsuppUnique a = a default

theorem Equiv.finsuppUnique_symm_apply_apply E0 #

∀ {M : Type u_4} [inst : Zero M] {ι : Type u_8} [inst_1 : Unique ι] (a : M) (a_1 : ι),
  (Equiv.finsuppUnique.symm a) a_1 = a

theorem Finsupp.equivFunOnFinite_single E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] [inst_1 : DecidableEq α] [inst_2 : Finite α] (x : α) (m : M),
  (Finsupp.equivFunOnFinite fun₀ | x => m) = Pi.single x m

theorem Finsupp.equivFunOnFinite_symm_single E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] [inst_1 : DecidableEq α] [inst_2 : Finite α] (x : α) (m : M),
  Finsupp.equivFunOnFinite.symm (Pi.single x m) = fun₀ | x => m

def Finsupp.update E3 #

{α : Type u_1} → {M : Type u_4} → [inst : Zero M] → (α →₀ M) → α → 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.

theorem Finsupp.update_apply E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α) (b : M) (i : α) [inst_1 : DecidableEq α],
  (f.update a b) i = if i = a then b else f i

theorem Finsupp.coe_update E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α) (b : M) [inst_1 : DecidableEq α],
  ⇑(f.update a b) = Function.update (⇑f) a b

theorem Finsupp.update_self E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α), f.update a (f a) = f

theorem Finsupp.zero_update E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a : α) (b : M), Finsupp.update 0 a b = fun₀ | a => b

theorem Finsupp.support_update E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α) (b : M) [inst_1 : DecidableEq α]
  [inst_2 : DecidableEq M], (f.update a b).support = if b = 0 then f.support.erase a else insert a f.support

theorem Finsupp.support_update_zero E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α) [inst_1 : DecidableEq α],
  (f.update a 0).support = f.support.erase a

theorem Finsupp.support_update_ne_zero E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α) {b : M} [inst_1 : DecidableEq α],
  b ≠ 0 → (f.update a b).support = insert a f.support

theorem Finsupp.support_update_subset E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α) {b : M} [inst_1 : DecidableEq α],
  (f.update a b).support ⊆ insert a f.support

theorem Finsupp.update_comm E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) {a₁ a₂ : α},
  a₁ ≠ a₂ → ∀ (m₁ m₂ : M), (f.update a₁ m₁).update a₂ m₂ = (f.update a₂ m₂).update a₁ m₁

theorem Finsupp.update_idem E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α) (b c : M), (f.update a b).update a c = f.update a c

def Finsupp.erase E3 #

{α : Type u_1} → {M : Type u_4} → [inst : Zero M] → α → (α →₀ 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.

theorem Finsupp.erase_apply E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] [inst_1 : DecidableEq α] {a a' : α} {f : α →₀ M},
  (Finsupp.erase a f) a' = if a' = a then 0 else f a'

theorem Finsupp.support_erase E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] [inst_1 : DecidableEq α] {a : α} {f : α →₀ M},
  (Finsupp.erase a f).support = f.support.erase a

theorem Finsupp.erase_same E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a : α} {f : α →₀ M}, (Finsupp.erase a f) a = 0

theorem Finsupp.erase_ne E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a a' : α} {f : α →₀ M}, a' ≠ a → (Finsupp.erase a f) a' = f a'

theorem Finsupp.erase_single E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a : α} {b : M}, (Finsupp.erase a fun₀ | a => b) = 0

theorem Finsupp.erase_single_ne E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {a a' : α} {b : M},
  a ≠ a' → (Finsupp.erase a fun₀ | a' => b) = fun₀ | a' => b

theorem Finsupp.erase_of_notMem_support E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] {f : α →₀ M} {a : α}, a ∉ f.support → Finsupp.erase a f = f

theorem Finsupp.erase_zero E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (a : α), Finsupp.erase a 0 = 0

theorem Finsupp.erase_eq_update_zero E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α), Finsupp.erase a f = f.update a 0

theorem Finsupp.erase_update_of_ne E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) {a a' : α},
  a ≠ a' → ∀ (b : M), Finsupp.erase a (f.update a' b) = (Finsupp.erase a f).update a' b

theorem Finsupp.erase_idem E1 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α),
  Finsupp.erase a (Finsupp.erase a f) = Finsupp.erase a f

theorem Finsupp.update_erase_eq_update E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α) (b : M),
  (Finsupp.erase a f).update a b = f.update a b

theorem Finsupp.erase_update_eq_erase E0 #

∀ {α : Type u_1} {M : Type u_4} [inst : Zero M] (f : α →₀ M) (a : α) (b : M),
  Finsupp.erase a (f.update a b) = Finsupp.erase a f

theorem Finsupp.mapRange_single E0 #

∀ {α : Type u_1} {M : Type u_4} {N : Type u_5} [inst : Zero M] [inst_1 : Zero N] {f : M → N} {hf : f 0 = 0} {a : α}
  {b : M}, (Finsupp.mapRange f hf fun₀ | a => b) = fun₀ | a => f b

theorem Finsupp.single_of_embDomain_single E1 #

∀ {α : Type u_1} {β : Type u_2} {M : Type u_4} [inst : Zero M] (l : α →₀ M) (f : α ↪ β) (a : β) (b : M),
  b ≠ 0 → (Finsupp.embDomain f l = fun₀ | a => b) → ∃ x, (l = fun₀ | x => b) ∧ f x = a

theorem Finsupp.embDomain_single E0 #

∀ {α : Type u_1} {β : Type u_2} {M : Type u_4} [inst : Zero M] (f : α ↪ β) (a : α) (m : M),
  (Finsupp.embDomain f fun₀ | a => m) = fun₀ | f a => m

theorem Finsupp.zipWith_single_single E0 #

∀ {α : Type u_1} {M : Type u_4} {N : Type u_5} {P : Type u_6} [inst : Zero M] [inst_1 : Zero N] [inst_2 : Zero P]
  (f : M → N → P) (hf : f 0 0 = 0) (a : α) (m : M) (n : N),
  (Finsupp.zipWith f hf (fun₀ | a => m) fun₀ | a => n) = fun₀ | a => f m n

Deprecated aliases

NameNew nameSince
Equiv.finsuppUniqueFinsupp.uniqueEquiv2026-05-06
Finsupp.support_single_ne_botFinsupp.support_single2026-11-15
Finsupp.support_single_ne_zeroFinsupp.support_single2026-05-05