Repository navigation
| is divisibility, and was disjunction - #1241
Conversation
`|` was the one spelling in the grammar that already means something else in
mathematics than we read it as: it is divides (a | b), "such that" ({x | P(x)}),
"given" (P(A | B)), and the delimiter in |x|. None of those is disjunction,
which is written with a vee. So input written by a mathematician was read as an
or and answered as one.
a | b is now the statement that b is a whole multiple of a -- the same node
a divides b has built since #1220, at the same precedence. Defined over the
integers and NaN over anything else, the way an inequality is over a non-real
number. 0 | 0 is True; 0 | b is otherwise False.
This is a silent change: an expression that used | still parses and answers
something else. I proposed a two-release migration through a parse error to
avoid that; Happypig375's decision on #1212 was to make the change directly,
since semantic versioning admits it, and to put the entry early in the
breakages list. Both done.
"2 | 6" was 2 or 6 is 2 divides 6, True
"x > 0 | x < -1" was a disjunction is regrouped, since
divisibility binds
tighter than >
"A | B" on booleans was A or B is NaN
or is unaffected and always was the primary spelling -- it is what the library
prints, so a round-tripped expression never held a | to begin with. Replacing |
with or restores the old reading exactly, everywhere. That is why the cost is
small: 7 of 8,525 tests referenced the old reading, five of them boolean-solver
inputs written A | B and two written to record this spelling as at risk.
The grammar is regenerated and post-processed; the parser is internal again,
checked rather than assumed.
All five suites green: UnitTests 8514 and 1500, FSharpWrapperUnitTests 134,
InteractiveWrapperUnitTests 18, TerminalUnitTests 41.
#1212
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
|
it may also be consistent to retire |
|
I would keep What
So it is a layout marker inside an equation array delimited by That is why it is not the same case as
And #1242 already contains the resolution, in your own words: "UnicodeMath parsing and output may be a separate entry point". If it is, the question dissolves — So my answer to "do we want to follow through with those semantics, or is consistency enough?" is: consistency is enough, and it is already satisfied — What would change my mind, and I would rather say it now than re-litigate later: if #1242 lands as one grammar rather than two, then Cost, if you decide otherwise: identical in shape to |
Implements your decision on #1212:
Both halves done — the change is direct, and the entry is first in
BREAKING-CHANGES.md's unreleased section rather than in its place in filing order.a | bis now the statement thatbis a whole multiple ofa— the same nodea divides bhas built since #1220, at the same precedence. Defined over the integers andNaNover anything else, the way an inequality is over a non-real number.0 | 0isTrue;0 | bis otherwiseFalse.What moves
"2 | 6"2 or 6, a disjunction of two numbers2 divides 6, which evaluatesTrue"x > 0 | x < -1"x > 0 or x < -1"A | B"on booleansA or BNaN, since divisibility is a statement about integers"{ x | x > 0 }"FiniteSetofx or x > 0FiniteSetof(x divides x) > 0It is a silent change: input that used
|still parses and answers something else. That is what I wanted the two-release migration for, and your call was that a breaking-changes row is the right protection. Recorded plainly at the top of the section rather than softened.What it cost, measured
7 of 8,525 tests referenced the old reading: five boolean-solver inputs written
A | B, and two written to record this spelling as at risk in the first place.The reason it is that small is the reason to expect it:
oris the primary spelling and is what the library prints, so a round-tripped expression never held a|. Replacing|withorrestores the old reading exactly, everywhere.I had argued this was too risky to do in one step. My argument was about the shape of the risk and I had not measured its size; the size is seven tests.
Mechanics
Grammar regenerated with ANTLR and put through the post-processor, with the parser confirmed
internalagain by counting rather than by assuming — that step silently does nothing if the library does not compile, so it is worth checking.Syntax.md's precedence table moves|from level 3 besideorto level 8 besideinanddivides.Checked
All five suites:
UnitTests8,514 and 1,500,FSharpWrapperUnitTests134,InteractiveWrapperUnitTests18,TerminalUnitTests41.Item 6 of #1019 is updated with what this actually cost.
🤖 Generated with Claude Code
https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura