Operations on Finsupps with an Option domain #
Similar to how Finsupp.cons and Finsupp.tail construct
an object of type Fin (n + 1) →₀ M from a map Fin n →₀ M and vice versa,
we define Finsupp.optionElim and Finsupp.some
to construct Option α →₀ M from a map α →₀ M, and vice versa.
As functions, these behave as Option.elim', and as an application of some hence the names.
We prove a variety of API lemmas, see Mathlib/Data/Finsupp/Fin.lean for comparison.
Main declarations #
Finsupp.some: restrict a finitely supported function onOption αto a finitely supported function onα.Finsupp.optionElim: extend a finitely supported function onαto a finitely supported function onOption α, provided a default value fornone.
Implementation notes #
This file is a noncomputable theory and uses classical logic throughout.
Restrict a finitely supported function on Option α to a finitely supported function on α.
Instances For
Finsupps from Option are equivalent to
pairs of an element and a Finsupp on the original type.
Instances For
Extend a finitely supported function on α to a finitely supported function on Option α,
provided a default value for none.