Documentation

Formalizations.Reusable.Combinatorics

Reusable layer: combinatorics and number theory #

Stable names for Pomerance's density theorem on divisors of the middle binomial coefficient and for Kirchhoff's matrix-tree theorem. Each theorem is proved by the archive theorem it re-exposes (no proof is copied).

Main results #

Pomerance's theorem on the middle binomial coefficient (Theorem 2 of the paper). For every integer k ≥ 1, the set of n with n + k ∣ C(2n, n) has asymptotic density 1: #{n < x : n + k ∣ C(2n, n)} / x → 1 as x → ∞. (For k = 1 every n qualifies: C(2n, n)/(n+1) is the Catalan number.)

Kirchhoff's matrix-tree theorem. Let G be a simple graph on a finite linearly ordered vertex type V, v₀ : V and R an integral domain. Deleting the row and the column of v₀ from Mathlib's Laplacian G.lapMatrix R leaves a matrix whose determinant is the number of spanning trees of G, counted as the sets of |V| − 1 edges of G whose spanning subgraph (SimpleGraph.fromEdgeSet) is a tree. The linear order on V only fixes the orientation used in the proof (oriented incidence matrix and Cauchy–Binet); any order gives the same count.

theorem Formalizations.Reusable.card_biUnion_submodular {ι : Type u_1} {α : Type u_2} [DecidableEq ι] [DecidableEq α] (t : ι → Finset α) (s u : Finset ι) :
((s ∪ u).biUnion t).card + ((s ∩ u).biUnion t).card ≤ (s.biUnion t).card + (u.biUnion t).card

The neighbourhood function of a set family is submodular. For an indexed family of finite sets t : ι → Finset α and s u : Finset ι, with N(s) = s.biUnion t (the union of the t i, i ∈ s): |N(s ∪ u)| + |N(s ∩ u)| ≤ |N(s)| + |N(u)|. It is the inequality behind the deficiency form of Hall's theorem (Kőnig–Ore) and behind the transversal matroid.

theorem Formalizations.Reusable.card_biUnion_union_inter_eq_of_tight {ι : Type u_1} {α : Type u_2} [DecidableEq ι] [DecidableEq α] {t : ι → Finset α} {s u : Finset ι} (hall : ∀ (v : Finset ι), v.card ≤ (v.biUnion t).card) (hs : (s.biUnion t).card = s.card) (hu : (u.biUnion t).card = u.card) :
((s ∪ u).biUnion t).card = (s ∪ u).card ∧ ((s ∩ u).biUnion t).card = (s ∩ u).card

Tight sets of a Hall family form a lattice. Let t : ι → Finset α satisfy Hall's condition |v| ≤ |v.biUnion t| for every v : Finset ι, and call s tight when |s.biUnion t| = |s|. Then the union and the intersection of two tight sets are tight. This is the critical-set step of the Halmos–Vaughan proof of Hall's theorem and the source of the Dulmage–Mendelsohn decomposition.

theorem Formalizations.Reusable.bondy_exists_erase_injOn {α : Type u_1} [DecidableEq α] (X : Finset α) (hX : X.Nonempty) (F : Finset (Finset α)) (hcard : F.card ≤ X.card) :
∃ x ∈ X, Set.InjOn (fun (A : Finset α) => A.erase x) ↑F

Bondy's theorem on induced subsets. Let X be a nonempty finite set and F a family of at most |X| distinct finite sets. Then some x ∈ X can be deleted from every member of F without merging two of them: A ↦ A.erase x is injective on F. The sets need not be subsets of X. Typical uses: test covers and separating systems, and deleting a coordinate of a binary code without identifying two codewords.

Godsil–Gutman identity. Summed over all ±1 signings of the edges, the characteristic polynomials of the signed adjacency matrices give #signings • μ(G), the matching polynomial: the expected characteristic polynomial of a uniformly random signing is μ(G). This is the spectral bridge of the Marcus–Spielman–Srivastava interlacing-families method.

theorem Formalizations.Reusable.bass_determinant_commRing {V : Type u_1} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (R : Type u_2) [CommRing R] (u : R) :
(1 - u ^ 2) ^ Fintype.card V * (1 - u • G.hashimoto R).det = (1 - u ^ 2) ^ G.edgeFinset.card * (1 - u • SimpleGraph.adjMatrix R G + u ^ 2 • (SimpleGraph.degMatrix R G - 1)).det

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.

theorem Formalizations.Reusable.bregman_permanent_le (n : ℕ) (A : Matrix (Fin n) (Fin n) ℕ) (hA : ∀ (i j : Fin n), A i j ≤ 1) :
↑A.permanent ≤ ∏ i : Fin n, ↑(∑ j : Fin n, A i j).factorial ^ (1 / ↑(∑ j : Fin n, A i j))

Brégman's theorem (Minc's conjecture). For an n × n (0,1)-matrix A with row sums rᵢ = Σⱼ A i j, the permanent satisfies per A ≤ ∏ᵢ (rᵢ!)^(1/rᵢ). A zero row makes per A = 0, and with 1/0 = 0 its factor is (0!)^0 = 1, so no non-zero-row hypothesis is needed.

  • Archive: Bregman.permanent_le (Formalizations.Combinatorics.Permanent.Bregman; the logarithmic form is Bregman.log_bound); the module cites no paper DOI of ours.
  • Classical reference: L. M. Brégman, Some properties of nonnegative matrices and their permanents, Soviet Math. Dokl. 14 (1973) 945–949; A. Schrijver, A short proof of Minc's conjecture, J. Combin. Theory Ser. A 25 (1978) 80–83.
  • Example: a 2 × 2 (0,1)-matrix.

De Bruijn–Erdős colouring theorem. A graph G is n-colourable iff every finite induced subgraph is n-colourable (no finiteness hypothesis on the vertex type).

Bruck–Ryser–Chowla theorem. If a finite projective plane of order n exists and n ≡ 1 or 2 (mod 4), then n is a sum of two squares (so there is no plane of order 6 or 14).

Transversal matroids. For a finite family A : Fin t → Finset α of sets, the independent finite sets of the transversal matroid presented by A are exactly the partial transversals of A (the sets I admitting an injection I → Fin t with x ∈ A (f x)). By Hall's theorem (partialTransversal_iff_hall in the archive) these are the I with |S| ≤ |⋃_{x ∈ S} {i | x ∈ A i}| for all S ⊆ I.

Laplacian factorization. The Gram matrix of the oriented incidence matrix of a finite simple graph on a linearly ordered vertex type is the graph Laplacian: N * Nᵀ = D - A (Mathlib's SimpleGraph.lapMatrix), over any ring. The unoriented incidence matrix gives D + A instead.

theorem Formalizations.Reusable.ncard_choose_eq_le_two_mul_log (a : ℕ) (ha : 2 ≤ a) :
{p : ℕ × ℕ | p.2 ≤ p.1 ∧ p.1.choose p.2 = a}.Finite ∧ {p : ℕ × ℕ | p.2 ≤ p.1 ∧ p.1.choose p.2 = a}.ncard ≤ 2 * Nat.log 2 a

Singmaster's bound. An integer a ≥ 2 occurs at most 2 ⌊log₂ a⌋ times in Pascal's triangle: the set of positions (n, k) with k ≤ n and C(n, k) = a is finite with at most that many elements. This is a sharpening of the form stated by Singmaster, 2 + 2 ⌊log₂ a⌋ (archive: Singmaster.ncard_choose_eq_le).

Matching polynomial of a forest. Over ℝ, a finite forest's matching polynomial is the characteristic polynomial of its adjacency matrix.

  • Archive: SimpleGraph.matchingPoly_forest_eq_charpoly.
  • Classical reference: C. D. Godsil, Matchings and walks in graphs, J. Graph Theory 5 (1981) 285–297.
  • Example: for an edgeless graph on n vertices, both polynomials are X ^ n.

Heilmann–Lieb real-rootedness. The matching polynomial of every finite simple graph splits over ℝ.

  • Archive: SimpleGraph.matchingPoly_realRooted.
  • Classical reference: O. J. Heilmann, E. H. Lieb, Theory of monomer-dimer systems, Comm. Math. Phys. 27 (1972) 190–232.
  • Example: the matching polynomial of a triangle splits over ℝ.
theorem Formalizations.Reusable.matchingPoly_root_bound {V : Type u_1} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (Δ : ℕ) (hΔ : 2 ≤ Δ) (hdeg : ∀ (v : V), G.degree v ≤ Δ) {x : ℝ} (hx : G.matchingPoly.IsRoot x) :
|x| ≤ 2 * √(↑Δ - 1)

Heilmann–Lieb root bound. For a finite simple graph with all degrees at most Δ ≥ 2, every real root of the matching polynomial has absolute value at most 2√(Δ − 1). The polynomial splits over ℝ by matchingPoly_splits.

  • Archive: SimpleGraph.matchingPoly_bounded.
  • Classical reference: O. J. Heilmann, E. H. Lieb, Theory of monomer-dimer systems, Comm. Math. Phys. 27 (1972) 190–232.
  • Example: if all degrees are at most two, all roots lie in [-2, 2].

Godsil's path-tree identity. Write T for the tree of simple paths starting at u and r for the trivial path. Then μ(G) μ(T - r) = μ(G - u) μ(T), where deleting a vertex takes the induced graph on the remaining vertices.

Godsil's moment theorem. The sum of the k-th powers of the complex roots of a finite simple graph's matching polynomial, with multiplicity, equals the number of closed tree-like walks of length k. For each starting vertex v, count closed walks from the root of the path tree at v using the root–root entry of the k-th power of its adjacency matrix.

Matching polynomial derivative. The derivative of μ(G) is the sum of the matching polynomials of the induced graphs obtained by deleting one vertex at a time.

Tree-like walks below the girth. Below the extended girth, every closed walk is tree-like, so their count is the trace of the corresponding adjacency matrix power over ℕ.

theorem Formalizations.Reusable.trace_hashimoto_pow {V : Type u_1} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (R : Type u_2) [CommRing R] (k : ℕ) :
(G.hashimoto R ^ k).trace = ↑(∑ e : G.Dart, (Matrix.relWalks G.nbRel k e e).card)

Hashimoto trace and non-backtracking walks. The trace of the k-th power of the Hashimoto matrix counts closed non-backtracking walks based at darts, cast into the coefficient ring. Closure uses the same non-backtracking relation as each intervening step.

  • Archive: SimpleGraph.trace_hashimoto_pow.
  • Classical reference: A. Terras, Zeta Functions of Graphs: A Stroll through the Garden, Cambridge University Press, 2011.
  • Example: at k = 0 there is one trivial walk per dart.

Matching gap law. For 1 ≤ k ≤ girth + 1, the adjacency trace minus the k-th power sum of the complex matching roots, counted with multiplicity, equals the Hashimoto trace.

theorem Formalizations.Reusable.ihara_Nk_explicit {V : Type u_1} [Fintype V] [DecidableEq V] [LinearOrder V] (G : SimpleGraph V) [DecidableRel G.Adj] (R : Type u_2) [Field R] [Infinite R] :
have X := Polynomial.X; have vertexFactor := ↑((1 - X ^ 2) ^ Fintype.card V); have edgeFactor := ↑((1 - X ^ 2) ^ G.edgeFinset.card); have hashimotoDet := ↑(1 - X • (G.hashimoto R).map ⇑Polynomial.C).det; have bassDet := ↑(1 - X • (SimpleGraph.adjMatrix R G).map ⇑Polynomial.C + X ^ 2 • (SimpleGraph.degMatrix R G - 1).map ⇑Polynomial.C).det; (PowerSeries.mk fun (k : ℕ) => (G.hashimoto R ^ (k + 1)).trace) = (vertexFactor * hashimotoDet).invOfUnit 1 * (hashimotoDet * PowerSeries.derivative vertexFactor - edgeFactor * PowerSeries.derivative bassDet - bassDet * PowerSeries.derivative edgeFactor)

Ihara trace generating function. Let B, A and D be the Hashimoto, adjacency and degree matrices. Differentiating Bass's determinant identity gives the series whose coefficient at X^k is tr(B^(k+1)). The inverse is taken in the formal power series ring and its argument has constant coefficient 1.

  • Archive: SimpleGraph.ihara_Nk_explicit.
  • Classical reference: H. Bass, The Ihara–Selberg zeta function of a tree lattice, Internat. J. Math. 3 (1992) 717–797.
  • Example: extracting the coefficient of X^k over ℚ gives the trace at length k + 1.