THE MODULE SPEND TABLE

which files spend the axiom, and on which primitive

A library-wide figure names no file. 18,109 declarations across 3,261 of Mathlib's 10,599 modules name a choice primitive in their own proof, and this is where they are.

Only 209 of those cite Classical.choice itself. 9,442 go through Classical.byContradiction and 8,440 through Classical.propDecidable — excluded middle and the decidability fallback. A repair aimed at one does nothing for the others, which is why they are counted apart.

Measured with gonzalgo · Lean 4.33.0 with Mathlib v4.33.0 · one streamed pass over 795,218 declarations, no closure computed

modulelibrarydeclarationsspendsratebyContradictionpropDecidablechoice
Batteries.Data.List.LemmasBatteries88116819.1%16620
Mathlib.Topology.EMetricSpace.BoundedVariationMathlib26810840.3%10420
Mathlib.Algebra.Homology.SpectralObject.HasSpectralSequenceMathlib2918529.2%8500
Mathlib.AlgebraicTopology.SimplexCategory.DeltaZeroIterMathlib2518533.9%8500
Mathlib.Algebra.BigOperators.Group.Finset.BasicMathlib3737921.2%41460
Mathlib.MeasureTheory.VectorMeasure.BasicMathlib3316920.8%3670
Mathlib.Algebra.Homology.SpectralObject.SpectralSequenceMathlib2906422.1%5680
Mathlib.Data.Finset.CardMathlib2646323.9%50150
Mathlib.NumberTheory.NumberField.CanonicalEmbedding.BasicMathlib2576224.1%0620
Mathlib.RingTheory.Polynomial.Resultant.BasicMathlib2355925.1%5160
Mathlib.Logic.BasicMathlib3655815.9%16391
Mathlib.Algebra.BigOperators.FinprodMathlib3525716.2%14430
Mathlib.AlgebraicTopology.SimplexCategory.GeneratorsRelations.NormalFormsMathlib2135726.8%5700
Mathlib.Topology.Sets.VietorisTopologyMathlib3225717.7%5130
Mathlib.GroupTheory.NilpotentMathlib4325412.5%18340
Mathlib.RingTheory.MvPolynomial.MonomialOrderMathlib2325423.3%5470
Mathlib.Analysis.SumIntegralComparisonsMathlib855362.4%5300
Std.Tactic.BVDecide.LRAT.Internal.Formula.RupAddResultStd2375322.4%5300
Mathlib.Data.Finset.BasicMathlib2445221.3%4950
Mathlib.CategoryTheory.Limits.Shapes.BiproductsMathlib4115012.2%0491
Mathlib.Combinatorics.SimpleGraph.PathsMathlib3925012.8%4670
Std.Tactic.BVDecide.LRAT.Internal.Formula.LemmasStd2385021.0%4910
Mathlib.Algebra.Homology.Factorizations.CM5aMathlib2014924.4%4800
Mathlib.Data.List.SortMathlib3364814.3%4710
Mathlib.Data.Finsupp.SingleMathlib1544730.5%34370
Mathlib.Order.Interval.Set.LinearOrderMathlib2174621.2%4600
Mathlib.Data.Set.ImageMathlib464459.7%4410
Init.Data.BitVec.LemmasInit2,051442.1%3410
Mathlib.Data.List.BasicMathlib484449.1%4310
Mathlib.Data.Set.InsertMathlib2034421.7%4400
Mathlib.LinearAlgebra.AffineSpace.CombinationMathlib1274434.6%01232
Mathlib.Order.ConditionallyCompleteLattice.BasicMathlib2794415.8%4400
Mathlib.Data.Set.ProdMathlib3844210.9%3840
Mathlib.NumberTheory.ChebyshevMathlib2664215.8%4210
Mathlib.Data.List.ChainMathlib2154119.1%4100
Mathlib.AlgebraicTopology.ExtraDegeneracyMathlib1714023.4%4000
Mathlib.Combinatorics.SimpleGraph.AcyclicMathlib1794022.3%28140
Mathlib.Probability.Process.HittingTimeMathlib1024039.2%11320
Mathlib.Algebra.Polynomial.RuleOfSignsMathlib703955.7%3700
Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.Rpow.IntegralRepresentationMathlib1093935.8%3900
Mathlib.NumberTheory.NumberField.CanonicalEmbedding.NormLeOneMathlib1603823.8%0380
Mathlib.Algebra.Homology.HomotopyCategory.MappingConeMathlib2013718.4%3700
Mathlib.Analysis.SpecialFunctions.ArtanhMathlib813745.7%3720
Mathlib.Analysis.SpecialFunctions.Trigonometric.Chebyshev.RootsExtremaMathlib763748.7%3100
Mathlib.NumberTheory.ModularMathlib1733721.4%3410
Mathlib.NumberTheory.Padics.PadicNumbersMathlib3123711.9%2370
Mathlib.Algebra.Homology.HomotopyCategory.HomComplexShiftMathlib1863619.4%3600
Mathlib.MeasureTheory.Function.SimpleFuncMathlib497367.2%2351
Mathlib.CategoryTheory.Triangulated.TStructure.TruncLTGEMathlib2373514.8%3500
Mathlib.Order.SuccPred.BasicMathlib408358.6%4310
Batteries.Data.Fin.LemmasBatteries1803418.9%3400
Mathlib.Algebra.Homology.HomotopyCategory.MappingCoconeMathlib1353425.2%3400
Mathlib.Algebra.Homology.TotalComplexShiftMathlib1003434.0%3400
Mathlib.MeasureTheory.Integral.SetToL1Mathlib1843418.5%0340
Mathlib.Order.SuccPred.LimitMathlib2953411.5%2300
Init.ClassicalInit673349.3%0205
Mathlib.Algebra.Ring.Int.ParityMathlib963334.4%3300
Mathlib.Order.RelSeriesMathlib382338.6%3100
Mathlib.Algebra.Homology.HomotopyCategory.HomComplexMathlib3163210.1%3200
Mathlib.Analysis.Analytic.OrderMathlib1333224.1%16160
Mathlib.Data.List.LatticeMathlib1123228.6%3200
Mathlib.Analysis.BoxIntegral.Partition.BasicMathlib2213114.0%0310
Mathlib.Algebra.Polynomial.RootsMathlib2103014.3%5250
Mathlib.Algebra.Ring.ParityMathlib1863016.1%3000
Mathlib.CategoryTheory.GlueDataMathlib1723017.4%0300
Mathlib.CategoryTheory.NatIsoMathlib1523019.7%3000
Mathlib.Data.Finset.InsertMathlib2603011.5%3000
Mathlib.Data.List.CycleMathlib442306.8%3000
Mathlib.CategoryTheory.Functor.CategoryMathlib1182924.6%2900
Mathlib.Data.Finsupp.BasicMathlib373297.8%7230
Mathlib.RingTheory.HahnSeries.BasicMathlib1852915.7%0290
Mathlib.Topology.FiberBundle.TrivializationMathlib355298.2%0290
Mathlib.AlgebraicTopology.SimplicialObject.DeltaZeroIterMathlib1232822.8%2800
Mathlib.Geometry.Euclidean.Angle.Unoriented.TriangleInequalityMathlib502856.0%2260
Mathlib.GroupTheory.OrderOfElementMathlib575284.9%4180
Mathlib.GroupTheory.Perm.FinMathlib1222823.0%2800
Mathlib.Logic.Function.BasicMathlib360287.8%9184
Init.Data.Char.OrdinalInit912729.7%2700
Mathlib.Algebra.MvPolynomial.DegreesMathlib1222722.1%3240
Mathlib.AlgebraicTopology.FundamentalGroupoid.BasicMathlib1882714.4%2700
Mathlib.Analysis.Complex.ValueDistribution.LogCounting.BasicMathlib692739.1%2250
Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.Rpow.BasicMathlib275279.8%2160
Mathlib.Combinatorics.SimpleGraph.Connectivity.SubgraphMathlib2382711.3%2610
Mathlib.Data.DFinsupp.DefsMathlib358277.5%2330
Mathlib.FieldTheory.RatFunc.BasicMathlib324278.3%0270
Mathlib.Logic.Equiv.DefsMathlib405276.7%2430
Mathlib.Order.KrullDimensionMathlib2522710.7%2110
Mathlib.Algebra.Homology.HomotopyCategory.KInjectiveMathlib562646.4%2600
Mathlib.Data.Option.NAryMathlib612642.6%2600
Mathlib.Geometry.Manifold.IsManifold.BasicMathlib2612610.0%4220
Mathlib.LinearAlgebra.RootSystem.Finite.LemmasMathlib712636.6%2340
Mathlib.NumberTheory.NumberField.CanonicalEmbedding.ConvexBodyMathlib1092623.9%0260
Mathlib.Order.SupIndepMathlib1142622.8%16180
Mathlib.Analysis.Meromorphic.NormalFormMathlib1142521.9%4220
Mathlib.Analysis.SpecialFunctions.Elliptic.WeierstrassMathlib260259.6%5210
Mathlib.Data.Finset.ProdMathlib1402517.9%2420
Mathlib.Data.Int.InitMathlib1482516.9%2500
Mathlib.Data.List.PeriodicityLemmaMathlib462554.3%2500
Mathlib.Data.List.SigmaMathlib2432510.3%2500
Mathlib.Data.Nat.LogMathlib1522516.4%2500
Mathlib.Logic.Equiv.BasicMathlib356257.0%2410
Mathlib.MeasureTheory.Function.ConditionalExpectation.BasicMathlib562544.6%1250
Mathlib.RingTheory.DedekindDomain.FactorizationMathlib1272519.7%2220
Init.Data.Nat.LemmasInit768243.1%0240
Mathlib.Algebra.Homology.Embedding.TruncGEMathlib862427.9%0240
Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.NonUnitalMathlib529244.5%0240
Mathlib.Analysis.SpecialFunctions.Trigonometric.AngleMathlib317247.6%2400
Mathlib.Computability.TuringMachine.PostTuringMachineMathlib457245.3%8210
Mathlib.Data.Fin.SuccPredMathlib290248.3%2400
Mathlib.Data.Set.SigmaMathlib1022423.5%2310
Mathlib.GroupTheory.ExponentMathlib1692414.2%4200
Mathlib.LinearAlgebra.RootSystem.ChainMathlib792430.4%9150
Mathlib.Order.Interval.Finset.GapsMathlib682435.3%2000
Mathlib.Probability.Distributions.UniformMathlib672435.8%1230
Mathlib.Topology.Covering.BasicMathlib1632414.7%0240
Std.Data.DTreeMap.Internal.BalancingStd368246.5%1230
Mathlib.AlgebraicTopology.DoldKan.FacesMathlib452351.1%2300
Mathlib.Analysis.CStarAlgebra.ContinuousFunctionalCalculus.UnitalMathlib556234.1%1220
Mathlib.Data.Set.CardMathlib445235.2%13100
Mathlib.MeasureTheory.VectorMeasure.SetIntegralMathlib1042322.1%9150

Showing the first 120 of 3,261 rows. Ordered by spends. The tail is long: most spending modules do it once or twice. The full set is in the JSON and the CSV.

spends counts declarations in the module whose own proof names a primitive; a declaration naming two is counted once here and once under each primitive, so the primitive columns can exceed it. rate is spends over declarations in that module. Modules with no direct spend are omitted — there are 7,338 of them, and their theorems can still depend on choice through imports.

Get the data

module-spend.json · module-spend.csv · CC-BY-4.0 · version 2026-08-13

One of the gonzalgo indexes — standing measurements of what formal libraries rest on, remeasured as the libraries move. Cite the series as 10.5281/zenodo.21900625, which resolves to the current deposit.

Reproduce it

lake env lean -D maxErrors=4000 Split.lean
python extract_module_spend.py

One pass, about seven seconds over a 640 MB dump. The module column comes from the extractor; a dump without it cannot answer this question at all. Method: 10.5281/zenodo.21769846.

Spending is not reach

This table answers where the axiom is used. It does not say how far each use travels, and the two are wildly different: 324,808 theorems depend on choice while 18,109 declarations spend it. One spend in Mathlib.Logic.Basic can be inherited by a hundred thousand theorems, and one in a leaf file by none.

The Dominator Table is the other half — how many theorems each site is responsible for. Read together they say which file to open and whether opening it is worth anything.

What the primitives mean

Classical.byContradiction is excluded middle: proving P by refuting its negation. Classical.propDecidable is the decidability fallback, supplied where an instance was wanted and none was synthesised. Classical.choice proper is choosing from a family, and is the rarest of the three by two orders of magnitude.

That ordering matters for anyone trying to reduce classical dependence. The common cases are not choice in the mathematician's sense at all — they are a proof style and a missing instance.

Where it concentrates

The heaviest single module is Batteries.Data.List.Lemmas at 168 spends across 881 declarations. By library the split is Mathlib 3,099, Init 99, Std 38, Batteries 20, Lean 3, Plausible 2 modules containing at least one spend.