Use this theorem
Create a project
lake +leanprover/lean4:v4.35.0 new myproject std.toml cd myprojectStandard template, not
math: themathtemplate adds its own Mathlib requirement pinned to the Lean release tag, not to the Mathlib commit this package is built and tested with, so you would get a second, different Mathlib. Mathlib comes in through this package. Skip this step in an existing project with the same Lean and Mathlib.Add the dependency to
lakefile.toml[[require]] name = "formalizations" git = "https://github.com/karlesmarin/formalizations" rev = "v0.15.0"Import the minimal module
import Formalizations.Reusable.CombinatoricsIn a file of the project, e.g.
Example.lean.Paste the example
open Formalizations.Reusable Filter Topology Classical /-- Bass's formula over `ℤ` at `u = 2`. -/ example {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] : (1 - (2 : ℤ) ^ 2) ^ (Fintype.card V) * (1 - (2 : ℤ) • G.hashimoto ℤ).det = (1 - (2 : ℤ) ^ 2) ^ G.edgeFinset.card * (1 - (2 : ℤ) • G.adjMatrix ℤ + (2 : ℤ) ^ 2 • (G.degMatrix ℤ - 1)).det := bass_determinant_commRing G ℤ 2Steps 3 and 4 together are a complete Lean file:
FormalizationsTest/ReusableCombinatoricsExample.leanat v0.15.0, compiled by the CI.Fetch and check
lake update lake lean Example.leanlake updatefetches this package and Mathlib, and Mathlib's update hook downloads the compiled Mathlib (lake exe cache get).lake lean Example.leanbuilds the imports of the file (steps 3 and 4) and checks it. If the file belongs to alean_libof your project,lake build <lib>does the same. Avoid a barelake buildin a project from the standard template: its default target is the executable, whose link compiles every imported Mathlib module to native code. Same versions required: Leanv4.35.0, Mathlibf0b4c81.
Alternative: import Formalizations.Reusable imports the whole layer (all areas).
Bass's determinant formula over any commutative ring: (1-u²)^|V| det(1-uB) = (1-u²)^|E| det(1-uA+u²(D-1)) with B the Hashimoto matrix.
Lean statement
theorem bass_determinant_commRing {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
[DecidableRel G.Adj] (R : Type*) [CommRing R] (u : R) :
(1 - u ^ 2) ^ (Fintype.card V) * (1 - u • G.hashimoto R).det
= (1 - u ^ 2) ^ G.edgeFinset.card
* (1 - u • G.adjMatrix R + u ^ 2 • (G.degMatrix R - 1)).detLinks
Lean docstring
Bass's determinant formula over any commutative ring. For a finite simple graph with Hashimoto (non-backtracking) matrix B, adjacency matrix A and degree matrix D, (1 - u²)^|V| · det (1 - u B) = (1 - u²)^|E| · det (1 - u A + u² (D - 1)) for every u in any commutative ring: the Ihara zeta function in determinant form, with no field and no vertex order.
- Archive:
SimpleGraph.bass_determinant_commRing(Formalizations.Combinatorics.SimpleGraph.Ihara.BassCommRing, from the field casebass_charpolyRev); the module cites no paper DOI of ours. - Classical reference: H. Bass, The Ihara–Selberg zeta function of a tree lattice, Internat. J. Math. 3 (1992) 717–797.
- Example:
u = 0gives1 = 1.
Upstream
needs the Hashimoto matrix, not in Mathlib
Depends on, in this repository
None besides the archive module (repo_dependencies = []).