A domain reduction leads its name and wraps the projection - #33
Merged
Conversation
A reduction collapses its operand over a domain, so the reduced object is the whole projected, qualified quantity rather than one axis component of it. The parser was absorbing the token into the qualifier chain whenever the residue resolved as an ordinary base expression, which let the projection and the trailing locus render outside the reduction and made the representation unable to say which quantity had been reduced. Peel the bare-spelled precedence-30 prefix operators before the base/qualifier priority so they reach the operator stack, and hoist any that still arrive as leading qualifiers (the flat-model projection re-creates that shape) onto the operator stack at render time, where the existing bare-prefix path already places them first. Four existing parametrised contracts pin the previous trailing spelling for this class and now fail; they are listed in the run manifest rather than adjusted here.
A reduction collapses its operand over a flux surface, a volume, a line or the time axis, so the reduced object is the whole projected, qualified quantity rather than one axis component of it. Two producers of the IR were seating the token in the qualifier chain instead, which renders it after the base and inside the trailing locus: the parser, whose base/qualifier priority absorbed the token whenever the residue resolved as an ordinary base expression, and the flat-model reconstruction, which is what the strict canonicality check renders through. The two disagreed about the same name, and neither spelling said which quantity had been reduced. Peel the class in the parser before that priority, and seat it on the operator stack in the flat-model reconstruction, so the parser's own IR and the IR rebuilt from the flat model agree by construction. The renderer needs no change: its bare-prefix path already spells a leading operator and already exempts one from tail relocation, so it stays free of vocabulary lookups. The class is derived from the registry, not enumerated: joiner-free prefixes at precedence 30. Lower bare prefixes modify the base rather than reducing it and keep their place inside the projection. Records that split, and the joiner-taking split beside it, next to the vocabulary. Repoints the contracts that pinned the trailing spelling, and moves a reduction under an explicit outer operator to the IR-only set: it is a second ordered unary application and the flat model holds one transformation slot.
…ntation A reduction has one reading wherever the author spelled it, but base and qualifier matching resolves tokens positionally, so a name that placed the projection or the trailing locus outside the reduction still seated the token in the qualifier chain. That left two canonical spellings for one quantity whose representations differed, and since representation equality is the meaning test, a rename between them read as meaning-changing. Hoist the class off the qualifier chain at IR assembly, where every spelling has converged on one chain, instead of peeling only a leading occurrence. Authored spellings now parse to the representation of the leading form and compose back to it, while the strict oracle still refuses them, so a migration can read the target off the name it already has. The hoist subsumes the leading peel, which is removed: one mechanism, and the reduction reaches the operator stack from any position. A reduction under an explicit outer operator converges too, so the trailing spelling that previously raised an unnamed token-loss error is now merely non-canonical and its rejection names the form to migrate to.
The reduction is now classified as an operator rather than a trailing qualifier, so both spellings share one representation and the authored form converges on the leading one instead of the grammar admitting two canonical spellings for one quantity. Three attempts were needed and each corrected the brief. The cause was neither the parser nor the renderer alone but a base expression outranking the operator peel; canonicality has two independent checks and only one routes through the flat model; and the placement rule needs both conditions, joiner-free and the reduction precedence. Twenty-one live names migrate to the leading form and 2326 are unchanged.
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.
A flux-surface or volume reduction now renders as the leading operator of its name, wrapping any projection, instead of trailing as a qualifier after the base.
The defect
flux_surface_averagedwas classified as a qualifier rather than an operator whenever a projection or locus tail was present. A base/qualifier/projection expression outranks the operator peel, so the reduction never reached the operator slot, and the renderer then faithfully placed it after the base:Because the token sat in
qualifiers, the representation could not distinguish an averaged quantity from an unaveraged one carrying a stray qualifier — and representation equality is the meaning-equality test a downstream consumer uses to decide whether a rename preserves meaning.The rule
A reduction leads its name: the average of the quantity. The placement test requires two conditions, joiner-free spelling and the reduction precedence, because the single-condition form disturbs the
change_inandnormalizedcontracts.Canonicality is checked in two independent places, only one of which routes through the flat model, so both the parser and the flat-model reconstruction are corrected. The renderer is unchanged.
Verification
The full suite passes at 2132 tests with no failures, against 2110 before. Both negative controls render byte-identical, including the recursive
flux_surface_averaged_ratio_of_...case. A census over 2347 accepted downstream names shows 2326 byte-identical and 21 migrating to the leading form.Eight contract parameters that pinned the trailing spelling are repointed, and the comment documenting that spelling as intended is updated with them.