Documentation

CslibFrontier.Foundations.Combinatorics.StagedTree

Heavy nodes and pieces of a tree by stages #

A tree by stages (Cslib.StagedTree) is a rooted tree given by the parents of its nodes, in which every node has a stage: the root alone is at the top stage, the depth, and every other node is one stage below its parent. A node q is below a node p (Cslib.StagedTree.Below) if p is q or an ancestor of q.

For two weights g and u on the nodes, two budgets M and Y and a number k, a node p is heavy (Cslib.StagedTree.Heavy) if it is the root or if the weights below it satisfy g / (4 M) + u / (2 Y) > 1 / k. Parents of heavy nodes are heavy, and, as the sets below the nodes of one stage are disjoint, every stage has fewer than k heavy nodes other than the root when g adds up to at most M and u to at most Y. The heads (Cslib.StagedTree.IsHead) are the root and the children of heavy nodes. The piece of a node (Cslib.StagedTree.piece) is the number of the first head on the way up from it (Cslib.StagedTree.pieceHead), where the heads are numbered in increasing order (Cslib.StagedTree.headRank). So the nodes of a piece are one heavy node or lie below a light node, and a sum over a piece is at most a value at one node or a sum below a light node (Cslib.StagedTree.sum_piece_le). If the root has at most C children and every other node at most b, there are fewer than 1 + C + b d k pieces for the depth d (Cslib.StagedTree.piece_lt), and the edges between a piece and the other nodes all meet one node (Cslib.StagedTree.exists_piece_boundary).

Main definitions #

Main results #

References #

structure Cslib.StagedTree (α : Type u_1) :
Type u_1

A rooted tree by stages on the nodes α: every node has a parent and a stage, the root alone is at the top stage depth, and every other node is one stage below its parent. The parent of the root is not used.

  • parent : α → α

    The parent of a node.

  • stage : α → ℕ

    The stage of a node.

  • depth : ℕ

    The stage of the root.

  • root : α

    The root.

  • stage_le (p : α) : self.stage p ≤ self.depth
  • stage_eq_depth_iff {p : α} : self.stage p = self.depth ↔ p = self.root
  • stage_parent {p : α} : p ≠ self.root → self.stage (self.parent p) = self.stage p + 1
def Cslib.StagedTree.Below {α : Type u_1} (T : StagedTree α) (q p : α) :

The node q is below the node p: p is q or an ancestor of q, so it is reached from q in stage p - stage q steps up.

Instances For
    def Cslib.StagedTree.sumBelow {α : Type u_1} (T : StagedTree α) [Fintype α] [DecidableEq α] (f : α → ℕ) (p : α) :

    The sum of f over the nodes below p.

    def Cslib.StagedTree.children {α : Type u_1} (T : StagedTree α) [Fintype α] [DecidableEq α] (p : α) :

    The children of a node: the nodes other than the root whose parent it is.

    theorem Cslib.StagedTree.sumBelow_children_le {α : Type u_1} {T : StagedTree α} [Fintype α] [DecidableEq α] (f : α → ℕ) (p : α) :
    T.sumBelow (fun (q : α) => ∑ c ∈ T.children q, f c) p ≤ T.sumBelow f p

    A sum over the children of the nodes below p is at most the sum over the nodes below p.

    Heavy nodes and pieces #

    def Cslib.StagedTree.Heavy {α : Type u_1} (T : StagedTree α) [Fintype α] [LinearOrder α] (g u : α → ℕ) (M Y k : ℕ) (p : α) :

    A node is heavy for the weights g and u, the budgets M and Y and the number k if it is the root or if sumBelow g p / (4 M) + sumBelow u p / (2 Y) > 1 / k, multiplied out: 8 M Y < k (2 Y · sumBelow g p + 4 M · sumBelow u p).

    Instances For
      @[instance_reducible]
      instance Cslib.StagedTree.instDecidablePredHeavy {α : Type u_1} (T : StagedTree α) [Fintype α] [LinearOrder α] (g u : α → ℕ) (M Y k : ℕ) :
      DecidablePred (T.Heavy g u M Y k)
      def Cslib.StagedTree.IsHead {α : Type u_1} (T : StagedTree α) [Fintype α] [LinearOrder α] (g u : α → ℕ) (M Y k : ℕ) (p : α) :

      The heads of the pieces: the root and the children of heavy nodes.

      Instances For
        @[instance_reducible]
        instance Cslib.StagedTree.instDecidablePredIsHead {α : Type u_1} (T : StagedTree α) [Fintype α] [LinearOrder α] (g u : α → ℕ) (M Y k : ℕ) :
        DecidablePred (T.IsHead g u M Y k)
        def Cslib.StagedTree.pieceHead {α : Type u_1} (T : StagedTree α) [Fintype α] [LinearOrder α] (g u : α → ℕ) (M Y k : ℕ) (p : α) :
        α

        The head of the piece of a node: the first head on the way up from it (stage p is at most depth, and the root is a head).

        def Cslib.StagedTree.headRank {α : Type u_1} (T : StagedTree α) [Fintype α] [LinearOrder α] (g u : α → ℕ) (M Y k : ℕ) (p : α) :

        The number of a head: the number of heads that are smaller in the order of α.

        def Cslib.StagedTree.piece {α : Type u_1} (T : StagedTree α) [Fintype α] [LinearOrder α] (g u : α → ℕ) (M Y k : ℕ) (p : α) :

        The piece of a node: the number of the head of its piece.

        theorem Cslib.StagedTree.piece_lt_card {α : Type u_1} {T : StagedTree α} [Fintype α] [LinearOrder α] {g u : α → ℕ} {M Y k : ℕ} (p : α) :
        T.piece g u M Y k p < Fintype.card α

        The pieces are numbered below the number of nodes.

        theorem Cslib.StagedTree.piece_lt {α : Type u_1} {T : StagedTree α} [Fintype α] [LinearOrder α] {g u : α → ℕ} {M Y k : ℕ} (hk : 0 < k) (hg : ∑ q : α, g q ≤ M) (hu : ∑ q : α, u q ≤ Y) {b C : ℕ} (hb : ∀ (p : α), p ≠ T.root → (T.children p).card ≤ b) (hC : (T.children T.root).card ≤ C) (p : α) :
        T.piece g u M Y k p < 1 + C + b * (T.depth * k)

        The number of pieces ("each stage has fewer than k heavy nodes", "so there are at most kΛ pieces"): if the root has at most C children and every other node at most b, the pieces are numbered below 1 + C + b d k for the depth d.

        theorem Cslib.StagedTree.sum_piece_le {α : Type u_1} {T : StagedTree α} [Fintype α] [LinearOrder α] {g u : α → ℕ} {M Y k : ℕ} (f : α → ℕ) {B : ℕ} (hB : ∀ (p : α), f p ≤ B) (hl : ∀ (x : α), ¬T.Heavy g u M Y k x → T.sumBelow f x ≤ B) (n : ℕ) :
        ∑ p : α with T.piece g u M Y k p = n, f p ≤ B

        A sum over a piece: if f is at most B at every node and its sum below every light node is at most B, then so is its sum over the nodes of the piece n, since these are one heavy node or lie below a light node.

        theorem Cslib.StagedTree.light_given_le {α : Type u_1} {T : StagedTree α} [Fintype α] [LinearOrder α] {g u : α → ℕ} {M Y k : ℕ} (hY : 0 < Y) {x : α} (hx : ¬T.Heavy g u M Y k x) :
        k * T.sumBelow g x ≤ 4 * M

        Below a light node g adds up to at most 4 M / k.

        theorem Cslib.StagedTree.light_units_le {α : Type u_1} {T : StagedTree α} [Fintype α] [LinearOrder α] {g u : α → ℕ} {M Y k : ℕ} (hM : 0 < M) {x : α} (hx : ¬T.Heavy g u M Y k x) :
        k * T.sumBelow u x ≤ 2 * Y

        Below a light node u adds up to at most 2 Y / k.

        theorem Cslib.StagedTree.exists_piece_boundary {α : Type u_1} {T : StagedTree α} [Fintype α] [LinearOrder α] {g u : α → ℕ} {M Y k : ℕ} (n : ℕ) :
        ∃ (x : α), ∀ (q : α), q ≠ T.root → ¬(T.piece g u M Y k q = n ↔ T.piece g u M Y k (T.parent q) = n) → q = x ∨ T.parent q = x

        The boundary of a piece: the edges between a node and its parent of which exactly one end is in the piece n all meet one node, the head of the piece (there are no such edges if no node is in the piece n).