Einsum-pattern parsing #
This module parses comma-separated operands, the output expression, and their canonical rendering round trip.
def
TorchLean.Tensor.Internal.Syntax.Parser.Impl.parseEinsumInputs
(policy : IdentifierPolicy)
:
List (List Token) → List Expression → Result (List Expression)
Parse comma-separated einsum operands in source order.
Instances For
def
TorchLean.Tensor.Internal.Syntax.parseEinsumPattern
(source : String)
(policy : IdentifierPolicy := IdentifierPolicy.pythonUnicode)
:
Parse an einsum pattern with one or more comma-separated input expressions.
Instances For
theorem
TorchLean.Tensor.Internal.Syntax.parseEinsumPattern_render_eq_ok
(source : String)
(pattern : EinsumPattern)
(hParse : parseEinsumPattern source = Except.ok pattern)
:
Parsing a successful einsum pattern's canonical rendering succeeds with the same canonical syntax.
The theorem applies to any number of input tensors. It preserves their order and comma boundaries, including empty expressions denoting scalar operands. Repeated labels and ellipses inside inputs are retained; only source locations and anonymous-axis occurrence offsets are intentionally refreshed.