Repository navigation
Conversation
…follow it A class whose basis is every one-point extension of the patterns of a basis B in one direction (every way of adding a new maximum to each, say) is the permutations whose maximum, taken out, leaves a permutation of Av(B). It has n times as many permutations of length n as Av(B) has of length n - 1. A partial placement of the topmost point, with obstruction inferral to the length of B's longest pattern, turns it into that point and Av(B). As Christian suggested, this is now a hint, beside the rotation's. - tilings/hints.py: one_point_extensions(pattern, direction), one_point_extension(basis), and the hint "one-point extension". - TileScopePack.add_extension_placement(direction, length): the partial placement of a requirement's point in the direction and obstruction inferral to the length. A pack holds one strategy of each class, so a pack that has either already raises ValueError, as add_expansion and add_inferral do; only_root_placements' packs have a requirement placement. - tilescope spec -x/--extension-placement: both, for the basis's direction and length, with a parser error for a basis that is not such an extension or a pack that cannot take them. - Tests: the extensions in each direction against their definition; the extensions found, and counted to length 7, for five bases in each direction, and none found where there are none; a basis that is not minimal; the hint's message, pack method and flag; both hints at once; a search in each direction, whose rules pass their sanity check; the flag and its errors; the pack through JSON. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Round 2 of #530's review changed tilings.hints (Hint names its strategies, hints_for), the CLI and the docs. In the four files both branches changed, this takes round 2's side; the next commit brings the one-point extension hint onto it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#530's round 2 changed tilings.hints. A Hint now names the strategies that follow it, and the rotation hint names the class to search for instead, cut again while it is closed under rotation. The extension hint follows suit: - It names Av(B) to search for instead, reduced again while the basis left is every one-point extension of a basis (one_point_extension_chain), with the count, n (n - 1) ... times the last class's, and F = 1 + x (x G)' once for each step. - It still says that the pack can take the partial placement and the inferral. Its strategies are the two that add_extension_placement adds, so tilescope spec logs it unless the pack has both. - add_extension_placement takes the directions to place in, so that a chain whose steps go in several directions is followed. The flag passes the chain's directions and the first step's length. - The README's paragraph is shorter, in round 2's style. - Tests: the chains of two steps (a new maximum twice, and a new maximum then a new minimum) for the hint and the flag; a pack with one of the two strategies does not follow the hint; the lift of the lift of 12 has both hints, as it is also every extension of the lift of 12 by a new minimum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#530's two tests that no longer depend on when the search looks for a specification. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The review's tests reader wrote tests for what no test read: - the flag's inferral length where it matters, on bases of patterns of different lengths and on chains, which two faults (the shortest pattern's length, and the last step's basis for the first's) passed; - the hint and the flag in each direction, south's and east's words among them, and chains of two steps in every order of directions and of three steps, with the message for one step and for three; - the flag end to end: the generating function in each direction against Permuta's counts, two steps, every pack with each other flag, the basis as the command reads it, and its refusals with their messages; - the pack method's errors and a generator of directions; - edges: a basis of one pattern of length 2, the class of every permutation of length 3, near misses, and empty, short and repeated bases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ization - one_point_extension, which differed from one_point_extensions by one letter and does the opposite, is one_point_extension_of, renamed while it still can be. Its steps are OnePointExtension(direction, basis), named tuples, and the chain is read by their names. - extension_placement(chain) gives the placement's directions and length, for the hint and for the flag, which derived them each by itself. - The basis is minimized once: hints_for's minimal basis goes through, and a step's basis, minimal too, is not minimized again. A direction whose patterns could not number the basis's is skipped before its extensions are made. - The message names the class the first step leaves once, and "that class" after, where it named it five times; it names the direction of each later step, and the points of every direction the placement places; it says for which n the counts hold; and the call it suggests is a tuple. - add_extension_placement raises ValueError for no directions, a value that is no direction, and a length below 1, and places in each direction once. - The flag's helper is pack_with_extension_placement, and says why a pack cannot take the placement in its own words. It warns of a pack that inserts no point requirements, as row_and_col_placements does, where the placement has no point to place, and its help says so. - _EXTENSION_WORDS has named fields, the search order is _DIRECTIONS, the names come from DIR_REPR, _without_extreme_point raises for no direction, and the docstrings, the README and the CHANGELOG say what the functions do. Tests: the steps and their placement, the input checks, the warning, the flag's own error, and the messages' new phrases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ents The chains of two and three steps check that the message says the transform F = 1 + x (x G)' is applied twice or 3 times, and that it names the point of every direction the placements place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dges The review's tests reader wrote these, as handed over: - the hint's whole message for seven chains of 123, of one to three steps in one, two and three directions, where the tests read it by phrases; - the pack method's shortest inferral, a length of 1, and its own messages for no directions, a value that is no direction, and a length of 0; - the flag's warning naming the pack, and no warning for the packs that insert point requirements through RequirementInsertionFactory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The review's last chance to rename them, which Henning took: they stay public, renamed to say what they do. - one_point_extension_of(basis) finds the basis that the given one extends, where its name read as making the extension: it is find_one_point_extension(basis). - one_point_extension_chain(basis) is find_one_point_extension_chain(basis). - OnePointExtension's basis is the smaller basis, B, not the extension: it is reduced_basis. - extension_placement(chain) gives the pack method's arguments, not a placement: it is extension_placement_arguments(chain). The doctests, the tests and the CHANGELOG follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cation
- The message says a step after the first by the point it takes out, in
one template ("taking out 2 more points, the leftmost point, then the
maximum, leaves a permutation of Av(012)"), where it mixed reducing and
extending. The point is added "to each pattern" of the basis, and the
one-step effect names the class, where "that class" could be misread. A
last sentence says that the placement places the points of point
requirements, which the pack must insert, as point_placements does. The
dictionary used as a switch is an if, and the one-element tuple's comma
has a comment.
- extension_placement_arguments raises ValueError for a chain of no
steps, where it raised IndexError, and takes any iterable of steps.
add_extension_placement raises TypeError for a length that is not an
integer, True among them: 2.5 and True were taken, and the search then
found nothing.
- POINT_INSERTIONS is the strategies of the command's packs that insert
a point requirement into the class's own tiling, CellInsertionFactory
and RequirementInsertionFactory, and a comment says why.
TargetedCellInsertionFactory, which no pack uses, never inserts there,
and the corroborations of row_and_col_placements insert points only into
tilings of two or more cells. A test checks the warning against each
pack's strategies applied to the class's tiling, and the warning says
"in the class's tiling".
- Duplication: _without_extreme_point takes out the maximum and the
minimum with Perm.remove_element; the directions' order is
_EXTENSION_WORDS'; the hint computes the placement's arguments once;
_falling_factorial serves both hints; the warning iterates the pack.
- Names: _ExtensionWords' extreme_point and placed_point, and the locals
first_class, search_class, taken_out, placed_points and direction_names;
in the tests, ext, m and d.
- Docstrings: find_one_point_extension's first sentence, the pack
method's, _extension_hint's "one" and _chain_of_minimal's comment; the
method's message says the directions "must be one or more of" them.
- The CHANGELOG names -x and the warning, and the command's search test
has a timeout of 60 s.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ning The review's tests reader wrote these, as handed over: - a chain of four steps, in one direction and in four: the chain, the counts by brute force, the whole message, the transform applied four times, and the placement's arguments, which no test reached past three steps; - the length's TypeError for False and for floats below 1, the type checked before the range; - an empty iterator of steps; - the warning in full. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- _extension_message's docstring said that the message names the first class once, which a one-step message does not; it now says what the first sentence and the later steps' sentence do. find_one_point_extension's first sentence says what it finds, and the chain's that its last reduced basis is that of the class to search for. - extension_placement_arguments is annotated and documented as taking (direction, reduced basis) pairs, as it reads them, OnePointExtension among them. - The pack method's docstring says once what the placement places, and why the pack must insert point requirements, without "goes by them to". The placement's need is said in the message, the flag's help and the pack method, no longer in the module docstring, and "insert them" is "insert point requirements". - _extension_message no longer appends and sets in one branch: the transform's count is _times_applied, the need _placement_need; the later steps' clause is more_points. - The CLI's try covers only the pack method, so that an empty chain's error could not take the pack's message; POINT_INSERTIONS' comment says it holds classes. - The pack method takes a length as operator.index does, an integer type of another library's among them, and still refuses a bool, with a comment on why. - In the tests, itertools.chain no longer shares its name with the chains of steps, and two pairs of overlapping tests are one each: the pack method's input checks with their messages, and the packs that insert points. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
This builds on #530 (
rotational-cut), its base here, whosetilings.hintsit extends. Once #530 is merged, this one's base becomesdevelop.Christian's idea: take a basis B, and for each of its patterns every way of adding one point in a single direction, such as a new maximum in every possible place. The class of the new basis B' is connected to Av(B) by a partial placement of the topmost point and obstruction inferral at the right length. This adds that as a second hint, beside the rotation's, with a pack method and a
tilescope specflag that follow it.The idea
A permutation contains a pattern of B' exactly when it has an occurrence of a pattern of B that leaves out its maximum: the maximum then completes it, and an occurrence that uses the maximum has no point above it to add. So Av(B') is the permutations whose maximum, taken out, leaves a permutation of Av(B), and it has n times as many permutations of length n as Av(B) has of length n − 1. The same goes for a new minimum, a new leftmost point or a new rightmost point.
In TileScope, the partial placement of the topmost point puts it in a row of its own, above a cell of the rest in the same column. Obstruction inferral to the length of B's longest pattern then finds that this cell avoids B, since the point, wherever it lies among the rest, would complete any occurrence. The tiling is then that point and Av(B).
What it adds
one-point extension(tilings.hints), given byhints_for(basis)when the basis is every one-point extension of a basis B. It names the class to search for instead, Av(B), reduced again while it is such an extension, with the counts and generating functions that relate them, and the direction of each step. It also says that the pack can take the placement and the inferral.one_point_extensions(pattern, direction)makes the extensions;find_one_point_extension(basis)finds the direction and B, as a named tupleOnePointExtension(direction, reduced_basis);find_one_point_extension_chain(basis)gives the steps of reducing again, as a list of them;extension_placement_arguments(chain)gives the directions and length of the placement that follows the hint, for the hint and the flag alike.TileScopePack.add_extension_placement(directions, length)adds the partial placement of a requirement's point in those directions, each once (RequirementPlacementFactory(partial=True, dirs=directions)), and obstruction inferral to the length. It raisesTypeErrorfor a length that is not an integer (any integer type is taken, a bool is not), andValueErrorfor no directions, a value that is no direction, or a length below 1. A pack holds one strategy of each class, whatever its parameters. So a pack that already has a requirement placement or obstruction inferral, asonly_root_placements' packs do, raisesValueErrortoo, asadd_expansionandadd_inferraldo.tilescope spec's flag-x/--extension-placementadds them for the class's steps. It refuses, with a parser error that says why, a basis that is no such extension and a pack that cannot take them. The placement places the points of point requirements, so the flag warns of a pack that inserts none into the class's tiling, asrow_and_col_placements,row_placementsandcol_placementsinsert none, and its help and the hint say so.tilescope speclogs the hint unless the pack has both strategies.What it does
It was tried on the new maximum's extensions of Av(123), Av(132), Av(1234), Av(1342), Av(2413, 3142), Av(1243, 2431) and Av(123, 3412), and on the other three directions' of Av(1342) and Av(123, 3412):
add_extension_placement, each took at most 0.2 s, with 4 rules, as did the two-step extensions of 123;For instance, this finds a specification at once:
Its generating function is
x/sqrt(1 - 4*x) + 1, whose coefficients are n times the Catalan numbers at n - 1.Who will use it
TileScope users with such a class: the hint names the simpler class to run, and the flag turns the class into a point and that class in a fraction of a second.
Tests
In
tests/test_hints.pyand the pack tests:one_point_extensionsagainst the permutations one point longer that give the pattern back, in each direction;find_one_point_extensionfinds the direction and B for five bases in each direction, whose classes have n times as many permutations of length n as Av(B) has of length n − 1; bases that are not minimal, repeated, unordered or given once through; and no extension where one is missing or one too many, for a single pattern, for the extensions of patterns of length 1, and for empty and short bases;add_extension_placementon the extensions of 123 in each direction, whose rules pass their sanity check, and the flag's search for two steps;add_extension_placement, through JSON, butonly_root_placements'.How it was checked
Before submission, by an automated reviewer, against
developof Permuta and comb_spec_searcher and #530's head:find_one_point_extension, on more than a thousand bases, among them mixed lengths, chains of up to three steps in mixed directions, and near misses: they agree, and each step's counts and generating function are right;-x, or refuses with a parser error, and warns exactly where the search places no point;hints_for, whichtilescope specruns once, within a tenth of a millisecond of Add the rotational cut strategy, for classes closed under rotation #530's on the bases tried.AI assistance: written with Claude Code (Opus 5.5) as the TileScope agent, and reviewed before submission by Claude Code (Opus 5.5) as an automated reviewer; Henning Ulfarsson checked and opened it.