Positions of a rose tree #
The positions of a rose tree t form RoseTree.Positions t, a subtype of TreePath. Since
validPaths t is prefix-closed, the positions inherit the order structure of TreePath: the root
is the least position, the parent of a position and the meet of two positions are again positions,
and strict dominance is well founded, so Positions t is a rooted tree in the sense of
Mathlib/Order/SuccPred/Tree.lean. Covering in Positions t is covering in TreePath
(Positions.covBy_iff), so the daughters of a position are its valid daughters, and the subtree
at a position (Positions.subtree) has the subtrees at its covers as daughters
(Positions.mem_children_subtree) and the subtrees at the positions below it as subtrees
(Positions.isSubtree_subtree).
The positions whose subtree satisfies a predicate form RoseTree.positionsWhere P t, decidable
when the predicate is, which picks out the positions of a label, of a branching node, or of any
other condition on a node and what it dominates. Replacing the subtree at a position leaves the
positions outside it where they were, for a predicate that does not look below the root
(mem_positionsWhere_replaceAt). The topmost and bottommost of the positions are their Minimal
and Maximal members, the root being least, and both are decidable: the positions above one are
its prefixes, and those below it in the tree are among vertices.
Main declarations #
RoseTree.Positions: the positions of a tree, a rooted tree under the prefix order.RoseTree.Positions.subtree: the subtree at a position.RoseTree.positionsWhere: the positions whose subtree satisfies a predicate.
The valid positions of t, as a subtype of TreePath, form a rooted tree under the prefix
order.
Equations
- t.Positions = { p : Core.Order.TreePath // p ∈ t.validPaths }
Instances For
The root is the least position.
Equations
- RoseTree.Positions.instOrderBot = { bot := ⟨⊥, ⋯⟩, bot_le := ⋯ }
The meet of two positions, their longest common prefix, is a position, since it dominates either.
Equations
- RoseTree.Positions.instSemilatticeInf = Subtype.semilatticeInf ⋯
The parent of a position is a position.
Equations
- RoseTree.Positions.instPredOrder = { pred := fun (p : t.Positions) => ⟨(↑p).parent, ⋯⟩, pred_le := ⋯, min_of_le_pred := ⋯, le_pred_of_lt := ⋯ }
Covering in the positions of t is covering in TreePath, so the daughters of a position
are its valid daughters.
Positions satisfying a predicate #
The positions of t whose subtree satisfies P.
Equations
- RoseTree.positionsWhere P t = {p : Core.Order.TreePath | ∃ s ∈ t.subtreeAt p.toList, P s}
Instances For
Relabelling moves the predicate onto the relabelled subtrees.
Outside the replaced subtree, a position satisfies a predicate that ignores what lies below the root exactly as before the replacement.
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.