Repository navigation
feat(advice): check advises on a tuple cross product - #1026
Draft
FabianHofmann wants to merge 4 commits into
Draft
FabianHofmann wants to merge 4 commits into
FabianHofmann wants to merge 4 commits into
Conversation
An entry whose dims: lists a dimension with members beside one of its members, or two such dimensions that share a member without a where: that compares it, loads as the cross product. advice() now returns a note of kind cross-product for it, naming the likely rewrite: at(...) or a sum to the member, or the inner-join filter. Rule 11 of #1011.
Documentation build overview
25 files changed ·
|
- an entry that reads an operand over both the dimension and its member gets no note: it asks for the product, and the rewrite would be refused - a declaration gets only "drop 'unit' from dims:" or "drop 'connection' from dims:", with no call to an operand it does not have - a member under two roles is named as one full call per role, and the join as trade[dst] (or trade[src]); trade[dst or src] did not parse - every operand over the member is named, not only the first - a named expression over two dimensions that share a member is advised itself, unless an entry whose dims: lists both reads it
…ple-advice # Conflicts: # docs/reference/language/dimensions.md
This branch has not been deployed
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.
Note
The following content was generated by AI.
mathspec checkadvises, and does not refuse, wheredims:crosses a tuple dimension with its own member or with another tuple dimension that shares one.Part of #1011 (rule 11). Stacked on #1025. Last PR of the stack: Closes #1011. Closes #935.
pixi run python -m mathspec check example.yaml, exact output:Each suggested rewrite loads, and the note goes away. A member under two roles gets one full call per role:
Method, gate output, choices, not done
Triage (limits.md): no construct. A new
Advicekind in the existing door (_advising.py); no new layer. limits.md unchanged: no limit moves.Rule
AdviceKind'cross-product'; order: never-an-axis, cross-product, given, unbounded. Subject: the entry.dims:sharing members → one note per pair, unless every shared member is compared with==in a top-levelANDconjunct ofwhere:(either side order).!=, or the join underOR, still advises. Suggests only the members not yet joined.at(...)each) and every operand over the dimension (sum(...)each). A side with no such operand, e.g. a declaration, says onlydrop 'unit' from dims:.or; in (a)trade[dst] (or trade[src]).Entries advised: parameters, variables, constraints, piecewise (
dims:+where:), named expressions. A named expression takes nowhere:: (a) goes to the entry that reads it when that entry'sdims:lists both; otherwise to the named expression itself, naming where the filter goes. Given entries: no; the file that builds them gets the note. Afterexpand(), the note moves from the curve to the weight variables it writes (the rows read them over both, so they get none).Tests:
test_tuple_dimensions.py: 15 advised cases, each applying every rewrite its note names (all roles) and loading it without the note; 11 silent cases (operands over both, given parameter, curve link over both, join through a role, named expression whose reader filters or is advised); rename / merge / override × 2; expand.test_advice.py: one fixture so every kind is still produced.Guard removal (each deleted, full suite run)
==dropped → 1; only unjoined members suggested → 1 (measured on 30c39a5)Gates
pixi run cipasses on 7535e5c (after merging feat(language): at spreads a tuple over its members #1025 head 2d66182): lint, 4393 tests (1 skipped), docs-build--strict, compile-tex (62 documents).Docs: dimensions.md (both rule-11 paragraphs, operands over both,
expand(), named expressions), errors.md (kind table). check.md and reading.md unchanged.Where #1011 is silent or off
where:today (refused at load: no frame); so only an inline comparison silences (a).Not done
shiftalong the tuple dimension stays refused. Noin:,maps:, linopy.trade[dst or src]; out of scope here.Co-Authored-By, by the user's rule.Generated by Claude Code