Repository navigation
feat(data): what a file assumes of its data is checked at the door, and a where may compare two parameters - #1637
Closed
FBumann wants to merge 4 commits into
Conversation
…nd a where may compare two parameters Follows math-spec to eeb38f6, the head of energy-models/mathspec#471, where a file states an `assumptions:` block and a where compares two parameters coordinate by coordinate. Both lanes read sources through `tidy_sources`, so the assumptions are checked there once every parameter is read: each entry's `holds` is evaluated through the relational lane's predicate compiler over the product its `where` admits, and the data is refused in the language's own sentence with the count and the first five failing coordinates. A missing row reads as false, as in any mask. `p_min <= p_max` in a where is answered on both lanes, false where either parameter has no row. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013HceuCYNepeQX8SdZtiMf1
…ssing are probed on both lanes The one guard the suite could not reach: the linopy lane masks the pair comparison by both rows being present, which only a `!=` over a hole can tell from reading the NaN. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013HceuCYNepeQX8SdZtiMf1
Merging this PR will not alter performance
Comparing Footnotes
|
FBumann
added this pull request to stack #1643
September 15, 2026 11:48
Its base carries main through the relations plan now, and the pin follows math-spec's assumptions branch onto the same base. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014pdMgEVkGBfh1f2AyiCSKA
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014pdMgEVkGBfh1f2AyiCSKA
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.
A file's
assumptions:block is checked at the door, once for both lanes, and the data refused in the language's own sentence with the failing coordinates; awheremay compare two parameters coordinate by coordinate, false where either has no row.Stacked on #1636. Follows math-spec to
eeb38f6, the head of energy-models/math-spec#471, itself stacked on #469. The regenerated gallery pages pick up the typesetter's new Assumptions section on the three piecewise models — the piecewise checks the language already made, now printed.How the check works
assumptions.py, called fromtidy_sourcesafter every parameter, dimension and lookup is read. Each entry'sholdsis evaluated by the relational lane's predicate compiler — the one reader of a mask this package has that needs no model built first, and the reader everywhere:goes through — over the product of the dims both masks name, restricted bywhere. The failing coordinates are the admitted product less the rowsholdskeeps, not the rows it drops: a mask certain of a parameter inner-joins it, so a coordinate with no row is gone from the carrier before the predicate is read, and that coordinate is exactly the one a missing row has to count as failing. The sentence isassumption_message's, then the count and the first five coordinates in the dimensions' own label order:Both lanes pass through
tidy_sources, soboth_lanes_refuseholds them to one sentence.attachis paid only by a program that declares an assumption.ParameterPairComparisonNode: the relational lane joins both parameters onto the carrier and compares the columns, both names certain under theANDspine; the linopy lane compares the two arrays and masks by both being present, sinceNaN != xis true in numpy.p_max > cost, refused before, moves from the refused list to the accepted sweep intest_resolution_parity.py.Mutation table
Taken by hand, tree restored through
git checkout --and__pycache__dropped on both sides, clean each time. Suite:tests/test_assumptions.py tests/test_resolution_parity.pyat4eda453e; the re-run addstests/test_where_arithmetic.pyat6894e2d8.validate_assumptionscall droppedwherenarrows the productframe(dims, None)& left.notnull() & right.notnull()droppedextra != costprobeVerified
Same uv venv as #1636, math-spec editable at
eeb38f6:ruff check .,ruff format --check .: clean.pyrefly check --python-interpreter-path <venv>: 0 errors.pytest -n 8at4eda453ebefore the gallery regeneration: 3764 passed, 328 skipped, 1 xfailed; 11 failed — 10[gurobi]/[xpress]cases with neither extra installed here, andtest_the_gallery_math_is_current, whichpython -m tools.gallery_maththen refreshed (the diff is the three piecewise pages' Assumptions sections). The docs tests and the touched files re-run green after.python -m tools.gallery_math --checkpasses.Not run:
pixi run checkas such, the docs build,test-bench.Not done
lps.checksays nothing about assumptions: it has no data, and the language already refuses an unresolvableholdsat load.diagnostics()does not report which assumptions were checked.assumptions.pyrather thanerrors.py: one module raises it.🤖 Generated with Claude Code
https://claude.ai/code/session_013HceuCYNepeQX8SdZtiMf1
Generated by Claude Code