Documentation

CslibFrontier.Foundations.Combinatorics.BinaryTreeCover

Complete Binary Tree Cover Bound #

This module formalizes the minimal covering set cover S of a leaf subset S in a complete binary tree of height h (n = 2 ^ h leaves) and proves the logarithmic cover-size bound of [BS23], Section 5.6 (Definition 5.4 and Theorem 5.8, pp. 206–207).

Main definitions #

Main results #

Deviations from [BS23] #

References #

A node in the complete binary tree of height h (2 ^ h leaves). Nodes at level cover 2 ^ level contiguous leaves; level = 0 is a leaf and level = h is the root.

  • level : ℕ

    Height above the leaf layer (0 at leaves, h at the root).

  • index : ℕ

    Left-to-right index among nodes at level.

  • level_le : self.level ≤ h

    Level is bounded by the tree height.

  • index_lt : self.index < 2 ^ (h - self.level)

    Index is bounded by the number of nodes at level.

theorem Cslib.CompleteBinaryTree.Node.ext {h : ℕ} {x y : Node h} (level : x.level = y.level) (index : x.index = y.index) :
x = y
def Cslib.CompleteBinaryTree.instDecidableEqNode.decEq {h✝ : ℕ} (x✝ x✝¹ : Node h✝) :
Decidable (x✝ = x✝¹)
@[instance_reducible]

The root of the complete binary tree of height h.

Leaf i belongs to the subtree rooted at v ([BS23], Definition 5.4).

Instances For
    @[instance_reducible]

    Embedding of the left subtree of height h into height h + 1.

    Embedding of the right subtree of height h into height h + 1.

    def Cslib.CompleteBinaryTree.Covers {h : ℕ} (W : Finset (Node h)) (S : Finset (Fin (2 ^ h))) :

    A set W of nodes covers a leaf set S iff the leaves descending from W are precisely the leaves in S ([BS23], Definition 5.4).

    def Cslib.CompleteBinaryTree.leftPart {h : ℕ} (S : Finset (Fin (2 ^ (h + 1)))) :
    Finset (Fin (2 ^ h))

    Left-half restriction of a leaf set S : Finset (Fin (2 ^ (h + 1))).

    def Cslib.CompleteBinaryTree.rightPart {h : ℕ} (S : Finset (Fin (2 ^ (h + 1)))) :
    Finset (Fin (2 ^ h))

    Right-half restriction of a leaf set S : Finset (Fin (2 ^ (h + 1))).

    The canonical optimal cover cover S of a leaf subset S in the complete binary tree of height h ([BS23], Definition 5.4 and remark before Theorem 5.8).

    Covering all leaves yields the singleton root {Node.root h} ([BS23], Definition 5.4).

    theorem Cslib.CompleteBinaryTree.covers_cover {h : ℕ} (S : Finset (Fin (2 ^ h))) :

    cover S covers S ([BS23], Definition 5.4).

    theorem Cslib.CompleteBinaryTree.card_cover_le_of_covers {h : ℕ} {W : Finset (Node h)} {S : Finset (Fin (2 ^ h))} (hW : Covers W S) :

    Every cover of S has at least as many nodes as cover S, justifying cover S as the smallest covering set ([BS23], Definition 5.4).

    theorem Cslib.CompleteBinaryTree.card_cover_le {h r : ℕ} {S : Finset (Fin (2 ^ h))} (hr : 1 ≤ r) (hS : S.card + r = 2 ^ h) :
    ↑(cover S).card ≤ ↑r * Real.logb 2 (2 ^ h / ↑r)

    Theorem 5.8 ([BS23], p. 207): In a complete binary tree with n = 2 ^ h leaves, for every 1 ≤ r ≤ n and every subset S of n - r leaves (written S.card + r = 2 ^ h so r ≤ 2 ^ h is built in without natural-number subtraction truncation), |cover(S)| ≤ r * log₂(n / r). In the r₁ = 0 case, the printed proof omits the + 1 for the full half's root (|cover(S)| = |cover(S₂)|); the bound still holds because 1 ≤ r.