Created Started Finished
Author: Lucien Huber <im@lcnbr.ch>
Committer: GitHub <noreply@github.com>
Carry admitted tensor interfaces through built-in rewrites (#265) * enforce authoritative tensor metadata across built-in operations Rebased onto the re-split FeynKit series. The state manifest moves to version 25 after the on-shell changes in version 24, and the new Spenso slot gates use the series' `symbolica` feature. Chain transposition keeps the series' reversal of projector words, and the spatial-momentum rewrite and external slot connections of momentum routing go through the typed producers. The rebase also fixes three checks of this change. The constructor contract of `from_produced_parts` reads tensor-free input as a scalar, as admission does. Scalar algebra over automatic ports is checked rather than trusted, and expansion without open ports keeps the established interface, so products of directed ports expand again. Coalesce per-leaf port witnesses in `SlotContraction` across terms while keeping admitted matchers in authoritative mode when no raw-leaf cache is present, and contract vanishing local-4D UV sectors against a zero cograph carrier so nested prefixes retain external tensor interfaces. * carry the series' tensor fixes through authoritative metadata The reviewed fixes of the FeynKit series freshen dummies, keep closed scopes and treat untagged calls as opaque scalars. Under authoritative metadata they need the following, so that their results stay admissible: - Publish raw ports for leaves whose dummies expansion and collection rename, from the source templates (`retain_permuted_leaf_ports`). - Report pairs that cancellation moves into the outer product before the producer contract compares the result. - Keep a closed scalar power bracketed when canonicalization rebuilds it, and give it the alias boundary of nonpositive powers. - Re-parse typed canonicalization with the tagged grammar of admission, so an untagged call stays an opaque scalar; check a tensor-free result of a scalar producer by the same rule as admission. - Scope indices in `wrap_indices` per sum and scalar-power region: a pair closed inside a region moves into the scope together, a label protected outside is not scoped inside it, and arguments of untagged calls stay data. Region mapping gains an exit hook for this context. - Accept index-free shorthand without retained facts: a constructor whose ports are bare representations (with no repeated explicit slot), or a fixed component such as `p(0, cind(0))`, besides index-free scalar data. Its ports are its slots and representations in order. Fully explicit constructors and self-loops still need retained ports, and automatic ports are never paired across factors. - Give a tensor-free composite, such as a sampled coefficient, the empty boundary that admission gives tensor-free input. - Derive an opaque chain or trace rebuilt without facts from its syntax, explicit internal pairs included, and give the words it unfolds the ports that unadmitted parsing observes. * read direct tensor ports and carry leaf facts through dummy renaming Prefer retained raw facts and read eligible direct constructor ports in the requested index grammar. Share built-in signature checks between admitted parsing and regional lookup, including group representations and fixed-basis selectors. Carry raw ports through nested dummy renamings and publish only surviving leaves. Bracket selected closed tensor factors before scalar expansion. Match source leaves modulo their declared symmetry and reject ambiguous declared port orders across canonical dummy substitutions. * freshen colliding composite dummy indices during collection Fixes #385 * optimize tensor region projection and numerator transport Eliminate four-loop numerator generation regressions introduced by authoritative tensor metadata transport: - Match small source region sets directly in a pruned breadth-first walk instead of indexing every subexpression of the output payload, and skip allocating empty RawLeafInterfaces caches during projection. - Reuse a single SlotMatcher and read-only retained boundaries during RegionMapping, guard bottom-up AfterChildren mapping against re-invoking leaf_map on collapsed Fun/Var leaves while preserving computed scalar callbacks, and move mapped proofs directly into renamed_indices and map_produced_expression without throwaway root clones or redundant uncached intrinsic normalization re-walks. - Skip trivial scalar unit factors with empty index history in multiply_many and preserve the root interface in project_interfaces. - Transport explicit concrete-dimension diagram finalization numerators via translate_produced_with_labels with numeric-scalar short-circuiting and checked translate fallback for open ports or symbolic dimensions, run index-head translation bottom-up for nested labels, retain pre-decoded NumeratorSourceLabels on admitted interaction templates, and cache automatic external-state projectors in NumeratorCache.