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.AList

14 declarations. Mathlib docs · Source

def Finsupp.toAList E1 #

{α : Type u_1} → {M : Type u_2} → [inst : Zero M] → (α →₀ M) → AList fun _x ↦ M

Produce an association list for the finsupp over its support using choice.

theorem Finsupp.toAList_entries E0 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M] (f : α →₀ M), f.toAList.entries = List.map Prod.toSigma f.graph.toList

theorem Finsupp.toAList_keys_toFinset E0 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M] [inst_1 : DecidableEq α] (f : α →₀ M),
  f.toAList.keys.toFinset = f.support

theorem Finsupp.mem_toAlist E0 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M] {f : α →₀ M} {x : α}, x ∈ f.toAList ↔ f x ≠ 0

def AList.lookupFinsupp E1 #

{α : Type u_1} → {M : Type u_2} → [inst : Zero M] → (AList fun _x ↦ M) → α →₀ M

Converts an association list into a finitely supported function via AList.lookup, sending absent keys to zero.

theorem AList.lookupFinsupp_apply E0 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M] [inst_1 : DecidableEq α] (l : AList fun _x ↦ M) (a : α),
  l.lookupFinsupp a = (AList.lookup a l).getD 0

theorem AList.lookupFinsupp_support E0 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M] [inst_1 : DecidableEq α] [inst_2 : DecidableEq M]
  (l : AList fun _x ↦ M), l.lookupFinsupp.support = (List.filter (fun x ↦ decide (x.snd ≠ 0)) l.entries).keys.toFinset

theorem AList.lookupFinsupp_eq_iff_of_ne_zero E1 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M] [inst_1 : DecidableEq α] {l : AList fun _x ↦ M} {a : α} {x : M},
  x ≠ 0 → (l.lookupFinsupp a = x ↔ x ∈ AList.lookup a l)

theorem AList.lookupFinsupp_eq_zero_iff E0 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M] [inst_1 : DecidableEq α] {l : AList fun _x ↦ M} {a : α},
  l.lookupFinsupp a = 0 ↔ a ∉ l ∨ 0 ∈ AList.lookup a l

theorem AList.empty_lookupFinsupp E0 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M], ∅.lookupFinsupp = 0

theorem AList.insert_lookupFinsupp E0 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M] [inst_1 : DecidableEq α] (l : AList fun _x ↦ M) (a : α) (m : M),
  (AList.insert a m l).lookupFinsupp = l.lookupFinsupp.update a m

theorem AList.singleton_lookupFinsupp E0 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M] (a : α) (m : M), (AList.singleton a m).lookupFinsupp = fun₀ | a => m

theorem Finsupp.toAList_lookupFinsupp E0 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M] (f : α →₀ M), f.toAList.lookupFinsupp = f

theorem AList.lookupFinsupp_surjective E1 #

∀ {α : Type u_1} {M : Type u_2} [inst : Zero M], Function.Surjective AList.lookupFinsupp