Proof of Lemma 9, p. 345 — at most vertices have rank or greater
ProvedHarelTarjan.Compressed.rank_ge_countheavy-pathnearest-common-ancestorp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1trees
Let be a rooted tree on vertices and its compressed tree. For every , the number of vertices with rank or greater satisfies
This is the first sentence of the proof of Lemma 9 and yields the sizes of plies two and three.
Formalization Note The bound is stated without division as , which is over the reals, including .
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 rank_ge_count {V : Type*} [Fintype V] [DecidableEq V] (T : RootedTree V) (k : ℕ) :
(Finset.univ.filter (fun v => k ≤ rank T v)).card * 2 ^ k ≤ 2 * Fintype.card V := by sorry
end HarelTarjan.Compressed
Source
Harel, Tarjan, Fast Algorithms for Finding Nearest Common Ancestors, SIAM J. Comput. 13 (1984), p. 345, proof of Lemma 9, first sentence
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 at least .
Degenerate cases.
- For every vertex qualifies, and the claim is , which is trivially true.
- For exceeding every attained rank, the left side is .
- If , the claim is for and otherwise.
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.