feat: Create Asymptotics/GrowthRates#468
Conversation
|
I would recommend adding additional common classes (nearly linear and almost linear time have been standard terms in TCS). GrowthRate.subpolynomial: Growth as O(n^{o(1)}) (e.g., 2^{sqrt{\log n}}) I would reserve quasi-linear for O(n*(alpha(n)), where alpha(n) is the inverse Ackermann function. |
|
There is also the iterated logarithm: |
|
I agree about subpolynomial certainly. The Foo-linear terminology seems like a mess in the literature! Here's a source for "quasilinear" meaning O(n * log^k(n)): https://en.wikipedia.org/wiki/Time_complexity#Quasilinear_time I'm not sure about nearly_linear and almost_linear being particularly standard. When I google them, the first results I get are https://cstheory.stackexchange.com/questions/39584/examples-of-quasilinear-vs-essentially-linear-time-translatable-models uses quasilinear to mean O(n * log^k(n)), and "essentially linear" to mean O(n ^ {1 + o(1)}). https://cstheory.stackexchange.com/a/36697 suggests O(n ^ (1 + epsilon)) -- or more precisely, the intersection of these for all epsilon > 0 -- to mean "near-linear", but doesn't seem to cite any literature uses of this form. It's worth noting that "quasilinear" has an unrelated meaning coming from convex analysis, and this notion is actually in Mathlib. It has a separate meaning in economics as well (a function in two variables which is linear in one variable but not the other). I tried looking up "pseudolinear" to see if that was a thing, it seems not to be. Based on this, it seems like |
|
For now, I'll look at adding GrowthRate.inverseAckermann and GrowthRate.iteratedLog, and I'll write some I'll start on splitting the files. |
|
The term "nearly linear" vs. "almost linear" has been standard for the last 10 years (you can check any algorithm conference from the past 10 years, and you will find this term with high probability). In your reference,
You can sample a few more if you want to get the most robust statistics. |
|
Now I'm confused. Surely \tilde{O}(n ^{1 + o(1)}) is the same as O(n^{1 + o(1)}), and would be (under your definition) "almost-linear time", and not "nearly-linear time"? And the title of the paper is "nearly-linear time", and their main result is that the algorithm runs in time \tilde{O}(n ^{1 + o(1)}). I liked your suggestion of just looking directly at recent conferences. (I wasn't aware that this might be a recent, 10-year shift in terminology, so especially thanks for that tip!) I took a quick survey of papers accepted to STOC 2025 with some variant of 'linear' in their title or abstract, to get statistics:
FOCS 2025:
I guess that seems pretty compelling. :) So I'll change |

I'll copy the docstring from the file, because I think it explains pretty well what the goal here is. I'm trying to PR this into CSLib from CircuitComp.
Asymptotic Growth Rates
Named Growth Rates
This file collects about common "growth rates" that show up in complexity theory. While
IsBigOexpresses growth rate up to a multiplicative constant, there are other importantclasses not directly expressible as
IsBigO. In rough order of literature frequency:GrowthRate.poly: Polynomial growth, typically writtenpoly(n)orn ^ O(1).GrowthRate.polylog:(log n)^k, that is, a polynomial in the logarithm.GrowthRate.exp: Exponential growth with any rate, often writtenexp(O(n))GrowthRate.sublinear: Sublinear growth, typically writteno(n).GrowthRate.quasilinear: Growth asO(n * (log n)^k)GrowthRate.quasipoly: Growth asO(2 ^ (log n)^k)GrowthRate.primitiveRecursive: Growth as a primitive recursive function.GrowthRate.computable: Any computable function. This excludes, for instance, the BusyBeaver function.
These are all given as a
GrowthRate := Set (ℕ → ℕ). We haveGrowthRate.bigOas a thin wrapperaround
Asymptotics.IsBigO, likewise forlittleO.We also provide aliases for some of the more common Big-O classes, in order to work
with them more cleanly.
GrowthRate.const: O(1)GrowthRate.log: O(log n)GrowthRate.sqrt: O(sqrt n)GrowthRate.linear: O(n)GrowthRate.linearithmic: O(n * log n)GrowthRate.two_pow: O(2 ^ n)GrowthRate.e_pow: O(Real.exp n)Where they involve functions with different definitions on
distinct types (e.g.
Nat.sqrtvs.Real.sqrt, or(2 : ℕ) ^ ·vs.(2 : ℝ) ^ .), wewant to have both forms.
Since all of these rates are
Sets, their ordering of "faster growth" is given by thesubset relation
⊆. That is, where you might want to writef ≤ gwherefandgare growth rates, this is best written as
f ⊆ g.Lawful Growth Rates
We call a
GrowthRatelawful if it is closed under dominating sequences, addition, andcomposition with a sublinear function; and is nontrivial (it contains at least one function
besides zero).
This last condition is equivalent to containing the constant function 1; or, containing any
two distinct functions. These conditions are enough to get most desirable properties, and all
of above have
LawfulGrowthRateinstances. This allows reusable proofs for many common properties,such as invariance under affine scaling.
Main Theorems
Most theorems in this file fall into one of three categories:
ℕ → ℕ,sometimes it's more convenient to work with real numbers. (For instance,
e ^ n, or differentbases of logarithms.) For instance,
GrowthRate.log_iff_rlogrelatesGrowthRate.logto thereal function
Real.log, instead of its definition in terms ofNat.log 2.GrowthRate.exp_ssubset_primitiveRecursiveshows thatexpis a strictsubset of
primitiveRecursive.GrowthRate.linear_compsays that any LawfulGrowthRate isclosed under composition with any function
f ∈ GrowthRate.linear.GrowthRate.poly_compsaysthat
GrowthRate.polyis closed under composition. AndGrowthRate.exp_mulsays thatGrowthRate.expis closed under multiplication.I realize this is a big file at the moment. I've already done a lot of cleanup (many of the proofs, but not the majority, were from Aristotle) but there's still plenty of room for improvement I'll admit. It's doing a lot of things, and a lot of them are messy! Converting between Real logs and powers, Ints, and Nats; different bases, different powers, showing these things are all equivalent. The hope is that when these invariably come up in other asymptotic analysis, it's a bit easier; and it gives a "canonical spelling" for certain classes of growth rates, in a way that is currently lacking.
I do think it's probably better to split the file, and I'm hoping for input as to where. Also especially looking for feedback on the choice of
LawfulGrowthRateaxioms, I could reasonably see having more or fewer.