Miscellaneous definitions, lemmas, and constructions using finsupp #
Main declarations #
Finsupp.graph
: the finset of input and output pairs with non-zero outputs.Finsupp.mapRange.equiv
:Finsupp.mapRange
as an equiv.Finsupp.mapDomain
: maps the domain of aFinsupp
by a function and by summing.Finsupp.comapDomain
: postcomposition of aFinsupp
with a function injective on the preimage of its support.Finsupp.some
: restrict a finitely supported function onOption α
to a finitely supported function onα
.Finsupp.filter
:filter p f
is the finitely supported function that isf a
ifp a
is true and 0 otherwise.Finsupp.frange
: the image of a finitely supported function on its support.Finsupp.subtype_domain
: the restriction of a finitely supported functionf
to a subtype.
Implementation notes #
This file is a noncomputable theory
and uses classical logic throughout.
TODO #
This file is currently ~1600 lines long and is quite a miscellany of definitions and lemmas, so it should be divided into smaller pieces.
Expand the list of definitions and important lemmas to the module docstring.
The graph of a finitely supported function over its support, i.e. the finset of input and output pairs with non-zero outputs.
Equations
- f.graph = Finset.map { toFun := fun (a : α) => (a, f a), inj' := ⋯ } f.support
Instances For
Declarations about mapRange
#
Finsupp.mapRange
as an equiv.
Equations
- Finsupp.mapRange.equiv f hf hf' = { toFun := Finsupp.mapRange (⇑f) hf, invFun := Finsupp.mapRange (⇑f.symm) hf', left_inv := ⋯, right_inv := ⋯ }
Instances For
Composition with a fixed zero-preserving homomorphism is itself a zero-preserving homomorphism on functions.
Equations
- Finsupp.mapRange.zeroHom f = { toFun := Finsupp.mapRange ⇑f ⋯, map_zero' := ⋯ }
Instances For
Composition with a fixed additive homomorphism is itself an additive homomorphism on functions.
Equations
- Finsupp.mapRange.addMonoidHom f = { toFun := Finsupp.mapRange ⇑f ⋯, map_zero' := ⋯, map_add' := ⋯ }
Instances For
Finsupp.mapRange.AddMonoidHom
as an equiv.
Equations
- Finsupp.mapRange.addEquiv f = { toFun := Finsupp.mapRange ⇑f ⋯, invFun := Finsupp.mapRange ⇑f.symm ⋯, left_inv := ⋯, right_inv := ⋯, map_add' := ⋯ }
Instances For
Declarations about equivCongrLeft
#
Given f : α ≃ β
, we can map l : α →₀ M
to equivMapDomain f l : β →₀ M
(computably)
by mapping the support forwards and the function backwards.
Equations
- Finsupp.equivMapDomain f l = { support := Finset.map f.toEmbedding l.support, toFun := fun (a : β) => l (f.symm a), mem_support_toFun := ⋯ }
Instances For
Given f : α ≃ β
, the finitely supported function spaces are also in bijection:
(α →₀ M) ≃ (β →₀ M)
.
This is the finitely-supported version of Equiv.piCongrLeft
.
Equations
- Finsupp.equivCongrLeft f = { toFun := Finsupp.equivMapDomain f, invFun := Finsupp.equivMapDomain f.symm, left_inv := ⋯, right_inv := ⋯ }
Instances For
Given f : α → β
and v : α →₀ M
, mapDomain f v : β →₀ M
is the finitely supported function whose value at a : β
is the sum
of v x
over all x
such that f x = a
.
Equations
- Finsupp.mapDomain f v = v.sum fun (a : α) => Finsupp.single (f a)
Instances For
Finsupp.mapDomain
is an AddMonoidHom
.
Equations
- Finsupp.mapDomain.addMonoidHom f = { toFun := Finsupp.mapDomain f, map_zero' := ⋯, map_add' := ⋯ }
Instances For
A version of sum_mapDomain_index
that takes a bundled AddMonoidHom
,
rather than separate linearity hypotheses.
When f
is an embedding we have an embedding (α →₀ ℕ) ↪ (β →₀ ℕ)
given by mapDomain
.
Equations
- Finsupp.mapDomainEmbedding f = { toFun := Finsupp.mapDomain ⇑f, inj' := ⋯ }
Instances For
When g
preserves addition, mapRange
and mapDomain
commute.
Declarations about comapDomain
#
Given f : α → β
, l : β →₀ M
and a proof hf
that f
is injective on
the preimage of l.support
, comapDomain f l hf
is the finitely supported function
from α
to M
given by composing l
with f
.
Equations
- Finsupp.comapDomain f l hf = { support := l.support.preimage f hf, toFun := fun (a : α) => l (f a), mem_support_toFun := ⋯ }
Instances For
Note the hif
argument is needed for this to work in rw
.
A version of Finsupp.comapDomain_add
that's easier to use.
Finsupp.comapDomain
is an AddMonoidHom
.
Equations
- Finsupp.comapDomain.addMonoidHom hf = { toFun := fun (x : β →₀ M) => Finsupp.comapDomain f x ⋯, map_zero' := ⋯, map_add' := ⋯ }
Instances For
Declarations about Finsupp.filter
#
Finsupp.filter p f
is the finitely supported function that is f a
if p a
is true and 0
otherwise.
Equations
- Finsupp.filter p f = { support := Finset.filter p f.support, toFun := fun (a : α) => if p a then f a else 0, mem_support_toFun := ⋯ }
Instances For
frange f
is the image of f
on the support of f
.
Equations
- f.frange = Finset.image (⇑f) f.support
Instances For
Declarations about Finsupp.subtypeDomain
#
subtypeDomain p f
is the restriction of the finitely supported function f
to subtype p
.
Equations
- Finsupp.subtypeDomain p f = { support := Finset.subtype p f.support, toFun := ⇑f ∘ Subtype.val, mem_support_toFun := ⋯ }
Instances For
subtypeDomain
but as an AddMonoidHom
.
Equations
- Finsupp.subtypeDomainAddMonoidHom = { toFun := Finsupp.subtypeDomain p, map_zero' := ⋯, map_add' := ⋯ }
Instances For
Finsupp.filter
as an AddMonoidHom
.
Equations
- Finsupp.filterAddHom p = { toFun := Finsupp.filter p, map_zero' := ⋯, map_add' := ⋯ }
Instances For
Given a finitely supported function f
from a product type α × β
to γ
,
curry f
is the "curried" finitely supported function from α
to the type of
finitely supported functions from β
to γ
.
Equations
- f.curry = f.sum fun (p : α × β) (c : M) => Finsupp.single p.1 (Finsupp.single p.2 c)
Instances For
Given a finitely supported function f
from α
to the type of
finitely supported functions from β
to M
,
uncurry f
is the "uncurried" finitely supported function from α × β
to M
.
Equations
- f.uncurry = f.sum fun (a : α) (g : β →₀ M) => g.sum fun (b : β) (c : M) => Finsupp.single (a, b) c
Instances For
finsuppProdEquiv
defines the Equiv
between ((α × β) →₀ M)
and (α →₀ (β →₀ M))
given by
currying and uncurrying.
Equations
- Finsupp.finsuppProdEquiv = { toFun := Finsupp.curry, invFun := Finsupp.uncurry, left_inv := ⋯, right_inv := ⋯ }
Instances For
Finsupp.sumElim f g
maps inl x
to f x
and inr y
to g y
.
Equations
- f.sumElim g = Finsupp.onFinset (Finset.map { toFun := Sum.inl, inj' := ⋯ } f.support ∪ Finset.map { toFun := Sum.inr, inj' := ⋯ } g.support) (Sum.elim ⇑f ⇑g) ⋯
Instances For
The equivalence between (α ⊕ β) →₀ γ
and (α →₀ γ) × (β →₀ γ)
.
This is the Finsupp
version of Equiv.sum_arrow_equiv_prod_arrow
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The additive equivalence between (α ⊕ β) →₀ M
and (α →₀ M) × (β →₀ M)
.
This is the Finsupp
version of Equiv.sum_arrow_equiv_prod_arrow
.
Equations
- Finsupp.sumFinsuppAddEquivProdFinsupp = { toEquiv := Finsupp.sumFinsuppEquivProdFinsupp, map_add' := ⋯ }
Instances For
Declarations about scalar multiplication #
Scalar multiplication acting on the domain.
This is not an instance as it would conflict with the action on the range.
See the instance_diamonds
test for examples of such conflicts.
Equations
- Finsupp.comapSMul = { smul := fun (g : G) => Finsupp.mapDomain fun (x : α) => g • x }
Instances For
Finsupp.comapSMul
is multiplicative
Equations
- Finsupp.comapMulAction = MulAction.mk ⋯ ⋯
Instances For
Finsupp.comapSMul
is distributive
Equations
- Finsupp.comapDistribMulAction = DistribMulAction.mk ⋯ ⋯
Instances For
When G
is a group, Finsupp.comapSMul
acts by precomposition with the action of g⁻¹
.
Equations
- Finsupp.smulZeroClass = SMulZeroClass.mk ⋯
Throughout this section, some Monoid
and Semiring
arguments are specified with {}
instead of
[]
. See note [implicit instance arguments].
Equations
- Finsupp.instSMulWithZero = SMulWithZero.mk ⋯
Equations
Equations
Equations
- Finsupp.module α M = Module.mk ⋯ ⋯
A version of Finsupp.comapDomain_smul
that's easier to use.
A version of Finsupp.sum_smul_index'
for bundled additive maps.
Finsupp.single
as a DistribMulActionSemiHom
.
See also Finsupp.lsingle
for the version as a linear map.
Equations
- Finsupp.DistribMulActionHom.single a = { toFun := (↑(Finsupp.singleAddHom a)).toFun, map_smul' := ⋯, map_zero' := ⋯, map_add' := ⋯ }
Instances For
See note [partially-applied ext lemmas].
Combine finitely supported functions over {a // P a}
and {a // ¬P a}
, by case-splitting on
P a
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given an AddCommMonoid M
and s : Set α
, restrictSupportEquiv s M
is the Equiv
between the subtype of finitely supported functions with support contained in s
and
the type of finitely supported functions from s
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given AddCommMonoid M
and e : α ≃ β
, domCongr e
is the corresponding Equiv
between
α →₀ M
and β →₀ M
.
This is Finsupp.equivCongrLeft
as an AddEquiv
.
Equations
- Finsupp.domCongr e = { toFun := Finsupp.equivMapDomain e, invFun := Finsupp.equivMapDomain e.symm, left_inv := ⋯, right_inv := ⋯, map_add' := ⋯ }
Instances For
Declarations about sigma types #
Given l
, a finitely supported function from the sigma type Σ (i : ι), αs i
to M
and
an index element i : ι
, split l i
is the i
th component of l
,
a finitely supported function from as i
to M
.
This is the Finsupp
version of Sigma.curry
.
Equations
- l.split i = Finsupp.comapDomain (Sigma.mk i) l ⋯
Instances For
Given l
, a finitely supported function from the sigma type Σ (i : ι), αs i
to β
,
split_support l
is the finset of indices in ι
that appear in the support of l
.
Equations
- l.splitSupport = Finset.image Sigma.fst l.support
Instances For
Given l
, a finitely supported function from the sigma type Σ i, αs i
to β
and
an ι
-indexed family g
of functions from (αs i →₀ β)
to γ
, split_comp
defines a
finitely supported function from the index type ι
to γ
given by composing g i
with
split l i
.
Equations
- l.splitComp g hg = { support := l.splitSupport, toFun := fun (i : ι) => g i (l.split i), mem_support_toFun := ⋯ }
Instances For
On a Fintype η
, Finsupp.split
is an equivalence between (Σ (j : η), ιs j) →₀ α
and Π j, (ιs j →₀ α)
.
This is the Finsupp
version of Equiv.Pi_curry
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
On a Fintype η
, Finsupp.split
is an additive equivalence between
(Σ (j : η), ιs j) →₀ α
and Π j, (ιs j →₀ α)
.
This is the AddEquiv
version of Finsupp.sigmaFinsuppEquivPiFinsupp
.
Equations
- Finsupp.sigmaFinsuppAddEquivPiFinsupp = { toEquiv := Finsupp.sigmaFinsuppEquivPiFinsupp, map_add' := ⋯ }