Documentation

BGW.Tree.Contour

The discrete contour of a finite plane tree #

The contour records heights during the complete depth-first traversal, starting and ending at the root. Each child contributes its own contour raised by one, followed by a return to height zero. The root-only tree has contour [0]; a tree with n vertices has contour length 2 * (n - 1) + 1, hence traversal duration 2 * (n - 1). Vertex addresses and their lengths identify exactly the heights encountered. This is a list of discrete heights, without any continuous interpolation.

Heights along the complete depth-first contour, including both endpoint visits.

Equations
Instances For
    theorem BGW.PlaneTree.isChain_contour (t : PlaneTree) :
    List.IsChain (fun (a b : ℕ) => a + 1 = b ∨ b + 1 = a) t.contour

    Every contour step changes height by exactly one; for the root-only tree this is vacuous.

    An addition-only form of the contour length formula.

    @[simp]

    The contour has one more entry than its traversal duration.

    theorem BGW.PlaneTree.mem_contour_iff (t : PlaneTree) (h : ℕ) :
    h ∈ t.contour ↔ ∃ (u : List ℕ), t.IsVertex u ∧ u.length = h

    The contour visits exactly the depths of the tree's vertex addresses.