File: Mathlib/Algebra/DirectSum/Basic.lean

full_name: DirectSum
code: /-- `DirectSum ι β` is the direct sum of a family of additive commutative monoids `β i`.

Note: `open DirectSum` will enable the notation `⨁ i, β i` for `DirectSum ι β`. -/
def DirectSum [∀ i, AddCommMonoid (β i)] : Type _ 
goal: Type (max w v)

full_name: instInhabitedDirectSum
code: instance [∀ i, AddCommMonoid (β i)] : Inhabited (DirectSum ι β) 
goal: Inhabited (DirectSum ι β)

full_name: instAddCommMonoidDirectSum
code: instance [∀ i, AddCommMonoid (β i)] : AddCommMonoid (DirectSum ι β) 
goal: AddCommMonoid (DirectSum ι β)

full_name: instDFunLikeDirectSum
code: instance [∀ i, AddCommMonoid (β i)] : DFunLike (DirectSum ι β) _ fun i : ι => β i 
goal: DFunLike (DirectSum ι β) ι fun i => β i

full_name: instCoeFunDirectSumForall
code: instance [∀ i, AddCommMonoid (β i)] : CoeFun (DirectSum ι β) fun _ => ∀ i : ι, β i 
goal: CoeFun (DirectSum ι β) fun x => (i : ι) → β i

full_name: DirectSum.«_aux_Mathlib_Algebra_DirectSum_Basic___macroRules_DirectSum_term⨁_,__1»
code: /-- `⨁ i, f i` is notation for `DirectSum _ f` and equals the direct sum of `fun i ↦ f i`.
Taking the direct sum over multiple arguments is possible, e.g. `⨁ (i) (j), f i j`. -/
scoped[DirectSum] notation3 "⨁ "(...)", "r:(scoped f => DirectSum _ f) => r
goal: Lean.Macro

full_name: instDecidableEqDirectSum
code: instance [DecidableEq ι] [∀ i, AddCommMonoid (β i)] [∀ i, DecidableEq (β i)] :
    DecidableEq (DirectSum ι β) 
goal: DecidableEq (DirectSum ι β)

full_name: DirectSum.instAddCommGroup
code: instance : AddCommGroup (DirectSum ι β) 
goal: AddCommGroup (DirectSum ι β)

full_name: DirectSum.sub_apply
code: @[simp]
theorem sub_apply (g₁ g₂ : ⨁ i, β i) (i : ι) : (g₁ - g₂) i = g₁ i - g₂ i 
goal: (g₁ - g₂) i = g₁ i - g₂ i

full_name: DirectSum.zero_apply
code: @[simp]
theorem zero_apply (i : ι) : (0 : ⨁ i, β i) i = 0 
goal: 0 i = 0

full_name: DirectSum.add_apply
code: @[simp]
theorem add_apply (g₁ g₂ : ⨁ i, β i) (i : ι) : (g₁ + g₂) i = g₁ i + g₂ i 
goal: (g₁ + g₂) i = g₁ i + g₂ i

full_name: DirectSum.mk
code: /-- `mk β s x` is the element of `⨁ i, β i` that is zero outside `s`
and has coefficient `x i` for `i` in `s`. -/
def mk (s : Finset ι) : (∀ i : (↑s : Set ι), β i.1) →+ ⨁ i, β i 
goal: ((i : ↑↑s) → β ↑i) →+ DirectSum ι fun i => β i

full_name: DirectSum.of
code: /-- `of i` is the natural inclusion map from `β i` to `⨁ i, β i`. -/
def of (i : ι) : β i →+ ⨁ i, β i 
goal: β i →+ DirectSum ι fun i => β i

full_name: DirectSum.of_eq_same
code: @[simp]
theorem of_eq_same (i : ι) (x : β i) : (of _ i x) i = x 
goal: ((DirectSum.of β i) x) i = x

full_name: DirectSum.of_eq_of_ne
code: theorem of_eq_of_ne (i j : ι) (x : β i) (h : i ≠ j) : (of _ i x) j = 0 
goal: ((DirectSum.of β i) x) j = 0

full_name: DirectSum.of_apply
code: lemma of_apply {i : ι} (j : ι) (x : β i) : of β i x j = if h : i = j then Eq.recOn h x else 0 
goal: ((DirectSum.of β i) x) j = if h : i = j then Eq.recOn h x else 0

full_name: DirectSum.mk_apply_of_mem
code: theorem mk_apply_of_mem {s : Finset ι} {f : ∀ i : (↑s : Set ι), β i.val} {n : ι} (hn : n ∈ s) :
    mk β s f n = f ⟨n, hn⟩ 
goal: ((DirectSum.mk β s) f) n = f ⟨n, hn⟩

full_name: DirectSum.mk_apply_of_not_mem
code: theorem mk_apply_of_not_mem {s : Finset ι} {f : ∀ i : (↑s : Set ι), β i.val} {n : ι} (hn : n ∉ s) :
    mk β s f n = 0 
goal: ((DirectSum.mk β s) f) n = 0

full_name: DirectSum.support_zero
code: @[simp]
theorem support_zero [∀ (i : ι) (x : β i), Decidable (x ≠ 0)] : (0 : ⨁ i, β i).support = ∅ 
goal: DFinsupp.support 0 = ∅

full_name: DirectSum.support_of
code: @[simp]
theorem support_of [∀ (i : ι) (x : β i), Decidable (x ≠ 0)] (i : ι) (x : β i) (h : x ≠ 0) :
    (of _ i x).support = {i} 
goal: DFinsupp.support ((DirectSum.of β i) x) = {i}

full_name: DirectSum.support_of_subset
code: theorem support_of_subset [∀ (i : ι) (x : β i), Decidable (x ≠ 0)] {i : ι} {b : β i} :
    (of _ i b).support ⊆ {i} 
goal: DFinsupp.support ((DirectSum.of β i) b) ⊆ {i}

full_name: DirectSum.sum_support_of
code: theorem sum_support_of [∀ (i : ι) (x : β i), Decidable (x ≠ 0)] (x : ⨁ i, β i) :
    (∑ i ∈ x.support, of β i (x i)) = x 
goal: ∑ i ∈ DFinsupp.support x, (DirectSum.of β i) (x i) = x

full_name: DirectSum.sum_univ_of
code: theorem sum_univ_of [Fintype ι] (x : ⨁ i, β i) :
    ∑ i ∈ Finset.univ, of β i (x i) = x 
goal: ∑ i : ι, (DirectSum.of β i) (x i) = x

full_name: DirectSum.mk_injective
code: theorem mk_injective (s : Finset ι) : Function.Injective (mk β s) 
goal: Function.Injective ⇑(DirectSum.mk β s)

full_name: DirectSum.of_injective
code: theorem of_injective (i : ι) : Function.Injective (of β i) 
goal: Function.Injective ⇑(DirectSum.of β i)

full_name: DirectSum.induction_on
code: @[elab_as_elim]
protected theorem induction_on {C : (⨁ i, β i) → Prop} (x : ⨁ i, β i) (H_zero : C 0)
    (H_basic : ∀ (i : ι) (x : β i), C (of β i x))
    (H_plus : ∀ x y, C x → C y → C (x + y)) : C x 
goal: C x

full_name: DirectSum.addHom_ext
code: /-- If two additive homomorphisms from `⨁ i, β i` are equal on each `of β i y`,
then they are equal. -/
theorem addHom_ext {γ : Type*} [AddMonoid γ] ⦃f g : (⨁ i, β i) →+ γ⦄
    (H : ∀ (i : ι) (y : β i), f (of _ i y) = g (of _ i y)) : f = g 
goal: f = g

full_name: DirectSum.addHom_ext'
code: /-- If two additive homomorphisms from `⨁ i, β i` are equal on each `of β i y`,
then they are equal.

See note [partially-applied ext lemmas]. -/
@[ext high]
theorem addHom_ext' {γ : Type*} [AddMonoid γ] ⦃f g : (⨁ i, β i) →+ γ⦄
    (H : ∀ i : ι, f.comp (of _ i) = g.comp (of _ i)) : f = g 
goal: f = g

full_name: DirectSum.toAddMonoid
code: /-- `toAddMonoid φ` is the natural homomorphism from `⨁ i, β i` to `γ`
induced by a family `φ` of homomorphisms `β i → γ`. -/
def toAddMonoid : (⨁ i, β i) →+ γ 
goal: (DirectSum ι fun i => β i) →+ γ

full_name: DirectSum.toAddMonoid_of
code: @[simp]
theorem toAddMonoid_of (i) (x : β i) : toAddMonoid φ (of β i x) = φ i x 
goal: (DirectSum.toAddMonoid φ) ((DirectSum.of β i) x) = (φ i) x

full_name: DirectSum.toAddMonoid.unique
code: theorem toAddMonoid.unique (f : ⨁ i, β i) : ψ f = toAddMonoid (fun i => ψ.comp (of β i)) f 
goal: ψ f = (DirectSum.toAddMonoid fun i => ψ.comp (DirectSum.of β i)) f

full_name: DirectSum.toAddMonoid_injective
code: lemma toAddMonoid_injective : Injective (toAddMonoid : (∀ i, β i →+ γ) → (⨁ i, β i) →+ γ) 
goal: Function.Injective DirectSum.toAddMonoid

full_name: DirectSum.toAddMonoid_inj
code: @[simp] lemma toAddMonoid_inj {f g : ∀ i, β i →+ γ} : toAddMonoid f = toAddMonoid g ↔ f = g 
goal: DirectSum.toAddMonoid f = DirectSum.toAddMonoid g ↔ f = g

full_name: DirectSum.fromAddMonoid
code: /-- `fromAddMonoid φ` is the natural homomorphism from `γ` to `⨁ i, β i`
induced by a family `φ` of homomorphisms `γ → β i`.

Note that this is not an isomorphism. Not every homomorphism `γ →+ ⨁ i, β i` arises in this way. -/
def fromAddMonoid : (⨁ i, γ →+ β i) →+ γ →+ ⨁ i, β i 
goal: (DirectSum ι fun i => γ →+ β i) →+ γ →+ DirectSum ι fun i => β i

full_name: DirectSum.fromAddMonoid_of
code: @[simp]
theorem fromAddMonoid_of (i : ι) (f : γ →+ β i) : fromAddMonoid (of _ i f) = (of _ i).comp f 
goal: DirectSum.fromAddMonoid ((DirectSum.of (fun i => γ →+ β i) i) f) = (DirectSum.of β i).comp f

full_name: DirectSum.fromAddMonoid_of_apply
code: theorem fromAddMonoid_of_apply (i : ι) (f : γ →+ β i) (x : γ) :
    fromAddMonoid (of _ i f) x = of _ i (f x) 
goal: (DirectSum.fromAddMonoid ((DirectSum.of (fun i => γ →+ β i) i) f)) x = (DirectSum.of β i) (f x)

full_name: DirectSum.setToSet
code: /-- `setToSet β S T h` is the natural homomorphism `⨁ (i : S), β i → ⨁ (i : T), β i`,
where `h : S ⊆ T`. -/
def setToSet (S T : Set ι) (H : S ⊆ T) : (⨁ i : S, β i) →+ ⨁ i : T, β i 
goal: (DirectSum ↑S fun i => β ↑i) →+ DirectSum ↑T fun i => β ↑i

full_name: DirectSum.unique
code: instance unique [∀ i, Subsingleton (β i)] : Unique (⨁ i, β i) 
goal: Unique (DirectSum ι fun i => β i)

full_name: DirectSum.uniqueOfIsEmpty
code: /-- A direct sum over an empty type is trivial. -/
instance uniqueOfIsEmpty [IsEmpty ι] : Unique (⨁ i, β i) 
goal: Unique (DirectSum ι fun i => β i)

full_name: DirectSum.id
code: /-- The natural equivalence between `⨁ _ : ι, M` and `M` when `Unique ι`. -/
protected def id (M : Type v) (ι : Type* := PUnit) [AddCommMonoid M] [Unique ι] :
    (⨁ _ : ι, M) ≃+ M 
goal: (DirectSum ι fun x => M) ≃+ M

full_name: DirectSum.equivCongrLeft
code: /-- Reindexing terms of a direct sum. -/
def equivCongrLeft (h : ι ≃ κ) : (⨁ i, β i) ≃+ ⨁ k, β (h.symm k) 
goal: (DirectSum ι fun i => β i) ≃+ DirectSum κ fun k => β (h.symm k)

full_name: DirectSum.equivCongrLeft_apply
code: @[simp]
theorem equivCongrLeft_apply (h : ι ≃ κ) (f : ⨁ i, β i) (k : κ) :
    equivCongrLeft h f k = f (h.symm k) 
goal: ((DirectSum.equivCongrLeft h) f) k = f (h.symm k)

full_name: DirectSum.addEquivProdDirectSum
code: /-- Isomorphism obtained by separating the term of index `none` of a direct sum over `Option ι`. -/
@[simps!]
noncomputable def addEquivProdDirectSum : (⨁ i, α i) ≃+ α none × ⨁ i, α (some i) 
goal: (DirectSum (Option ι) fun i => α i) ≃+ α none × DirectSum ι fun i => α (some i)

full_name: DirectSum.addEquivProdDirectSum_symm_apply_support'
code: /-- Isomorphism obtained by separating the term of index `none` of a direct sum over `Option ι`. -/
@[simps!]
noncomputable def addEquivProdDirectSum : (⨁ i, α i) ≃+ α none × ⨁ i, α (some i) 
goal: (DirectSum.addEquivProdDirectSum.symm f).support' = Trunc.map (fun s => ⟨none ::ₘ Multiset.map some ↑s, ⋯⟩) f.2.support'

full_name: DirectSum.addEquivProdDirectSum_symm_apply_toFun
code: /-- Isomorphism obtained by separating the term of index `none` of a direct sum over `Option ι`. -/
@[simps!]
noncomputable def addEquivProdDirectSum : (⨁ i, α i) ≃+ α none × ⨁ i, α (some i) 
goal: (DirectSum.addEquivProdDirectSum.symm f) i =
  match i with
  | none => f.1
  | some val => f.2 val

full_name: DirectSum.addEquivProdDirectSum_apply
code: /-- Isomorphism obtained by separating the term of index `none` of a direct sum over `Option ι`. -/
@[simps!]
noncomputable def addEquivProdDirectSum : (⨁ i, α i) ≃+ α none × ⨁ i, α (some i) 
goal: DirectSum.addEquivProdDirectSum f = (f none, DFinsupp.comapDomain some ⋯ f)

full_name: DirectSum.sigmaCurry
code: /-- The natural map between `⨁ (i : Σ i, α i), δ i.1 i.2` and `⨁ i (j : α i), δ i j`. -/
def sigmaCurry : (⨁ i : Σ _i, _, δ i.1 i.2) →+ ⨁ (i) (j), δ i j 
goal: (DirectSum ((_i : ι) × α _i) fun i => δ i.fst i.snd) →+ DirectSum ι fun i => DirectSum (α i) fun j => δ i j

full_name: DirectSum.sigmaCurry_apply
code: @[simp]
theorem sigmaCurry_apply (f : ⨁ i : Σ _i, _, δ i.1 i.2) (i : ι) (j : α i) :
    sigmaCurry f i j = f ⟨i, j⟩ 
goal: ((DirectSum.sigmaCurry f) i) j = f ⟨i, j⟩

full_name: DirectSum.sigmaUncurry
code: /-- The natural map between `⨁ i (j : α i), δ i j` and `Π₀ (i : Σ i, α i), δ i.1 i.2`, inverse of
`curry`. -/
def sigmaUncurry : (⨁ (i) (j), δ i j) →+ ⨁ i : Σ _i, _, δ i.1 i.2 
goal: (DirectSum ι fun i => DirectSum (α i) fun j => δ i j) →+ DirectSum ((_i : ι) × α _i) fun i => δ i.fst i.snd

full_name: DirectSum.sigmaUncurry_apply
code: @[simp]
theorem sigmaUncurry_apply (f : ⨁ (i) (j), δ i j) (i : ι) (j : α i) :
    sigmaUncurry f ⟨i, j⟩ = f i j 
goal: (DirectSum.sigmaUncurry f) ⟨i, j⟩ = (f i) j

full_name: DirectSum.sigmaCurryEquiv
code: /-- The natural map between `⨁ (i : Σ i, α i), δ i.1 i.2` and `⨁ i (j : α i), δ i j`. -/
def sigmaCurryEquiv : (⨁ i : Σ _i, _, δ i.1 i.2) ≃+ ⨁ (i) (j), δ i j 
goal: (DirectSum ((_i : ι) × α _i) fun i => δ i.fst i.snd) ≃+ DirectSum ι fun i => DirectSum (α i) fun j => δ i j

full_name: DirectSum.coeAddMonoidHom
code: /-- The canonical embedding from `⨁ i, A i` to `M` where `A` is a collection of `AddSubmonoid M`
indexed by `ι`.

When `S = Submodule _ M`, this is available as a `LinearMap`, `DirectSum.coe_linearMap`. -/
protected def coeAddMonoidHom {M S : Type*} [DecidableEq ι] [AddCommMonoid M] [SetLike S M]
    [AddSubmonoidClass S M] (A : ι → S) : (⨁ i, A i) →+ M 
goal: (DirectSum ι fun i => ↥(A i)) →+ M

full_name: DirectSum.coeAddMonoidHom_eq_dfinsupp_sum
code: theorem coeAddMonoidHom_eq_dfinsupp_sum [DecidableEq ι]
    {M S : Type*} [DecidableEq M] [AddCommMonoid M]
    [SetLike S M] [AddSubmonoidClass S M] (A : ι → S) (x : DirectSum ι fun i => A i) :
    DirectSum.coeAddMonoidHom A x = DFinsupp.sum x fun i => (fun x : A i => ↑x) 
goal: (DirectSum.coeAddMonoidHom A) x = DFinsupp.sum x fun i x => ↑x

full_name: DirectSum.coeAddMonoidHom_of
code: @[simp]
theorem coeAddMonoidHom_of {M S : Type*} [DecidableEq ι] [AddCommMonoid M] [SetLike S M]
    [AddSubmonoidClass S M] (A : ι → S) (i : ι) (x : A i) :
    DirectSum.coeAddMonoidHom A (of (fun i => A i) i x) = x 
goal: (DirectSum.coeAddMonoidHom A) ((DirectSum.of (fun i => ↥(A i)) i) x) = ↑x

full_name: DirectSum.coe_of_apply
code: theorem coe_of_apply {M S : Type*} [DecidableEq ι] [AddCommMonoid M] [SetLike S M]
    [AddSubmonoidClass S M] {A : ι → S} (i j : ι) (x : A i) :
    (of (fun i ↦ {x // x ∈ A i}) i x j : M) = if i = j then x else 0 
goal: ↑(((DirectSum.of (fun i => ↥(A i)) i) x) j) = ↑(if i = j then x else 0)

full_name: DirectSum.IsInternal
code: /-- The `DirectSum` formed by a collection of additive submonoids (or subgroups, or submodules) of
`M` is said to be internal if the canonical map `(⨁ i, A i) →+ M` is bijective.

For the alternate statement in terms of independence and spanning, see
`DirectSum.subgroup_isInternal_iff_independent_and_supr_eq_top` and
`DirectSum.isInternal_submodule_iff_independent_and_iSup_eq_top`. -/
def IsInternal {M S : Type*} [DecidableEq ι] [AddCommMonoid M] [SetLike S M]
    [AddSubmonoidClass S M] (A : ι → S) : Prop 
goal: Prop

full_name: DirectSum.IsInternal.addSubmonoid_iSup_eq_top
code: theorem IsInternal.addSubmonoid_iSup_eq_top {M : Type*} [DecidableEq ι] [AddCommMonoid M]
    (A : ι → AddSubmonoid M) (h : IsInternal A) : iSup A = ⊤ 
goal: iSup A = ⊤

full_name: DirectSum.support_subset
code: theorem support_subset [DecidableEq ι] [DecidableEq M] (A : ι → S) (x : DirectSum ι fun i => A i) :
    (Function.support fun i => (x i : M)) ⊆ ↑(DFinsupp.support x) 
goal: (Function.support fun i => ↑(x i)) ⊆ ↑(DFinsupp.support x)

full_name: DirectSum.finite_support
code: theorem finite_support (A : ι → S) (x : DirectSum ι fun i => A i) :
    (Function.support fun i => (x i : M)).Finite 
goal: (Function.support fun i => ↑(x i)).Finite