Documentation

Anderson4D.HeppTree.SubtreeCollapse

Subtrees and contractions of plane Hepp trees #

This file provides the structural API used by the collapse induction in paper §5.4.1. Positions in a PlaneTree are paths from the root, so the subtree at a valid position is obtained by following that path. Contracting at a position replaces the whole rooted subtree there by one leaf.

The API is deliberately independent of markings, multiplicities, and embeddings. Those data are transported in the later collapse layers.

The rooted subtree at a position #

The subtree rooted at p. At an invalid position this returns the bare leaf; all mathematical uses supply IsPos t p, under which the fallback is unreachable.

Equations
Instances For
    theorem Anderson4D.PlaneTree.subtreeAt_cons_of_lt {cs : List PlaneTree} {i : ℕ} {p : Pos} (hi : i < cs.length) :
    (node cs).subtreeAt (i :: p) = cs[i].subtreeAt p
    theorem Anderson4D.PlaneTree.isPos_subtreeAt_iff {t : PlaneTree} {p q : Pos} (hp : t.IsPos p) :
    (t.subtreeAt p).IsPos q ↔ t.IsPos (p ++ q)

    A path q is valid in the rooted subtree at p exactly when p ++ q is valid in the original tree.

    theorem Anderson4D.PlaneTree.childCount_subtreeAt {t : PlaneTree} {p : Pos} (hp : t.IsPos p) (q : Pos) :

    Child counts are unchanged when a vertex is viewed inside a rooted subtree.

    A rooted subtree of a valid Hepp tree is valid.

    A rooted subtree never has more vertices than the original tree.

    theorem Anderson4D.PlaneTree.subtreeAt_size_lt {t : PlaneTree} {p : Pos} (hp : t.IsPos p) (hp0 : p ≠ []) :

    Every proper rooted subtree (one whose root is not the original root) has strictly fewer vertices. This is the well-founded measure for the collapse induction.

    Vertex, leaf, and branch transport #

    @[reducible, inline]

    Vertices of t lying weakly below r.

    Equations
    Instances For

      Include a vertex of the subtree at r into the original tree by prepending r's path.

      Equations
      Instances For
        @[simp]
        theorem Anderson4D.PlaneTree.subtreeVertex_val {t : PlaneTree} (r : t.VPos) (v : (t.subtreeAt ↑r).VPos) :
        ↑(subtreeVertex r v) = ↑r ++ ↑v

        Vertices of the rooted subtree are exactly descendants of its root in the original tree.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Child count is preserved by the subtree vertex inclusion.

          @[reducible, inline]

          Leaves of t below r, represented as descendant vertices.

          Equations
          Instances For
            @[reducible, inline]

            Branch vertices of t below r, represented as descendant vertices.

            Equations
            Instances For

              Leaves of the rooted subtree are exactly descendant leaves.

              Equations
              Instances For

                Branch vertices of the rooted subtree are exactly descendant branch vertices.

                Equations
                Instances For

                  Descendant leaves are the same carrier as membership in leavesUnder.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Paper-facing leaf equivalence: the leaves of the actual rooted subtree are precisely the original leaves in leavesUnder r.

                    Equations
                    Instances For

                      The recursive leaf count of the actual rooted subtree is the cardinality of the previously used prefix-defined leavesUnder finset.

                      Contracting a rooted subtree #

                      Replace the rooted subtree at p by a single leaf. At an invalid step the tree is left unchanged; all structural theorems below assume IsPos t p.

                      Equations
                      Instances For

                        q lies strictly below p when it properly extends p.

                        Equations
                        Instances For
                          theorem Anderson4D.PlaneTree.contractAt_cons_of_lt {cs : List PlaneTree} {i : ℕ} {p : Pos} (hi : i < cs.length) :
                          (node cs).contractAt (i :: p) = node (cs.set i (cs[i].contractAt p))

                          Contracting at p removes exactly the vertices strictly below p. The position p itself remains as the replacement leaf.

                          @[reducible, inline]

                          Vertices retained by contraction: all original vertices except those strictly below the contraction position.

                          Equations
                          Instances For
                            def Anderson4D.PlaneTree.contractVertex {t : PlaneTree} {p : Pos} (hp : t.IsPos p) (v : (t.contractAt p).VPos) :

                            Include a vertex of the contracted tree into the original tree. Its position path is unchanged.

                            Equations
                            Instances For
                              @[simp]
                              theorem Anderson4D.PlaneTree.contractVertex_val {t : PlaneTree} {p : Pos} (hp : t.IsPos p) (v : (t.contractAt p).VPos) :
                              ↑(contractVertex hp v) = ↑v

                              Vertices of the contracted tree are exactly the retained vertices of the original tree.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For

                                Contracting a rooted subtree preserves Hepp validity.

                                The contraction position remains a valid position in the contracted tree.

                                The vertex replacing the contracted subtree.

                                Equations
                                Instances For
                                  @[simp]
                                  theorem Anderson4D.PlaneTree.contractMarker_val (t : PlaneTree) (p : Pos) (hp : t.IsPos p) :
                                  ↑(t.contractMarker p hp) = p

                                  The replacement vertex is a leaf.

                                  theorem Anderson4D.PlaneTree.childCount_contractAt_eq_of_ne {t : PlaneTree} {p q : Pos} (hp : t.IsPos p) (hq : (t.contractAt p).IsPos q) (hne : q ≠ p) :

                                  Away from the replacement vertex, contraction preserves child counts at every retained vertex.

                                  @[reducible, inline]

                                  Original branch vertices surviving contraction. The root of the removed subtree is excluded because it becomes the marker leaf.

                                  Equations
                                  Instances For
                                    @[reducible, inline]

                                    Original leaves outside the contracted rooted subtree.

                                    Equations
                                    Instances For

                                      A branch vertex of the contracted tree cannot lie weakly below the contraction position: the only retained vertex there is the marker leaf.

                                      theorem Anderson4D.PlaneTree.not_prefix_of_ne_contractAt {t : PlaneTree} {p : Pos} (hp : t.IsPos p) (v : (t.contractAt p).VPos) (hne : ↑v ≠ p) :
                                      ¬p <+: ↑v

                                      A retained vertex distinct from the marker lies completely outside the contracted rooted subtree.

                                      Branch vertices of the contracted tree are exactly the original branch vertices outside the removed rooted subtree.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For

                                        Leaves of the contracted tree consist of the new marker leaf together with the original leaves outside the removed rooted subtree. none denotes the marker and some l denotes an unchanged outside leaf.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For

                                          Looking below the replacement vertex gives the bare leaf.

                                          Exact vertex-count ledger for contraction: the contracted tree and the removed subtree overlap in precisely their common replacement/root vertex.

                                          Exact leaf-count ledger for contraction. The marker replaces all leaves of the removed subtree, hence the correction term + 1.

                                          A subtree rooted at a branch vertex has more than one vertex.

                                          Contracting at a branch vertex strictly decreases tree size.