Permutation of rose trees #
RoseTree.Perm t s says that t and s agree up to reordering the children of every node. It is
the counterpart for rose trees of List.Perm, and UnorderedTree is the quotient by it. As for
List.Perm, transitivity is a constructor and reflexivity and symmetry are theorems. The relation
is mutually inductive with PermList, which is List.Perm with elements compared by Perm in
place of equality.
Main declarations #
RoseTree.Perm,RoseTree.PermList: the mutual permutation relations.RoseTree.isSetoid: the setoid of whichUnorderedTreeis the quotient.
Main results #
RoseTree.permList_iff_rel:PermListisMultiset.Rel Permon the coerced lists, so its theory is that ofMultiset.Rel.RoseTree.perm_node_iff: two nodes are related exactly when their labels are equal and their children are related byMultiset.Rel Perm.
Two rose trees are equal up to reordering the children of every vertex.
Transitivity is a constructor (as in List.Perm); reflexivity and symmetry
are theorems.
- node
{α : Type u_1}
{a : α}
{cs ds : List (RoseTree α)}
: PermList cs ds → (RoseTree.node a cs).Perm (RoseTree.node a ds)
Equal labels over permuted, componentwise-related children.
- trans
{α : Type u_1}
{t s u : RoseTree α}
: t.Perm s → s.Perm u → t.Perm u
Composition of permutations.
Instances For
List.Perm with corresponding elements related by Perm instead of Eq.
- nil
{α : Type u_1}
: PermList [] []
Empty lists are related.
- cons
{α : Type u_1}
{c d : RoseTree α}
{cs ds : List (RoseTree α)}
: c.Perm d → PermList cs ds → PermList (c :: cs) (d :: ds)
Related heads over related tails.
- swap
{α : Type u_1}
(c d : RoseTree α)
(cs : List (RoseTree α))
: PermList (d :: c :: cs) (c :: d :: cs)
Swap the first two elements.
- trans
{α : Type u_1}
{cs ds es : List (RoseTree α)}
: PermList cs ds → PermList ds es → PermList cs es
Composition of permutations.
Instances For
Two rose trees are equal up to reordering the children of every vertex.
Transitivity is a constructor (as in List.Perm); reflexivity and symmetry
are theorems.
Equations
- RoseTree.«term_~_» = Lean.ParserDescr.trailingNode `RoseTree.«term_~_» 50 50 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ~ ") (Lean.ParserDescr.cat `term 51))
Instances For
Equivalence #
Equations
- RoseTree.instTransPerm = { trans := ⋯ }
Equations
- RoseTree.instTransListPermList = { trans := ⋯ }
The setoid of rose trees up to child reordering; the nonplanar quotient is taken over it.
Equations
- RoseTree.isSetoid = { r := RoseTree.Perm, iseqv := ⋯ }
Constructors from list-level data #
The Multiset.Rel characterization #
Functoriality #
RoseTree.map preserves Perm (cf. List.Perm.map).
List.map ∘ RoseTree.map preserves PermList.
Fold invariance #
A fold whose algebra is congruent along Multiset.Rel S of the folded children
carries Perm to S (fold_rel): the generic dissolver of per-function invariance
inductions, relational so that tree-valued folds descend too. fold_perm is the
S := Eq case; the counts below are such folds.