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 = {F := λ (_x : Π₀ (i : ι), β i), Π (i : ι), β i, 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 g = quotient.lift_on g (λ (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 g₁ g₂ = quotient.lift_on₂ g₁ g₂ (λ (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
add_monoid_hom.apply
.
Equations
Equations
- dfinsupp.has_neg = {neg := λ (f : Π₀ (i : ι), β i), dfinsupp.map_range (λ (_x : ι), has_neg.neg) dfinsupp.has_neg._proof_1 f}
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 := nsmul dfinsupp.add_monoid, nsmul_zero' := _, nsmul_succ' := _, add_comm := _}
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 := nsmul dfinsupp.add_monoid, nsmul_zero' := _, nsmul_succ' := _, neg := has_neg.neg infer_instance, sub := sub_neg_monoid.sub._default add_monoid.add dfinsupp.add_group._proof_6 add_monoid.zero dfinsupp.add_group._proof_7 dfinsupp.add_group._proof_8 nsmul dfinsupp.add_group._proof_9 dfinsupp.add_group._proof_10 has_neg.neg, sub_eq_add_neg := _, gsmul := sub_neg_monoid.gsmul._default add_monoid.add dfinsupp.add_group._proof_12 add_monoid.zero dfinsupp.add_group._proof_13 dfinsupp.add_group._proof_14 nsmul dfinsupp.add_group._proof_15 dfinsupp.add_group._proof_16 has_neg.neg, gsmul_zero' := _, gsmul_succ' := _, gsmul_neg' := _, add_left_neg := _}
Equations
- dfinsupp.add_comm_group = {add := add_group.add dfinsupp.add_group, add_assoc := _, zero := add_group.zero dfinsupp.add_group, zero_add := _, add_zero := _, nsmul := add_group.nsmul dfinsupp.add_group, nsmul_zero' := _, nsmul_succ' := _, neg := add_group.neg dfinsupp.add_group, sub := add_group.sub dfinsupp.add_group, sub_eq_add_neg := _, gsmul := add_group.gsmul dfinsupp.add_group, gsmul_zero' := _, gsmul_succ' := _, gsmul_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 f = quotient.lift_on f (λ (x : dfinsupp.pre ι (λ (i : ι), β i)), ⟦{to_fun := λ (i : ι), ite (p i) (x.to_fun i) 0, pre_support := x.pre_support, zero := _}⟧) _
subtype_domain p f
is the restriction of the finitely supported function
f
to the subtype p
.
Equations
- dfinsupp.subtype_domain p f = quotient.lift_on f (λ (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 := _}⟧) _
Create an element of Π₀ i, β i
from a finset s
and a function x
defined on this finset
.
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 f = quotient.lift_on f (λ (x : dfinsupp.pre ι (λ (i : ι), β i)), ⟦{to_fun := λ (j : ι), ite (j = i) 0 (x.to_fun j), pre_support := x.pre_support, zero := _}⟧) _
dfinsupp.single
as an add_monoid_hom
.
Equations
- dfinsupp.single_add_hom β i = {to_fun := dfinsupp.single 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.
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 = ∅) _
sum f g
is the sum of g i (f i)
over the support of f
.
prod f g
is the product 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 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 #
The above lemmas, repeated for dfinsupp.sum_add_hom
.