doc-next-gen

Mathlib.Data.Finsupp.Order

Module docstring

{"# Pointwise order on finitely supported functions

This file lifts order structures on α to ι →₀ α.

Main declarations

  • Finsupp.orderEmbeddingToFun: The order embedding from finitely supported functions to functions. ","### Order structures ","### Algebraic order structures ","### Some lemmas about "}
Finsupp.sum_le_sum theorem
(h : ∀ i ∈ f.support, h₁ i (f i) ≤ h₂ i (f i)) : f.sum h₁ ≤ f.sum h₂
Full source
@[gcongr]
lemma sum_le_sum (h : ∀ i ∈ f.support, h₁ i (f i) ≤ h₂ i (f i)) : f.sum h₁ ≤ f.sum h₂ :=
  Finset.sum_le_sum h
Monotonicity of Sum for Finitely Supported Functions
Informal description
Let $f : \iota \to₀ \alpha$ be a finitely supported function, and let $h_1, h_2 : \iota \to \alpha \to \beta$ be functions where $\beta$ has an order structure. If for every $i$ in the support of $f$, $h_1(i, f(i)) \leq h_2(i, f(i))$, then the sum of $f$ weighted by $h_1$ is less than or equal to the sum of $f$ weighted by $h_2$, i.e., $\sum_{i} h_1(i, f(i)) \leq \sum_{i} h_2(i, f(i))$.
Finsupp.instLEFinsupp instance
: LE (ι →₀ α)
Full source
instance instLEFinsupp : LE (ι →₀ α) :=
  ⟨fun f g => ∀ i, f i ≤ g i⟩
Pointwise Order on Finitely Supported Functions
Informal description
For any type $\iota$ and any ordered type $\alpha$, the type $\iota \to₀ \alpha$ of finitely supported functions from $\iota$ to $\alpha$ is equipped with a pointwise order, where $f \leq g$ if and only if $f(i) \leq g(i)$ for all $i \in \iota$.
Finsupp.le_def theorem
: f ≤ g ↔ ∀ i, f i ≤ g i
Full source
lemma le_def : f ≤ g ↔ ∀ i, f i ≤ g i := Iff.rfl
Pointwise Order Characterization for Finitely Supported Functions
Informal description
For finitely supported functions $f, g : \iota \to \alpha$, the inequality $f \leq g$ holds if and only if $f(i) \leq g(i)$ for all $i \in \iota$.
Finsupp.coe_le_coe theorem
: ⇑f ≤ g ↔ f ≤ g
Full source
@[simp, norm_cast] lemma coe_le_coe : ⇑f ≤ g ↔ f ≤ g := Iff.rfl
Equivalence of Pointwise Order Between Finitely Supported Functions and Their Canonical Embedding
Informal description
For finitely supported functions $f, g : \iota \to \alpha$, the pointwise inequality $f \leq g$ holds (viewing $f$ as a regular function via the canonical embedding) if and only if $f \leq g$ holds in the order structure of finitely supported functions.
Finsupp.orderEmbeddingToFun definition
: (ι →₀ α) ↪o (ι → α)
Full source
/-- The order on `Finsupp`s over a partial order embeds into the order on functions -/
def orderEmbeddingToFun : (ι →₀ α) ↪o (ι → α) where
  toFun f := f
  inj' f g h :=
    Finsupp.ext fun i => by
      dsimp at h
      rw [h]
  map_rel_iff' := coe_le_coe
Order embedding from finitely supported functions to functions
Informal description
The order embedding from the type of finitely supported functions $\iota \to₀ \alpha$ to the type of all functions $\iota \to \alpha$, where the order on finitely supported functions is defined pointwise. Specifically, for any finitely supported functions $f, g : \iota \to₀ \alpha$, the embedding satisfies $f \leq g$ if and only if $f(i) \leq g(i)$ for all $i \in \iota$.
Finsupp.orderEmbeddingToFun_apply theorem
{f : ι →₀ α} {i : ι} : orderEmbeddingToFun f i = f i
Full source
@[simp]
theorem orderEmbeddingToFun_apply {f : ι →₀ α} {i : ι} : orderEmbeddingToFun f i = f i :=
  rfl
Evaluation of Order Embedding for Finitely Supported Functions
Informal description
For any finitely supported function $f : \iota \to₀ \alpha$ and any element $i \in \iota$, the evaluation of the order embedding $\text{orderEmbeddingToFun}(f)$ at $i$ is equal to $f(i)$, i.e., $\text{orderEmbeddingToFun}(f)(i) = f(i)$.
Finsupp.preorder instance
: Preorder (ι →₀ α)
Full source
instance preorder : Preorder (ι →₀ α) :=
  { Finsupp.instLEFinsupp with
    le_refl := fun _ _ => le_rfl
    le_trans := fun _ _ _ hfg hgh i => (hfg i).trans (hgh i) }
Pointwise Preorder on Finitely Supported Functions
Informal description
For any type $\iota$ and any preordered type $\alpha$, the type $\iota \to₀ \alpha$ of finitely supported functions from $\iota$ to $\alpha$ is equipped with a pointwise preorder, where $f \leq g$ if and only if $f(i) \leq g(i)$ for all $i \in \iota$.
Finsupp.lt_def theorem
: f < g ↔ f ≤ g ∧ ∃ i, f i < g i
Full source
lemma lt_def : f < g ↔ f ≤ g ∧ ∃ i, f i < g i := Pi.lt_def
Characterization of Strict Inequality for Finitely Supported Functions
Informal description
For finitely supported functions $f, g : \iota \to₀ \alpha$, the strict inequality $f < g$ holds if and only if $f \leq g$ pointwise (i.e., $f(i) \leq g(i)$ for all $i \in \iota$) and there exists some $i \in \iota$ such that $f(i) < g(i)$.
Finsupp.coe_lt_coe theorem
: ⇑f < g ↔ f < g
Full source
@[simp, norm_cast] lemma coe_lt_coe : ⇑f < g ↔ f < g := Iff.rfl
Pointwise Order on Finitely Supported Functions via Underlying Functions
Informal description
For finitely supported functions $f, g : \iota \to₀ \alpha$, the pointwise order relation $f < g$ holds if and only if the underlying functions $\tilde{f}, \tilde{g} : \iota \to \alpha$ satisfy $\tilde{f} < \tilde{g}$ pointwise.
Finsupp.coe_mono theorem
: Monotone (Finsupp.toFun : (ι →₀ α) → ι → α)
Full source
lemma coe_mono : Monotone (Finsupp.toFun : (ι →₀ α) → ι → α) := fun _ _ ↦ id
Monotonicity of the Embedding from Finitely Supported Functions to Functions
Informal description
The canonical embedding from finitely supported functions $f : \iota \to₀ \alpha$ to functions $\iota \to \alpha$ is monotone. That is, if $f \leq g$ in the pointwise order on $\iota \to₀ \alpha$, then $f(i) \leq g(i)$ for all $i \in \iota$.
Finsupp.coe_strictMono theorem
: Monotone (Finsupp.toFun : (ι →₀ α) → ι → α)
Full source
lemma coe_strictMono : Monotone (Finsupp.toFun : (ι →₀ α) → ι → α) := fun _ _ ↦ id
Monotonicity of the Embedding from Finitely Supported Functions to Functions
Informal description
For any type $\iota$ and any preordered type $\alpha$, the function `Finsupp.toFun` that maps finitely supported functions $f : \iota \to₀ \alpha$ to their underlying functions $\iota \to \alpha$ is monotone. That is, if $f \leq g$ in the pointwise order on finitely supported functions, then $f(i) \leq g(i)$ for all $i \in \iota$.
Finsupp.single_le_single theorem
: single i a ≤ single i b ↔ a ≤ b
Full source
@[simp] lemma single_le_single : singlesingle i a ≤ single i b ↔ a ≤ b := by
  classical exact Pi.single_le_single
Pointwise Order on Single-Element Finitely Supported Functions: $f_i \leq g_i \leftrightarrow a \leq b$
Informal description
For any finitely supported functions `single i a` and `single i b` (which are zero everywhere except at index `i` where they take values `a` and `b` respectively), the pointwise order relation `single i a ≤ single i b` holds if and only if `a ≤ b` in the underlying ordered type.
Finsupp.single_mono theorem
: Monotone (single i : α → ι →₀ α)
Full source
lemma single_mono : Monotone (single i : α → ι →₀ α) := fun _ _ ↦ single_le_single.2
Monotonicity of Single-Point Finitely Supported Function Construction
Informal description
For any index $i \in \iota$, the function $\text{single}_i : \alpha \to \iota \to₀ \alpha$ that maps an element $a \in \alpha$ to the finitely supported function which is zero everywhere except at $i$ where it takes the value $a$, is monotone. That is, for any $a, b \in \alpha$, if $a \leq b$, then $\text{single}_i a \leq \text{single}_i b$ pointwise.
Finsupp.single_nonneg theorem
: 0 ≤ single i a ↔ 0 ≤ a
Full source
@[simp] lemma single_nonneg : 0 ≤ single i a ↔ 0 ≤ a := by classical exact Pi.single_nonneg
Nonnegativity of Single-Point Finitely Supported Function: $0 \leq \text{single}_i a \leftrightarrow 0 \leq a$
Informal description
For a finitely supported function `single i a` from $\iota$ to $\alpha$, the condition that the zero function is pointwise less than or equal to `single i a` is equivalent to the condition that $0 \leq a$ in $\alpha$.
Finsupp.single_nonpos theorem
: single i a ≤ 0 ↔ a ≤ 0
Full source
@[simp] lemma single_nonpos : singlesingle i a ≤ 0 ↔ a ≤ 0 := by classical exact Pi.single_nonpos
Nonpositivity of Single-Point Finitely Supported Function: $\text{single}_i a \leq 0 \leftrightarrow a \leq 0$
Informal description
For a finitely supported function `single i a` from $\iota$ to $\alpha$, the condition that `single i a` is pointwise less than or equal to the zero function is equivalent to the condition that $a \leq 0$ in $\alpha$.
Finsupp.sum_le_sum_index theorem
[DecidableEq ι] {f₁ f₂ : ι →₀ α} {h : ι → α → β} (hf : f₁ ≤ f₂) (hh : ∀ i ∈ f₁.support ∪ f₂.support, Monotone (h i)) (hh₀ : ∀ i ∈ f₁.support ∪ f₂.support, h i 0 = 0) : f₁.sum h ≤ f₂.sum h
Full source
lemma sum_le_sum_index [DecidableEq ι] {f₁ f₂ : ι →₀ α} {h : ι → α → β} (hf : f₁ ≤ f₂)
    (hh : ∀ i ∈ f₁.support ∪ f₂.support, Monotone (h i))
    (hh₀ : ∀ i ∈ f₁.support ∪ f₂.support, h i 0 = 0) : f₁.sum h ≤ f₂.sum h := by
  classical
  rw [sum_of_support_subset _ Finset.subset_union_left _ hh₀,
    sum_of_support_subset _ Finset.subset_union_right _ hh₀]
  exact Finset.sum_le_sum fun i hi ↦ hh _ hi <| hf _
Monotonicity of Sums under Pointwise Order on Finitely Supported Functions
Informal description
Let $\iota$ be a type with decidable equality, and let $\alpha$ and $\beta$ be types. Given two finitely supported functions $f_1, f_2 : \iota \to₀ \alpha$ such that $f_1 \leq f_2$ pointwise, and a family of functions $h : \iota \to \alpha \to \beta$ such that for each $i$ in the union of the supports of $f_1$ and $f_2$, the function $h(i)$ is monotone and satisfies $h(i)(0) = 0$, then the sum $\sum_{i} h(i)(f_1(i))$ is less than or equal to the sum $\sum_{i} h(i)(f_2(i))$.
Finsupp.partialorder instance
[PartialOrder α] : PartialOrder (ι →₀ α)
Full source
instance partialorder [PartialOrder α] : PartialOrder (ι →₀ α) :=
  { Finsupp.preorder with le_antisymm :=
      fun _f _g hfg hgf => ext fun i => (hfg i).antisymm (hgf i) }
Pointwise Partial Order on Finitely Supported Functions
Informal description
For any type $\iota$ and any partially ordered type $\alpha$, the type $\iota \to₀ \alpha$ of finitely supported functions from $\iota$ to $\alpha$ is equipped with a pointwise partial order, where $f \leq g$ if and only if $f(i) \leq g(i)$ for all $i \in \iota$.
Finsupp.semilatticeInf instance
[SemilatticeInf α] : SemilatticeInf (ι →₀ α)
Full source
instance semilatticeInf [SemilatticeInf α] : SemilatticeInf (ι →₀ α) :=
  { Finsupp.partialorder with
    inf := zipWith (· ⊓ ·) (inf_idem _)
    inf_le_left := fun _f _g _i => inf_le_left
    inf_le_right := fun _f _g _i => inf_le_right
    le_inf := fun _f _g _i h1 h2 s => le_inf (h1 s) (h2 s) }
Pointwise Semilattice Infima on Finitely Supported Functions
Informal description
For any type $\iota$ and any semilattice with infima $\alpha$, the type $\iota \to₀ \alpha$ of finitely supported functions from $\iota$ to $\alpha$ is equipped with a pointwise semilattice structure, where the infimum of two functions $f$ and $g$ is given by $(f \sqcap g)(i) = f(i) \sqcap g(i)$ for all $i \in \iota$.
Finsupp.inf_apply theorem
[SemilatticeInf α] {i : ι} {f g : ι →₀ α} : (f ⊓ g) i = f i ⊓ g i
Full source
@[simp]
theorem inf_apply [SemilatticeInf α] {i : ι} {f g : ι →₀ α} : (f ⊓ g) i = f i ⊓ g i :=
  rfl
Pointwise Infimum of Finitely Supported Functions
Informal description
For any semilattice with infima $\alpha$, any index $i \in \iota$, and any finitely supported functions $f, g : \iota \to₀ \alpha$, the infimum of $f$ and $g$ evaluated at $i$ is equal to the infimum of $f(i)$ and $g(i)$, i.e., $(f \sqcap g)(i) = f(i) \sqcap g(i)$.
Finsupp.semilatticeSup instance
[SemilatticeSup α] : SemilatticeSup (ι →₀ α)
Full source
instance semilatticeSup [SemilatticeSup α] : SemilatticeSup (ι →₀ α) :=
  { Finsupp.partialorder with
    sup := zipWith (· ⊔ ·) (sup_idem _)
    le_sup_left := fun _f _g _i => le_sup_left
    le_sup_right := fun _f _g _i => le_sup_right
    sup_le := fun _f _g _h hf hg i => sup_le (hf i) (hg i) }
Pointwise Semilattice Supremum on Finitely Supported Functions
Informal description
For any type $\iota$ and any semilattice with supremum $\alpha$, the type $\iota \to₀ \alpha$ of finitely supported functions from $\iota$ to $\alpha$ is equipped with a pointwise semilattice structure, where the supremum of two functions $f$ and $g$ is defined by $(f \sqcup g)(i) = f(i) \sqcup g(i)$ for all $i \in \iota$.
Finsupp.sup_apply theorem
[SemilatticeSup α] {i : ι} {f g : ι →₀ α} : (f ⊔ g) i = f i ⊔ g i
Full source
@[simp]
theorem sup_apply [SemilatticeSup α] {i : ι} {f g : ι →₀ α} : (f ⊔ g) i = f i ⊔ g i :=
  rfl
Pointwise Supremum Evaluation for Finitely Supported Functions
Informal description
For any type $\iota$ and any semilattice with supremum $\alpha$, given finitely supported functions $f, g : \iota \to₀ \alpha$ and an index $i \in \iota$, the evaluation of the pointwise supremum $f \sqcup g$ at $i$ equals the supremum of the evaluations $f(i) \sqcup g(i)$.
Finsupp.lattice instance
[Lattice α] : Lattice (ι →₀ α)
Full source
instance lattice [Lattice α] : Lattice (ι →₀ α) :=
  { Finsupp.semilatticeInf, Finsupp.semilatticeSup with }
Pointwise Lattice Structure on Finitely Supported Functions
Informal description
For any type $\iota$ and any lattice $\alpha$, the type $\iota \to₀ \alpha$ of finitely supported functions from $\iota$ to $\alpha$ is equipped with a pointwise lattice structure, where the infimum and supremum of two functions $f$ and $g$ are given by $(f \sqcap g)(i) = f(i) \sqcap g(i)$ and $(f \sqcup g)(i) = f(i) \sqcup g(i)$ for all $i \in \iota$.
Finsupp.support_inf_union_support_sup theorem
: (f ⊓ g).support ∪ (f ⊔ g).support = f.support ∪ g.support
Full source
theorem support_inf_union_support_sup : (f ⊓ g).support ∪ (f ⊔ g).support = f.support ∪ g.support :=
  coe_injective <| compl_injective <| by ext; simp [inf_eq_and_sup_eq_iff]
Support Union Property for Pointwise Infimum and Supremum of Finitely Supported Functions
Informal description
For any finitely supported functions $f, g : \iota \to₀ \alpha$, the union of the supports of the pointwise infimum $f \sqcap g$ and the pointwise supremum $f \sqcup g$ is equal to the union of the supports of $f$ and $g$. In other words, $(f \sqcap g).\text{support} \cup (f \sqcup g).\text{support} = f.\text{support} \cup g.\text{support}$.
Finsupp.support_sup_union_support_inf theorem
: (f ⊔ g).support ∪ (f ⊓ g).support = f.support ∪ g.support
Full source
theorem support_sup_union_support_inf : (f ⊔ g).support ∪ (f ⊓ g).support = f.support ∪ g.support :=
  (union_comm _ _).trans <| support_inf_union_support_sup _ _
Support Union Property for Pointwise Supremum and Infimum of Finitely Supported Functions
Informal description
For any finitely supported functions $f, g : \iota \to₀ \alpha$, the union of the supports of the pointwise supremum $f \sqcup g$ and the pointwise infimum $f \sqcap g$ is equal to the union of the supports of $f$ and $g$. In other words, $(f \sqcup g).\text{support} \cup (f \sqcap g).\text{support} = f.\text{support} \cup g.\text{support}$.
Finsupp.isOrderedAddMonoid instance
: IsOrderedAddMonoid (ι →₀ α)
Full source
instance isOrderedAddMonoid : IsOrderedAddMonoid (ι →₀ α) :=
  { add_le_add_left := fun _a _b h c s => add_le_add_left (h s) (c s) }
Ordered Additive Monoid Structure on Finitely Supported Functions
Informal description
For any type $\iota$ and any partially ordered additive monoid $\alpha$, the type $\iota \to_{\text{f}} \alpha$ of finitely supported functions from $\iota$ to $\alpha$ forms an ordered additive monoid under pointwise addition and the pointwise partial order.
Finsupp.mapDomain_mono theorem
: Monotone (mapDomain f : (ι →₀ α) → (κ →₀ α))
Full source
lemma mapDomain_mono : Monotone (mapDomain f : (ι →₀ α) → (κ →₀ α)) := by
  classical exact fun g₁ g₂ h ↦ sum_le_sum_index h (fun _ _ ↦ single_mono) (by simp)
Monotonicity of Domain Mapping for Finitely Supported Functions
Informal description
For any function $f : \iota \to \kappa$, the function $\text{mapDomain}_f : (\iota \to_{\text{f}} \alpha) \to (\kappa \to_{\text{f}} \alpha)$ is monotone with respect to the pointwise order on finitely supported functions. That is, if $g_1 \leq g_2$ in $\iota \to_{\text{f}} \alpha$, then $\text{mapDomain}_f(g_1) \leq \text{mapDomain}_f(g_2)$ in $\kappa \to_{\text{f}} \alpha$.
Finsupp.GCongr.mapDomain_mono theorem
(hg : g₁ ≤ g₂) : g₁.mapDomain f ≤ g₂.mapDomain f
Full source
@[gcongr] protected lemma GCongr.mapDomain_mono (hg : g₁ ≤ g₂) : g₁.mapDomain f ≤ g₂.mapDomain f :=
  mapDomain_mono hg
Monotonicity of Domain Mapping for Finitely Supported Functions
Informal description
For any function $f : \iota \to \kappa$ and finitely supported functions $g_1, g_2 : \iota \to_{\text{f}} \alpha$, if $g_1 \leq g_2$ pointwise, then their images under domain mapping satisfy $\text{mapDomain}_f(g_1) \leq \text{mapDomain}_f(g_2)$ pointwise.
Finsupp.mapDomain_nonneg theorem
(hg : 0 ≤ g) : 0 ≤ g.mapDomain f
Full source
lemma mapDomain_nonneg (hg : 0 ≤ g) : 0 ≤ g.mapDomain f := by simpa using mapDomain_mono hg
Non-negativity Preservation under Domain Mapping for Finitely Supported Functions
Informal description
For any finitely supported function $g : \iota \to_{\text{f}} \alpha$ such that $0 \leq g$ (pointwise non-negativity), the mapped function $g.\text{mapDomain}\, f : \kappa \to_{\text{f}} \alpha$ is also pointwise non-negative, i.e., $0 \leq g.\text{mapDomain}\, f$.
Finsupp.mapDomain_nonpos theorem
(hg : g ≤ 0) : g.mapDomain f ≤ 0
Full source
lemma mapDomain_nonpos (hg : g ≤ 0) : g.mapDomain f ≤ 0 := by simpa using mapDomain_mono hg
Nonpositivity Preservation under Domain Mapping for Finitely Supported Functions
Informal description
For any finitely supported function $g \colon \iota \to \alpha$ such that $g \leq 0$ pointwise, and any function $f \colon \iota \to \kappa$, the mapped function $\text{mapDomain}_f(g) \colon \kappa \to \alpha$ satisfies $\text{mapDomain}_f(g) \leq 0$ pointwise.
Finsupp.isOrderedCancelAddMonoid instance
[AddCommMonoid α] [PartialOrder α] [IsOrderedCancelAddMonoid α] : IsOrderedCancelAddMonoid (ι →₀ α)
Full source
instance isOrderedCancelAddMonoid [AddCommMonoid α] [PartialOrder α] [IsOrderedCancelAddMonoid α] :
    IsOrderedCancelAddMonoid (ι →₀ α) :=
  { le_of_add_le_add_left := fun _f _g _i h s => le_of_add_le_add_left (h s) }
Ordered Cancel Additive Monoid Structure on Finitely Supported Functions
Informal description
For any type $\iota$ and any partially ordered additive commutative monoid $\alpha$ that is an ordered cancel additive monoid, the type $\iota \to_{\text{f}} \alpha$ of finitely supported functions from $\iota$ to $\alpha$ is also an ordered cancel additive monoid under pointwise addition and the pointwise partial order.
Finsupp.addLeftReflectLE instance
[AddCommMonoid α] [PartialOrder α] [AddLeftReflectLE α] : AddLeftReflectLE (ι →₀ α)
Full source
instance addLeftReflectLE [AddCommMonoid α] [PartialOrder α] [AddLeftReflectLE α] :
    AddLeftReflectLE (ι →₀ α) :=
  ⟨fun _f _g _h H x => le_of_add_le_add_left <| H x⟩
Addition Reflects Order from the Left for Finitely Supported Functions
Informal description
For any type $\iota$ and any ordered additive commutative monoid $\alpha$ where addition reflects the order from the left, the type $\iota \to₀ \alpha$ of finitely supported functions from $\iota$ to $\alpha$ also has the property that addition reflects the order from the left. That is, for any functions $f, g, h \colon \iota \to₀ \alpha$, if $f + h \leq g + h$, then $f \leq g$.
Finsupp.instPosSMulMono instance
[PosSMulMono α β] : PosSMulMono α (ι →₀ β)
Full source
instance instPosSMulMono [PosSMulMono α β] : PosSMulMono α (ι →₀ β) :=
  PosSMulMono.lift _ coe_le_coe coe_smul
Positive Scalar Multiplication Preserves Order on Finitely Supported Functions
Informal description
For any type $\iota$ and any types $\alpha$ and $\beta$ with a preorder and a scalar multiplication operation, if $\alpha$ has the property that positive scalar multiplication preserves the order on $\beta$, then the same property holds for finitely supported functions $\iota \to₀ \beta$ with respect to $\alpha$.
Finsupp.instSMulPosMono instance
[SMulPosMono α β] : SMulPosMono α (ι →₀ β)
Full source
instance instSMulPosMono [SMulPosMono α β] : SMulPosMono α (ι →₀ β) :=
  SMulPosMono.lift _ coe_le_coe coe_smul coe_zero
Monotonicity of Scalar Multiplication on Finitely Supported Functions
Informal description
For any types $\alpha$ and $\beta$ where $\alpha$ has a scalar multiplication operation that is monotone in the second argument (i.e., $[SMulPosMono \alpha \beta]$), the type of finitely supported functions $\iota \to₀ \beta$ inherits this property. This means that for any $a \in \alpha$ and any finitely supported functions $f, g : \iota \to₀ \beta$, if $f \leq g$ pointwise, then $a \cdot f \leq a \cdot g$ pointwise.
Finsupp.instPosSMulReflectLE instance
[PosSMulReflectLE α β] : PosSMulReflectLE α (ι →₀ β)
Full source
instance instPosSMulReflectLE [PosSMulReflectLE α β] : PosSMulReflectLE α (ι →₀ β) :=
  PosSMulReflectLE.lift _ coe_le_coe coe_smul
Positivity-Reflecting Scalar Multiplication on Finitely Supported Functions
Informal description
For any type $\iota$ and any ordered types $\alpha$ and $\beta$ where scalar multiplication by positive elements reflects the order (i.e., if $a > 0$ and $a \cdot x \leq a \cdot y$ implies $x \leq y$), the type $\iota \to₀ \beta$ of finitely supported functions from $\iota$ to $\beta$ inherits this property. That is, for any positive $a \in \alpha$ and finitely supported functions $f, g : \iota \to \beta$, if $a \cdot f \leq a \cdot g$ pointwise, then $f \leq g$ pointwise.
Finsupp.instSMulPosReflectLE instance
[SMulPosReflectLE α β] : SMulPosReflectLE α (ι →₀ β)
Full source
instance instSMulPosReflectLE [SMulPosReflectLE α β] : SMulPosReflectLE α (ι →₀ β) :=
  SMulPosReflectLE.lift _ coe_le_coe coe_smul coe_zero
Pointwise Scalar Multiplication Reflects Order on Finitely Supported Functions
Informal description
For any type $\iota$ and any type $\beta$ with a preorder, if $\alpha$ is a type with a scalar multiplication operation that reflects the order on $\beta$ (i.e., for positive $a \in \alpha$, $a \cdot b \leq a \cdot c$ implies $b \leq c$), then the finitely supported functions $\iota \to₀ \beta$ also inherit this property under pointwise scalar multiplication.
Finsupp.instPosSMulStrictMono instance
[PosSMulStrictMono α β] : PosSMulStrictMono α (ι →₀ β)
Full source
instance instPosSMulStrictMono [PosSMulStrictMono α β] : PosSMulStrictMono α (ι →₀ β) :=
  PosSMulStrictMono.lift _ coe_le_coe coe_smul
Strict Monotonicity of Positive Scalar Multiplication on Finitely Supported Functions
Informal description
For any type $\iota$ and ordered types $\alpha$ and $\beta$ where scalar multiplication by positive elements is strictly monotone (i.e., if $a > 0$ and $x < y$ implies $a \cdot x < a \cdot y$), the type $\iota \to₀ \beta$ of finitely supported functions from $\iota$ to $\beta$ inherits this property under pointwise scalar multiplication.
Finsupp.instSMulPosStrictMono instance
[SMulPosStrictMono α β] : SMulPosStrictMono α (ι →₀ β)
Full source
instance instSMulPosStrictMono [SMulPosStrictMono α β] : SMulPosStrictMono α (ι →₀ β) :=
  SMulPosStrictMono.lift _ coe_le_coe coe_smul coe_zero
Strict Monotonicity of Pointwise Scalar Multiplication on Finitely Supported Functions
Informal description
For any type $\iota$ and any type $\beta$ with a preorder, if scalar multiplication by positive elements of $\alpha$ is strictly monotone on $\beta$ (i.e., for $a > 0$ in $\alpha$, the function $b \mapsto a \cdot b$ is strictly increasing on $\beta$), then pointwise scalar multiplication on finitely supported functions $\iota \to₀ \beta$ is also strictly monotone.
Finsupp.instSMulPosReflectLT instance
[SMulPosReflectLT α β] : SMulPosReflectLT α (ι →₀ β)
Full source
instance instSMulPosReflectLT [SMulPosReflectLT α β] : SMulPosReflectLT α (ι →₀ β) :=
  SMulPosReflectLT.lift _ coe_le_coe coe_smul coe_zero
Reflection of Less-Than Relation under Positive Scalar Multiplication on Finitely Supported Functions
Informal description
For any type $\iota$ and any types $\alpha$ and $\beta$ with a scalar multiplication operation, if the scalar multiplication on $\beta$ reflects the less-than relation when the scalar is positive (i.e., for $a > 0$, $a \cdot x < a \cdot y$ implies $x < y$), then the pointwise scalar multiplication on finitely supported functions $\iota \to₀ \beta$ also reflects the less-than relation when the scalar is positive.
Finsupp.orderBot instance
: OrderBot (ι →₀ α)
Full source
instance orderBot : OrderBot (ι →₀ α) where
  bot := 0
  bot_le := by simp only [le_def, coe_zero, Pi.zero_apply, imp_true_iff, zero_le]
Order with Bottom Element on Finitely Supported Functions
Informal description
For any type $\iota$ and any canonically ordered additive monoid $\alpha$ with a bottom element, the type $\iota \to₀ \alpha$ of finitely supported functions from $\iota$ to $\alpha$ is equipped with an order structure that has a bottom element, where the bottom element is the zero function.
Finsupp.bot_eq_zero theorem
: (⊥ : ι →₀ α) = 0
Full source
protected theorem bot_eq_zero : ( : ι →₀ α) = 0 :=
  rfl
Bottom Element Equals Zero in Finitely Supported Functions
Informal description
For any type $\iota$ and any canonically ordered additive monoid $\alpha$ with a bottom element, the bottom element of the pointwise order on finitely supported functions $\iota \to₀ \alpha$ is the zero function, i.e., $\bot = 0$.
Finsupp.add_eq_zero_iff theorem
(f g : ι →₀ α) : f + g = 0 ↔ f = 0 ∧ g = 0
Full source
@[simp]
theorem add_eq_zero_iff (f g : ι →₀ α) : f + g = 0 ↔ f = 0 ∧ g = 0 := by
  simp [DFunLike.ext_iff, forall_and]
Sum of Finitely Supported Functions is Zero if and only if Both Functions are Zero
Informal description
For any two finitely supported functions $f, g \colon \iota \to \alpha$ from a type $\iota$ to a canonically ordered additive monoid $\alpha$, the sum $f + g$ is the zero function if and only if both $f$ and $g$ are the zero function.
Finsupp.le_iff' theorem
(f g : ι →₀ α) {s : Finset ι} (hf : f.support ⊆ s) : f ≤ g ↔ ∀ i ∈ s, f i ≤ g i
Full source
theorem le_iff' (f g : ι →₀ α) {s : Finset ι} (hf : f.support ⊆ s) : f ≤ g ↔ ∀ i ∈ s, f i ≤ g i :=
  ⟨fun h s _hs => h s, fun h s => by
    classical exact
        if H : s ∈ f.support then h s (hf H) else (not_mem_support_iff.1 H).symm ▸ zero_le (g s)⟩
Pointwise Order Characterization for Finitely Supported Functions on a Finite Subset
Informal description
Let $f$ and $g$ be finitely supported functions from $\iota$ to $\alpha$, and let $s$ be a finite subset of $\iota$ containing the support of $f$. Then $f \leq g$ if and only if for every $i \in s$, we have $f(i) \leq g(i)$.
Finsupp.le_iff theorem
(f g : ι →₀ α) : f ≤ g ↔ ∀ i ∈ f.support, f i ≤ g i
Full source
theorem le_iff (f g : ι →₀ α) : f ≤ g ↔ ∀ i ∈ f.support, f i ≤ g i :=
  le_iff' f g <| Subset.refl _
Pointwise Order Characterization for Finitely Supported Functions
Informal description
For any two finitely supported functions $f, g \colon \iota \to \alpha$, the inequality $f \leq g$ holds if and only if $f(i) \leq g(i)$ for all $i$ in the support of $f$.
Finsupp.support_monotone theorem
: Monotone (support (α := ι) (M := α))
Full source
lemma support_monotone : Monotone (support (α := ι) (M := α)) :=
  fun f g h a ha ↦ by rw [mem_support_iff, ← pos_iff_ne_zero] at ha ⊢; exact ha.trans_le (h _)
Monotonicity of Support for Finitely Supported Functions
Informal description
The support function on finitely supported functions from $\iota$ to $\alpha$ is monotone with respect to the pointwise order. That is, for any two finitely supported functions $f, g \colon \iota \to_{\text{f}} \alpha$, if $f \leq g$ pointwise, then the support of $f$ is contained in the support of $g$.
Finsupp.support_mono theorem
(hfg : f ≤ g) : f.support ⊆ g.support
Full source
lemma support_mono (hfg : f ≤ g) : f.support ⊆ g.support := support_monotone hfg
Support Monotonicity under Pointwise Order for Finitely Supported Functions
Informal description
For any two finitely supported functions $f, g \colon \iota \to \alpha$, if $f \leq g$ pointwise (i.e., $f(i) \leq g(i)$ for all $i \in \iota$), then the support of $f$ is contained in the support of $g$.
Finsupp.decidableLE instance
[DecidableLE α] : DecidableLE (ι →₀ α)
Full source
instance decidableLE [DecidableLE α] : DecidableLE (ι →₀ α) := fun f g =>
  decidable_of_iff _ (le_iff f g).symm
Decidability of Pointwise Order on Finitely Supported Functions
Informal description
For any type $\iota$ and any ordered type $\alpha$ with a decidable order relation $\leq$, the pointwise order on finitely supported functions $\iota \to₀ \alpha$ is decidable. That is, given two finitely supported functions $f, g : \iota \to₀ \alpha$, it is decidable whether $f \leq g$ holds pointwise.
Finsupp.decidableLT instance
[DecidableLE α] : DecidableLT (ι →₀ α)
Full source
instance decidableLT [DecidableLE α] : DecidableLT (ι →₀ α) :=
  decidableLTOfDecidableLE
Decidability of Strict Pointwise Order on Finitely Supported Functions
Informal description
For any type $\iota$ and any ordered type $\alpha$ with a decidable order relation $\leq$, the strict pointwise order on finitely supported functions $\iota \to₀ \alpha$ is decidable. That is, given two finitely supported functions $f, g : \iota \to₀ \alpha$, it is decidable whether $f < g$ holds pointwise.
Finsupp.single_le_iff theorem
{i : ι} {x : α} {f : ι →₀ α} : single i x ≤ f ↔ x ≤ f i
Full source
@[simp]
theorem single_le_iff {i : ι} {x : α} {f : ι →₀ α} : singlesingle i x ≤ f ↔ x ≤ f i :=
  (le_iff' _ _ support_single_subset).trans <| by simp
Comparison of Single-Point Function with General Function: $\text{single}(i, x) \leq f \leftrightarrow x \leq f(i)$
Informal description
For any finitely supported function $f : \iota \to₀ \alpha$, any index $i \in \iota$, and any element $x \in \alpha$, the single-point function $\text{single}(i, x)$ is less than or equal to $f$ if and only if $x \leq f(i)$.
Finsupp.tsub instance
: Sub (ι →₀ α)
Full source
/-- This is called `tsub` for truncated subtraction, to distinguish it with subtraction in an
additive group. -/
instance tsub : Sub (ι →₀ α) :=
  ⟨zipWith (fun m n => m - n) (tsub_self 0)⟩
Pointwise Subtraction on Finitely Supported Functions
Informal description
For any type $\alpha$ with a subtraction operation, the type of finitely supported functions $\iota \to₀ \alpha$ is equipped with a pointwise subtraction operation. This operation is defined as $(f - g)(i) = f(i) - g(i)$ for each $i \in \iota$.
Finsupp.orderedSub instance
: OrderedSub (ι →₀ α)
Full source
instance orderedSub : OrderedSub (ι →₀ α) :=
  ⟨fun _n _m _k => forall_congr' fun _x => tsub_le_iff_right⟩
Ordered Subtraction Structure on Finitely Supported Functions
Informal description
For any type $\iota$ and any canonically ordered additive monoid $\alpha$, the type of finitely supported functions $\iota \to₀ \alpha$ is equipped with an ordered subtraction structure, where the subtraction operation is defined pointwise and satisfies the property that $f \leq g$ if and only if there exists $h$ such that $g = f + h$.
Finsupp.instCanonicallyOrderedAddOfCovariantClassHAddLe instance
[CovariantClass α α (· + ·) (· ≤ ·)] : CanonicallyOrderedAdd (ι →₀ α)
Full source
instance [CovariantClass α α (· + ·) (· ≤ ·)] : CanonicallyOrderedAdd (ι →₀ α) where
  exists_add_of_le := fun {f g} h => ⟨g - f, ext fun x => (add_tsub_cancel_of_le <| h x).symm⟩
  le_self_add := fun _f _g _x => le_self_add
Canonically Ordered Additive Monoid Structure on Finitely Supported Functions
Informal description
For any type $\alpha$ with a covariant addition operation with respect to the order $\leq$, the type of finitely supported functions $\iota \to₀ \alpha$ is a canonically ordered additive monoid. This means that for any two functions $f, g \colon \iota \to₀ \alpha$, we have $f \leq g$ if and only if there exists a function $h \colon \iota \to₀ \alpha$ such that $g = f + h$.
Finsupp.coe_tsub theorem
(f g : ι →₀ α) : ⇑(f - g) = f - g
Full source
@[simp, norm_cast] lemma coe_tsub (f g : ι →₀ α) : ⇑(f - g) = f - g := rfl
Pointwise Subtraction of Finitely Supported Functions
Informal description
For any two finitely supported functions $f, g : \iota \to \alpha$, the underlying function of their pointwise subtraction $f - g$ is equal to the pointwise subtraction of the underlying functions, i.e., $(f - g)(i) = f(i) - g(i)$ for all $i \in \iota$.
Finsupp.tsub_apply theorem
(f g : ι →₀ α) (a : ι) : (f - g) a = f a - g a
Full source
theorem tsub_apply (f g : ι →₀ α) (a : ι) : (f - g) a = f a - g a :=
  rfl
Pointwise Subtraction of Finitely Supported Functions
Informal description
For any finitely supported functions $f, g : \iota \to₀ \alpha$ and any element $a \in \iota$, the pointwise subtraction $(f - g)(a)$ is equal to $f(a) - g(a)$.
Finsupp.single_tsub theorem
: single i (a - b) = single i a - single i b
Full source
@[simp]
theorem single_tsub : single i (a - b) = single i a - single i b := by
  ext j
  obtain rfl | h := eq_or_ne i j
  · rw [tsub_apply, single_eq_same, single_eq_same, single_eq_same]
  · rw [tsub_apply, single_eq_of_ne h, single_eq_of_ne h, single_eq_of_ne h, tsub_self]
Pointwise Subtraction of Single-Point Finitely Supported Functions: $\text{single}_i(a - b) = \text{single}_i(a) - \text{single}_i(b)$
Informal description
For any index $i$ and elements $a, b$ in a type $\alpha$ with a subtraction operation, the finitely supported function with a single nonzero value at $i$ given by $a - b$ is equal to the pointwise subtraction of the finitely supported functions with single nonzero values at $i$ given by $a$ and $b$ respectively. That is, $\text{single}_i(a - b) = \text{single}_i(a) - \text{single}_i(b)$.
Finsupp.support_tsub theorem
{f1 f2 : ι →₀ α} : (f1 - f2).support ⊆ f1.support
Full source
theorem support_tsub {f1 f2 : ι →₀ α} : (f1 - f2).support ⊆ f1.support := by
  simp +contextual only [subset_iff, tsub_eq_zero_iff_le, mem_support_iff,
    Ne, coe_tsub, Pi.sub_apply, not_imp_not, zero_le, imp_true_iff]
Support of Pointwise Difference is Subset of First Function's Support
Informal description
For any two finitely supported functions $f_1, f_2 : \iota \to₀ \alpha$, the support of their pointwise difference $f_1 - f_2$ is a subset of the support of $f_1$.
Finsupp.subset_support_tsub theorem
[DecidableEq ι] {f1 f2 : ι →₀ α} : f1.support \ f2.support ⊆ (f1 - f2).support
Full source
theorem subset_support_tsub [DecidableEq ι] {f1 f2 : ι →₀ α} :
    f1.support \ f2.supportf1.support \ f2.support ⊆ (f1 - f2).support := by
  simp +contextual [subset_iff]
Support Difference Contained in Pointwise Difference Support
Informal description
For any finitely supported functions $f_1, f_2 : \iota \to₀ \alpha$ (where $\iota$ has decidable equality), the set difference of their supports is contained in the support of their pointwise difference. In other words, $f_1.\text{support} \setminus f_2.\text{support} \subseteq (f_1 - f_2).\text{support}$.
Finsupp.support_inf theorem
[DecidableEq ι] (f g : ι →₀ α) : (f ⊓ g).support = f.support ∩ g.support
Full source
@[simp]
theorem support_inf [DecidableEq ι] (f g : ι →₀ α) : (f ⊓ g).support = f.support ∩ g.support := by
  ext
  simp only [inf_apply, mem_support_iff, Ne, Finset.mem_union, Finset.mem_filter,
    Finset.mem_inter]
  simp only [← nonpos_iff_eq_zero, min_le_iff, not_or]
Support of Pointwise Infimum Equals Intersection of Supports
Informal description
For any finitely supported functions $f, g : \iota \to₀ \alpha$ (where $\iota$ has decidable equality), the support of their pointwise infimum $f \sqcap g$ is equal to the intersection of their supports, i.e., $\text{support}(f \sqcap g) = \text{support}(f) \cap \text{support}(g)$.
Finsupp.support_sup theorem
[DecidableEq ι] (f g : ι →₀ α) : (f ⊔ g).support = f.support ∪ g.support
Full source
@[simp]
theorem support_sup [DecidableEq ι] (f g : ι →₀ α) : (f ⊔ g).support = f.support ∪ g.support := by
  ext
  simp only [Finset.mem_union, mem_support_iff, sup_apply, Ne, ← bot_eq_zero]
  rw [_root_.sup_eq_bot_iff, not_and_or]
Support of Pointwise Supremum Equals Union of Supports
Informal description
For any finitely supported functions $f, g : \iota \to₀ \alpha$ (where $\iota$ has decidable equality), the support of their pointwise supremum $f \sqcup g$ is equal to the union of their individual supports, i.e., $\text{supp}(f \sqcup g) = \text{supp}(f) \cup \text{supp}(g)$.
Finsupp.disjoint_iff theorem
{f g : ι →₀ α} : Disjoint f g ↔ Disjoint f.support g.support
Full source
nonrec theorem disjoint_iff {f g : ι →₀ α} : DisjointDisjoint f g ↔ Disjoint f.support g.support := by
  classical
    rw [disjoint_iff, disjoint_iff, Finsupp.bot_eq_zero, ← Finsupp.support_eq_empty,
      Finsupp.support_inf]
    rfl
Disjointness Characterization for Finitely Supported Functions via Supports
Informal description
For any finitely supported functions $f, g : \iota \to_{\text{f}} \alpha$, the functions $f$ and $g$ are disjoint (i.e., their infimum is the zero function) if and only if their supports are disjoint sets.
Finsupp.sub_single_one_add theorem
{a : ι} {u u' : ι →₀ ℕ} (h : u a ≠ 0) : u - single a 1 + u' = u + u' - single a 1
Full source
theorem sub_single_one_add {a : ι} {u u' : ι →₀ ℕ} (h : u a ≠ 0) :
    u - single a 1 + u' = u + u' - single a 1 :=
  tsub_add_eq_add_tsub <| single_le_iff.mpr <| Nat.one_le_iff_ne_zero.mpr h
Subtraction-Additivity Property for Finitely Supported Functions with Single-Point Modification
Informal description
For any finitely supported functions $u, u' \colon \iota \to₀ \mathbb{N}$ and any index $a \in \iota$ such that $u(a) \neq 0$, we have: $$(u - \text{single}(a, 1)) + u' = (u + u') - \text{single}(a, 1)$$ where $\text{single}(a, 1)$ is the function that takes value 1 at $a$ and 0 elsewhere, and all operations are performed pointwise.
Finsupp.add_sub_single_one theorem
{a : ι} {u u' : ι →₀ ℕ} (h : u' a ≠ 0) : u + (u' - single a 1) = u + u' - single a 1
Full source
theorem add_sub_single_one {a : ι} {u u' : ι →₀ ℕ} (h : u' a ≠ 0) :
    u + (u' - single a 1) = u + u' - single a 1 :=
  (add_tsub_assoc_of_le (single_le_iff.mpr <| Nat.one_le_iff_ne_zero.mpr h) _).symm
Addition-Subtraction Identity for Finitely Supported Functions with Single-Point Adjustment
Informal description
For any finitely supported functions $u, u' \colon \iota \to₀ \mathbb{N}$ and any index $a \in \iota$ such that $u'(a) \neq 0$, we have the equality: $$ u + (u' - \text{single}(a, 1)) = u + u' - \text{single}(a, 1) $$ where $\text{single}(a, 1)$ denotes the function that is 1 at $a$ and 0 elsewhere.
Finsupp.sub_add_single_one_cancel theorem
{u : ι →₀ ℕ} {i : ι} (h : u i ≠ 0) : u - single i 1 + single i 1 = u
Full source
lemma sub_add_single_one_cancel {u : ι →₀ ℕ} {i : ι} (h : u i ≠ 0) :
    u - single i 1 + single i 1 = u := by
  rw [sub_single_one_add h, add_tsub_cancel_right]
Cancellation Property for Finitely Supported Functions with Single-Point Adjustment
Informal description
For any finitely supported function $u \colon \iota \to₀ \mathbb{N}$ and any index $i \in \iota$ such that $u(i) \neq 0$, we have: $$(u - \text{single}(i, 1)) + \text{single}(i, 1) = u$$ where $\text{single}(i, 1)$ is the function that takes value 1 at $i$ and 0 elsewhere, and all operations are performed pointwise.