... is the pattern operator: the progression the shown terms determine, up to the term after it - #1439
Merged
Conversation
…e, up to the term after it The smaller half of #1437. {1, 2, ..., n}, {2, 4, ..., 2 n}, {5, 10, 15, ...}, {..., -1, 0}, {k - 2, ..., k + 2}, 1 + 2 + ... + n and 1 * 2 * ... * n parse -- also with … -- as the arithmetic progression of whole numbers the shown terms determine: the step is the difference of the first two, or one where a single term is shown on each side, every further shown term is checked against it, and the term after the dots is where it stops. Nothing new is built: a set is ZZ /\ [a; z] for step one and a residue class cut by the interval otherwise, listed when the ends are numbers and written over a symbolic end, a one-sided pattern the class cut by a ray; a sum is sum(k, k, a, z) and a product the same, with a + d k as the term for another step. Refused, with a message saying which: shown terms with no common step ({1, 4, 9, ...} is a guess about the writer's rule, not a progression), a progression that is not of whole numbers (the image of a range has no node yet), and dots with nothing to determine them. The general term with an index shown and the argument list of symbolic length are the larger half and wait for v3's family of names. #1437 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
This was referenced Sep 21, 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 smaller half of #1437, as triaged there:
...(or…) between shown terms names the arithmetic progression of whole numbers the shown terms determine, and the term after it names where it stops.{1, 2, ..., 10}{ 1, 2, …, 10 }, listed{1, 2, ..., n},{1, ..., n},{k - 2, ..., k + 2}ZZ /\ [1; n]— the[n]of #1435; step one is the convention when a single term is shown on each side{2, 4, ..., 2 n}{ x in ZZ : x = 0 (mod 2) } /\ [2; 2 n]— a residue class (#1424) cut by the interval; listed when the ends are numbers{5, 10, 15, ...},{..., -1, 0},{10, 8, ...}7 in {1, 3, 5, ...}isTrue,8is not1 + 2 + ... + n,1 * 2 * ... * nsum(k, k, 1, n),product(k, k, 1, n);a + d kas the term for another step;1 + 2 + ... + 100evaluates to5050forall k in {1, ..., n} : …,union(A_k, k in {1, ..., 3})Refused, with a message saying which: shown terms with no common step (
{1, 4, 9, ..., n}— a rule other than a common step is a guess about the writer, not a progression), a progression that is not of whole numbers ({1/2, 1, ..., n}: the image of a range has no node yet), dots with nothing to determine them ({..., n},1 + ... + n), and dots twice. The step is the difference of the first two shown terms, simplified ((k + 1) - kis1), and every further shown term is checked against it.Nothing new in the tree:
Core/PatternOperator.csbuilds fromZZ /\ [a; z], the residue-class set,sumandproduct. The grammar collects the terms of a sum and the factors of a product and the items of a set literal, and where dots stood among them calls the reader; without dots every one of them folds as before (NothingChangesWithoutDots). The larger half — the general term with an index shown,a_1 + ... + a_n, and the argument list of symbolic length,f(x_1, ..., x_n)— is v3's family of names (#1019), as agreed on the issue.PatternOperatorTest, 32 rows. Syntax.md and BREAKING-CHANGES.md (every input was a parse error in 2.5.0). Parser regenerated and post-processed. Full suite 12203 passed, 0 failed; benchmark gate PASSED — ParseEasy +0.3% (18,461 B/op; a first version collected the terms of every sum into a list and the gate caught it at +3.7%, so the terms are read off the folded sum instead), ParseHard +2.5% (3,702,858 B/op, within the 3% the gate allows; the extra alternatives on+and*are what the parser pays), SimplifyHard unchanged.Part of #1437.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura