Skip to content

A domain reduction leads its name and wraps the projection - #33

Merged
Simon-McIntosh merged 5 commits into
iterorganization:mainfrom
Simon-McIntosh:main
Sep 6, 2026
Merged

A domain reduction leads its name and wraps the projection#33
Simon-McIntosh merged 5 commits into
iterorganization:mainfrom
Simon-McIntosh:main

Conversation

@Simon-McIntosh

Copy link
Copy Markdown
Collaborator

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_averaged was 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:

authored   toroidal_flux_surface_averaged_lithium_velocity_at_plasma_boundary
rendered   toroidal_lithium_velocity_flux_surface_averaged_at_plasma_boundary

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_in and normalized contracts.

canonical  flux_surface_averaged_toroidal_lithium_velocity_at_plasma_boundary

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.

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.
@Simon-McIntosh
Simon-McIntosh merged commit 41015bf into iterorganization:main Sep 6, 2026
5 checks passed
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