Documentation

Anderson4D.HeppTree.Basic

Hepp trees: carrier, canonicalization, automorphism group, markings (node D-hepp) #

Paper: D-hepp — Hepp trees, markings, the automorphism group

Stable Hepp-tree carrier and the Hepp-specific data of paper Definition 5.1: branching vertices, leaves, dyadic markings, leaf multiplicities.

Implementation note: children are sorted with mathlib's structurally recursive List.insertionSort instead of List.mergeSort, because mergeSort is defined by well-founded recursion and does not reduce in the kernel; the carrier needs decide/rfl to evaluate autCard. All helpers below are structurally recursive.

Plane rooted tree; node [] is a leaf. Carrier for Hepp trees (paper Def 5.1); Hepp validity (branching ⇒ ≥ 2 children) is the separate predicate isValid, and markings/multiplicities are separate data.

Instances For

    sizeList is the sum of the children's sizes.

    Number of leaves; a bare node [] counts as one leaf. (Children's leaf counts are all ≥ 1, so the max 1 only affects the leaf case.)

    Equations
    Instances For

      leafCountList is the sum of the children's leaf counts.

      Hepp validity: no internal vertex has exactly one child.

      Equations
      Instances For

        isValidList is the conjunction of the children's validities.

        Injective serialization (balanced-parentheses encoding): 0 opens a node and 1 closes it. Injectivity is proved below using the stack decoder.

        Equations
        Instances For

          keyList is the flattened list of the children's keys.

          Lexicographic ≤ on serialization keys, as a Bool comparator.

          Equations
          Instances For

            Key-lexicographic comparison of trees (a decidable total preorder), the sorting relation for canonicalization.

            Equations
            Instances For

              Canonical (order-forgotten) representative: recursively canonicalize children, then sort them by key. Two plane trees represent the same unordered rooted tree iff their canonical forms are equal.

              Equations
              Instances For

                Product of (run length)! over maximal runs of key-equal adjacent elements (intended for canonicalized, i.e. sorted, children lists).

                Equations
                Instances For

                  Tail of runsProdFactorial: go c k ds scans ds with current run representative c of length k.

                  Equations
                  Instances For

                    Order of the automorphism group of the unordered rooted tree represented by a plane tree: permutations of iso-equal children (run factorials on the canonicalized children) times the children's own automorphism counts (Prop 5.6's |Aut(T)|). Cross-checked against the permutation-subgroup order in card_aut_eq_autCard.

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

                      Companion of autCard: product of the automorphism counts of a forest.

                      Equations
                      Instances For

                        autCardList is the product of the children's automorphism counts.

                        Basic examples and compiled-evaluation sanity checks #

                        Positions (vertex addresses) #

                        @[reducible, inline]

                        A vertex address: the path of child indices from the root.

                        Equations
                        Instances For

                          Validity of a position in a tree (Bool-valued, kernel-reducible).

                          Equations
                          Instances For

                            Position validity, Prop-valued.

                            Equations
                            Instances For

                              The root position is valid in every tree.

                              theorem Anderson4D.PlaneTree.isPos_cons_iff {cs : List PlaneTree} {i : ℕ} {p : Pos} :
                              (node cs).IsPos (i :: p) ↔ ∃ (h : i < cs.length), cs[i].IsPos p

                              Unfolding IsPos along one step into child i.

                              The parent of a valid vertex is valid; the root maps to itself.

                              All valid positions of t, root first.

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

                                positions enumerates exactly the valid positions.

                                @[reducible, inline]

                                The (finite) vertex set of t: valid positions.

                                Equations
                                Instances For

                                  The root vertex.

                                  Equations
                                  Instances For

                                    Total parent map on vertices; the root is its own parent.

                                    Equations
                                    Instances For

                                      The automorphism group #

                                      A vertex permutation is an automorphism of the unordered rooted tree iff it commutes with the total parent map (a classical, HEq-free characterization).

                                      A vertex permutation is an automorphism of the unordered rooted tree iff it commutes with the parent map.

                                      Equations
                                      Instances For

                                        Automorphisms of the unordered rooted tree presented by t, as a subgroup of the vertex permutations.

                                        Equations
                                        Instances For
                                          @[reducible, inline]

                                          The automorphism group of (the unordered tree presented by) t.

                                          Equations
                                          Instances For

                                            Every automorphism fixes the root (automatic from parent-commutation).

                                            Markings and the action of Aut #

                                            @[reducible, inline]

                                            A plain marking: one natural number per vertex (the raw carrier on which Aut t acts; the Def 5.1 constraints are bundled in HeppMarking).

                                            Equations
                                            Instances For
                                              @[implicit_reducible]

                                              Aut t acts on markings by precomposition with the inverse vertex transport (the position transport is just g.1 : Equiv.Perm (VPos t)).

                                              Equations
                                              theorem Anderson4D.PlaneTree.smul_marking_apply {t : PlaneTree} (g : t.Aut) (N : t.Marking) (v : t.VPos) :
                                              (g • N) v = N (↑g⁻¹ v)

                                              Unfolding lemma for the action on markings.

                                              @[reducible, inline]

                                              Automorphisms of the marked tree (T, N) = the marking stabilizer (paper's Aut(T, N) in Prop 5.6).

                                              Equations
                                              Instances For

                                                Orbit–stabilizer for marked trees (Prop 5.6 counting step): #(orbit of N) · |Aut(T, N)| = |Aut(T)|.

                                                Sanity checks on the cherry #

                                                A marking separating the two leaves of the cherry (sanity checks only).

                                                Equations
                                                Instances For

                                                  Hepp data (paper Def 5.1): branching vertices, leaves, markings, #

                                                  multiplicities

                                                  Number of children of the vertex at position p (0 if p is invalid); Bool-free companion of isPos, kernel-reducible.

                                                  Equations
                                                  Instances For

                                                    Branching vertices: at least two children (paper Def 5.1's branching nodes; in a Hepp-valid tree every internal vertex is branching).

                                                    Equations
                                                    Instances For

                                                      Leaves: childless vertices.

                                                      Equations
                                                      Instances For

                                                        A Hepp marking on t (paper Def 5.1): dyadic scales N_n = 2 ^ Nexp n attached to the branching vertices, with N_n ≥ 2 and strictly increasing toward the root (N_{n⁺} > N_n for the parent n⁺). The exponent function Nexp is stored as a total function on all vertices; its values at non-branching vertices are junk (unconstrained), and both constraints quantify over BranchNodes t only. Note that in a Hepp-valid tree the parent of any vertex has ≥ 2 children, so parent_gt only ever inspects Nexp at branching vertices.

                                                        Instances For

                                                          Leaf multiplicities on t (paper Def 5.1): m v ≥ 2 at every leaf; values at non-leaf vertices are junk (unconstrained).

                                                          • m : t.VPos → ℕ

                                                            The multiplicity of each leaf.

                                                          • two_le (v : t.VPos) : v ∈ t.Leaves → 2 ≤ self.m v

                                                            Every leaf occurs with multiplicity at least two.

                                                          Instances For

                                                            Proof toolkit for the D-hepp cross-check #

                                                            Key injectivity (stack decoder), order properties of KeyLe, the vertex calculus of node trees (childV), tree isomorphisms Iso as parent-commuting vertex bijections, the graft/split equivalence for nodes, permutations of fibers of a classification, and run-length counting on canonically sorted lists. All of it feeds card_aut_eq_autCard.

                                                            Key injectivity via a stack decoder #

                                                            Stack decoder inverting key: token 0 opens a frame, token 1 closes the top frame into the frame below (children are collected in reverse order).

                                                            Equations
                                                            Instances For
                                                              theorem Anderson4D.PlaneTree.dec_key_append (t : PlaneTree) (xs : List ℕ) (acc : List PlaneTree) (st : List (List PlaneTree)) :
                                                              dec (t.key ++ xs) (acc :: st) = dec xs ((t :: acc) :: st)

                                                              Running the decoder over key t pushes t onto the top frame.

                                                              theorem Anderson4D.PlaneTree.dec_keyList_append (cs : List PlaneTree) (xs : List ℕ) (acc : List PlaneTree) (st : List (List PlaneTree)) :
                                                              dec (keyList cs ++ xs) (acc :: st) = dec xs ((cs.reverse ++ acc) :: st)

                                                              Companion of dec_key_append for forests.

                                                              The serialization key is injective.

                                                              The lexicographic comparator is a total preorder, antisymmetric on keys #

                                                              theorem Anderson4D.PlaneTree.lexLe_cons_lt {a b : ℕ} {as bs : List ℕ} (h : a < b) :
                                                              lexLe (a :: as) (b :: bs) = true
                                                              theorem Anderson4D.PlaneTree.lexLe_cons_gt {a b : ℕ} {as bs : List ℕ} (h : b < a) :
                                                              lexLe (a :: as) (b :: bs) = false
                                                              theorem Anderson4D.PlaneTree.lexLe_cons_eq {a : ℕ} {as bs : List ℕ} :
                                                              lexLe (a :: as) (a :: bs) = lexLe as bs
                                                              theorem Anderson4D.PlaneTree.lexLe_trans (a b c : List ℕ) :
                                                              lexLe a b = true → lexLe b c = true → lexLe a c = true
                                                              theorem Anderson4D.PlaneTree.lexLe_antisymm (a b : List ℕ) :
                                                              lexLe a b = true → lexLe b a = true → a = b
                                                              theorem Anderson4D.PlaneTree.key_notMem_map_of_pairwise {c d : PlaneTree} {ds : List PlaneTree} (h : List.Pairwise KeyLe (c :: d :: ds)) (hne : c.key ≠ d.key) :
                                                              c.key ∉ List.map key (d :: ds)

                                                              In a KeyLe-pairwise list c :: d :: ds with key c ≠ key d, the key of c occurs nowhere from d on.

                                                              Vertices of a node: root and child embeddings #

                                                              theorem Anderson4D.PlaneTree.isPos_cons_lt {cs : List PlaneTree} {i : ℕ} {p : Pos} (h : (node cs).IsPos (i :: p)) :
                                                              i < cs.length
                                                              theorem Anderson4D.PlaneTree.isPos_cons_tail {cs : List PlaneTree} {i : ℕ} {p : Pos} (h : (node cs).IsPos (i :: p)) :
                                                              (cs.get ⟨i, ⋯⟩).IsPos p
                                                              def Anderson4D.PlaneTree.childV {cs : List PlaneTree} (i : Fin cs.length) (v : (cs.get i).VPos) :
                                                              (node cs).VPos

                                                              The vertex of node cs at position i :: v inside child i.

                                                              Equations
                                                              Instances For
                                                                @[simp]
                                                                theorem Anderson4D.PlaneTree.childV_val {cs : List PlaneTree} (i : Fin cs.length) (v : (cs.get i).VPos) :
                                                                ↑(childV i v) = ↑i :: ↑v
                                                                theorem Anderson4D.PlaneTree.childV_inj_idx {cs : List PlaneTree} {i j : Fin cs.length} {v : (cs.get i).VPos} {w : (cs.get j).VPos} (h : childV i v = childV j w) :
                                                                i = j
                                                                theorem Anderson4D.PlaneTree.childV_inj_snd {cs : List PlaneTree} {i : Fin cs.length} {v w : (cs.get i).VPos} (h : childV i v = childV i w) :
                                                                v = w
                                                                theorem Anderson4D.PlaneTree.vpos_node_cases {cs : List PlaneTree} (P : (node cs).VPos → Prop) (hroot : P (node cs).rootV) (hchild : ∀ (i : Fin cs.length) (v : (cs.get i).VPos), P (childV i v)) (v : (node cs).VPos) :
                                                                P v
                                                                theorem Anderson4D.PlaneTree.parentV_childV {cs : List PlaneTree} (i : Fin cs.length) {v : (cs.get i).VPos} (hv : v ≠ (cs.get i).rootV) :
                                                                theorem Anderson4D.PlaneTree.parentV_eq_root_cases {cs : List PlaneTree} {v : (node cs).VPos} (h : parentV v = (node cs).rootV) :
                                                                v = (node cs).rootV ∨ ∃ (i : Fin cs.length), v = childV i (cs.get i).rootV
                                                                theorem Anderson4D.PlaneTree.exists_childV_of_parentV_eq {ds : List PlaneTree} {x : (node ds).VPos} {j : Fin ds.length} {u : (ds.get j).VPos} (h : parentV x = childV j u) :
                                                                ∃ (u' : (ds.get j).VPos), x = childV j u'

                                                                Isomorphisms of unordered rooted trees #

                                                                An isomorphism between the unordered rooted trees presented by s and t: a parent-commuting bijection of vertices (for s = t this is exactly the defining property of autSubgroup).

                                                                Equations
                                                                Instances For
                                                                  theorem Anderson4D.PlaneTree.Iso.ext {s t : PlaneTree} {e f : s.Iso t} (h : ∀ (v : s.VPos), ↑e v = ↑f v) :
                                                                  e = f

                                                                  The identity isomorphism.

                                                                  Equations
                                                                  Instances For
                                                                    def Anderson4D.PlaneTree.Iso.trans {s t u : PlaneTree} (e : s.Iso t) (f : t.Iso u) :
                                                                    s.Iso u

                                                                    Composition of isomorphisms.

                                                                    Equations
                                                                    Instances For
                                                                      def Anderson4D.PlaneTree.Iso.symm {s t : PlaneTree} (e : s.Iso t) :
                                                                      t.Iso s

                                                                      Inverse of an isomorphism.

                                                                      Equations
                                                                      Instances For
                                                                        def Anderson4D.PlaneTree.Iso.ofEq {s t : PlaneTree} (h : s = t) :
                                                                        s.Iso t

                                                                        Transport along an equality of trees.

                                                                        Equations
                                                                        Instances For
                                                                          def Anderson4D.PlaneTree.Iso.congr {s t s' t' : PlaneTree} (hs : s = s') (ht : t = t') (e : s.Iso t) :
                                                                          s'.Iso t'

                                                                          Transport an isomorphism along equalities of its endpoints.

                                                                          Equations
                                                                          Instances For
                                                                            @[simp]
                                                                            theorem Anderson4D.PlaneTree.Iso.refl_apply {t : PlaneTree} (v : t.VPos) :
                                                                            ↑(refl t) v = v
                                                                            @[simp]
                                                                            theorem Anderson4D.PlaneTree.Iso.trans_apply {s t u : PlaneTree} (e : s.Iso t) (f : t.Iso u) (v : s.VPos) :
                                                                            ↑(e.trans f) v = ↑f (↑e v)
                                                                            @[simp]
                                                                            theorem Anderson4D.PlaneTree.Iso.symm_apply_apply {s t : PlaneTree} (e : s.Iso t) (v : s.VPos) :
                                                                            ↑e.symm (↑e v) = v
                                                                            @[simp]
                                                                            theorem Anderson4D.PlaneTree.Iso.apply_symm_apply {s t : PlaneTree} (e : s.Iso t) (v : t.VPos) :
                                                                            ↑e (↑e.symm v) = v
                                                                            @[simp]
                                                                            theorem Anderson4D.PlaneTree.Iso.root_eq {s t : PlaneTree} (e : s.Iso t) :
                                                                            ↑e s.rootV = t.rootV

                                                                            Isomorphisms send the root to the root.

                                                                            theorem Anderson4D.PlaneTree.Iso.apply_ne_root {s t : PlaneTree} (e : s.Iso t) {v : s.VPos} (hv : v ≠ s.rootV) :
                                                                            ↑e v ≠ t.rootV

                                                                            Automorphisms are exactly the self-isomorphisms.

                                                                            Equations
                                                                            Instances For

                                                                              Splitting a node's vertex set into root and child parts; grafting #

                                                                              The vertices of node cs are the root plus the vertices of the children.

                                                                              Equations
                                                                              • One or more equations did not get rendered due to their size.
                                                                              Instances For
                                                                                @[simp]
                                                                                def Anderson4D.PlaneTree.graftCarrier {cs ds : List PlaneTree} (π : Fin cs.length ≃ Fin ds.length) (F : (i : Fin cs.length) → (cs.get i).Iso (ds.get (π i))) :
                                                                                (node cs).VPos ≃ (node ds).VPos

                                                                                Carrier bijection of a graft: permute children by π, act inside child i by F i.

                                                                                Equations
                                                                                • One or more equations did not get rendered due to their size.
                                                                                Instances For
                                                                                  @[simp]
                                                                                  theorem Anderson4D.PlaneTree.graftCarrier_root {cs ds : List PlaneTree} (π : Fin cs.length ≃ Fin ds.length) (F : (i : Fin cs.length) → (cs.get i).Iso (ds.get (π i))) :
                                                                                  (graftCarrier π F) (node cs).rootV = (node ds).rootV
                                                                                  @[simp]
                                                                                  theorem Anderson4D.PlaneTree.graftCarrier_childV {cs ds : List PlaneTree} (π : Fin cs.length ≃ Fin ds.length) (F : (i : Fin cs.length) → (cs.get i).Iso (ds.get (π i))) (i : Fin cs.length) (v : (cs.get i).VPos) :
                                                                                  (graftCarrier π F) (childV i v) = childV (π i) (↑(F i) v)
                                                                                  def Anderson4D.PlaneTree.graft {cs ds : List PlaneTree} (π : Fin cs.length ≃ Fin ds.length) (F : (i : Fin cs.length) → (cs.get i).Iso (ds.get (π i))) :
                                                                                  (node cs).Iso (node ds)

                                                                                  Graft a permutation of the children together with per-child isomorphisms into an isomorphism of the nodes.

                                                                                  Equations
                                                                                  Instances For
                                                                                    @[simp]
                                                                                    theorem Anderson4D.PlaneTree.graft_apply_root {cs ds : List PlaneTree} (π : Fin cs.length ≃ Fin ds.length) (F : (i : Fin cs.length) → (cs.get i).Iso (ds.get (π i))) :
                                                                                    ↑(graft π F) (node cs).rootV = (node ds).rootV
                                                                                    @[simp]
                                                                                    theorem Anderson4D.PlaneTree.graft_apply_childV {cs ds : List PlaneTree} (π : Fin cs.length ≃ Fin ds.length) (F : (i : Fin cs.length) → (cs.get i).Iso (ds.get (π i))) (i : Fin cs.length) (v : (cs.get i).VPos) :
                                                                                    ↑(graft π F) (childV i v) = childV (π i) (↑(F i) v)

                                                                                    Splitting an isomorphism of nodes into child data #

                                                                                    theorem Anderson4D.PlaneTree.vpos_node_cases_or {cs : List PlaneTree} (v : (node cs).VPos) :
                                                                                    v = (node cs).rootV ∨ ∃ (i : Fin cs.length) (w : (cs.get i).VPos), v = childV i w
                                                                                    theorem Anderson4D.PlaneTree.exists_childIdx {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) (i : Fin cs.length) :
                                                                                    ∃ (j : Fin ds.length), ↑e (childV i (cs.get i).rootV) = childV j (ds.get j).rootV

                                                                                    An isomorphism of nodes maps depth-one vertices to depth-one vertices.

                                                                                    noncomputable def Anderson4D.PlaneTree.childIdx {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) (i : Fin cs.length) :

                                                                                    Index of the child onto which e maps child i.

                                                                                    Equations
                                                                                    Instances For
                                                                                      theorem Anderson4D.PlaneTree.childIdx_spec {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) (i : Fin cs.length) :
                                                                                      ↑e (childV i (cs.get i).rootV) = childV (childIdx e i) (ds.get (childIdx e i)).rootV
                                                                                      theorem Anderson4D.PlaneTree.exists_childV_image {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) (i : Fin cs.length) (v : (cs.get i).VPos) :
                                                                                      ∃ (w : (ds.get (childIdx e i)).VPos), ↑e (childV i v) = childV (childIdx e i) w

                                                                                      e maps the whole subtree below child i into the subtree below child childIdx e i.

                                                                                      noncomputable def Anderson4D.PlaneTree.childMap {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) (i : Fin cs.length) (v : (cs.get i).VPos) :
                                                                                      (ds.get (childIdx e i)).VPos

                                                                                      The action of e inside child i, expressed in child childIdx e i.

                                                                                      Equations
                                                                                      Instances For
                                                                                        theorem Anderson4D.PlaneTree.childMap_spec {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) (i : Fin cs.length) (v : (cs.get i).VPos) :
                                                                                        ↑e (childV i v) = childV (childIdx e i) (childMap e i v)
                                                                                        theorem Anderson4D.PlaneTree.childMap_root {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) (i : Fin cs.length) :
                                                                                        childMap e i (cs.get i).rootV = (ds.get (childIdx e i)).rootV
                                                                                        noncomputable def Anderson4D.PlaneTree.childEquiv {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) :

                                                                                        The permutation of children induced by an isomorphism of nodes.

                                                                                        Equations
                                                                                        Instances For
                                                                                          theorem Anderson4D.PlaneTree.exists_childMap_preimage {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) (i : Fin cs.length) (w : (ds.get (childIdx e i)).VPos) :
                                                                                          ∃ (v : (cs.get i).VPos), ↑e (childV i v) = childV (childIdx e i) w
                                                                                          noncomputable def Anderson4D.PlaneTree.childIso {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) (i : Fin cs.length) :
                                                                                          (cs.get i).Iso (ds.get ((childEquiv e) i))

                                                                                          The isomorphism induced by e from child i onto child childEquiv e i.

                                                                                          Equations
                                                                                          • One or more equations did not get rendered due to their size.
                                                                                          Instances For
                                                                                            @[simp]
                                                                                            theorem Anderson4D.PlaneTree.childIso_apply {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) (i : Fin cs.length) (v : (cs.get i).VPos) :
                                                                                            ↑(childIso e i) v = childMap e i v
                                                                                            @[simp]
                                                                                            theorem Anderson4D.PlaneTree.childEquiv_apply {cs ds : List PlaneTree} (e : (node cs).Iso (node ds)) (i : Fin cs.length) :

                                                                                            Splitting is a section of grafting.

                                                                                            theorem Anderson4D.PlaneTree.graft_injective {cs ds : List PlaneTree} :
                                                                                            Function.Injective fun (x : (π : Fin cs.length ≃ Fin ds.length) × ((i : Fin cs.length) → (cs.get i).Iso (ds.get (π i)))) => graft x.fst x.snd
                                                                                            theorem Anderson4D.PlaneTree.graft_surjective {cs ds : List PlaneTree} :
                                                                                            Function.Surjective fun (x : (π : Fin cs.length ≃ Fin ds.length) × ((i : Fin cs.length) → (cs.get i).Iso (ds.get (π i)))) => graft x.fst x.snd
                                                                                            theorem Anderson4D.PlaneTree.nat_card_iso_node {cs ds : List PlaneTree} :
                                                                                            Nat.card ((node cs).Iso (node ds)) = ∑ π : Fin cs.length ≃ Fin ds.length, ∏ i : Fin cs.length, Nat.card ((cs.get i).Iso (ds.get (π i)))

                                                                                            Master counting step: isomorphisms of nodes are counted by a child permutation together with per-child isomorphisms.

                                                                                            Torsor step: a single isomorphism s ≅ t makes the isomorphisms a torsor under the self-isomorphisms of s.

                                                                                            Permutations of the children list give isomorphisms #

                                                                                            def Anderson4D.PlaneTree.finExtend {n m : ℕ} (σ : Fin n ≃ Fin m) :
                                                                                            Fin (n + 1) ≃ Fin (m + 1)

                                                                                            Extend an index bijection by fixing a new head index 0.

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

                                                                                              A permutation of a list of trees induces an isomorphism of the nodes.

                                                                                              Counting values of a list function via index fibers #

                                                                                              theorem Anderson4D.PlaneTree.count_ofFn {β : Type} [BEq β] [LawfulBEq β] [DecidableEq β] {n : ℕ} (g : Fin n → β) (b : β) :
                                                                                              List.count b (List.ofFn g) = {i : Fin n | g i = b}.card
                                                                                              theorem Anderson4D.PlaneTree.map_eq_ofFn {α β : Type} (l : List α) (f : α → β) :
                                                                                              List.map f l = List.ofFn fun (i : Fin l.length) => f (l.get i)
                                                                                              theorem Anderson4D.PlaneTree.count_map_get {α β : Type} [BEq β] [LawfulBEq β] [DecidableEq β] (l : List α) (f : α → β) (b : β) :
                                                                                              List.count b (List.map f l) = {i : Fin l.length | f (l.get i) = b}.card
                                                                                              theorem Anderson4D.PlaneTree.canonList_getElem (cs : List PlaneTree) (i : ℕ) (h : i < (canonList cs).length) (h' : i < cs.length) :

                                                                                              Canonicalization does not change the unordered tree.

                                                                                              theorem Anderson4D.PlaneTree.canon_eq_of_iso (s t : PlaneTree) :
                                                                                              ∀ (a : s.Iso t), s.canon = t.canon

                                                                                              Isomorphic trees have equal canonical forms.

                                                                                              Permutations preserving a classification #

                                                                                              theorem Anderson4D.PlaneTree.fiberPerm_congr {ι κ : Type} (f : ι → κ) (u : (k : κ) → Equiv.Perm { i : ι // f i = k }) {k k' : κ} (h : k = k') (x : ι) (hx : f x = k) (hx' : f x = k') :
                                                                                              ↑((u k) ⟨x, hx⟩) = ↑((u k') ⟨x, hx'⟩)
                                                                                              def Anderson4D.PlaneTree.assemblePerm {ι κ : Type} (f : ι → κ) (u : (k : κ) → Equiv.Perm { i : ι // f i = k }) :

                                                                                              Assemble a family of fiber permutations into a permutation of the base.

                                                                                              Equations
                                                                                              Instances For
                                                                                                def Anderson4D.PlaneTree.fiberPermEquiv {ι κ : Type} (f : ι → κ) :
                                                                                                { π : Equiv.Perm ι // ∀ (i : ι), f (π i) = f i } ≃ ((k : κ) → Equiv.Perm { i : ι // f i = k })

                                                                                                Permutations preserving the classification f are families of permutations of the fibers of f.

                                                                                                Equations
                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                Instances For
                                                                                                  theorem Anderson4D.PlaneTree.nat_card_fiber_perms {ι κ : Type} [Fintype ι] [DecidableEq ι] [DecidableEq κ] (f : ι → κ) [Fintype κ] :
                                                                                                  Nat.card { π : Equiv.Perm ι // ∀ (i : ι), f (π i) = f i } = ∏ k : κ, (Nat.card { i : ι // f i = k }).factorial
                                                                                                  theorem Anderson4D.PlaneTree.nat_card_pres_perms {ι : Type} [Fintype ι] [DecidableEq ι] {κ' : Type} [DecidableEq κ'] (g : ι → κ') :
                                                                                                  Nat.card { π : Equiv.Perm ι // ∀ (i : ι), g (π i) = g i } = ∏ k ∈ Finset.image g Finset.univ, (Nat.card { i : ι // g i = k }).factorial

                                                                                                  Runs of key-equal elements in a sorted list #

                                                                                                  runsProdFactorial of a KeyLe-pairwise list is the product of the factorials of the key multiplicities.

                                                                                                  Assembly helpers #

                                                                                                  theorem Anderson4D.PlaneTree.prod_ite_zero {n : ℕ} (p : Fin n → Prop) [DecidablePred p] (a : Fin n → ℕ) :
                                                                                                  (∏ i : Fin n, if p i then a i else 0) = if ∀ (i : Fin n), p i then ∏ i : Fin n, a i else 0
                                                                                                  theorem Anderson4D.PlaneTree.sum_ite_eq_card_mul {α : Type} [Fintype α] (P : α → Prop) [DecidablePred P] (C : ℕ) :
                                                                                                  (∑ x : α, if P x then C else 0) = Nat.card { x : α // P x } * C

                                                                                                  The product of the children's autCards over Fin-indices.

                                                                                                  The canon-class-preserving permutation count is the run-factorial product of the canonically sorted children.

                                                                                                  The D-hepp cross-check: |Aut t| = t.autCard #

                                                                                                  Blueprint obligation (D-hepp cross-check).

                                                                                                  The order of the automorphism group realized as parent-commuting vertex permutations (Aut) equals the recursive product formula autCard (run factorials on canonically sorted children × the children's own counts). Proof: strong induction on t; an automorphism of node cs fixes the root, permutes the depth-1 vertices by some σ with canon cs[σ i] = canon cs[i] and restricts to subtree isomorphisms, giving an equivalence of Aut (node cs) with (canon-class-preserving σ) × (a family of subtree isomorphism sets, each of cardinality autCard cs[i]); the σ-factor has runsProdFactorial many elements by key-injectivity. Kernel-checked instances follow below.