Repository navigation
docs(language): the expressions page says why a case when: cannot compare expressions - #476
Merged
FBumann merged 1 commit intoSep 15, 2026
Conversation
…pare expressions The page stated the refusal and its rewrite in one sentence, and said nothing about what makes a case `when:` different from every other `where`. The reason is the apartness proof: the loader enumerates a grid from the values each mask names, and a comparison of expressions names none. The paragraph now gives the reason, quotes the loader's own message word for word, and says that a variable's `where` and a constraint's `where` are not held to the rule. Sentence measure on the page, by the script in the docs-writing skill: n 139 avg 17.5 median 16 over25 27 before, n 144 avg 17.2 median 16 over25 26 after. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011wswYDGW6H9n5Sod42NwUM
Documentation build overview
9 files changed ·
|
FBumann
merged commit Sep 15, 2026
8b84589
into
claude/zealous-archimedes-k13bq7-arithmetic-where
5 checks passed
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.
Stacked on #469. One paragraph of
docs/reference/language/expressions.mdis rewritten: it now gives the reason a casewhen:may not compare expressions, and quotes the loader's message word for word.What this changes
The paragraph, before and after
Before:
After:
Three things are new. The reason, which is the apartness proof rather than a general bar on complexity in a
when:. The message, quoted whole, asAGENTS.mdasks. The scope, which says that no otherwhereis held to the rule.The forward link lands on
#the-rules-that-keep-the-cases-apart, the section that owns the rule, so the fact keeps one home.Why
The reason the old sentence did not land
https://github.com/energy-models/math-spec/pull/469#discussion_r4017530831reports that the sentence does not read. It carried four claims in one 34-word sentence, and its subject was "a casewhen:that compares expressions", which cannot be proved apart from anything on its own. "Proved apart" is house vocabulary, and the section that glosses it sits 130 lines further down the page.The mechanism the paragraph now names is in
src/math_spec/exclusivity.py._Grid.ofwalks every atom of both masks and_observerecords the value each names,_cells_forturns each value into the regions around it, and_witnessevaluates both masks in every cell of the product. AnArithmeticComparisonNodenames no value, so_observeraisesUndecidable.Verified
uvvenv, Python 3.11, sincepixiis not installable in this environment:mkdocs build --strict: passes. The one error on an unmodified run isCouldn't load inventory https://docs.python.org/3/objects.inv, which this environment's proxy refuses; with those two lines removed frommkdocs.ymlthe build is clean, so the new anchor resolves.pytest tests/test_docs.py tests/test_reading_page.py: 34 passed.prettier --check,typos,reuse lint: clean.to_specraises for a two-case model split onc > 2 * k/c <= 2 * k. Identical.n 139 avg 17.5 median 16 over25 27before,n 144 avg 17.2 median 16 over25 26after.compile-tex,ruff,pyrefly,taplo,zizmor, and the rest ofpytest. No Python changed.Not done here
https://github.com/energy-models/math-spec/pull/469#discussion_r4017605575asks whether it could be._subject_ofalready gives every comparison of expressions one placeholder subject that nothing reaches, and keying that subject on the two sides, sharing it between a pair with complementary comparators, and giving it[True, False]cells the waylookup_pairdoes would provec > 2 * kapart fromc <= 2 * k. That is afeatonsrc/, and it belongs in its own PR with its own tests.🤖 Generated with Claude Code
https://claude.ai/code/session_011wswYDGW6H9n5Sod42NwUM
Generated by Claude Code