feat: advice names the assumption that proves a quadratic objective or row convex - #747
Open
FBumann wants to merge 11 commits into
Conversation
…r row convex A new advice kind, convexity, fires where the problem class is undecided and one stated sign for the declaration's unsigned parameters would prove it convex. The note gives the single assumptions: entry to write. It is silent for a nonconvex declaration and for a cross term that no sign decides. examples/pypsa_quadratic.yaml states the note's assumption and is now provably convex. The golden model states cost > 0, which proves its maximized square nonconvex, so it still draws no advice and its legend still covers the nonconvex sentence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS
Documentation build overview
59 files changed ·
|
FBumann
added this pull request to stack #754
September 28, 2026 10:56
…nalysis-features-zy7x4n-convexity-advice Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS
…nalysis-features-zy7x4n-convexity-advice Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS
…nalysis-features-zy7x4n-convexity-advice examples/pypsa_quadratic.yaml is folded into examples/pypsa.yaml on main (#736), so the assumption this branch added to it goes with the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS
…nalysis-features-zy7x4n-convexity-advice Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS
…nalysis-features-zy7x4n-convexity-advice Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS
…nalysis-features-zy7x4n-convexity-advice Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS
…nalysis-features-zy7x4n-convexity-advice Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS
…nalysis-features-zy7x4n-convexity-advice Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS
…nalysis-features-zy7x4n-convexity-advice Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS
FBumann
pushed a commit
that referenced
this pull request
Oct 2, 2026
… so a subproblem is a call on the whole model Each named variable becomes a parameter under the same name: binary and integer become int, continuous becomes float. Its bounds become the assumption <name>_within_bounds, and a constraint that named only fixed variables becomes an assumption. A masked variable with absence: undefined keeps its meaning: each read outside a sum is proven guarded, masked at its row, or refused with the reader named. Ported from #748 onto main, without its base (#746, #747). A given variable is refused with a message that names it as given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XjTvqu5LubaVCgWeKogCqj
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.
What this changes
A new advice kind,
convexity, names the oneassumptions:entry that would prove an undecided quadratic objective or row convex. Stacked on #746; the base moves tomainwhen #746 merges.Rules, gate output, what was not done
When it fires
Per declaration: the parameters its quadratic terms leave unsigned are given one sign together,
>= 0then<= 0, and the verdict re-run. Where one sign proves the declaration convex, one note names them all. Onexamples/pypsa.yaml:It is silent for a declaration proven nonconvex (a model the author may mean), for a cross term no sign decides, for an equality, and where the two terms need opposite signs.
test_stating_what_the_note_says_proves_it_convexpastes the note'sholdsback into the spec and assertsconvex is Trueand no note.Fixture changes
tests/typesetting/golden/model.yamlmaximizessum(p * p * cost)withcostunsigned, andtest_check_accepts_the_model_that_carries_every_constructholds it to no advice. It now statescost > 0, which proves that square nonconvex: no note, and the legend still reaches the nonconvex sentence the golden coverage test counts. Statingcost <= 0would make it convex and leave the undecided and nonconvex legend lines unreached.tools/notation.pygains a heading for the new entry; golden output anddocs/reference/notation.mdare regenerated.tests/test_advice.py: a fixtureTHREE_KINDSadds a squaredxunderctomain's never-an-axis and unbounded fixture, and the every-kind test reads it withmain'sgivenfixture, since the test pins that everyAdviceKindis produced.examples/pypsa_quadratic.yamlthe note's assumption.mainfolded that file intoexamples/pypsa.yaml(docs(pypsa): the pypsa spec is also 24 topic files that merge back to it, each component adding its share of a sum by name #736), so the change went with it; no example changes here.Guards
two-at-once(both signs provec * kconvex)<=tried with the non-positive signmaximized,an-at-least-rowA first draft skipped declarations whose verdict was not undecided. No test failed without it: a note needs an unsigned parameter, and neither a convex nor a nonconvex verdict turns on one. It was removed.
Gates
pixi run lint: pass.pixi run test: 2688 passed, on the merge ofmainat 22cdebd.docs-buildandcompile-texdid not run to completion in the session: its network blocksdocs.python.organd the Tectonic bundle. CI runs both.Open, for review
examples/pypsa.yamlthe objective's note asks for every quadratic cost, weight andCVaR_omegato be<= 0. The objective reads(1 - CVaR_omega), which onlyCVaR_omega <= 1signs; a sign set of {-1, 0, 1} cannot state that bound, so>= 0fails and<= 0proves the objective convex. The proof holds, but PyPSA data never meets it.Not done
Why
A spec whose convexity turns on an unstated sign usually has an author who knows the sign. The note turns that into the one line to write.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CvcU9JRnsinc9e9syvVcHS