Lemma 8 — for any rank , the number of vertices of rank is at most
ProvedHarelTarjan.Compressed.lemma8_rank_countheavy-pathnearest-common-ancestorp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1trees
Let be a rooted tree on vertices and its compressed tree, with . For every ,
Few vertices have high rank. Summed over this gives the count of high-rank vertices used for Lemma 9.
Formalization Note The bound is stated without division as , which is equivalent over the reals.
Preamble
import Mathlib import Definitions.Def_HarelTarjan_Compressed_RootedTree import Definitions.Def_HarelTarjan_Compressed_HeavyPath import Definitions.Def_HarelTarjan_Compressed_CompressedTree
Formal statement
namespace HarelTarjan.Compressed
theorem lemma8_rank_count {V : Type*} [Fintype V] [DecidableEq V] (T : RootedTree V) (i : ℕ) :
(Finset.univ.filter (fun v => rank T v = i)).card * 2 ^ i ≤ Fintype.card V := by sorry
end HarelTarjan.Compressed
Source
Harel, Tarjan, Fast Algorithms for Finding Nearest Common Ancestors, SIAM J. Comput. 13 (1984), p. 344, Lemma 8
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. is any finite type with decidable equality. is any rooted tree on with root and parent map , where:
- ;
- every vertex reaches under some iterate , .
is any natural number.
Definitions used.
- is the number of with for some , including itself.
- A vertex is heavy when and .
- for the least with not heavy.
- The compressed parent is , and for .
- is the number of with for some , including itself.
- .
Statement. The theorem asserts
In words: at most vertices have rank exactly .
Degenerate cases.
- For the claim is only that the number of rank- vertices is at most , which is trivially true.
- For larger than every attained rank, the left side is .
- If , the single vertex has rank , and the claim reduces to for and otherwise.
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.