/- Copyright 2026 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ module public import Mathlib.Algebra.BigOperators.Finprod public import Mathlib.Algebra.Category.ModuleCat.Abelian public import Mathlib.Algebra.Category.ModuleCat.Monoidal.Closed public import Mathlib.Algebra.Category.ModuleCat.Projective public import Mathlib.CategoryTheory.Monoidal.Tor public import Mathlib.RingTheory.Length

Serre's intersection multiplicity

For a commutative ring R and R-modules M, N, this file defines Serre's intersection multiplicity $$\chi(M, N) = \sum_{i \ge 0} (-1)^i \ell_R(\operatorname{Tor}_i^R(M, N)),$$ using CategoryTheory.Tor on ModuleCat R.

The definition is meaningful when R is a regular local ring, M and N are finitely generated and M ⊗[R] N has finite length: then Tor_i vanishes for i > dim R, so the sum is finite, and every Tor_i has finite length, so ENat.toNat truncates nothing.

Main declarations

    Module.intersectionMultiplicity R M N: the alternating sum above.

    Module.intersectionMultiplicity_of_projective: if N is projective, χ(M, N) = ℓ(M ⊗ N).

    Module.intersectionMultiplicity_eq_zero_of_subsingleton: if M = 0, then χ(M, N) = 0.

    Module.intersectionMultiplicity_self_self: over a field k, χ(k, k) = 1.

@[expose] public sectionopen CategoryTheory Limits MonoidalCategory TensorProductuniverse unamespace Modulevariable (R : Type u) [CommRing R] (M N : Type u) [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N]

The intersection multiplicity of two modules M and N over a commutative ring R, $$\chi(M, N) = \sum_{i \ge 0} (-1)^i \ell_R(\operatorname{Tor}_i^R(M, N)).$$ Here Tor is CategoryTheory.Tor on ModuleCat R, the sum is a finsum over ℕ, and the length of each Tor module is converted to a natural number by ENat.toNat.

noncomputable def intersectionMultiplicity : ℤ := ∑ᶠ i : ℕ, (-1 : ℤ) ^ i * (Module.length R (((Tor (ModuleCat.{u} R) i).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))).toNatvariable {R M N}

If N is projective, only Tor₀(M, N) = M ⊗ N contributes to χ(M, N).

R:Type uinst✝⁵:CommRing RM:Type uN:Type uinst✝⁴:AddCommGroup Minst✝³:Module R Minst✝²:AddCommGroup Ninst✝¹:Module R Ninst✝:Projective R Ne:((Tor (ModuleCat R) 0).obj (ModuleCat.of R M)).obj (ModuleCat.of R N) ≅ ModuleCat.of R M ⊗ ModuleCat.of R N⊢ ↑(length R ↑(ModuleCat.of R M ⊗ ModuleCat.of R N)).toNat = ↑(length R (M ⊗[R] N)).toNat All goals completed! 🐙 R:Type uinst✝⁵:CommRing RM:Type uN:Type uinst✝⁴:AddCommGroup Minst✝³:Module R Minst✝²:AddCommGroup Ninst✝¹:Module R Ninst✝:Projective R N⊢ ∀ (x : ℕ), x ≠ 0 → (-1) ^ x * ↑(length R ↑(((Tor (ModuleCat R) x).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))).toNat = 0 R:Type uinst✝⁵:CommRing RM:Type uN:Type uinst✝⁴:AddCommGroup Minst✝³:Module R Minst✝²:AddCommGroup Ninst✝¹:Module R Ninst✝:Projective R Ni:ℕhi:i ≠ 0⊢ (-1) ^ i * ↑(length R ↑(((Tor (ModuleCat R) i).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))).toNat = 0 R:Type uinst✝⁵:CommRing RM:Type uN:Type uinst✝⁴:AddCommGroup Minst✝³:Module R Minst✝²:AddCommGroup Ninst✝¹:Module R Ninst✝:Projective R Nn:ℕhi:n.succ ≠ 0⊢ (-1) ^ n.succ * ↑(length R ↑(((Tor (ModuleCat R) n.succ).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))).toNat = 0 R:Type uinst✝⁵:CommRing RM:Type uN:Type uinst✝⁴:AddCommGroup Minst✝³:Module R Minst✝²:AddCommGroup Ninst✝¹:Module R Ninst✝:Projective R Nn:ℕhi:n.succ ≠ 0this:Subsingleton ↑(((Tor (ModuleCat R) (n + 1)).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))⊢ (-1) ^ n.succ * ↑(length R ↑(((Tor (ModuleCat R) n.succ).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))).toNat = 0 All goals completed! 🐙

If M is the zero module, then χ(M, N) = 0: the functor M ⊗ - is zero, so all its left derived functors vanish.

R:Type uinst✝⁵:CommRing RM:Type uN:Type uinst✝⁴:AddCommGroup Minst✝³:Module R Minst✝²:AddCommGroup Ninst✝¹:Module R Ninst✝:Subsingleton MhM:IsZero (ModuleCat.of R M)hTor:∀ (i : ℕ), IsZero (((Tor (ModuleCat R) i).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))⊢ intersectionMultiplicity R M N = 0 R:Type uinst✝⁵:CommRing RM:Type uN:Type uinst✝⁴:AddCommGroup Minst✝³:Module R Minst✝²:AddCommGroup Ninst✝¹:Module R Ninst✝:Subsingleton MhM:IsZero (ModuleCat.of R M)hTor:∀ (i : ℕ), IsZero (((Tor (ModuleCat R) i).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))⊢ ∑ᶠ (i : ℕ), (-1) ^ i * ↑(length R ↑(((Tor (ModuleCat R) i).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))).toNat = 0 R:Type uinst✝⁵:CommRing RM:Type uN:Type uinst✝⁴:AddCommGroup Minst✝³:Module R Minst✝²:AddCommGroup Ninst✝¹:Module R Ninst✝:Subsingleton MhM:IsZero (ModuleCat.of R M)hTor:∀ (i : ℕ), IsZero (((Tor (ModuleCat R) i).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))i:ℕ⊢ (-1) ^ i * ↑(length R ↑(((Tor (ModuleCat R) i).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))).toNat = 0 R:Type uinst✝⁵:CommRing RM:Type uN:Type uinst✝⁴:AddCommGroup Minst✝³:Module R Minst✝²:AddCommGroup Ninst✝¹:Module R Ninst✝:Subsingleton MhM:IsZero (ModuleCat.of R M)hTor:∀ (i : ℕ), IsZero (((Tor (ModuleCat R) i).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))i:ℕthis:Subsingleton ↑(((Tor (ModuleCat R) i).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))⊢ (-1) ^ i * ↑(length R ↑(((Tor (ModuleCat R) i).obj (ModuleCat.of R M)).obj (ModuleCat.of R N))).toNat = 0 All goals completed! 🐙

Normalisation: over a field k, χ(k, k) = 1.

k:Type uinst✝:Field k⊢ ↑(ENat.toNat 1) = 1 All goals completed! 🐙end Module