Reusable layer v0.15.0
82 results of the formalizations archive under stable names Formalizations.Reusable.*. Each is proved by the archive theorem it re-exposes (no proof is copied). Usage example: 82 of 82. Axioms audited, standard only: 82 of 82. API marks lemmas to import into other proofs; showcase, classical theorems to consult.
📘 New to the layer? The practical guide takes you from installing it to using every theorem, with recipes and worked examples (en castellano, PDF).
Install directly from GitHub (Reservoir indexing pending).
1 Create a project
lake +leanprover/lean4:v4.35.0 new myproject std.toml
cd myprojectStandard template, not math: the math template 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.
2 Add to lakefile.toml
[[require]]
name = "formalizations"
git = "https://github.com/karlesmarin/formalizations"
rev = "v0.15.0"3 Import one area
import Formalizations.Reusable.Geometryor the whole layer: import Formalizations.Reusable. Each page gives the area and a compiled example.
4 Fetch and check
lake update
lake lean Example.leanlake update fetches this package and Mathlib, and Mathlib's update hook downloads the compiled Mathlib (lake exe cache get). lake lean Example.lean builds the imports of the file (steps 3 and 4) and checks it. If the file belongs to a lean_lib of your project, lake build <lib> does the same. Avoid a bare lake build in a project from the standard template: its default target is the executable, whose link compiles every imported Mathlib module to native code.
formalizations 0.15.0Lean v4.35.0Mathlib f0b4c81
The project that requires it must use the same Lean and Mathlib.
Geometry
Pappus's hexagon theorem
Pappus's hexagon theorem in homogeneous coordinates over any commutative ring: if A, B, C are collinear and a, b, c are collinear, the meets Ab∩aB, Ac∩aC, Bc∩bC are collinear, with no non-degeneracy hypothesis.
pappus_hexagonWolstenholme's inequality, defect form
If A + B + C = π, then x² + y² + z² − (2yz cos A + 2zx cos B + 2xy cos C) = (x − z cos B − y cos C)² + (z sin B − y sin C)² for all real x, y, z; hence Wolstenholme's inequality.
wolstenholme_defect_eq_sq_add_sqMeasure Theory
Analysis
Oscillation of the Airy equation
Every solution f of the Airy equation f'' = x f on ℝ has zeros unbounded below: for every M there is x < M with f x = 0.
airy_eq_zeros_unbounded_belowGlasser's integral
For a ≥ 0 and b > 0, \(∫_{v>0}\) \(v^{-1/2}\) exp(−a/v − b v) dv = √(π/b) exp(−2√(ab)) (the modified Bessel \(K_{1/2}\) integral).
glasser_integralProduct of sines
For every n ≥ 1, \(∏_{k=1}^{n−1}\) 2 sin(kπ/n) = n.
prod_two_sin_mul_pi_divThe Eneström–Kakeya theorem
The Eneström–Kakeya theorem: a polynomial \(∑_{k ≤ n}\) a_k z^k with real coefficients a_0 ≥ a_1 ≥ ⋯ ≥ a_n > 0 has no zero in the open unit disc ‖z‖ < 1.
enestrom_kakeya_ne_zeroGeneralised Hlawka inequality (Djoković 1963; Smiley–Smiley 1964)
Generalised Hlawka inequality: for n ≥ 3 vectors of a real inner product space, with d_k the sum of the norms of all k-element subsums, d_2 + ⋯ + \(d_{n-1}\) ≤ (2^(n-2) − 1)(d_1 + d_n); n = 3 is Hlawka's ‖x+y‖+‖y+z‖+‖z+x‖ ≤ ‖x‖+‖y‖+‖z‖+‖x+y+z‖.
hlawka_generalisedThe Zieliński–Zych inequality
The Zieliński–Zych inequality: for every α > 0 and x ≥ 0, 0 ≤ x^α − π^α/2 + (π^α/2) cos x + α π^(α−1) sin x; the analytic core of the fractional-moment speed limit π^α ≤ 2 M_α τ^α (α = 1 is Margolus–Levitin).
zielinski_zych_inequalityThe Margolus–Levitin theorem
The Margolus–Levitin quantum speed limit (ℏ = 1): for a normalized population p over nonnegative energies E with mean Ebar, if the autocorrelation Σ pₙ e^(−i Eₙ τ) vanishes at τ ≥ 0, then π ≤ 2 · Ebar · τ.
margolus_levitinmandelstam_tamm_L1
For a probability distribution over real energy levels, if its autocorrelation vanishes at time τ ≥ 0, then D₁τ ≥ 1, where D₁ is the mean absolute energy deviation from the reference energy.
mandelstam_tamm_L1variance_mixture_kurtosis_identity
For independent standard normal Z and nonnegative V with finite second moment and positive mean, √V · Z has kurtosis 3 E[V²] / E[V]² and excess kurtosis 3 Var(V) / E[V]² ≥ 0.
variance_mixture_kurtosis_identityEuler's reflection formula
Euler’s reflection formula for 0 < x < 1: Li₂(x) + Li₂(1 − x) = π²/6 − log(x) log(1 − x).
Li₂_add_Li₂_one_subLanden's identity
Landen’s identity for 0 < x < 1/2: Li₂(x) + Li₂(x/(x − 1)) = −log²(1 − x)/2.
Li₂_landenDuplication
Duplication for the real dilogarithm: Li₂(x²) = 2(Li₂(x) + Li₂(−x)) for |x| ≤ 1.
Li₂_sqAbel's five-term relation
Abel’s five-term relation for the Rogers dilogarithm on (0, 1): L(x) + L(y) = L(xy) + L(x(1 − y)/(1 − xy)) + L(y(1 − x)/(1 − xy)).
rogersL_fivetermThe dilogarithm at the imaginary unit
At the imaginary unit, the complex dilogarithm is Li₂(i) = −π²/48 + i G, where G is Catalan’s constant.
Li₂c_IPolynomial
Real-rootedness from sign alternation
A nonzero real polynomial of degree at most n that alternates sign at n + 1 strictly increasing points splits over ℝ (is real-rooted).
splits_of_alternating_signCounting real roots by sign alternation
If a nonzero real polynomial takes strictly alternating signs at n + 1 strictly increasing points, it has at least n distinct real roots.
card_roots_toFinset_ge_of_alternating_signReal-rootedness from one root per gap
A nonzero real polynomial of degree at most n with a root in each of the n open gaps between n + 1 strictly increasing points splits over ℝ.
splits_of_isRoot_mem_Ioo_of_gapsSturm's theorem
Sturm's theorem: for squarefree p ∈ ℝ[X] and a < b with p(a), p(b) ≠ 0, the sign variations of Mathlib's Polynomial.sturmSeq p p' at a minus those at b equal the number of distinct roots of p in (a, b].
sturm_signVariations_sub_eq_card_rootsThe Budan–Fourier theorem
The Budan–Fourier theorem: for nonzero p ∈ ℝ[X] and a < b with p(a), p(b) ≠ 0, the number of roots of p in (a, b] counted with multiplicity is at most V(a) − V(b), with even difference, where V(x) is the number of sign variations of p, p′, …, p^(deg p) at x.
budan_fourier_card_roots_leNewton's inequalities
Newton's inequalities: for a monic real polynomial p of degree n that splits over ℝ and 1 ≤ k ≤ n − 1, e_k² · C(n,k−1) C(n,k+1) ≥ \(e_{k−1}\) \(e_{k+1}\) · C(n,k)², with e_j the elementary symmetric functions of the roots.
newton_inequality_esymm_rootsReal-rootedness is stable under differentiation
If a real polynomial splits over ℝ (all its roots are real), so does its derivative.
splits_derivativeReal-rootedness is stable under reversal
If a real polynomial splits over ℝ, so does its reverse (the reciprocal polynomial X^deg · p(1/X)).
splits_reversed'Ocagne's identity for the Vieta–Fibonacci polynomials
d'Ocagne's identity for the Vieta–Fibonacci polynomials: over a commutative ring, for Mathlib's Polynomial.Chebyshev.S and all p, q : ℤ, S p · S (q−1) − S q · S (p−1) = − S (p−q−1); the case q = p+1 is S_sq_add_S_sq.
chebyshev_S_docagneCombinatorics
Pomerance's theorem on the middle binomial coefficient
For every integer k ≥ 1, the set of n with n + k dividing the central binomial coefficient C(2n, n) has asymptotic density 1.
pomerance_density_add_dvd_centralBinomKirchhoff's matrix-tree theorem
Kirchhoff's matrix-tree theorem: over an integral domain, deleting the row and column of any vertex from the Laplacian (Mathlib's lapMatrix) of a finite simple graph leaves a matrix whose determinant is the number of spanning trees.
det_lapMatrix_submatrix_eq_card_spanningTreesThe neighbourhood function of a set family is submodular
For an indexed family of finite sets t, the neighbourhood function s ↦ |s.biUnion t| is submodular: |N(s ∪ u)| + |N(s ∩ u)| ≤ |N(s)| + |N(u)|.
card_biUnion_submodularTight sets of a Hall family form a lattice
Under Hall's condition |v| ≤ |v.biUnion t| for all v, the union and the intersection of two tight sets (|s.biUnion t| = |s|) are tight.
card_biUnion_union_inter_eq_of_tightBondy's theorem on induced subsets
Bondy's theorem: if X is a nonempty finite set and F a family of at most |X| distinct finite sets, some x ∈ X can be deleted from every member of F keeping them distinct.
bondy_exists_erase_injOnGodsil–Gutman identity
Godsil–Gutman: the sum over all ±1 edge signings of the characteristic polynomials of the signed adjacency matrices is (number of signings) times the matching polynomial.
godsil_gutmanBass's determinant formula over any commutative ring
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.
bass_determinant_commRingBrégman's theorem (Minc's conjecture)
Brégman's theorem (Minc's conjecture): for an n × n (0,1)-matrix A with row sums r_i, per A ≤ ∏ (r_i!)^(1/r_i); zero rows allowed (factor 1).
bregman_permanent_leDe Bruijn–Erdős colouring theorem
De Bruijn–Erdős: a graph G is n-colourable iff every finite induced subgraph is n-colourable (no finiteness hypothesis on the vertex type).
colorable_iff_forall_finite_induceBruck–Ryser–Chowla theorem
Bruck–Ryser–Chowla: 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 no plane of order 6 or 14).
bruck_ryser_chowlaTransversal matroids
For a finite family A : Fin t → Finset α, the independent finite sets of the transversal matroid presented by A are exactly the partial transversals of A (by Hall, the I with |S| ≤ \(|⋃_{x∈S}\) {i | x ∈ A i}| for all S ⊆ I).
transversalMatroid_indepLaplacian factorization
For a finite simple graph on a linearly ordered vertex type, over any ring, the oriented incidence matrix N satisfies N Nᵀ = D − A, the Laplacian (Mathlib's SimpleGraph.lapMatrix).
orientedIncMatrix_mul_transposeSingmaster's bound
Singmaster's bound: an integer a ≥ 2 occurs at most 2⌊log₂ a⌋ times in Pascal's triangle (the set of positions (n,k), k ≤ n, with C(n,k) = a is finite with at most that many elements; Singmaster states 2 + 2⌊log₂ a⌋).
ncard_choose_eq_le_two_mul_logMatching polynomial of a forest
The matching polynomial of a finite forest equals the characteristic polynomial of its real adjacency matrix.
matchingPoly_forest_eq_charpolyHeilmann–Lieb real-rootedness
Heilmann–Lieb real-rootedness: the matching polynomial of every finite simple graph splits over ℝ.
matchingPoly_splitsHeilmann–Lieb root bound
Heilmann–Lieb: if every vertex degree is at most Δ ≥ 2, then every real root of the matching polynomial lies in [−2√(Δ−1), 2√(Δ−1)].
matchingPoly_root_boundGodsil's path-tree identity
Godsil’s path-tree identity: μ(G) μ(T−r) = μ(G−u) μ(T), where T is the path tree at u, r is its root, and deletion takes the induced graph on the remaining vertices.
godsil_pathTree_identityGodsil's moment theorem
Godsil’s moment theorem: the sum of kth powers of the complex matching roots with multiplicity counts closed tree-like walks of length k, expressed by the root entries of the path-tree adjacency matrix powers.
matchingPoly_root_power_sum_eq_pathTree_walksMatching polynomial derivative
The derivative of the matching polynomial equals the sum of the matching polynomials of the induced graphs obtained by deleting one vertex at a time.
matchingPoly_derivative_eq_sum_vertex_deletionsTree-like walks below the girth
Below the extended girth, the number of closed tree-like walks of length k equals the trace of the kth adjacency matrix power over ℕ.
treeLikeWalkCount_eq_trace_of_lt_egirthHashimoto trace and non-backtracking walks
The trace of the kth Hashimoto matrix power counts closed non-backtracking walks based at darts, cast into the coefficient ring.
trace_hashimoto_powMatching gap law
For 1 ≤ k ≤ girth + 1, the adjacency trace minus the kth power sum of the complex matching roots, counted with multiplicity, equals the Hashimoto trace.
trace_sub_matchingPoly_root_power_sum_eq_trace_hashimotoIhara trace generating function
The series with coefficient tr(B^(k+1)) at X^k for the Hashimoto matrix B is given by differentiating Bass’s determinant identity and inverting its unit factor.
ihara_Nk_explicitLinear Algebra
Rank of a block upper-triangular matrix
Over a field, the rank of the block upper-triangular matrix [[A, B], [0, D]] is at most the number of rows of A plus the rank of D.
rank_fromBlocks_zero₂₁_le_card_add_rankSubadditivity of the rank
Over a field, rank (A + B) ≤ rank A + rank B for matrices.
matrix_rank_add_leThe Cauchy–Binet formula
Cauchy–Binet: for A : m × n and B : n × m over a commutative ring (n linearly ordered), det (A B) is the sum over the |m|-subsets S of n of det A[:, S] · det B[S, :].
det_mul_eq_sum_det_submatrix_mul_det_submatrixJacobi's formula
Jacobi's formula: for a square matrix A of polynomials over a commutative ring, derivative (det A) = trace (adjugate A · A.map derivative).
derivative_det_eq_trace_adjugate_mulLower bound for the rank of a block upper-triangular matrix
Over a field, rank A + rank D ≤ rank of the block upper-triangular matrix fromBlocks A B 0 D.
matrix_rank_add_rank_le_rank_fromBlocksThe rank of a Kronecker product is the product of the ranks
Over a field, the rank of the Kronecker product A ⊗ₖ B of two matrices is rank A · rank B.
matrix_rank_kroneckerDiagonal entries of the adjugate are principal minors
For a square matrix A over a commutative ring, indexed by any finite type, adjugate A i i is the determinant of the principal submatrix obtained by deleting row and column i.
adjugate_apply_self_eq_det_principal_submatrixAlternating characteristic polynomial ⇒ positive semidefinite
A real symmetric matrix whose characteristic polynomial has coefficients alternating in sign is positive semidefinite (the polynomial rule is a corollary of Descartes' rule of signs).
posSemidef_of_charpoly_alternatingA positive semidefinite matrix of rank `k` is a sum of `k` squares
The quadratic form of a real positive semidefinite matrix of rank k is a sum of exactly k squares of linear forms.
psd_quadForm_eq_sum_rank_sqRank through the Schur complement
Over a field, a block matrix with invertible top-left block A has rank card m + rank (D - C A⁻¹ B); with A positive definite and zero Schur complement it is PSD of rank card m.
rank_fromBlocks_of_isUnit₁₁Sums of squares of bilinear forms under orthogonal congruence
For P_H(x, y) = (x₀² + x₁²)(y·y) + 2x₀x₁(y·Hy) over a commutative ring and DᵀD = 1, every sum-of-squares representation of P_H by bilinear forms x·(B_i y) transports to one of \(P_{DᵀHD}\) by the forms B_i D (same number of squares); signed-graph switching is D = diag(s), s_i² = 1.
biquadratic_sos_transportInteger orthonormal columns are signed unit vectors
If an integer m × n matrix A satisfies AᵀA = I, every column j is \(±e_{f(j)}\) for an injective f : n → m (signed unit vectors in distinct rows); in particular an integer vector with v·v = 1 is ±e_i. False over ℚ.
int_columns_of_transpose_mul_selfSchur's bound on commutative subspaces
Schur's bound: a subspace of M_n(K) over a field K whose elements pairwise commute has dimension ≤ ⌊n²/4⌋ + 1 (sharp: R0056).
schur_commuting_finrank_leHua's identity
Hua's identity in a division ring: for a ≠ 0, b ≠ 0 and ab ≠ 1, a − (a⁻¹ + (b⁻¹ − a)⁻¹)⁻¹ = aba.
hua_identityNewton's identity for traces
Newton's identity for traces: for a square matrix M over a commutative ring R, d/dX (charpolyRev M) = − charpolyRev M · Σₖ trace(M^(k+1)) Xᵏ in R⟦X⟧, with charpolyRev M = det(1 − X • M).
derivative_coe_charpolyRevSchur's bound is sharp
Schur's bound is sharp: for every field K and n ≥ 1 there is a subspace of M_n(K) whose elements pairwise commute, of dimension exactly ⌊n²/4⌋ + 1 (the companion of R0042).
schur_commuting_finrank_attainedmul_add_mul_eq_trace_smul_add_trace_smul_fin_two
For two-by-two matrices A and B over a commutative ring, AB + BA = tr(A) B + tr(B) A + (tr(AB) − tr(A)tr(B)) I.
mul_add_mul_eq_trace_smul_add_trace_smul_fin_tworesolventSeries_diag_mul_coe_charpolyRev
For a square matrix M over a commutative ring, the power series with coefficients (Mᵏ)ᵢᵢ times the reversed characteristic polynomial of M equals the reversed characteristic polynomial of the principal submatrix deleting i.
resolventSeries_diag_mul_coe_charpolyRevAlgebraic Geometry
Number Theory
Wolstenholme's theorem (1862)
Wolstenholme's theorem: for a prime p ≥ 5, C(2p − 1, p − 1) ≡ 1 and C(2p, p) ≡ 2 (mod p³).
wolstenholme_choose_modEqTouchard's congruence (1933)
Touchard's congruence: for every prime p and every n, the Bell numbers satisfy B(n + p) ≡ B(n) + B(n + 1) (mod p); in particular B(p) ≡ 2 (mod p).
touchard_bell_add_primeDedekind reciprocity
Dedekind reciprocity: for coprime positive integers h, k, s(h,k) + s(k,h) = (h² + k² + 1)/(12hk) − 1/4, with s(h,k) = \(Σ_{r<k}\) ((r/k))((hr/k)) the Dedekind sum.
ded_reciprocityThe Dirichlet identity `τ ∗ φ = σ`
The Dirichlet identity τ ∗ φ = σ: for every n, \(Σ_{d∣n}\) τ(d) φ(n/d) = σ(n), with τ the number of divisors, φ Euler's totient and σ the sum of divisors.
sum_card_divisors_mul_totientCyclotomic reciprocity
Cyclotomic reciprocity: for n ≥ 2, the nth cyclotomic polynomial over ℝ equals its coefficient reversal.
reverse_cyclotomicExistence of Pisano periods
For every positive m, the Fibonacci sequence modulo m has a positive period valid from index zero.
exists_fib_modEq_periodParity of Pisano periods
For every modulus m > 2, each positive period of the Fibonacci sequence modulo m is even.
even_of_fib_modEq_periodFibonacci numbers at primes
For every prime p, the pth Fibonacci number equals the Legendre symbol (5/p) modulo p.
fib_prime_eq_legendreSymFlynn-Connolly's theorem
Infinitely many odd k divide the sum F₁ + ⋯ + Fₖ. For odd primes p ≡ 2 modulo 3 and p ≡ ±2 modulo 5, both k = F_(2p) and k = F_(4p) are odd and satisfy F_(k+2) ≡ 1 modulo k.
flynn_connollyAmiot's interval lemma
A cyclic interval of k consecutive residues modulo n, with 1 < k < n − 1, cannot be preserved by multiplication by a unit other than ±1.
amiot_intervalGroup Theory
The Pólya–Redfield enumeration theorem
Pólya–Redfield enumeration theorem: for a finite group G acting on a finite set α and colour weights w, |G| · Σ over orbits of colourings of Π_a w(F a) equals Σ_g p₁^(fixed points of g) · Π over the cycles of g of p_length, where p_k = Σ_c w(c)^k.
polya_redfield_card_mul_sum_orbit_weightSeparation lemma (transitive case)
Separation lemma, transitive case: if G acts pretransitively on Ω and A, B are finite subsets with #A · #B < #Ω, some g ∈ G satisfies g • a ∉ B for all a ∈ A (no finiteness of G or Ω assumed).
separation_lemma_of_pretransitivePraeger's theorem on bounded movement
Praeger's theorem on bounded movement: if a group acts on Ω with no fixed point and every finite set moved off itself by some element has at most m ≥ 1 points, then Ω is finite, there are at most 2m − 1 orbits, every orbit has at most 3m points and |Ω| ≤ 3m + t − 1, t the number of orbits.
praeger_bounded_movementfanoGroup_card
The group of permutations of the seven points of the Fano plane that preserve its seven lines has order 168.
fanoGroup_cardNo result matches.