Dependent functions with finite support #
For a non-dependent version see data/finsupp.lean
.
Equations
- dfinsupp.inhabited_pre ι β = {default := {to_fun := λ (i : ι), 0, pre_support := ∅, zero := _}}
Equations
- dfinsupp.pre.setoid ι β = {r := λ (x y : dfinsupp.pre ι β), ∀ (i : ι), x.to_fun i = y.to_fun i, iseqv := _}
Equations
- dfinsupp.has_coe_to_fun = {coe := λ (f : Π₀ (i : ι), β i), quotient.lift_on f dfinsupp.pre.to_fun dfinsupp.has_coe_to_fun._proof_1}
Equations
- dfinsupp.inhabited = {default := 0}
The composition of f : β₁ → β₂
and g : Π₀ i, β₁ i
is
map_range f hf g : Π₀ i, β₂ i
, well defined when f 0 = 0
.
This preserves the structure on f
, and exists in various bundled forms for when f
is itself
bundled:
dfinsupp.map_range.add_monoid_hom
dfinsupp.map_range.add_equiv
dfinsupp.map_range.linear_map
dfinsupp.map_range.linear_equiv
Equations
- dfinsupp.map_range f hf = quotient.map (λ (x : dfinsupp.pre ι (λ (i : ι), β₁ i)), {to_fun := λ (i : ι), f i (x.to_fun i), pre_support := x.pre_support, zero := _}) _
Let f i
be a binary operation β₁ i → β₂ i → β i
such that f i 0 0 = 0
.
Then zip_with f hf
is a binary operation Π₀ i, β₁ i → Π₀ i, β₂ i → Π₀ i, β i
.
Equations
- dfinsupp.zip_with f hf = quotient.map₂ (λ (x : dfinsupp.pre ι (λ (i : ι), β₁ i)) (y : dfinsupp.pre ι (λ (i : ι), β₂ i)), {to_fun := λ (i : ι), f i (x.to_fun i) (y.to_fun i), pre_support := x.pre_support + y.pre_support, zero := _}) _
Equations
- dfinsupp.has_add = {add := dfinsupp.zip_with (λ (_x : ι), has_add.add) dfinsupp.has_add._proof_1}
Equations
- dfinsupp.add_zero_class = {zero := 0, add := has_add.add dfinsupp.has_add, zero_add := _, add_zero := _}
Equations
- dfinsupp.add_monoid = {add := has_add.add dfinsupp.has_add, add_assoc := _, zero := 0, zero_add := _, add_zero := _, nsmul := nsmul_rec (add_zero_class.to_has_add (Π₀ (i : ι), β i)), nsmul_zero' := _, nsmul_succ' := _}
Coercion from a dfinsupp
to a pi type is an add_monoid_hom
.
Equations
- dfinsupp.coe_fn_add_monoid_hom = {to_fun := coe_fn dfinsupp.has_coe_to_fun, map_zero' := _, map_add' := _}
Evaluation at a point is an add_monoid_hom
. This is the finitely-supported version of
pi.eval_add_monoid_hom
.
Equations
Equations
- dfinsupp.add_comm_monoid = {add := add_monoid.add dfinsupp.add_monoid, add_assoc := _, zero := add_monoid.zero dfinsupp.add_monoid, zero_add := _, add_zero := _, nsmul := λ (n : ℕ) (v : Π₀ (i : ι), β i), dfinsupp.map_range (λ (_x : ι), has_scalar.smul n) _ v, nsmul_zero' := _, nsmul_succ' := _, add_comm := _}
Equations
- dfinsupp.has_neg = {neg := λ (f : Π₀ (i : ι), β i), dfinsupp.map_range (λ (_x : ι), has_neg.neg) dfinsupp.has_neg._proof_1 f}
Equations
- dfinsupp.has_sub = {sub := dfinsupp.zip_with (λ (_x : ι), has_sub.sub) dfinsupp.has_sub._proof_1}
Equations
- dfinsupp.add_group = {add := add_monoid.add dfinsupp.add_monoid, add_assoc := _, zero := add_monoid.zero dfinsupp.add_monoid, zero_add := _, add_zero := _, nsmul := add_monoid.nsmul dfinsupp.add_monoid, nsmul_zero' := _, nsmul_succ' := _, neg := has_neg.neg dfinsupp.has_neg, sub := has_sub.sub dfinsupp.has_sub, sub_eq_add_neg := _, zsmul := sub_neg_monoid.zsmul._default add_monoid.add dfinsupp.add_group._proof_7 add_monoid.zero dfinsupp.add_group._proof_8 dfinsupp.add_group._proof_9 add_monoid.nsmul dfinsupp.add_group._proof_10 dfinsupp.add_group._proof_11 has_neg.neg, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, add_left_neg := _}
Equations
- dfinsupp.add_comm_group = {add := add_comm_monoid.add dfinsupp.add_comm_monoid, add_assoc := _, zero := add_comm_monoid.zero dfinsupp.add_comm_monoid, zero_add := _, add_zero := _, nsmul := add_comm_monoid.nsmul dfinsupp.add_comm_monoid, nsmul_zero' := _, nsmul_succ' := _, neg := add_group.neg dfinsupp.add_group, sub := add_group.sub dfinsupp.add_group, sub_eq_add_neg := _, zsmul := λ (n : ℤ) (v : Π₀ (i : ι), β i), dfinsupp.map_range (λ (_x : ι), has_scalar.smul n) _ v, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, add_left_neg := _, add_comm := _}
Dependent functions with finite support inherit a semiring action from an action on each coordinate.
Equations
- dfinsupp.has_scalar = {smul := λ (c : γ) (v : Π₀ (i : ι), β i), dfinsupp.map_range (λ (_x : ι), has_scalar.smul c) _ v}
Dependent functions with finite support inherit a distrib_mul_action
structure from such a
structure on each coordinate.
Equations
- dfinsupp.distrib_mul_action = {to_mul_action := {to_has_scalar := {smul := has_scalar.smul dfinsupp.has_scalar}, one_smul := _, mul_smul := _}, smul_add := _, smul_zero := _}
Dependent functions with finite support inherit a module structure from such a structure on each coordinate.
Equations
- dfinsupp.module = {to_distrib_mul_action := {to_mul_action := distrib_mul_action.to_mul_action dfinsupp.distrib_mul_action, smul_add := _, smul_zero := _}, add_smul := _, zero_smul := _}
filter p f
is the function which is f i
if p i
is true and 0 otherwise.
Equations
- dfinsupp.filter p = quotient.map (λ (x : dfinsupp.pre ι (λ (i : ι), β i)), {to_fun := λ (i : ι), ite (p i) (x.to_fun i) 0, pre_support := x.pre_support, zero := _}) _
dfinsupp.filter
as an add_monoid_hom
.
Equations
- dfinsupp.filter_add_monoid_hom β p = {to_fun := dfinsupp.filter p (λ (a : ι), _inst_2 a), map_zero' := _, map_add' := _}
dfinsupp.filter
as a linear_map
.
Equations
- dfinsupp.filter_linear_map γ β p = {to_fun := dfinsupp.filter p (λ (a : ι), _inst_4 a), map_add' := _, map_smul' := _}
subtype_domain p f
is the restriction of the finitely supported function
f
to the subtype p
.
Equations
- dfinsupp.subtype_domain p = quotient.map (λ (x : dfinsupp.pre ι (λ (i : ι), β i)), {to_fun := λ (i : subtype p), x.to_fun ↑i, pre_support := multiset.map (λ (j : {x_1 // x_1 ∈ multiset.filter p x.pre_support}), ⟨↑j, _⟩) (multiset.filter p x.pre_support).attach, zero := _}) _
subtype_domain
but as an add_monoid_hom
.
Equations
- dfinsupp.subtype_domain_add_monoid_hom β p = {to_fun := dfinsupp.subtype_domain p (λ (a : ι), _inst_2 a), map_zero' := _, map_add' := _}
dfinsupp.subtype_domain
as a linear_map
.
Equations
- dfinsupp.subtype_domain_linear_map γ β p = {to_fun := dfinsupp.subtype_domain p (λ (a : ι), _inst_4 a), map_add' := _, map_smul' := _}
Create an element of Π₀ i, β i
from a finset s
and a function x
defined on this finset
.
Given fintype ι
, equiv_fun_on_fintype
is the equiv
between Π₀ i, β i
and Π i, β i
.
(All dependent functions on a finite type are finitely supported.)
Equations
- dfinsupp.equiv_fun_on_fintype = {to_fun := coe_fn dfinsupp.has_coe_to_fun, inv_fun := λ (f : Π (i : ι), β i), ⟦{to_fun := f, pre_support := finset.univ.val, zero := _}⟧, left_inv := _, right_inv := _}
The function single i b : Π₀ i, β i
sends i
to b
and all other points to 0
.
Equations
- dfinsupp.single i b = dfinsupp.mk {i} (λ (j : ↥↑{i}), _.rec_on b)
Like finsupp.single_eq_single_iff
, but with a heq
due to dependent types
Equality of sigma types is sufficient (but not necessary) to show equality of dfinsupp
s.
Redefine f i
to be 0
.
Equations
- dfinsupp.erase i = quotient.map (λ (x : dfinsupp.pre ι (λ (i : ι), β i)), {to_fun := λ (j : ι), ite (j = i) 0 (x.to_fun j), pre_support := x.pre_support, zero := _}) _
Replace the value of a Π₀ i, β i
at a given point i : ι
by a given value b : β i
.
If b = 0
, this amounts to removing i
from the support.
Otherwise, i
is added to it.
This is the (dependent) finitely-supported version of function.update
.
Equations
- f.update i b = quotient.map (λ (x : dfinsupp.pre ι (λ (i : ι), β i)), {to_fun := function.update x.to_fun i b, pre_support := ite (b = 0) (x.pre_support.erase i) (i ::ₘ x.pre_support), zero := _}) _ f
dfinsupp.single
as an add_monoid_hom
.
Equations
- dfinsupp.single_add_hom β i = {to_fun := dfinsupp.single i, map_zero' := _, map_add' := _}
dfinsupp.erase
as an add_monoid_hom
.
Equations
- dfinsupp.erase_add_hom β i = {to_fun := dfinsupp.erase i, map_zero' := _, map_add' := _}
If two additive homomorphisms from Π₀ i, β i
are equal on each single a b
, then
they are equal.
If two additive homomorphisms from Π₀ i, β i
are equal on each single a b
, then
they are equal.
If s
is a subset of ι
then mk_add_group_hom s
is the canonical additive
group homomorphism from $\prod_{i\in s}\beta_i$ to $\prod_{\mathtt{i : \iota}}\beta_i.$
Equations
- dfinsupp.mk_add_group_hom s = {to_fun := dfinsupp.mk s, map_zero' := _, map_add' := _}
Set {i | f x ≠ 0}
as a finset
.
Equations
- f.support = quotient.lift_on f (λ (x : dfinsupp.pre ι (λ (i : ι), β i)), finset.filter (λ (i : ι), x.to_fun i ≠ 0) x.pre_support.to_finset) dfinsupp.support._proof_1
Equations
- dfinsupp.decidable_zero = λ (f : Π₀ (i : ι), β i), decidable_of_iff (f.support = ∅) _
prod f g
is the product of g i (f i)
over the support of f
.
sum f g
is the sum of g i (f i)
over the support of f
.
When summing over an add_monoid_hom
, the decidability assumption is not needed, and the result is
also an add_monoid_hom
.
Equations
- dfinsupp.sum_add_hom φ = {to_fun := λ (f : Π₀ (i : ι), β i), quotient.lift_on f (λ (x : dfinsupp.pre ι (λ (i : ι), β i)), ∑ (i : ι) in x.pre_support.to_finset, ⇑(φ i) (x.to_fun i)) _, map_zero' := _, map_add' := _}
While we didn't need decidable instances to define it, we do to reduce it to a sum
The supremum of a family of commutative additive submonoids is equal to the range of
dfinsupp.sum_add_hom
; that is, every element in the supr
can be produced from taking a finite
number of non-zero elements of S i
, coercing them to γ
, and summing them.
The bounded supremum of a family of commutative additive submonoids is equal to the range of
dfinsupp.sum_add_hom
composed with dfinsupp.filter_add_monoid_hom
; that is, every element in the
bounded supr
can be produced from taking a finite number of non-zero elements from the S i
that
satisfy p i
, coercing them to γ
, and summing them.
A variant of add_submonoid.mem_supr_iff_exists_dfinsupp
with the RHS fully unfolded.
The dfinsupp
version of finsupp.lift_add_hom
,
Equations
- dfinsupp.lift_add_hom = {to_fun := dfinsupp.sum_add_hom _inst_2, inv_fun := λ (F : (Π₀ (i : ι), β i) →+ γ) (i : ι), F.comp (dfinsupp.single_add_hom β i), left_inv := _, right_inv := _, map_add' := _}
The dfinsupp
version of finsupp.lift_add_hom_single_add_hom
,
The dfinsupp
version of finsupp.lift_add_hom_apply_single
,
The dfinsupp
version of finsupp.lift_add_hom_comp_single
,
The dfinsupp
version of finsupp.comp_lift_add_hom
,
Bundled versions of dfinsupp.map_range
#
The names should match the equivalent bundled finsupp.map_range
definitions.
dfinsupp.map_range
as an add_monoid_hom
.
Equations
- dfinsupp.map_range.add_monoid_hom f = {to_fun := dfinsupp.map_range (λ (i : ι) (x : β₁ i), ⇑(f i) x) _, map_zero' := _, map_add' := _}
dfinsupp.map_range.add_monoid_hom
as an add_equiv
.
Equations
- dfinsupp.map_range.add_equiv e = {to_fun := dfinsupp.map_range (λ (i : ι) (x : β₁ i), ⇑(e i) x) _, inv_fun := dfinsupp.map_range (λ (i : ι) (x : β₂ i), ⇑((e i).symm) x) _, left_inv := _, right_inv := _, map_add' := _}
Product and sum lemmas for bundled morphisms. #
In this section, we provide analogues of add_monoid_hom.map_sum
, add_monoid_hom.coe_sum
, and
add_monoid_hom.sum_apply
for dfinsupp.sum
and dfinsupp.sum_add_hom
instead of finset.sum
.
We provide these for add_monoid_hom
, monoid_hom
, ring_hom
, add_equiv
, and mul_equiv
.
Lemmas for linear_map
and linear_equiv
are in another file.
The above lemmas, repeated for dfinsupp.sum_add_hom
.