Zulip Chat Archive

Stream: mathlib4

Topic: Master theorem for divide-and-conquer recurrences


Coder-Osman (Feb 23 2026 at 11:13):

Hi all, I’ve formalized a version of the Master Theorem for divide-and-conquer recurrences (time complexity) in Lean 4, together with supporting lemmas.
Roughly, it’s about recurrences of the form

T(n)=aT(n/b)+f(n)T(n) = a \cdot T(\lfloor n/b \rfloor) + f(n)

and derives asymptotic bounds (Big-O) under standard assumptions.
I’m wondering where this should live in mathlib: would Mathlib.Analysis.Asymptotics be the right home, or is Mathlib.Combinatorics ever appropriate here? (Alternatively, if people prefer a “computational complexity” home under Mathlib/Computability, I can adapt.)
Any advice on file location / naming / existing lemmas to reuse would be appreciated!

Yaël Dillies (Feb 23 2026 at 12:50):

Congratulations! Does this not already exist in Mathlib.Computability.AkraBazzi ?

Coder-Osman (Feb 24 2026 at 03:39):

Thanks for the pointer! I honestly missed Mathlib.Computability.AkraBazzi when I was searching, so that’s my oversight.
I’ll just treat my development as a personal exercise. Really appreciate the heads-up—it saved me from reinventing the wheel.

Snir Broshi (Feb 24 2026 at 12:00):

Coder-Osman said:

I’ll just treat my development as a personal exercise.

Can I suggest solving this TODO in AkraBazzi?

* Specialize this theorem to the very common case where the recurrence is of the form
  `T(n) = ℓT(r_i(n)) + g(n)`
  where `g(n) ∈ Θ(n^t)` for some `t`. (This is often called the "master theorem" in the literature.)

Last updated: Feb 28 2026 at 14:05 UTC