Normalized transformation patterns #
Normalization expands ellipses against a statically known input rank and replaces surface axes by stable elementary-axis identifiers. The result carries the rank and operation-specific well-formedness facts needed by later checking and semantics.
The three transformation modes with distinct axis-set rules.
- rearrange : TransformKind
Permute and reshape axes without creating or reducing elements.
- repeat : TransformKind
Insert and replicate axes while preserving every input axis.
- reduce : TransformKind
Remove input axes with an explicitly chosen reduction.
Instances For
Instances For
Instances For
Stable identity of an elementary axis after ellipsis expansion.
- named
(name : String)
: AxisId
A logical axis identified by its source name.
- anonymous
(value occurrence : ℕ)
: AxisId
A numeric axis identified by both its length and source occurrence.
- ellipsis
(index : ℕ)
: AxisId
One concrete dimension generated by expanding an ellipsis.
Instances For
Instances For
Whether an axis is an anonymous numeric occurrence.
Instances For
Expand one parsed axis into its elementary normalized axes.
This helper is exposed only because elaborated transformation certificates
reduce expandExpression in downstream modules.
Instances For
Whether a physical axis consists solely of an unparenthesized ellipsis.
The distinction matters because a bare ellipsis contributes several physical dimensions, whereas a parenthesized ellipsis remains one composite dimension.
Instances For
Expand one composition, splitting a bare ellipsis into separate dimensions.
Instances For
Expand every composition in an expression against rank-generated ellipsis axes.
Instances For
Whether every elementary axis in left also occurs in right.
Instances For
Whether a normalized axis list contains a numeric anonymous axis.
This helper remains under Internal; its body is visible so generated
well-formedness certificates can reduce anonymousAxesAllowed.
Instances For
A transformation pattern after rank-specific ellipsis expansion.
- kind : TransformKind
Operation whose axis-set rules the normalized pattern must satisfy.
- source : Syntax.TransformPattern
Original parsed pattern, retained for diagnostics and source conventions.
- input : Shape
Physical input against which the left side was normalized.
- ellipsisRank : ℕ
Number of physical dimensions represented by the input ellipsis.
Fresh logical axes replacing the ellipsis, in physical order.
Elementary input axes grouped by physical input dimension.
Elementary output axes grouped by physical output dimension.
Instances For
Elementary input axes in source order.
Instances For
Elementary output axes in source order.
Instances For
The axis-set condition associated with the selected transformation mode.
Instances For
Whether the mode permits all anonymous axes present in the pattern.
Instances For
The rank equation determining the number of expanded ellipsis axes.
Instances For
The ellipsis rank equation is constructively decidable from the finite pattern and shape data.
All structural facts established by normalization.
The input expression contains at most one ellipsis.
The output expression contains at most one ellipsis.
An input ellipsis occupies a complete physical-axis position.
- right_ellipsis_has_source : normalized.source.right.ellipsisCount = 0 ∨ normalized.source.left.ellipsisCount = 1
An output ellipsis is present only when the input supplies its axes.
- ellipsis_rank : normalized.ellipsisRankValid
The expanded ellipsis rank agrees with the physical input rank.
- ellipsis_axes : normalized.ellipsisAxes = List.map AxisId.ellipsis (List.range normalized.ellipsisRank)
Ellipsis axes are the canonical fresh identifiers in physical order.
- input_expansion : normalized.inputGroups = expandExpression normalized.ellipsisAxes normalized.source.left
Input groups are exactly the rank-specific expansion of the source syntax.
- output_expansion : normalized.outputGroups = expandExpression normalized.ellipsisAxes normalized.source.right
Output groups are exactly the rank-specific expansion of the target syntax.
Expanded input groups correspond one-for-one with physical dimensions.
Every elementary input axis has a unique semantic occurrence.
- output_nodup : normalized.outputAxes.Nodup
Every elementary output axis has a unique semantic occurrence.
Input and output axis sets obey the selected operation's rule.
Anonymous numeric axes occur only in modes where their semantics is defined.
Instances For
Rearrange preserves every input elementary axis in its output.
Rearrange introduces no output elementary axis absent from its input.
Repeat retains every input elementary axis and may add new output axes.
Reduce retains only elementary axes already present in its input.
A normalized pattern bundled with its machine-checked invariant.
- value : NormalizedTransform
Normalized transformation data consumed by shape resolution.
Proof that normalization established every structural invariant.
Instances For
Expand a parsed transformation pattern against a concrete input rank.
The returned proof records rank agreement, ellipsis expansion, uniqueness of elementary axes, and the mode-specific axis relation.