Skip to content

Rotationally stable strategy - #207

Open
ulfarsson wants to merge 5 commits into
developfrom
rotationally-stable-strategy
Open

ulfarsson wants to merge 5 commits into
developfrom
rotationally-stable-strategy

Conversation

@ulfarsson

Copy link
Copy Markdown
Member

Functionality for circular patterns and a new strategy to simplify rotationally stable normal permtuation classes.

ulfarsson and others added 3 commits October 15, 2026 12:30
A class whose basis is closed under rotation (moving the first entry of a
pattern to the end) is closed under rotation too, so it has n times as many
permutations of length n as its min cut, the class of the permutations p
with 1 + p in the class, has of length n - 1. The new fast enumeration
strategy checks this for the basis and its symmetries, gives the min and
max cuts, follows the cuts while they are rotationally stable again, and
counts the class through them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements the model of Domagalski et al., "Cyclic Pattern Containment and
Avoidance" (arXiv:2106.02534): a cyclic permutation is the class of all
rotations of a permutation, stored by its rotation that starts with its
minimum, so [sigma] contains [p] when that rotation of sigma contains some
rotation of p.

The tests check Callan's enumeration of the single patterns of length 4,
three-pattern results of Domagalski et al., the cyclic Erdos-Szekeres bound,
the trivial Wilf-equivalences, that the number of cyclic descents does not
depend on the rotation, and that [42351] contains [1234] though 42351 avoids
1234.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All rotations of a set of cyclic patterns are a rotationally stable basis,
whose class has n times as many permutations of length n as there are
cyclic permutations of length n avoiding the patterns. Checked for every
cyclic pattern of length 4 or 5 and every pair of length 4, to length 7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ulfarsson
ulfarsson requested review from ReedActon, akc and christianbean and removed request for akc and christianbean October 16, 2026 17:04
ulfarsson and others added 2 commits October 16, 2026 21:00
CyclicPerm keeps its representative in the slot _rep, set in __new__ on
the new object, so mypy never learned the attribute and failed with 27
errors. A class annotation declares it. With _rep typed as a Perm, whose
slices mypy takes for empty tuples, sigma now drops the first entry with
itertools.islice, as Perm itself does. reverse, complement,
reverse_complement, avoids_set and count_occurrences_of get the
docstrings pylint asks for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arPatt

pylint 4 counts a method that only raises NotImplementedError as
abstract, and flags the subclasses that do not override it, on develop
too. BivincularPatt leaves unrank and of_length unimplemented on
purpose, and so do these two subclasses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant