Proof of Theorem 1 (p. 340) — a vertex of height occurs in at least sets
ProvedHarelTarjan.PointerLB.half_leaves_occurrencesLet be the complete binary tree of height , represented in a list structure with two pointers per node by a map from vertices to nodes, and suppose that every nca query on two leaves is answered in steps. For a leaf let be the set of tree vertices whose nodes are accessible from in steps or less.
If is a vertex of height (depth ), then belongs to for at least half of its leaf descendants :
where is the set of leaves of .
Formalization Note The count is Set.encard. The height is fixed through with , so is not truncated. As in nonleaf_dichotomy, need not be injective.
import Mathlib import Definitions.Def_HarelTarjan_PointerLB_BinaryTree import Definitions.Def_HarelTarjan_PointerLB_PointerMachine
namespace HarelTarjan.PointerLB
theorem half_leaves_occurrences {N : Type*} {h k : ℕ} (ptr : N → Fin 2 → Option N)
(rep : Vertex h → N) (hk : AnswersLeafQueriesIn ptr rep k)
(w : Vertex h) (i : ℕ) (hi : 1 ≤ i) (hwi : w.1.length + i = h) :
(2 ^ (i - 1) : ℕ∞) ≤
{x : Vertex h | IsLeaf x ∧ IsAncestor w x ∧ w ∈ A ptr rep k x}.encard := by sorry
end HarelTarjan.PointerLB
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setup. The setup is the same as in the previous item:
- and any node type ;
- a pointer structure with two fields per node, each holding a node or nil;
- an arbitrary map , not necessarily injective, from vertices of the height- complete binary tree (boolean sequences of length ) to nodes;
- , where is the set of nodes reachable from via at most non-nil pointer fields.
Hypotheses.
- For all leaves , some run of at most steps holds . The run starts holding and each step adds a non-nil field of a held node. is the longest common prefix.
- is a vertex and , with and .
Conclusion. With cardinality in :
Degenerate cases.
- The subtraction is in , but it is exact because .
- The hypotheses force and to be a non-leaf. So for the statement is vacuous.
- For , meaning has depth , the claim is that at least one leaf child of has .
- The same caveats about non-injective and apply as in the previous item. For with injective and , the query hypothesis is unsatisfiable.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.