Skip to content

ReverseComplement ​

Reverse, then complement.

ReverseComplement(Permutation)Reverse, then complement.
Typed signatures
TypePackageApplies
((dyck_path) -> dyck_path) & ((permutation) -> permutation)combinatoricsalways

Domain: Combinatorial maps

Details
  • Takes a Permutation and returns a Permutation — a typed map, so a wrong carrier is a type error rather than a wrong answer.
  • Defined as a COMPOSITION, applied right to left: Complement after Reverse. Each step goes through its own declared head, so every intermediate value is a properly constructed carrier.
  • A thin alias over Compose(Complement, Reverse). The catalog has the name, so we keep it — but the name is not what makes it work, and nothing stops a reader writing the composition directly.
  • Also takes a DyckPath, returning a DyckPath: The path read backwards, with ups and downs swapped: its mirror image across the vertical.
  • FindStat's "reverse" for Dyck paths: reading the steps backwards alone would leave the word's ups and downs unbalanced, so each step is also swapped.

Examples

Basic #

the one-line word 231231

live ↗
InReverseComplement(Permutation⁡([2,3,1]))\mathrm{ReverseComplement}({\operatorname{Permutation}}([2, 3, 1]))OutPermutation⁡([3,1,2]){\operatorname{Permutation}}([3, 1, 2])

the Dyck path UUDDUDUUDDUD

live ↗
InReverseComplement(DyckPath⁡([1,1,0,0,1,0]))\mathrm{ReverseComplement}({\operatorname{DyckPath}}([1, 1, 0, 0, 1, 0]))OutDyckPath⁡([1,0,1,1,0,0]){\operatorname{DyckPath}}([1, 0, 1, 1, 0, 0])
About
Examples2
CrosswalkFindStat

See also: Complement, Reverse