Macaulay2 » Documentation
Packages » Permutations :: Pattern avoidance
next | previous | forward | backward | up | index | toc

Pattern avoidance -- an overview of pattern avoidance for permutations in Macaulay2

We can check if a permutation avoids a pattern. For example, a permutation $p$ is $2143$-avoiding if there do not exist indices $i < j < k < l$ such that $w_j < w_i < w_l < w_k$.

i1 : p = permutation {3,1,2,5,4};
i2 : avoidsPattern(p, {2,1,4,3})

o2 = false

Some patterns are common enough that those pattern-avoiding permutations are given a name, such as vexillary for those that are $2143$-avoiding.

i3 : p = permutation {3,1,2,5,4};
i4 : isVexillary p

o4 = false

We can also check if a permutation simultaneously avoids a list of patterns.

i5 : p = permutation {3,1,2,5,4};
i6 : avoidsPatterns(p, {{2,1,4,3},{1,4,3,2}})

o6 = false

Just as before, some lists of patterns are common enough to be given names. See the documentation for isCartwrightSturmfels, isCDG, and isSeparable for such lists of patterns.

i7 : p = permutation {3,1,2,5,4};
i8 : isCartwrightSturmfels p

o8 = true
i9 : isCDG p

o9 = true

The source of this document is in /build/reproducible-path/macaulay2-1.25.05+ds/M2/Macaulay2/packages/Permutations/Documentation/packageDocs.m2:282:0.