Repository navigation
Conversation
A core strategy checked every pattern of the basis given against its corollary's conditions, so a redundant pattern, one that contains another pattern of the basis, could stop it from applying, as 23145 did for RuCuCoreStrategy with 2314 and 3124. It now checks the minimal basis of the class it already builds, so its answer depends on the class alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tegy 21345 contains 1234 but neither needed pattern, so a check that skipped only the patterns containing a needed one would refuse Av(1234, 2314, 3124, 21345). The test over every core strategy now runs once for each, under its name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The core strategies now check a class's minimal basis, so a redundant pattern in the basis given no longer stops one from applying.
CoreStrategy._applies_to_symmetry, inpermuta/enumeration_strategies/core_strategies.py, checked every pattern given against its corollary's conditions, even one that contains another pattern of the basis:On
developthis givesFalse, though 23145 contains 2314, so the class is Av(2314, 3124), which Corollary 4.3 enumerates. A basis now gets the same answer from every core strategy with or without redundant patterns, and so fromfind_strategies, which passes a caller's list through. On a minimal basis nothing changes.Details
Why
A core strategy decides whether a class, in some symmetry, avoids the patterns its corollary needs and has every other basis pattern of the form the corollary allows. It read the basis as given, so a redundant pattern had to meet the corollary's conditions too, though it changes nothing in the class. Each extra pattern must start with 1 in every core strategy but
Ru2143CoreStrategy, whose own fix is a separate pull request, so a redundant pattern without a leading 1 stopped them:RuCuCoreStrategyrefused Av(2314, 3124, q) for each of the 28 patterns q of length 5 that contain 2314 or 3124 and do not start with 1, though each of these classes is Av(2314, 3124).The minimal basis decides it exactly. Each corollary's condition is on one extra pattern alone, and a class has the form Av(N ∪ E), with each pattern of E allowed, exactly when it avoids the needed patterns N and every other pattern of its minimal basis is allowed: the minimal basis of Av(N ∪ E) is part of N ∪ E, and a class that avoids N is Av(N ∪ B) for its minimal basis B. So the answer now depends on the class alone, not on how its basis is written.
The fix is for anyone who passes a basis that is not minimal, to
find_strategiesor to a strategy, such as the patterns a search has collected.What changes
CoreStrategy._applies_to_symmetrychecks the patterns ofAv.from_iterable(basis).basis, the class's minimal basis, which it already built, in place of the basis given. Its docstring, rewritten, says what it checks, with an example.basiskeeps the patterns as given.tests/enumeration_strategies/test_core_strategies.pygets three tests:TestRuCu.test_a_redundant_pattern_is_ignored;TestRuCu.test_a_pattern_redundant_through_an_extra_pattern_is_ignored, where 21345 is redundant through 1234 rather than through a needed pattern;test_a_redundant_pattern_changes_no_core_strategy, run for each core strategy by name. It adds to the strategy's needed patterns a pattern that contains one of them and does not start with 1.CHANGELOG.md: an entry under Unreleased, Fixed.Checks
develop: the new tests fail, but for the third test's cases ofRdCdCoreStrategyandRu2143CoreStrategy: a symmetry lets the first take that redundant pattern, and the second does not yet ask for a leading 1. A tempting wrong fix, which skips each given pattern that contains a needed one in place of reading the minimal basis, fails the test of 21345.developwith this Permuta, on both Pythons.develop; with a redundant pattern they give their answer on the minimal basis, always.developdiffered only by refusing._applies_to_symmetryare killed, and so is each fault made by hand that is not equivalent:develop's line, the needed patterns not left out,anyforall, the redundant patterns checked in place of the minimal ones, and the wrong fix above.develop: level or faster under CPython in every round, and faster under PyPy on 6 of 8 paired hash seeds.bitmaps-memory-note, or with the separate fix toRu2143CoreStrategy. With that fix merged too,Ru2143CoreStrategyagrees on every basis above, minimal or not, with the form Section 10 of Bean, Nadeau and Ulfarsson enumerates, but on Av(1). There the one-point pattern makes four core strategies raiseAssertionError,RdCdCuCoreStrategy,RdCuCoreStrategy,Rd2134CoreStrategyandRu2143CoreStrategy, ondevelopand with both fixes alike.AI assistance: written with Claude Code (Opus 5.5) as the Permuta developer, and reviewed before submission by Claude Code (Opus 5.5) as an automated reviewer; Henning Ulfarsson checked and opened it.