Connections between Finsupp and AList #
Main definitions #
Finsupp.toAListAList.lookupFinsupp: converts an association list into a finitely supported function viaAList.lookup, sending absent keys to zero.
noncomputable def AList.lookupFinsupp {α : Type u_1} {M : Type u_2} [Zero M] (l : AList fun (_x : α) => M) :
Converts an association list into a finitely supported function via AList.lookup, sending
absent keys to zero.
Equations
- l.lookupFinsupp = { support := (List.filter (fun (x : (_ : α) × M) => decide (x.snd ≠ 0)) l.entries).keys.toFinset, toFun := fun (a : α) => (AList.lookup a l).getD 0, mem_support_toFun := ⋯ }
Instances For
@[simp]
theorem AList.lookupFinsupp_apply {α : Type u_1} {M : Type u_2} [Zero M] [DecidableEq α] (l : AList fun (_x : α) => M) (a : α) :
@[simp]
theorem AList.lookupFinsupp_support {α : Type u_1} {M : Type u_2} [Zero M] [DecidableEq α] [DecidableEq M] (l : AList fun (_x : α) => M) :
l.lookupFinsupp.support = (List.filter (fun (x : (_ : α) × M) => decide (x.snd ≠ 0)) l.entries).keys.toFinset
theorem AList.lookupFinsupp_eq_iff_of_ne_zero {α : Type u_1} {M : Type u_2} [Zero M] [DecidableEq α] {l : AList fun (_x : α) => M} {a : α} {x : M} (hx : x ≠ 0) :
theorem AList.lookupFinsupp_eq_zero_iff {α : Type u_1} {M : Type u_2} [Zero M] [DecidableEq α] {l : AList fun (_x : α) => M} {a : α} :
@[simp]
@[simp]
theorem AList.insert_lookupFinsupp {α : Type u_1} {M : Type u_2} [Zero M] [DecidableEq α] (l : AList fun (_x : α) => M) (a : α) (m : M) :
@[simp]
@[simp]