Documentation

BGW.Tree.Geometry

Ancestors and graph distance on finite plane trees #

The common ancestor of two addresses is their longest common prefix. The distance is the sum of their depths minus twice that ancestor's depth. The definitions are total on addresses; prefix closure ensures that the common ancestor of present vertices is present too.

Vertex t is only a name for the subtype of present addresses of t. Its metric is the real cast of the natural distance. No metric or topology instance is introduced on all addresses, and no separate graph representation is needed.

The longest common address prefix, with the root represented by the empty list.

Equations
Instances For
    theorem BGW.PlaneTree.prefix_lca_iff (w u v : List ℕ) :
    w <+: lca u v ↔ w <+: u ∧ w <+: v

    An address is a prefix of the LCA exactly when it is a common prefix.

    @[simp]
    theorem BGW.PlaneTree.lca_self (u : List ℕ) :
    lca u u = u
    theorem BGW.PlaneTree.lca_comm (u v : List ℕ) :
    lca u v = lca v u
    theorem BGW.PlaneTree.isVertex_lca {t : PlaneTree} {u v : List ℕ} (hu : t.IsVertex u) (_hv : t.IsVertex v) :
    t.IsVertex (lca u v)

    The LCA of two present vertices remains a present vertex.

    The natural parent-child distance between two addresses.

    Equations
    Instances For

      The subtraction in graphDist never truncates a negative quantity.

      @[simp]

      Every parent-child edge has unit length.

      Removing the last address entry gives a present parent, with the root fixed.

      Present addresses of a fixed tree; this is a subtype, not a second tree representation.

      Equations
      Instances For
        @[instance_reducible]

        The metric on vertices is the real cast of their natural parent-child distance.

        Equations
        • One or more equations did not get rendered due to their size.
        @[simp]
        theorem BGW.PlaneTree.dist_vertex_eq_graphDist {t : PlaneTree} (u v : t.Vertex) :
        dist u v = ↑(graphDist ↑u ↑v)