Skip to content

... is the pattern operator: the progression the shown terms determine, up to the term after it - #1439

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
pattern-operator
Sep 21, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
pattern-operator

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

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.

written read as
{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, ...} the class cut by a ray: 7 in {1, 3, 5, ...} is True, 8 is not
1 + 2 + ... + n, 1 * 2 * ... * n sum(k, k, 1, n), product(k, k, 1, n); a + d k as the term for another step; 1 + 2 + ... + 100 evaluates to 5050
forall k in {1, ..., n} : …, union(A_k, k in {1, ..., 3}) the range under a binder

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) - k is 1), and every further shown term is checked against it.

Nothing new in the tree: Core/PatternOperator.cs builds from ZZ /\ [a; z], the residue-class set, sum and product. 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

…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
@Rafael-SOWNet
Rafael-SOWNet merged commit 6d3c3d9 into master Sep 21, 2026
32 checks passed
@Rafael-SOWNet
Rafael-SOWNet deleted the pattern-operator branch September 21, 2026 05:58
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