Skip to content

Complement ​

Each entry replaced by n + 1 minus itself.

Complement(Permutation)Each entry replaced by n + 1 minus itself.
Typed signatures
TypePackageApplies
((binary_word) -> binary_word) & ((composition) -> composition) & ((permutation) -> permutation) & ((set_composition) -> set_composition) & ((set_partition) -> set_partition) & ((signed_permutation) -> signed_permutation)combinatoricsreplaces compute-enginealways
(set<any>+) -> setcompute-enginealways

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.
  • Also takes a SignedPermutation, returning a SignedPermutation: Each entry ±i replaced by ±(n + 1 − i), its sign kept.
  • FindStat's Mp00188.
  • Also takes a SetPartition, returning a SetPartition: Each element i replaced by n + 1 - i: the set partition seen from the other end.
  • Also takes a SetComposition, returning a SetComposition: Each element i replaced by n + 1 - i, the blocks staying in their order.
  • FindStat's Mp00289.
  • Also takes a IntegerComposition, returning a IntegerComposition: The composition cut exactly where this one is not: its cut set complemented.
  • Reverse then complement is TransposeComposition, and reversing commutes with complementing.
  • Also takes a BinaryWord, returning a BinaryWord: Each letter swapped for the other: 0 for 1 and 1 for 0.

Examples

Basic #

the one-line word 231231

live ↗
InPermutation⁡([2,3,1])∁{\operatorname{Permutation}}([2, 3, 1])^\complementOutPermutation⁡([2,1,3]){\operatorname{Permutation}}([2, 1, 3])

the signed permutation 2 3ˉ 12\,\bar 3\,1

live ↗
InSignedPermutation⁡([2,−3,1])∁{\operatorname{SignedPermutation}}([2, -3, 1])^\complementOutSignedPermutation⁡([2,−1,3]){\operatorname{SignedPermutation}}([2, -1, 3])

the set partition {1,3}∣{2}∣{4}\{1,3\} \mid \{2\} \mid \{4\}

live ↗
InSetPartition⁡([[1,3],[2],[4]])∁{\operatorname{SetPartition}}([[1, 3], [2], [4]])^\complementOutSetPartition⁡([[1],[2,4],[3]]){\operatorname{SetPartition}}([[1], [2, 4], [3]])

the set composition {2,4}∣{1}∣{3}\{2,4\} \mid \{1\} \mid \{3\}

live ↗
InSetComposition⁡([[2,4],[1],[3]])∁{\operatorname{SetComposition}}([[2, 4], [1], [3]])^\complementOutSetComposition⁡([[1,3],[4],[2]]){\operatorname{SetComposition}}([[1, 3], [4], [2]])

the composition 2+1+32 + 1 + 3

live ↗
InIntegerComposition⁡([2,1,3])∁{\operatorname{IntegerComposition}}([2, 1, 3])^\complementOutIntegerComposition⁡([1,3,1,1]){\operatorname{IntegerComposition}}([1, 3, 1, 1])

the binary word 0110001100

live ↗
InBinaryWord⁡([0,1,1,0,0])∁{\operatorname{BinaryWord}}([0, 1, 1, 0, 0])^\complementOutBinaryWord⁡([1,0,0,1,1]){\operatorname{BinaryWord}}([1, 0, 0, 1, 1])
About
Examples6
CrosswalkWikipediaMathWorldWikidataBritannicaFindStat ×6