Skip to content

NonNestingMatchings ​

The perfect matchings of {1,…,2n}\{1, …, 2n\} with no two nesting chords.

NonNestingMatchings(n)the perfect matchings of {1,…,2n}\{1, …, 2n\} with no two nesting chords
Typed signatures
TypePackageApplies
(integer<0..>) -> indexed_collection<set_partition>combinatoricsalways

Domain: Collections

Details
  • Count is the Catalan number CnC_n (A000108).

Definition

Epsil, as the implementation runs it.

count(_n)

Apply((bd: integer) => 0 if 2 * _n < 0 || (2 * _n - 0) % 2 == 1 else Binomial(2 *
                                                                              _n, bd) -
                                                                     (0 if bd ==
                                                                           0 else Binomial(2 * _n, bd - 1)), (2 * _n -
                                                                        0 - (2 *
                                                                            _n - 0) %
                                                                           2) / 2)

unrank(_n, _r)

Apply(
       (ms: list<integer>) => Apply(
                                     (mu: list<integer>) => Apply(
                                                                   (md: list<integer>) => Map(
                                                                                               Function([mu[mk], md[mk]], mk),
                                                                                               Range(1, _n, 1),
                                                                                             ),
                                                                   Filter(
                                                                           Range(
                                                                                  1,
                                                                                  2 * _n,
                                                                                  1,
                                                                                ),
                                                                           Function(ms[mp] == 0, mp),
                                                                         ),
                                                                 ),
                                     Filter(
                                             Range(1, 2 * _n, 1),
                                             Function(ms[mp] == 1, mp),
                                           ),
                                   ),
       Drop(Fold(Function(us if us[3] == 0 else Apply(
                                                       (uc0: integer) => Join(
                                                                               [
                                                                                 us[1] - 0,
                                                                                 us[2] + 1,
                                                                                 us[3] - 1,
                                                                                 1,
                                                                               ],
                                                                               Drop(us, 4),
                                                                               [1],
                                                                             ) if us[1] < uc0 else Join([
                                                                                                         us[1] - uc0,
                                                                                                         us[2] - 1,
                                                                                                         us[3] - 1,
                                                                                                         1,
                                                                                                       ], Drop(us, 4), [0]),
                                                       Apply(
                                                              (bd: integer) => 0 if us[3] - 1 <
                                                                                    us[2] + 1 ||
                                                                                    (us[3] - 1 -
                                                                                     (us[2] + 1)) %
                                                                                    2 ==
                                                                                    1 else Binomial(us[3] - 1, bd) -
                                                                                          (0 if bd == 0 else Binomial(us[3] - 1, bd - 1)),
                                                              (us[3] - 1 - (us[2] +
                                                                            1) - (us[3] - 1 -
                                                                                 (us[2] + 1)) %
                                                                                2) /
                                                              2,
                                                            ) if 1 <= us[3] && us[2] +
                                                                              1 >=
                                                                              0 else 0,
                                                     ), us, ui), [
                                                                  _r,
                                                                  0,
                                                                  2 * _n,
                                                                  1,
                                                                ], Range(1, 2 *
                                                                           _n, 1)), 4),
     )

rank(_n, _x)

Apply(
       (pt: list<integer>) => Apply(
                                     (ms: list<integer>) => Fold(
                                                                  Function(Apply(
                                                                                  (rc0: integer) => [
                                                                                                      rs[1] + 0,
                                                                                                      rs[2] + 1,
                                                                                                      rs[3] - 1,
                                                                                                      1,
                                                                                                    ] if rx == 1 else [
                                                                                                                       rs[1] + rc0,
                                                                                                                       rs[2] - 1,
                                                                                                                       rs[3] - 1,
                                                                                                                       1,
                                                                                                                     ],
                                                                                  Apply(
                                                                                         (bd: integer) => 0 if rs[3] - 1 <
                                                                                                               rs[2] + 1 ||
                                                                                                               (rs[3] - 1 -
                                                                                                                (rs[2] + 1)) %
                                                                                                               2 ==
                                                                                                               1 else Binomial(rs[3] - 1, bd) -
                                                                                                                     (0 if bd == 0 else Binomial(rs[3] - 1, bd - 1)),
                                                                                         (rs[3] - 1 -
                                                                                          (rs[2] + 1) -
                                                                                          (rs[3] - 1 -
                                                                                           (rs[2] + 1)) %
                                                                                          2) /
                                                                                         2,
                                                                                       ) if 1 <= rs[3] &&
                                                                                           rs[2] + 1 >=
                                                                                           0 else 0,
                                                                                ), rs, rx),
                                                                  [
                                                                    0,
                                                                    0,
                                                                    2 * _n,
                                                                    1,
                                                                  ],
                                                                  ms,
                                                                )[1],
                                     Map(
                                          Function(1 if px < pt[px] else 0, px),
                                          Range(1, 2 * _n, 1),
                                        ),
                                   ),
       Apply((pmn: list<integer>) => Apply(
                                            (pmx: list<integer>) => Map(
                                                                         Function(Fold(
                                                                                        Function(
                                                                                                  pmx[pj] if pmn[pj] == pp else pmn[pj] if pmx[pj] == pp else pq,
                                                                                                  pq,
                                                                                                  pj,
                                                                                                ),
                                                                                        0,
                                                                                        Range(1, Length(_x), 1),
                                                                                      ), pp),
                                                                         Range(
                                                                                1,
                                                                                2 * _n,
                                                                                1,
                                                                              ),
                                                                       ),
                                            Map(Function(Max(blk), blk), _x),
                                          ), Map(Function(Min(blk), blk), _x)),
     )

valid(_n, _x)

Length(_x) == _n && Fold(
                          Function(ok_blk && Length(blk) == 2, ok_blk, blk),
                          True,
                          _x,
                        ) && Apply((flat: list<integer>) => Fold(
                                                                 Function(ok_y &&
                                                                          Contains(flat, y), ok_y, y),
                                                                 True,
                                                                 Range(
                                                                        1,
                                                                        2 * _n,
                                                                        1,
                                                                      ),
                                                               ), Flatten(_x)) &&
Apply((lo: list<integer>) => Apply(
                                    (hi: list<integer>) => Fold(
                                                                 Function(ok_nj &&
                                                                          Fold(
                                                                                Function(ok_nk &&
                                                                                         !(lo[nj] < lo[nk] &&
                                                                                           hi[nk] < hi[nj]), ok_nk, nk),
                                                                                True,
                                                                                Range(1, _n, 1),
                                                                              ), ok_nj, nj),
                                                                 True,
                                                                 Range(1, _n, 1),
                                                               ),
                                    Map(Function(Max(blk), blk), _x),
                                  ), Map(Function(Min(blk), blk), _x))

Statistics

On SetPartition, called as CombinatorialStat(x, "Name").

Maps

Into and out of SetPartition, called as CombinatorialMap(x, "Name"). Properties are the laws we state and what FindStat records.

From SetPartition

  • ArcRepresentationSetPartition → EndofunctionEach position linked to the next in its block, or to itself when last.
  • AssociatedStandardTableauSetPartition → StandardTableauSurjectionMp00258The standard tableau whose j-th column holds the j-th smallest elements of the blocks, in increasing order.
  • BlockSizeCompositionSetPartition → IntegerCompositionsurjectionSurjectionGraded mapMp00128The block sizes of a set partition, its blocks taken in order of their least elements.
  • BlockSizePartitionSetPartition → IntegerPartitionsurjectionSurjectionGraded mapMp00079The partition of n a set partition's block sizes form, largest first.
  • CallanSwitchSetPartition → SetPartitionBijectionGraded mapInvolutionMp00249Callan's involution: switches the first closer with the lesser of the least closer and the second element of the block of 1.
  • ComplementSetPartition → SetPartitioninvolutionBijectionGraded mapInvolutionMp00112Each element i replaced by n + 1 - i: the set partition seen from the other end.
  • DecreasingRotationSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00176Every element lowered by one, cyclically: 1 becomes the largest.
  • DualMajorIndexToIntertwiningSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00174The inverse of IntertwiningToDualMajorIndex: read the growth word as an intertwining word and rebuild the blocks.
  • IncreasingCyclePermutationSetPartition → PermutationInjectionGraded mapMp00080The permutation whose cycles are the blocks, each cycle increasing: every element goes to the next larger in its block, the largest to the least.
  • IncreasingRotationSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00091Every element raised by one, cyclically: the largest becomes 1.
  • IntertwiningToDualMajorIndexSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00171The set partition whose growth word is the intertwining word: a bijection taking the intertwining number to the dual major index.
  • InverseWachsWhiteSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00216The set partition joined by the arcs of the rook placement that Wachs and White's bijection gamma assigns to the set partition.
  • InverseWachsWhiteRhoSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00218The set partition joined by the arcs of the rook placement that Wachs and White's bijection rho assigns to the set partition.
  • InverseYipSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00219The set partition joined by the arcs of the rook placement that Yip's bijection psi assigns to the set partition.
  • KasraouiZengSetPartition → SetPartitionBijectionGraded mapInvolutionMp00115The Kasraoui-Zeng involution: exchanges the number of crossings with the number of nestings.
  • RestrictedGrowthStringSetPartition → RestrictedGrowthStringinverseA set partition's restricted growth string: each position labelled with its block's index, from 0.
  • WachsWhiteSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00215The set partition whose arcs, read as a rook placement, Wachs and White's bijection gamma carries to a set partition.
  • WachsWhiteRhoSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00217The set partition whose arcs, read as a rook placement, Wachs and White's bijection rho carries to a set partition.
  • YipSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00220The set partition whose arcs, read as a rook placement, Yip's bijection psi carries to a set partition.

To SetPartition

  • CyclePartitionPermutation → SetPartitionsurjectionSurjectionGraded mapMp00151The orbits, as a set partition of the positions.
  • NoncrossingPartitionDyckPath → SetPartitionInjectionGraded mapMp00138Biane's noncrossing set partition: the up steps whose matching downs lie in one run of downs form a block.
  • RowSetPartitionStandardTableau → SetPartitionInjectionGraded mapMp00284The set partition whose blocks are the rows of the tableau.
  • SetPartitionRestrictedGrowthString → SetPartitioninverseThe set partition a restricted growth string labels: block j holds the positions labelled j.
  • UnderlyingSetPartitionSetComposition → SetPartitionsurjectionSurjectionGraded mapMp00285The set partition with the same blocks, the order of the blocks forgotten.
  • WeakExceedancePartitionPermutation → SetPartitionSurjectionGraded mapMp00240The coarsest set partition containing every arc from i to π(i) with i ≤ π(i).
3 more in FindStat, not implemented here
  • Mp00092PerfectMatching → SetPartitionInjectionGraded mapto set partition
  • Mp00164SetPartition → SetPartitionBijectionGraded mapInvolutionChen Deng Du Stanley Yan
  • Mp00221SetPartition → SetPartitionBijectionGraded mapInvolutionconjugate

Enumeration

Examples

1 more kept as data, checked against the oracles
Basic #

Count(NonNestingMatchings(4))=14Count(NonNestingMatchings(4)) = 14

live ↗
InCount(NonNestingMatchings(4))\mathrm{Count}(\mathrm{NonNestingMatchings}(4))Out1414

The first element in enumeration order

live ↗
InNonNestingMatchings(4)[1]\mathrm{NonNestingMatchings}(4)[1]OutSetPartition⁡([[1,5],[2,6],[3,7],[4,8]]){\operatorname{SetPartition}}([[1, 5], [2, 6], [3, 7], [4, 8]])
About
Examples3
CrosswalkOEIS

See also: NonCrossingMatchings, DyckPaths