doc-next-gen

Mathlib.RingTheory.FiniteType

Module docstring

{"# Finiteness conditions in commutative algebra

In this file we define a notion of finiteness that is common in commutative algebra.

Main declarations

  • Algebra.FiniteType, RingHom.FiniteType, AlgHom.FiniteType all of these express that some object is finitely generated as algebra over some base ring.

"}

Algebra.FiniteType structure
[CommSemiring R] [Semiring A] [Algebra R A]
Full source
/-- An algebra over a commutative semiring is of `FiniteType` if it is finitely generated
over the base ring as algebra. -/
class Algebra.FiniteType [CommSemiring R] [Semiring A] [Algebra R A] : Prop where
  out : ( : Subalgebra R A).FG
Finite type algebra
Informal description
An algebra $A$ over a commutative semiring $R$ is said to be of *finite type* if it is finitely generated as an algebra over $R$. This means there exists a finite subset of $A$ such that the smallest subalgebra of $A$ containing this subset is $A$ itself.
Module.Finite.finiteType instance
{R : Type*} (A : Type*) [CommSemiring R] [Semiring A] [Algebra R A] [hRA : Module.Finite R A] : Algebra.FiniteType R A
Full source
instance (priority := 100) finiteType {R : Type*} (A : Type*) [CommSemiring R] [Semiring A]
    [Algebra R A] [hRA : Module.Finite R A] : Algebra.FiniteType R A :=
  ⟨Subalgebra.fg_of_submodule_fg hRA.1⟩
Finitely Generated Modules are Finitely Generated Algebras
Informal description
For any commutative semiring $R$ and semiring $A$ that is an $R$-algebra, if $A$ is finitely generated as an $R$-module, then $A$ is also finitely generated as an $R$-algebra.
Algebra.FiniteType.self theorem
: FiniteType R R
Full source
theorem self : FiniteType R R :=
  ⟨⟨{1}, Subsingleton.elim _ _⟩⟩
Self-algebra is finitely generated
Informal description
For any commutative semiring $R$, the algebra $R$ over itself is finitely generated as an $R$-algebra.
Algebra.FiniteType.freeAlgebra theorem
(ι : Type*) [Finite ι] : FiniteType R (FreeAlgebra R ι)
Full source
protected theorem freeAlgebra (ι : Type*) [Finite ι] : FiniteType R (FreeAlgebra R ι) := by
  cases nonempty_fintype ι
  classical
  exact
    ⟨⟨Finset.univ.image (FreeAlgebra.ι R), by
        rw [Finset.coe_image, Finset.coe_univ, Set.image_univ]
        exact FreeAlgebra.adjoin_range_ι R ι⟩⟩
Free Algebra over Finite Type is Finitely Generated
Informal description
For any finite type $\iota$ and any commutative semiring $R$, the free algebra $\text{FreeAlgebra}\, R\, \iota$ is finitely generated as an $R$-algebra.
Algebra.FiniteType.mvPolynomial theorem
(ι : Type*) [Finite ι] : FiniteType R (MvPolynomial ι R)
Full source
protected theorem mvPolynomial (ι : Type*) [Finite ι] : FiniteType R (MvPolynomial ι R) := by
  cases nonempty_fintype ι
  classical
  exact
    ⟨⟨Finset.univ.image MvPolynomial.X, by
        rw [Finset.coe_image, Finset.coe_univ, Set.image_univ]
        exact MvPolynomial.adjoin_range_X⟩⟩
Finite Generation of Multivariate Polynomial Algebras
Informal description
For any finite type $\iota$ and any commutative semiring $R$, the multivariate polynomial algebra $\text{MvPolynomial}(\iota, R)$ is finitely generated as an $R$-algebra.
Algebra.FiniteType.of_restrictScalars_finiteType theorem
[Algebra S A] [IsScalarTower R S A] [hA : FiniteType R A] : FiniteType S A
Full source
theorem of_restrictScalars_finiteType [Algebra S A] [IsScalarTower R S A] [hA : FiniteType R A] :
    FiniteType S A := by
  obtain ⟨s, hS⟩ := hA.out
  refine ⟨⟨s, eq_top_iff.2 fun b => ?_⟩⟩
  have le : adjoin R (s : Set A) ≤ Subalgebra.restrictScalars R (adjoin S s) := by
    apply (Algebra.adjoin_le _ : adjoin R (s : Set A) ≤ Subalgebra.restrictScalars R (adjoin S ↑s))
    simp only [Subalgebra.coe_restrictScalars]
    exact Algebra.subset_adjoin
  exact le (eq_top_iff.1 hS b)
Finite generation under scalar restriction in algebras
Informal description
Let $R$, $S$, and $A$ be commutative semirings with algebra structures such that $R \to S \to A$ forms a scalar tower. If $A$ is finitely generated as an algebra over $R$, then $A$ is also finitely generated as an algebra over $S$.
Algebra.FiniteType.of_surjective theorem
(hRA : FiniteType R A) (f : A →ₐ[R] B) (hf : Surjective f) : FiniteType R B
Full source
theorem of_surjective (hRA : FiniteType R A) (f : A →ₐ[R] B) (hf : Surjective f) : FiniteType R B :=
  ⟨by
    convert hRA.1.map f
    simpa only [map_top f, @eq_comm _ ⊤, eq_top_iff, AlgHom.mem_range] using hf⟩
Finite generation preserved under surjective algebra homomorphism
Informal description
Let $R$ be a commutative semiring and $A$, $B$ be semirings with $R$-algebra structures. If $A$ is finitely generated as an algebra over $R$ and there exists a surjective $R$-algebra homomorphism $f: A \to B$, then $B$ is also finitely generated as an algebra over $R$.
Algebra.FiniteType.equiv theorem
(hRA : FiniteType R A) (e : A ≃ₐ[R] B) : FiniteType R B
Full source
theorem equiv (hRA : FiniteType R A) (e : A ≃ₐ[R] B) : FiniteType R B :=
  hRA.of_surjective e e.surjective
Finite generation preserved under algebra isomorphism
Informal description
Let $R$ be a commutative semiring and $A$, $B$ be semirings with $R$-algebra structures. If $A$ is finitely generated as an algebra over $R$ and there exists an $R$-algebra isomorphism $e: A \simeq B$, then $B$ is also finitely generated as an algebra over $R$.
Algebra.FiniteType.trans theorem
[Algebra S A] [IsScalarTower R S A] (hRS : FiniteType R S) (hSA : FiniteType S A) : FiniteType R A
Full source
theorem trans [Algebra S A] [IsScalarTower R S A] (hRS : FiniteType R S) (hSA : FiniteType S A) :
    FiniteType R A :=
  ⟨fg_trans' hRS.1 hSA.1⟩
Transitivity of Finite Generation for Algebras in Scalar Tower
Informal description
Let $R$, $S$, and $A$ be commutative semirings with $R$-algebra structures, and suppose there is a scalar tower structure $R \to S \to A$. If $S$ is finitely generated as an algebra over $R$ and $A$ is finitely generated as an algebra over $S$, then $A$ is finitely generated as an algebra over $R$.
Algebra.FiniteType.quotient instance
(R : Type*) {S : Type*} [CommSemiring R] [CommRing S] [Algebra R S] (I : Ideal S) [h : Algebra.FiniteType R S] : Algebra.FiniteType R (S ⧸ I)
Full source
instance quotient (R : Type*) {S : Type*} [CommSemiring R] [CommRing S] [Algebra R S] (I : Ideal S)
    [h : Algebra.FiniteType R S] : Algebra.FiniteType R (S ⧸ I) :=
  Algebra.FiniteType.trans h inferInstance
Finite Generation of Quotient Algebras
Informal description
For any commutative semiring $R$ and commutative ring $S$ that is a finitely generated $R$-algebra, the quotient ring $S/I$ is also a finitely generated $R$-algebra for any ideal $I$ of $S$.
Algebra.FiniteType.iff_quotient_freeAlgebra theorem
: FiniteType R A ↔ ∃ (s : Finset A) (f : FreeAlgebra R s →ₐ[R] A), Surjective f
Full source
/-- An algebra is finitely generated if and only if it is a quotient
of a free algebra whose variables are indexed by a finset. -/
theorem iff_quotient_freeAlgebra :
    FiniteTypeFiniteType R A ↔
      ∃ (s : Finset A) (f : FreeAlgebra R s →ₐ[R] A), Surjective f := by
  constructor
  · rintro ⟨s, hs⟩
    refine ⟨s, FreeAlgebra.lift _ (↑), ?_⟩
    rw [← Set.range_eq_univ, ← AlgHom.coe_range, ← adjoin_range_eq_range_freeAlgebra_lift,
      Subtype.range_coe_subtype, Finset.setOf_mem, hs, coe_top]
  · rintro ⟨s, ⟨f, hsur⟩⟩
    exact FiniteType.of_surjective (FiniteType.freeAlgebra R s) f hsur
Characterization of Finitely Generated Algebras via Quotients of Free Algebras
Informal description
Let $R$ be a commutative semiring and $A$ be a semiring with an $R$-algebra structure. Then $A$ is finitely generated as an algebra over $R$ if and only if there exists a finite subset $s \subseteq A$ and a surjective $R$-algebra homomorphism from the free algebra $\text{FreeAlgebra}\, R\, s$ to $A$.
Algebra.FiniteType.iff_quotient_mvPolynomial theorem
: FiniteType R S ↔ ∃ (s : Finset S) (f : MvPolynomial { x // x ∈ s } R →ₐ[R] S), Surjective f
Full source
/-- A commutative algebra is finitely generated if and only if it is a quotient
of a polynomial ring whose variables are indexed by a finset. -/
theorem iff_quotient_mvPolynomial :
    FiniteTypeFiniteType R S ↔
      ∃ (s : Finset S) (f : MvPolynomial { x // x ∈ s } R →ₐ[R] S), Surjective f := by
  constructor
  · rintro ⟨s, hs⟩
    use s, MvPolynomial.aeval (↑)
    intro x
    have hrw : (↑s : Set S) = fun x : S => x ∈ s.val := rfl
    rw [← Set.mem_range, ← AlgHom.coe_range, ← adjoin_eq_range]
    simp_rw [← hrw, hs]
    exact Set.mem_univ x
  · rintro ⟨s, ⟨f, hsur⟩⟩
    exact FiniteType.of_surjective (FiniteType.mvPolynomial R { x // x ∈ s }) f hsur
Characterization of Finitely Generated Algebras via Quotients of Multivariate Polynomial Rings
Informal description
Let $R$ be a commutative semiring and $S$ be a semiring with an $R$-algebra structure. Then $S$ is finitely generated as an $R$-algebra if and only if there exists a finite subset $s \subseteq S$ and a surjective $R$-algebra homomorphism from the multivariate polynomial ring $\text{MvPolynomial}(\{x \in s\}, R)$ to $S$.
Algebra.FiniteType.iff_quotient_freeAlgebra' theorem
: FiniteType R A ↔ ∃ (ι : Type uA) (_ : Fintype ι) (f : FreeAlgebra R ι →ₐ[R] A), Surjective f
Full source
/-- An algebra is finitely generated if and only if it is a quotient
of a polynomial ring whose variables are indexed by a fintype. -/
theorem iff_quotient_freeAlgebra' : FiniteTypeFiniteType R A ↔
    ∃ (ι : Type uA) (_ : Fintype ι) (f : FreeAlgebra R ι →ₐ[R] A), Surjective f := by
  constructor
  · rw [iff_quotient_freeAlgebra]
    rintro ⟨s, ⟨f, hsur⟩⟩
    use { x : A // x ∈ s }, inferInstance, f
  · rintro ⟨ι, ⟨hfintype, ⟨f, hsur⟩⟩⟩
    letI : Fintype ι := hfintype
    exact FiniteType.of_surjective (FiniteType.freeAlgebra R ι) f hsur
Characterization of Finitely Generated Algebras via Surjective Maps from Free Algebras over Finite Types
Informal description
Let $R$ be a commutative semiring and $A$ be an $R$-algebra. Then $A$ is finitely generated as an algebra over $R$ if and only if there exists a finite type $\iota$ and a surjective $R$-algebra homomorphism $f: \text{FreeAlgebra}\, R\, \iota \to A$ from the free algebra over $R$ indexed by $\iota$ to $A$.
Algebra.FiniteType.iff_quotient_mvPolynomial' theorem
: FiniteType R S ↔ ∃ (ι : Type uS) (_ : Fintype ι) (f : MvPolynomial ι R →ₐ[R] S), Surjective f
Full source
/-- A commutative algebra is finitely generated if and only if it is a quotient
of a polynomial ring whose variables are indexed by a fintype. -/
theorem iff_quotient_mvPolynomial' : FiniteTypeFiniteType R S ↔
    ∃ (ι : Type uS) (_ : Fintype ι) (f : MvPolynomial ι R →ₐ[R] S), Surjective f := by
  constructor
  · rw [iff_quotient_mvPolynomial]
    rintro ⟨s, ⟨f, hsur⟩⟩
    use { x : S // x ∈ s }, inferInstance, f
  · rintro ⟨ι, ⟨hfintype, ⟨f, hsur⟩⟩⟩
    letI : Fintype ι := hfintype
    exact FiniteType.of_surjective (FiniteType.mvPolynomial R ι) f hsur
Characterization of finitely generated algebras via surjective maps from multivariate polynomial rings
Informal description
Let $R$ be a commutative semiring and $S$ be an $R$-algebra. Then $S$ is finitely generated as an $R$-algebra if and only if there exists a finite type $\iota$ and a surjective $R$-algebra homomorphism from the multivariate polynomial ring $\text{MvPolynomial}(\iota, R)$ to $S$.
Algebra.FiniteType.iff_quotient_mvPolynomial'' theorem
: FiniteType R S ↔ ∃ (n : ℕ) (f : MvPolynomial (Fin n) R →ₐ[R] S), Surjective f
Full source
/-- A commutative algebra is finitely generated if and only if it is a quotient of a polynomial ring
in `n` variables. -/
theorem iff_quotient_mvPolynomial'' :
    FiniteTypeFiniteType R S ↔ ∃ (n : ℕ) (f : MvPolynomial (Fin n) R →ₐ[R] S), Surjective f := by
  constructor
  · rw [iff_quotient_mvPolynomial']
    rintro ⟨ι, hfintype, ⟨f, hsur⟩⟩
    have equiv := MvPolynomial.renameEquiv R (Fintype.equivFin ι)
    exact ⟨Fintype.card ι, AlgHom.comp f equiv.symm.toAlgHom, by simpa using hsur⟩
  · rintro ⟨n, ⟨f, hsur⟩⟩
    exact FiniteType.of_surjective (FiniteType.mvPolynomial R (Fin n)) f hsur
Characterization of finitely generated algebras via surjective maps from finite-variable polynomial rings
Informal description
Let $R$ be a commutative semiring and $S$ an $R$-algebra. Then $S$ is finitely generated as an $R$-algebra if and only if there exists a natural number $n$ and a surjective $R$-algebra homomorphism from the multivariate polynomial ring $\text{MvPolynomial}(\text{Fin}(n), R)$ to $S$.
Algebra.FiniteType.prod instance
[hA : FiniteType R A] [hB : FiniteType R B] : FiniteType R (A × B)
Full source
instance prod [hA : FiniteType R A] [hB : FiniteType R B] : FiniteType R (A × B) :=
  ⟨by rw [← Subalgebra.prod_top]; exact hA.1.prod hB.1⟩
Finite Type Property Preserved under Direct Products of Algebras
Informal description
For any commutative semiring $R$ and $R$-algebras $A$ and $B$, if both $A$ and $B$ are finitely generated as $R$-algebras, then their direct product $A \times B$ is also finitely generated as an $R$-algebra.
Algebra.FiniteType.isNoetherianRing theorem
(R S : Type*) [CommRing R] [CommRing S] [Algebra R S] [h : Algebra.FiniteType R S] [IsNoetherianRing R] : IsNoetherianRing S
Full source
theorem isNoetherianRing (R S : Type*) [CommRing R] [CommRing S] [Algebra R S]
    [h : Algebra.FiniteType R S] [IsNoetherianRing R] : IsNoetherianRing S := by
  obtain ⟨s, hs⟩ := h.1
  apply
    isNoetherianRing_of_surjective (MvPolynomial s R) S
      (MvPolynomial.aeval (↑) : MvPolynomialMvPolynomial s R →ₐ[R] S).toRingHom
  rw [← Set.range_eq_univ, AlgHom.toRingHom_eq_coe, RingHom.coe_coe, ← AlgHom.coe_range,
    ← Algebra.adjoin_range_eq_range_aeval, Subtype.range_coe_subtype, Finset.setOf_mem, hs]
  rfl
Noetherianity of finitely generated algebras over Noetherian rings
Informal description
Let $R$ and $S$ be commutative rings with an algebra structure $S$ over $R$. If $S$ is finitely generated as an $R$-algebra and $R$ is Noetherian, then $S$ is also Noetherian.
RingHom.FiniteType definition
(f : A →+* B) : Prop
Full source
/-- A ring morphism `A →+* B` is of `FiniteType` if `B` is finitely generated as `A`-algebra. -/
@[algebraize]
def FiniteType (f : A →+* B) : Prop :=
  @Algebra.FiniteType A B _ _ f.toAlgebra
Finite type ring homomorphism
Informal description
A ring homomorphism \( f: A \to B \) is said to be of *finite type* if \( B \) is finitely generated as an \( A \)-algebra via \( f \). This means there exists a finite subset of \( B \) such that the smallest \( A \)-subalgebra of \( B \) containing this subset is \( B \) itself.
RingHom.Finite.finiteType theorem
{f : A →+* B} (hf : f.Finite) : FiniteType f
Full source
theorem finiteType {f : A →+* B} (hf : f.Finite) : FiniteType f :=
  @Module.Finite.finiteType _ _ _ _ f.toAlgebra hf
Finite ring homomorphisms are of finite type
Informal description
Let $f \colon A \to B$ be a finite ring homomorphism (i.e., $B$ is finitely generated as an $A$-module via $f$). Then $f$ is of finite type (i.e., $B$ is finitely generated as an $A$-algebra via $f$).
RingHom.FiniteType.id theorem
: FiniteType (RingHom.id A)
Full source
theorem id : FiniteType (RingHom.id A) :=
  Algebra.FiniteType.self A
Identity Ring Homomorphism is of Finite Type
Informal description
The identity ring homomorphism $\mathrm{id}_A \colon A \to A$ is of finite type. That is, $A$ is finitely generated as an $A$-algebra via the identity map.
RingHom.FiniteType.comp_surjective theorem
{f : A →+* B} {g : B →+* C} (hf : f.FiniteType) (hg : Surjective g) : (g.comp f).FiniteType
Full source
theorem comp_surjective {f : A →+* B} {g : B →+* C} (hf : f.FiniteType) (hg : Surjective g) :
    (g.comp f).FiniteType := by
  algebraize_only [f, g.comp f]
  exact Algebra.FiniteType.of_surjective hf
    { g with
      toFun := g
      commutes' := fun a => rfl }
    hg
Finite type property preserved under composition with surjective ring homomorphism
Informal description
Let $f \colon A \to B$ and $g \colon B \to C$ be ring homomorphisms. If $f$ is of finite type and $g$ is surjective, then the composition $g \circ f \colon A \to C$ is also of finite type.
RingHom.FiniteType.of_surjective theorem
(f : A →+* B) (hf : Surjective f) : f.FiniteType
Full source
theorem of_surjective (f : A →+* B) (hf : Surjective f) : f.FiniteType := by
  rw [← f.comp_id]
  exact (id A).comp_surjective hf
Surjective Ring Homomorphisms are of Finite Type
Informal description
Let $f \colon A \to B$ be a surjective ring homomorphism. Then $f$ is of finite type, meaning that $B$ is finitely generated as an $A$-algebra via $f$.
RingHom.FiniteType.comp theorem
{g : B →+* C} {f : A →+* B} (hg : g.FiniteType) (hf : f.FiniteType) : (g.comp f).FiniteType
Full source
theorem comp {g : B →+* C} {f : A →+* B} (hg : g.FiniteType) (hf : f.FiniteType) :
    (g.comp f).FiniteType := by
  algebraize_only [f, g, g.comp f]
  exact Algebra.FiniteType.trans hf hg
Composition of Finite Type Ring Homomorphisms is Finite Type
Informal description
Let $f \colon A \to B$ and $g \colon B \to C$ be ring homomorphisms. If $f$ is of finite type and $g$ is of finite type, then their composition $g \circ f \colon A \to C$ is also of finite type.
RingHom.FiniteType.of_finite theorem
{f : A →+* B} (hf : f.Finite) : f.FiniteType
Full source
theorem of_finite {f : A →+* B} (hf : f.Finite) : f.FiniteType :=
  @Module.Finite.finiteType _ _ _ _ f.toAlgebra hf
Finite ring homomorphisms are of finite type
Informal description
Let $f \colon A \to B$ be a ring homomorphism. If $f$ is finite (i.e., $B$ is finitely generated as an $A$-module via $f$), then $f$ is of finite type (i.e., $B$ is finitely generated as an $A$-algebra via $f$).
RingHom.FiniteType.of_comp_finiteType theorem
{f : A →+* B} {g : B →+* C} (h : (g.comp f).FiniteType) : g.FiniteType
Full source
theorem of_comp_finiteType {f : A →+* B} {g : B →+* C} (h : (g.comp f).FiniteType) :
    g.FiniteType := by
  algebraize [f, g, g.comp f]
  exact Algebra.FiniteType.of_restrictScalars_finiteType A B C
Finite type property of a ring homomorphism via composition
Informal description
Let $f \colon A \to B$ and $g \colon B \to C$ be ring homomorphisms. If the composition $g \circ f \colon A \to C$ is of finite type, then $g$ is of finite type.
AlgHom.FiniteType definition
(f : A →ₐ[R] B) : Prop
Full source
/-- An algebra morphism `A →ₐ[R] B` is of `FiniteType` if it is of finite type as ring morphism.
In other words, if `B` is finitely generated as `A`-algebra. -/
def FiniteType (f : A →ₐ[R] B) : Prop :=
  f.toRingHom.FiniteType
Finite type algebra homomorphism
Informal description
An algebra homomorphism \( f: A \to B \) over a base ring \( R \) is said to be of *finite type* if the underlying ring homomorphism is of finite type, meaning \( B \) is finitely generated as an \( A \)-algebra via \( f \).
AlgHom.Finite.finiteType theorem
{f : A →ₐ[R] B} (hf : f.Finite) : FiniteType f
Full source
theorem finiteType {f : A →ₐ[R] B} (hf : f.Finite) : FiniteType f :=
  RingHom.Finite.finiteType hf
Finite algebra homomorphisms are of finite type
Informal description
Let $f \colon A \to B$ be a finite algebra homomorphism over a base ring $R$ (i.e., $B$ is finitely generated as an $A$-module via $f$). Then $f$ is of finite type (i.e., $B$ is finitely generated as an $A$-algebra via $f$).
AlgHom.FiniteType.id theorem
: FiniteType (AlgHom.id R A)
Full source
theorem id : FiniteType (AlgHom.id R A) :=
  RingHom.FiniteType.id A
Identity Algebra Homomorphism is of Finite Type
Informal description
The identity algebra homomorphism $\mathrm{id}_A \colon A \to A$ over a base ring $R$ is of finite type, meaning $A$ is finitely generated as an $A$-algebra via the identity map.
AlgHom.FiniteType.comp theorem
{g : B →ₐ[R] C} {f : A →ₐ[R] B} (hg : g.FiniteType) (hf : f.FiniteType) : (g.comp f).FiniteType
Full source
theorem comp {g : B →ₐ[R] C} {f : A →ₐ[R] B} (hg : g.FiniteType) (hf : f.FiniteType) :
    (g.comp f).FiniteType :=
  RingHom.FiniteType.comp hg hf
Composition of Finite Type Algebra Homomorphisms is Finite Type
Informal description
Let $R$ be a commutative ring, and let $A$, $B$, and $C$ be $R$-algebras. Given algebra homomorphisms $f \colon A \to B$ and $g \colon B \to C$, if both $f$ and $g$ are of finite type, then their composition $g \circ f \colon A \to C$ is also of finite type.
AlgHom.FiniteType.comp_surjective theorem
{f : A →ₐ[R] B} {g : B →ₐ[R] C} (hf : f.FiniteType) (hg : Surjective g) : (g.comp f).FiniteType
Full source
theorem comp_surjective {f : A →ₐ[R] B} {g : B →ₐ[R] C} (hf : f.FiniteType) (hg : Surjective g) :
    (g.comp f).FiniteType :=
  RingHom.FiniteType.comp_surjective hf hg
Finite type property preserved under composition with surjective algebra homomorphism
Informal description
Let $R$ be a commutative ring, and let $A$, $B$, and $C$ be $R$-algebras. Given algebra homomorphisms $f \colon A \to B$ and $g \colon B \to C$, if $f$ is of finite type and $g$ is surjective, then the composition $g \circ f \colon A \to C$ is also of finite type.
AlgHom.FiniteType.of_surjective theorem
(f : A →ₐ[R] B) (hf : Surjective f) : f.FiniteType
Full source
theorem of_surjective (f : A →ₐ[R] B) (hf : Surjective f) : f.FiniteType :=
  RingHom.FiniteType.of_surjective f.toRingHom hf
Surjective Algebra Homomorphisms are of Finite Type
Informal description
Let $R$ be a commutative ring, and let $A$ and $B$ be $R$-algebras. Given a surjective algebra homomorphism $f \colon A \to B$, then $f$ is of finite type, meaning that $B$ is finitely generated as an $A$-algebra via $f$.
AlgHom.FiniteType.of_comp_finiteType theorem
{f : A →ₐ[R] B} {g : B →ₐ[R] C} (h : (g.comp f).FiniteType) : g.FiniteType
Full source
theorem of_comp_finiteType {f : A →ₐ[R] B} {g : B →ₐ[R] C} (h : (g.comp f).FiniteType) :
    g.FiniteType :=
  RingHom.FiniteType.of_comp_finiteType h
Finite type property of an algebra homomorphism via composition
Informal description
Let $R$ be a commutative ring, and let $A$, $B$, and $C$ be $R$-algebras. Given algebra homomorphisms $f \colon A \to B$ and $g \colon B \to C$, if the composition $g \circ f \colon A \to C$ is of finite type, then $g$ is of finite type.
algebraMap_finiteType_iff_algebra_finiteType theorem
{R A : Type*} [CommRing R] [CommRing A] [Algebra R A] : (algebraMap R A).FiniteType ↔ Algebra.FiniteType R A
Full source
theorem algebraMap_finiteType_iff_algebra_finiteType {R A : Type*} [CommRing R] [CommRing A]
    [Algebra R A] : (algebraMap R A).FiniteType ↔ Algebra.FiniteType R A := by
  dsimp [RingHom.FiniteType]
  constructor <;> (intro h; convert h; apply Algebra.algebra_ext; exact congrFun rfl)
Equivalence of Finite Type Conditions for Algebra Map and Algebra Structure
Informal description
Let $R$ and $A$ be commutative rings with an algebra structure $[Algebra\, R\, A]$. The algebra map $\text{algebraMap}\, R\, A : R \to A$ is of finite type if and only if the algebra $A$ is of finite type over $R$.
AddMonoidAlgebra.mem_adjoin_support theorem
(f : R[M]) : f ∈ adjoin R (of' R M '' f.support)
Full source
/-- An element of `R[M]` is in the subalgebra generated by its support. -/
theorem mem_adjoin_support (f : R[M]) : f ∈ adjoin R (of' R M '' f.support) := by
  suffices span R (of'of' R M '' f.support) ≤
      Subalgebra.toSubmodule (adjoin R (of'of' R M '' f.support)) by
    exact this (mem_span_support f)
  rw [Submodule.span_le]
  exact subset_adjoin
Element of Additive Monoid Algebra is in Subalgebra Generated by Its Support
Informal description
For any element $f$ in the additive monoid algebra $R[M]$, $f$ belongs to the subalgebra generated by the image of its support under the canonical map $\text{of}' : R \times M \to R[M]$. In other words, $f \in \text{adjoin}_R(\text{of}'_R^M(f.\text{support}))$.
AddMonoidAlgebra.support_gen_of_gen theorem
{S : Set R[M]} (hS : Algebra.adjoin R S = ⊤) : Algebra.adjoin R (⋃ f ∈ S, of' R M '' (f.support : Set M)) = ⊤
Full source
/-- If a set `S` generates, as algebra, `R[M]`, then the set of supports of
elements of `S` generates `R[M]`. -/
theorem support_gen_of_gen {S : Set R[M]} (hS : Algebra.adjoin R S = ) :
    Algebra.adjoin R (⋃ f ∈ S, of' R M '' (f.support : Set M)) =  := by
  refine le_antisymm le_top ?_
  rw [← hS, adjoin_le_iff]
  intro f hf
  have hincl :
    of'of' R M '' f.supportof' R M '' f.support ⊆ ⋃ (g : R[M]) (_ : g ∈ S), of' R M '' g.support := by
    intro s hs
    exact Set.mem_iUnion₂.2 ⟨f, ⟨hf, hs⟩⟩
  exact adjoin_mono hincl (mem_adjoin_support f)
Generation of Additive Monoid Algebra by Supports of Generators
Informal description
Let $R$ be a commutative ring and $M$ an additive monoid. For any subset $S$ of the additive monoid algebra $R[M]$, if $S$ generates the entire algebra (i.e., $\text{adjoin}_R(S) = \top$), then the union of the supports of all elements in $S$ also generates the entire algebra. That is, $\text{adjoin}_R\left(\bigcup_{f \in S} \text{of}'_R^M(f.\text{support})\right) = \top$.
AddMonoidAlgebra.support_gen_of_gen' theorem
{S : Set R[M]} (hS : Algebra.adjoin R S = ⊤) : Algebra.adjoin R (of' R M '' ⋃ f ∈ S, (f.support : Set M)) = ⊤
Full source
/-- If a set `S` generates, as algebra, `R[M]`, then the image of the union of
the supports of elements of `S` generates `R[M]`. -/
theorem support_gen_of_gen' {S : Set R[M]} (hS : Algebra.adjoin R S = ) :
    Algebra.adjoin R (of'of' R M '' ⋃ f ∈ S, (f.support : Set M)) =  := by
  suffices (of'of' R M '' ⋃ f ∈ S, (f.support : Set M)) = ⋃ f ∈ S, of' R M '' (f.support : Set M) by
    rw [this]
    exact support_gen_of_gen hS
  simp only [Set.image_iUnion]
Generation of Additive Monoid Algebra by Image of Union of Supports
Informal description
Let $R$ be a commutative ring and $M$ an additive monoid. For any subset $S$ of the additive monoid algebra $R[M]$, if $S$ generates the entire algebra (i.e., $\text{adjoin}_R(S) = \top$), then the image under the canonical map $\text{of}'_R^M$ of the union of the supports of all elements in $S$ also generates the entire algebra. That is, $\text{adjoin}_R(\text{of}'_R^M(\bigcup_{f \in S} f.\text{support})) = \top$.
AddMonoidAlgebra.exists_finset_adjoin_eq_top theorem
[h : FiniteType R R[M]] : ∃ G : Finset M, Algebra.adjoin R (of' R M '' G) = ⊤
Full source
/-- If `R[M]` is of finite type, then there is a `G : Finset M` such that its
image generates, as algebra, `R[M]`. -/
theorem exists_finset_adjoin_eq_top [h : FiniteType R R[M]] :
    ∃ G : Finset M, Algebra.adjoin R (of' R M '' G) = ⊤ := by
  obtain ⟨S, hS⟩ := h
  letI : DecidableEq M := Classical.decEq M
  use Finset.biUnion S fun f => f.support
  have : (Finset.biUnion S fun f => f.support : Set M) = ⋃ f ∈ S, (f.support : Set M) := by
    simp only [Finset.set_biUnion_coe, Finset.coe_biUnion]
  rw [this]
  exact support_gen_of_gen' hS
Existence of Finite Generating Set for Finite Type Additive Monoid Algebra
Informal description
Let $R$ be a commutative semiring and $M$ an additive monoid. If the additive monoid algebra $R[M]$ is of finite type over $R$, then there exists a finite subset $G \subseteq M$ such that the image of $G$ under the canonical map $\text{of}'_R^M$ generates $R[M]$ as an $R$-algebra, i.e., $\text{adjoin}_R(\text{of}'_R^M(G)) = \top$.
AddMonoidAlgebra.of'_mem_span theorem
[Nontrivial R] {m : M} {S : Set M} : of' R M m ∈ span R (of' R M '' S) ↔ m ∈ S
Full source
/-- The image of an element `m : M` in `R[M]` belongs the submodule generated by
`S : Set M` if and only if `m ∈ S`. -/
theorem of'_mem_span [Nontrivial R] {m : M} {S : Set M} :
    of'of' R M m ∈ span R (of' R M '' S)of' R M m ∈ span R (of' R M '' S) ↔ m ∈ S := by
  refine ⟨fun h => ?_, fun h => Submodule.subset_span <| Set.mem_image_of_mem (of R M) h⟩
  unfold of' at h
  rw [← Finsupp.supported_eq_span_single, Finsupp.mem_supported,
    Finsupp.support_single_ne_zero _ (one_ne_zero' R)] at h
  simpa using h
Membership in Span of Monoid Algebra Generators $\text{of}'_R^M(m) \in \text{span}_R(\text{of}'_R^M(S))$ iff $m \in S$
Informal description
Let $R$ be a nontrivial commutative semiring and $M$ an additive monoid. For any element $m \in M$ and any subset $S \subseteq M$, the image of $m$ in the monoid algebra $R[M]$ (denoted $\text{of}'_R^M(m)$) belongs to the $R$-linear span of the image of $S$ in $R[M]$ if and only if $m \in S$.
AddMonoidAlgebra.mem_closure_of_mem_span_closure theorem
[Nontrivial R] {m : M} {S : Set M} (h : of' R M m ∈ span R (Submonoid.closure (of' R M '' S) : Set R[M])) : m ∈ closure S
Full source
/--
If the image of an element `m : M` in `R[M]` belongs the submodule generated by
the closure of some `S : Set M` then `m ∈ closure S`. -/
theorem mem_closure_of_mem_span_closure [Nontrivial R] {m : M} {S : Set M}
    (h : of'of' R M m ∈ span R (Submonoid.closure (of' R M '' S) : Set R[M])) :
    m ∈ closure S := by
  suffices Multiplicative.ofAddMultiplicative.ofAdd m ∈ Submonoid.closure (Multiplicative.toAdd ⁻¹' S) by
    simpa [← toSubmonoid_closure]
  let S' := @Submonoid.closure (Multiplicative M) Multiplicative.mulOneClass S
  have h' : Submonoid.map (of R M) S' = Submonoid.closure ((fun x : M => (of R M) x) '' S) :=
    MonoidHom.map_mclosure _ _
  rw [Set.image_congr' (show ∀ x, of' R M x = of R M x from fun x => of'_eq_of x), ← h'] at h
  simpa using of'_mem_span.1 h
Membership in Additive Closure via Span Condition in Monoid Algebra
Informal description
Let $R$ be a nontrivial commutative semiring and $M$ an additive monoid. For any element $m \in M$ and any subset $S \subseteq M$, if the image of $m$ in the monoid algebra $R[M]$ (denoted $\text{of}'_R^M(m)$) belongs to the $R$-linear span of the image of the submonoid closure of $S$ in $R[M]$, then $m$ is in the additive closure of $S$.
AddMonoidAlgebra.mvPolynomial_aeval_of_surjective_of_closure theorem
[AddCommMonoid M] [CommSemiring R] {S : Set M} (hS : closure S = ⊤) : Function.Surjective (MvPolynomial.aeval fun s : S => of' R M ↑s : MvPolynomial S R → R[M])
Full source
/-- If a set `S` generates an additive monoid `M`, then the image of `M` generates, as algebra,
`R[M]`. -/
theorem mvPolynomial_aeval_of_surjective_of_closure [AddCommMonoid M] [CommSemiring R] {S : Set M}
    (hS : closure S = ) :
    Function.Surjective
      (MvPolynomial.aeval fun s : S => of' R M ↑s : MvPolynomial S R → R[M]) := by
  intro f
  induction' f using induction_on with m f g ihf ihg r f ih
  · have : m ∈ closure S := hS.symmmem_top _
    refine AddSubmonoid.closure_induction (fun m hm => ?_) ?_ ?_ this
    · exact ⟨MvPolynomial.X ⟨m, hm⟩, MvPolynomial.aeval_X _ _⟩
    · exact ⟨1, map_one _⟩
    · rintro m₁ m₂ _ _ ⟨P₁, hP₁⟩ ⟨P₂, hP₂⟩
      exact
        ⟨P₁ * P₂, by
          rw [map_mul, hP₁, hP₂, of_apply, of_apply, of_apply, single_mul_single,
            one_mul]; rfl⟩
  · rcases ihf with ⟨P, rfl⟩
    rcases ihg with ⟨Q, rfl⟩
    exact ⟨P + Q, map_add _ _ _⟩
  · rcases ih with ⟨P, rfl⟩
    exact ⟨r • P, map_smul _ _ _⟩
Surjectivity of Polynomial Evaluation Map for Generating Sets in Additive Monoid Algebras
Informal description
Let $M$ be an additive commutative monoid and $R$ a commutative semiring. For any subset $S \subseteq M$ that generates $M$ (i.e., the additive closure of $S$ equals $M$), the evaluation map from the multivariate polynomial ring $R[S]$ to the monoid algebra $R[M]$, defined by sending each generator $s \in S$ to its image in $R[M]$, is surjective.
AddMonoidAlgebra.freeAlgebra_lift_of_surjective_of_closure theorem
[CommSemiring R] {S : Set M} (hS : closure S = ⊤) : Function.Surjective (FreeAlgebra.lift R fun s : S => of' R M ↑s : FreeAlgebra R S → R[M])
Full source
/-- If a set `S` generates an additive monoid `M`, then the image of `M` generates, as algebra,
`R[M]`. -/
theorem freeAlgebra_lift_of_surjective_of_closure [CommSemiring R] {S : Set M}
    (hS : closure S = ) :
    Function.Surjective
      (FreeAlgebra.lift R fun s : S => of' R M ↑s : FreeAlgebra R S → R[M]) := by
  intro f
  induction' f using induction_on with m f g ihf ihg r f ih
  · have : m ∈ closure S := hS.symmmem_top _
    refine AddSubmonoid.closure_induction (fun m hm => ?_) ?_ ?_ this
    · exact ⟨FreeAlgebra.ι R ⟨m, hm⟩, FreeAlgebra.lift_ι_apply _ _⟩
    · exact ⟨1, map_one _⟩
    · rintro m₁ m₂ _ _ ⟨P₁, hP₁⟩ ⟨P₂, hP₂⟩
      exact
        ⟨P₁ * P₂, by
          rw [map_mul, hP₁, hP₂, of_apply, of_apply, of_apply, single_mul_single,
            one_mul]; rfl⟩
  · rcases ihf with ⟨P, rfl⟩
    rcases ihg with ⟨Q, rfl⟩
    exact ⟨P + Q, map_add _ _ _⟩
  · rcases ih with ⟨P, rfl⟩
    exact ⟨r • P, map_smul _ _ _⟩
Surjectivity of Free Algebra Lift for Generating Sets in Monoid Algebras
Informal description
Let $R$ be a commutative semiring and $M$ an additive monoid. For any subset $S \subseteq M$ whose additive closure equals $M$, the $R$-algebra homomorphism $\text{lift}_R \colon \text{FreeAlgebra}\, R\, S \to R[M]$, defined by extending the map $s \mapsto \text{of'}\, R\, M\, s$ for $s \in S$, is surjective.
AddMonoidAlgebra.finiteType_of_fg instance
[CommRing R] [h : AddMonoid.FG M] : FiniteType R R[M]
Full source
/-- If an additive monoid `M` is finitely generated then `R[M]` is of finite
type. -/
instance finiteType_of_fg [CommRing R] [h : AddMonoid.FG M] :
    FiniteType R R[M] := by
  obtain ⟨S, hS⟩ := h.fg_top
  exact (FiniteType.freeAlgebra R (S : Set M)).of_surjective
      (FreeAlgebra.lift R fun s : (S : Set M) => of' R M ↑s)
      (freeAlgebra_lift_of_surjective_of_closure hS)
Finitely Generated Monoid Algebras are of Finite Type
Informal description
For any commutative ring $R$ and any finitely generated additive monoid $M$, the monoid algebra $R[M]$ is finitely generated as an algebra over $R$.
AddMonoidAlgebra.finiteType_iff_fg theorem
[CommRing R] [Nontrivial R] : FiniteType R R[M] ↔ AddMonoid.FG M
Full source
/-- An additive monoid `M` is finitely generated if and only if `R[M]` is of
finite type. -/
theorem finiteType_iff_fg [CommRing R] [Nontrivial R] :
    FiniteTypeFiniteType R R[M] ↔ AddMonoid.FG M := by
  refine ⟨fun h => ?_, fun h => @AddMonoidAlgebra.finiteType_of_fg _ _ _ _ h⟩
  obtain ⟨S, hS⟩ := @exists_finset_adjoin_eq_top R M _ _ h
  refine AddMonoid.fg_def.2 ⟨S, (eq_top_iff' _).2 fun m => ?_⟩
  have hm : of'of' R M m ∈ Subalgebra.toSubmodule (adjoin R (of' R M '' ↑S)) := by
    simp only [hS, top_toSubmodule, Submodule.mem_top]
  rw [adjoin_eq_span] at hm
  exact mem_closure_of_mem_span_closure hm
Equivalence of Finite Generation for Monoid Algebras and Additive Monoids
Informal description
Let $R$ be a nontrivial commutative ring and $M$ an additive monoid. The monoid algebra $R[M]$ is finitely generated as an algebra over $R$ if and only if the additive monoid $M$ is finitely generated.
AddMonoidAlgebra.fg_of_finiteType theorem
[CommRing R] [Nontrivial R] [h : FiniteType R R[M]] : AddMonoid.FG M
Full source
/-- If `R[M]` is of finite type then `M` is finitely generated. -/
theorem fg_of_finiteType [CommRing R] [Nontrivial R] [h : FiniteType R R[M]] :
    AddMonoid.FG M :=
  finiteType_iff_fg.1 h
Finitely Generated Monoid Algebra Implies Finitely Generated Monoid
Informal description
Let $R$ be a nontrivial commutative ring and $M$ an additive monoid. If the monoid algebra $R[M]$ is finitely generated as an algebra over $R$, then $M$ is finitely generated as an additive monoid.
AddMonoidAlgebra.finiteType_iff_group_fg theorem
{G : Type*} [AddGroup G] [CommRing R] [Nontrivial R] : FiniteType R R[G] ↔ AddGroup.FG G
Full source
/-- An additive group `G` is finitely generated if and only if `R[G]` is of
finite type. -/
theorem finiteType_iff_group_fg {G : Type*} [AddGroup G] [CommRing R] [Nontrivial R] :
    FiniteTypeFiniteType R R[G] ↔ AddGroup.FG G := by
  simpa [AddGroup.fg_iff_addMonoid_fg] using finiteType_iff_fg
Equivalence of Finite Generation for Group Algebras and Additive Groups
Informal description
Let $G$ be an additive group and $R$ a nontrivial commutative ring. The group algebra $R[G]$ is finitely generated as an algebra over $R$ if and only if the additive group $G$ is finitely generated.
MonoidAlgebra.mem_adjoin_support theorem
(f : MonoidAlgebra R M) : f ∈ adjoin R (of R M '' f.support)
Full source
/-- An element of `MonoidAlgebra R M` is in the subalgebra generated by its support. -/
theorem mem_adjoin_support (f : MonoidAlgebra R M) : f ∈ adjoin R (of R M '' f.support) := by
  suffices span R (ofof R M '' f.support) ≤ Subalgebra.toSubmodule (adjoin R (ofof R M '' f.support)) by
    exact this (mem_span_support f)
  rw [Submodule.span_le]
  exact subset_adjoin
Element of Monoid Algebra is in Subalgebra Generated by Its Support
Informal description
For any element $f$ in the monoid algebra $R[M]$, $f$ belongs to the subalgebra generated by the image of its support under the canonical embedding $\text{of} : M \to R[M]$. In other words, $f \in \text{adjoin}_R(\text{of}(f.\text{support}))$.
MonoidAlgebra.support_gen_of_gen theorem
{S : Set (MonoidAlgebra R M)} (hS : Algebra.adjoin R S = ⊤) : Algebra.adjoin R (⋃ f ∈ S, of R M '' (f.support : Set M)) = ⊤
Full source
/-- If a set `S` generates, as algebra, `MonoidAlgebra R M`, then the set of supports of elements
of `S` generates `MonoidAlgebra R M`. -/
theorem support_gen_of_gen {S : Set (MonoidAlgebra R M)} (hS : Algebra.adjoin R S = ) :
    Algebra.adjoin R (⋃ f ∈ S, of R M '' (f.support : Set M)) =  := by
  refine le_antisymm le_top ?_
  rw [← hS, adjoin_le_iff]
  intro f hf
  -- Porting note: ⋃ notation did not work here. Was
  -- ⋃ (g : MonoidAlgebra R M) (H : g ∈ S), (of R M '' g.support)
  have hincl : (of R M '' f.support) ⊆
      Set.iUnion fun (g : MonoidAlgebra R M)
        => Set.iUnion fun (_ : g ∈ S) => (of R M '' g.support) := by
    intro s hs
    exact Set.mem_iUnion₂.2 ⟨f, ⟨hf, hs⟩⟩
  exact adjoin_mono hincl (mem_adjoin_support f)
Generation of Monoid Algebra by Supports of Generators
Informal description
Let $R$ be a commutative ring and $M$ a monoid. If a set $S$ generates the monoid algebra $R[M]$ as an $R$-algebra (i.e., $\text{adjoin}_R(S) = \top$), then the union of the supports of all elements in $S$ generates $R[M]$ as well. In other words, $\text{adjoin}_R\left(\bigcup_{f \in S} \text{of}(f.\text{support})\right) = \top$, where $\text{of} : M \to R[M]$ is the canonical embedding.
MonoidAlgebra.support_gen_of_gen' theorem
{S : Set (MonoidAlgebra R M)} (hS : Algebra.adjoin R S = ⊤) : Algebra.adjoin R (of R M '' ⋃ f ∈ S, (f.support : Set M)) = ⊤
Full source
/-- If a set `S` generates, as algebra, `MonoidAlgebra R M`, then the image of the union of the
supports of elements of `S` generates `MonoidAlgebra R M`. -/
theorem support_gen_of_gen' {S : Set (MonoidAlgebra R M)} (hS : Algebra.adjoin R S = ) :
    Algebra.adjoin R (ofof R M '' ⋃ f ∈ S, (f.support : Set M)) =  := by
  suffices (ofof R M '' ⋃ f ∈ S, (f.support : Set M)) = ⋃ f ∈ S, of R M '' (f.support : Set M) by
    rw [this]
    exact support_gen_of_gen hS
  simp only [Set.image_iUnion]
Generation of Monoid Algebra by Image of Supports' Union
Informal description
Let $R$ be a commutative ring and $M$ a monoid. If a set $S$ generates the monoid algebra $R[M]$ as an $R$-algebra (i.e., $\text{Algebra.adjoin}_R(S) = \top$), then the image under the canonical embedding $\text{of} : M \to R[M]$ of the union of the supports of all elements in $S$ also generates $R[M]$. In other words, $\text{Algebra.adjoin}_R(\text{of}(\bigcup_{f \in S} f.\text{support})) = \top$.
MonoidAlgebra.exists_finset_adjoin_eq_top theorem
[h : FiniteType R (MonoidAlgebra R M)] : ∃ G : Finset M, Algebra.adjoin R (of R M '' G) = ⊤
Full source
/-- If `MonoidAlgebra R M` is of finite type, then there is a `G : Finset M` such that its image
generates, as algebra, `MonoidAlgebra R M`. -/
theorem exists_finset_adjoin_eq_top [h : FiniteType R (MonoidAlgebra R M)] :
    ∃ G : Finset M, Algebra.adjoin R (of R M '' G) = ⊤ := by
  obtain ⟨S, hS⟩ := h
  letI : DecidableEq M := Classical.decEq M
  use Finset.biUnion S fun f => f.support
  have : (Finset.biUnion S fun f => f.support : Set M) = ⋃ f ∈ S, (f.support : Set M) := by
    simp only [Finset.set_biUnion_coe, Finset.coe_biUnion]
  rw [this]
  exact support_gen_of_gen' hS
Existence of Finite Generating Set for Finitely Generated Monoid Algebra
Informal description
Let $R$ be a commutative ring and $M$ a monoid. If the monoid algebra $R[M]$ is finitely generated as an $R$-algebra, then there exists a finite subset $G \subseteq M$ such that the image of $G$ under the canonical embedding $\text{of} : M \to R[M]$ generates $R[M]$ as an $R$-algebra. In other words, $\text{Algebra.adjoin}_R(\text{of}(G)) = \top$.
MonoidAlgebra.of_mem_span_of_iff theorem
[Nontrivial R] {m : M} {S : Set M} : of R M m ∈ span R (of R M '' S) ↔ m ∈ S
Full source
/-- The image of an element `m : M` in `MonoidAlgebra R M` belongs the submodule generated by
`S : Set M` if and only if `m ∈ S`. -/
theorem of_mem_span_of_iff [Nontrivial R] {m : M} {S : Set M} :
    ofof R M m ∈ span R (of R M '' S)of R M m ∈ span R (of R M '' S) ↔ m ∈ S := by
  refine ⟨fun h => ?_, fun h => Submodule.subset_span <| Set.mem_image_of_mem (of R M) h⟩
  dsimp [of] at h
  rw [← Finsupp.supported_eq_span_single, Finsupp.mem_supported,
    Finsupp.support_single_ne_zero _ (one_ne_zero' R)] at h
  simpa using h
Membership in Span of Monoid Algebra Embedding $\text{of}(m) \in \text{span}_R(\text{of}(S)) \leftrightarrow m \in S$
Informal description
Let $R$ be a nontrivial commutative ring and $M$ a monoid. For any element $m \in M$ and subset $S \subseteq M$, the canonical embedding $\text{of}(m) \in R[M]$ belongs to the $R$-linear span of $\text{of}(S)$ if and only if $m \in S$.
MonoidAlgebra.mem_closure_of_mem_span_closure theorem
[Nontrivial R] {m : M} {S : Set M} (h : of R M m ∈ span R (Submonoid.closure (of R M '' S) : Set (MonoidAlgebra R M))) : m ∈ closure S
Full source
/--
If the image of an element `m : M` in `MonoidAlgebra R M` belongs the submodule generated by the
closure of some `S : Set M` then `m ∈ closure S`. -/
theorem mem_closure_of_mem_span_closure [Nontrivial R] {m : M} {S : Set M}
    (h : ofof R M m ∈ span R (Submonoid.closure (of R M '' S) : Set (MonoidAlgebra R M))) :
    m ∈ closure S := by
  rw [← MonoidHom.map_mclosure] at h
  simpa using of_mem_span_of_iff.1 h
Membership in Submonoid Closure via Span Condition in Monoid Algebra
Informal description
Let $R$ be a nontrivial commutative ring and $M$ a monoid. For any element $m \in M$ and subset $S \subseteq M$, if the canonical embedding $\text{of}(m) \in R[M]$ belongs to the $R$-linear span of the image of the submonoid closure of $S$ under $\text{of}$, then $m$ is in the submonoid closure of $S$.
MonoidAlgebra.mvPolynomial_aeval_of_surjective_of_closure theorem
[CommMonoid M] [CommSemiring R] {S : Set M} (hS : closure S = ⊤) : Function.Surjective (MvPolynomial.aeval fun s : S => of R M ↑s : MvPolynomial S R → MonoidAlgebra R M)
Full source
/-- If a set `S` generates a monoid `M`, then the image of `M` generates, as algebra,
`MonoidAlgebra R M`. -/
theorem mvPolynomial_aeval_of_surjective_of_closure [CommMonoid M] [CommSemiring R] {S : Set M}
    (hS : closure S = ) :
    Function.Surjective
      (MvPolynomial.aeval fun s : S => of R M ↑s : MvPolynomial S R → MonoidAlgebra R M) := by
  intro f
  induction' f using induction_on with m f g ihf ihg r f ih
  · have : m ∈ closure S := hS.symmmem_top _
    refine Submonoid.closure_induction (fun m hm => ?_) ?_ ?_ this
    · exact ⟨MvPolynomial.X ⟨m, hm⟩, MvPolynomial.aeval_X _ _⟩
    · exact ⟨1, map_one _⟩
    · rintro m₁ m₂ _ _ ⟨P₁, hP₁⟩ ⟨P₂, hP₂⟩
      exact
        ⟨P₁ * P₂, by
          rw [map_mul, hP₁, hP₂, of_apply, of_apply, of_apply, single_mul_single, one_mul]⟩
  · rcases ihf with ⟨P, rfl⟩; rcases ihg with ⟨Q, rfl⟩
    exact ⟨P + Q, map_add _ _ _⟩
  · rcases ih with ⟨P, rfl⟩
    exact ⟨r • P, map_smul _ _ _⟩
Surjectivity of Evaluation Homomorphism from Multivariate Polynomials to Monoid Algebra for Generating Sets
Informal description
Let $R$ be a commutative semiring and $M$ be a commutative monoid. For any subset $S \subseteq M$ that generates $M$ as a monoid (i.e., the submonoid closure of $S$ equals $M$), the evaluation homomorphism from the multivariate polynomial ring $MvPolynomial(S, R)$ to the monoid algebra $MonoidAlgebra(R, M)$ is surjective. Here, the evaluation homomorphism is defined by mapping each generator $s \in S$ to the corresponding element $of(R, M, s)$ in the monoid algebra.
MonoidAlgebra.freeAlgebra_lift_of_surjective_of_closure theorem
[CommSemiring R] {S : Set M} (hS : closure S = ⊤) : Function.Surjective (FreeAlgebra.lift R fun s : S => of R M ↑s : FreeAlgebra R S → MonoidAlgebra R M)
Full source
/-- If a set `S` generates an additive monoid `M`, then the image of `M` generates, as algebra,
`R[M]`. -/
theorem freeAlgebra_lift_of_surjective_of_closure [CommSemiring R] {S : Set M}
    (hS : closure S = ) :
    Function.Surjective
      (FreeAlgebra.lift R fun s : S => of R M ↑s : FreeAlgebra R S → MonoidAlgebra R M) := by
  intro f
  induction' f using induction_on with m f g ihf ihg r f ih
  · have : m ∈ closure S := hS.symmmem_top _
    refine Submonoid.closure_induction (fun m hm => ?_) ?_ ?_ this
    · exact ⟨FreeAlgebra.ι R ⟨m, hm⟩, FreeAlgebra.lift_ι_apply _ _⟩
    · exact ⟨1, map_one _⟩
    · rintro m₁ m₂ _ _ ⟨P₁, hP₁⟩ ⟨P₂, hP₂⟩
      exact
        ⟨P₁ * P₂, by
          rw [map_mul, hP₁, hP₂, of_apply, of_apply, of_apply, single_mul_single, one_mul]⟩
  · rcases ihf with ⟨P, rfl⟩
    rcases ihg with ⟨Q, rfl⟩
    exact ⟨P + Q, map_add _ _ _⟩
  · rcases ih with ⟨P, rfl⟩
    exact ⟨r • P, map_smul _ _ _⟩
Surjectivity of Free Algebra Lift to Monoid Algebra for Generating Sets
Informal description
Let $R$ be a commutative semiring and $M$ a monoid. For any subset $S \subseteq M$ that generates $M$ as a monoid (i.e., the submonoid closure of $S$ equals $M$), the $R$-algebra homomorphism $\text{lift}_R$ from the free algebra $\text{FreeAlgebra}\, R\, S$ to the monoid algebra $R[M]$, defined by mapping each generator $s \in S$ to the corresponding element $s \in R[M]$, is surjective.
MonoidAlgebra.finiteType_of_fg instance
[CommRing R] [Monoid.FG M] : FiniteType R (MonoidAlgebra R M)
Full source
/-- If a monoid `M` is finitely generated then `MonoidAlgebra R M` is of finite type. -/
instance finiteType_of_fg [CommRing R] [Monoid.FG M] : FiniteType R (MonoidAlgebra R M) :=
  (AddMonoidAlgebra.finiteType_of_fg R (Additive M)).equiv (toAdditiveAlgEquiv R M).symm
Finitely Generated Monoid Algebras are of Finite Type
Informal description
For any commutative ring $R$ and any finitely generated monoid $M$, the monoid algebra $R[M]$ is finitely generated as an algebra over $R$.
MonoidAlgebra.finiteType_iff_fg theorem
[CommRing R] [Nontrivial R] : FiniteType R (MonoidAlgebra R M) ↔ Monoid.FG M
Full source
/-- A monoid `M` is finitely generated if and only if `MonoidAlgebra R M` is of finite type. -/
theorem finiteType_iff_fg [CommRing R] [Nontrivial R] :
    FiniteTypeFiniteType R (MonoidAlgebra R M) ↔ Monoid.FG M :=
  ⟨fun h =>
    Monoid.fg_iff_add_fg.2 <|
      AddMonoidAlgebra.finiteType_iff_fg.1 <| h.equiv <| toAdditiveAlgEquiv R M,
    fun h => @MonoidAlgebra.finiteType_of_fg _ _ _ _ h⟩
Equivalence of Finite Generation for Monoid Algebras and Monoids
Informal description
Let $R$ be a nontrivial commutative ring and $M$ a monoid. The monoid algebra $R[M]$ is finitely generated as an algebra over $R$ if and only if the monoid $M$ is finitely generated.
MonoidAlgebra.fg_of_finiteType theorem
[CommRing R] [Nontrivial R] [h : FiniteType R (MonoidAlgebra R M)] : Monoid.FG M
Full source
/-- If `MonoidAlgebra R M` is of finite type then `M` is finitely generated. -/
theorem fg_of_finiteType [CommRing R] [Nontrivial R] [h : FiniteType R (MonoidAlgebra R M)] :
    Monoid.FG M :=
  finiteType_iff_fg.1 h
Finitely Generated Monoid from Finite Type Monoid Algebra
Informal description
Let $R$ be a nontrivial commutative ring and $M$ a monoid. If the monoid algebra $R[M]$ is finitely generated as an algebra over $R$, then the monoid $M$ is finitely generated.
MonoidAlgebra.finiteType_iff_group_fg theorem
{G : Type*} [Group G] [CommRing R] [Nontrivial R] : FiniteType R (MonoidAlgebra R G) ↔ Group.FG G
Full source
/-- A group `G` is finitely generated if and only if `R[G]` is of finite type. -/
theorem finiteType_iff_group_fg {G : Type*} [Group G] [CommRing R] [Nontrivial R] :
    FiniteTypeFiniteType R (MonoidAlgebra R G) ↔ Group.FG G := by
  simpa [Group.fg_iff_monoid_fg] using finiteType_iff_fg
Equivalence of Finite Generation for Group Algebras and Groups
Informal description
Let $R$ be a nontrivial commutative ring and $G$ a group. The group algebra $R[G]$ is finitely generated as an algebra over $R$ if and only if the group $G$ is finitely generated.
CommRing.orzechProperty instance
(R : Type*) [CommRing R] : OrzechProperty R
Full source
/-- Any commutative ring `R` satisfies the `OrzechProperty`, that is, for any finitely generated
`R`-module `M`, any surjective homomorphism `f : N →ₗ[R] M` from a submodule `N` of `M` to `M`
is injective.

This is a consequence of Noetherian case
(`IsNoetherian.injective_of_surjective_of_injective`), which requires that `M` is a
Noetherian module, but allows `R` to be non-commutative. The reduction of this result to
Noetherian case is adapted from <https://math.stackexchange.com/a/1066110>:
suppose `{ m_j }` is a finite set of generator of `M`, for any `n : N` one can write
`i n = ∑ j, b_j * m_j` for `{ b_j }` in `R`, here `i : N →ₗ[R] M` is the standard inclusion.
We can choose `{ n_j }` which are preimages of `{ m_j }` under `f`, and can choose
`{ c_jl }` in `R` such that `i n_j = ∑ l, c_jl * m_l` for each `j`.
Now let `A` be the subring of `R` generated by `{ b_j }` and `{ c_jl }`, then it is
Noetherian. Let `N'` be the `A`-submodule of `N` generated by `n` and `{ n_j }`,
`M'` be the `A`-submodule of `M` generated by `{ m_j }`,
then it's easy to see that `i` and `f` restrict to `N' →ₗ[A] M'`,
and the restricted version of `f` is surjective, hence by Noetherian case,
it is also injective, in particular, if `f n = 0`, then `n = 0`.

See also Orzech's original paper: *Onto endomorphisms are isomorphisms* [orzech1971]. -/
instance (priority := 100) CommRing.orzechProperty
    (R : Type*) [CommRing R] : OrzechProperty R := by
  refine ⟨fun {M} _ _ _ {N} f hf ↦ ?_⟩
  letI := addCommMonoidToAddCommGroup R (M := M)
  letI := addCommMonoidToAddCommGroup R (M := N)
  let i := N.subtype
  let hi : Function.Injective i := N.injective_subtype
  refine LinearMap.ker_eq_bot.1 <| LinearMap.ker_eq_bot'.2 fun n hn ↦ ?_
  obtain ⟨k, mj, hmj⟩ := exists_fin (R := R) (M := M)
  rw [← surjective_piEquiv_apply_iff] at hmj
  obtain ⟨b, hb⟩ := hmj (i n)
  choose nj hnj using fun j ↦ hf (mj j)
  choose c hc using fun j ↦ hmj (i (nj j))
  let A := Subring.closure (Set.rangeSet.range b ∪ Set.range c.uncurry)
  let N' := span A ({n}{n} ∪ Set.range nj)
  let M' := span A (Set.range mj)
  haveI : IsNoetherianRing A := is_noetherian_subring_closure _
    (.union (Set.finite_range _) (Set.finite_range _))
  haveI : Module.Finite A M' := span_of_finite A (Set.finite_range _)
  refine congr($((LinearMap.ker_eq_bot'.1 <| LinearMap.ker_eq_bot.2 <|
    IsNoetherian.injective_of_surjective_of_injective
      ((i.restrictScalars A).restrict fun x hx ↦ ?_ : N' →ₗ[A] M')
      ((f.restrictScalars A).restrict fun x hx ↦ ?_ : N' →ₗ[A] M')
      (fun _ _ h ↦ injective_subtype _ (hi congr(($h).1)))
      fun ⟨x, hx⟩ ↦ ?_) ⟨n, (subset_span (by simp))⟩ (Subtype.val_injective hn)).1)
  · induction hx using span_induction with
    | mem x hx =>
      change i x ∈ M'
      simp only [Set.singleton_union, Set.mem_insert_iff, Set.mem_range] at hx
      rcases hx with hx | ⟨j, rfl⟩
      · rw [hx, ← hb, piEquiv_apply_apply]
        refine Submodule.sum_mem _ fun j _ ↦ ?_
        let b' : A := ⟨b j, Subring.subset_closure (by simp)⟩
        rw [show b j • mj j = b' • mj j from rfl]
        exact smul_mem _ _ (subset_span (by simp))
      · rw [← hc, piEquiv_apply_apply]
        refine Submodule.sum_mem _ fun j' _ ↦ ?_
        let c' : A := ⟨c j j', Subring.subset_closure
          (by simp [show ∃ a b, c a b = c j j' from ⟨j, j', rfl⟩])⟩
        rw [show c j j' • mj j' = c' • mj j' from rfl]
        exact smul_mem _ _ (subset_span (by simp))
    | zero => simp
    | add x _ y _ hx hy => rw [map_add]; exact add_mem hx hy
    | smul a x _ hx => rw [map_smul]; exact smul_mem _ _ hx
  · induction hx using span_induction with
    | mem x hx =>
      change f x ∈ M'
      simp only [Set.singleton_union, Set.mem_insert_iff, Set.mem_range] at hx
      rcases hx with hx | ⟨j, rfl⟩
      · rw [hx, hn]; exact zero_mem _
      · exact subset_span (by simp [hnj])
    | zero => simp
    | add x _ y _ hx hy => rw [map_add]; exact add_mem hx hy
    | smul a x _ hx => rw [map_smul]; exact smul_mem _ _ hx
  suffices x ∈ LinearMap.range ((f.restrictScalars A).domRestrict N') by
    obtain ⟨a, ha⟩ := this
    exact ⟨a, Subtype.val_injective ha⟩
  induction hx using span_induction with
  | mem x hx =>
    obtain ⟨j, rfl⟩ := hx
    exact ⟨⟨nj j, subset_span (by simp)⟩, hnj j⟩
  | zero => exact zero_mem _
  | add x y _ _ hx hy => exact add_mem hx hy
  | smul a x _ hx => exact smul_mem _ a hx
Commutative Rings Satisfy the Orzech Property
Informal description
Every commutative ring $R$ satisfies the Orzech property: for any finitely generated $R$-module $M$ and any submodule $N$ of $M$, if a linear map $f \colon N \to M$ is surjective, then it is injective.