Permutation of rose trees #
RoseTree.Perm t s says the trees agree up to reordering the children of every
vertex — the n-ary tree analogue of List.Perm, and the identity criterion of the
unordered quotient (Nonplanar, built downstream). Mirroring List.Perm,
transitivity is a constructor while reflexivity and symmetry are theorems, and the
list-level companion PermList (List.Perm with elements compared by Perm
instead of Eq) is mutually inductive with it, in the fold/foldList pattern.
Main declarations #
RoseTree.Perm,RoseTree.PermList: the mutual permutation relations.RoseTree.isSetoid: the setoid the nonplanar quotient is taken over.
Main results #
RoseTree.permList_iff_rel:PermList cs ds ↔ Multiset.Rel Perm (↑cs : Multiset (RoseTree α)) ↑ds— the list companion isMultiset.Relin list clothing, so its theory is inherited.RoseTree.perm_node_iff: node inversion,Perm (node a cs) (node b ds) ↔ a = b ∧ Multiset.Rel Perm (↑cs : Multiset (RoseTree α)) ↑ds.
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 #
A plain List.Perm of the children relates the nodes.
Componentwise-related children relate the nodes.
Rewriting a single child by a Perm-related tree relates the nodes.
The Multiset.Rel characterization #
Prepending a shared child preserves relatedness of nodes.
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.
A fold whose algebra is congruent along Multiset.Rel S carries Perm to any
reflexive transitive S.
Folded children of PermList-related lists are Multiset.Rel S-related.