Repository navigation
feat(language): a case may branch on at(…, by=…) - #1012
Draft
FabianHofmann wants to merge 23 commits into
Draft
FabianHofmann wants to merge 23 commits into
FabianHofmann wants to merge 23 commits into
Conversation
Two `when:` strings that read a condition through the same relation and columns reach one row, so the exclusivity check compares the conditions they read instead of refusing the pair as undecidable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F4nx8HNM3uZTJUHnUs1cr9
The undecidable refusal test now pins what loads and what overlaps, and the PyPSA reference tests key their hand-built grid as the prover does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F4nx8HNM3uZTJUHnUs1cr9
FabianHofmann
requested review from
FBumann and
brynpickering
as code owners
November 16, 2026 10:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F4nx8HNM3uZTJUHnUs1cr9
Documentation build overview
51 files changed ·
|
FabianHofmann
marked this pull request as draft
November 16, 2026 11:12
The fleet fuzz reads each atom off concrete fleets instead of the prover's own cells, and covers nested reads, dimension tests under a read and condition references. The case-when test asserting two behaviours is split in two.
FBumann
reviewed
Nov 16, 2026
Contributor
There was a problem hiding this comment.
@FabianHofmann I would like to reuse as many primitives and meanings as possible if its genuinely the same thing.
Here are some things id like to change. You don't have to apply all of them
Note
The following content was generated by AI.
Naming: one idea, three words. Users read "through" (docs, JoinedCondition docstring, the new witness). The code adds Hop and via.
| now | proposed | why |
|---|---|---|
Subject.via |
through |
the word __str__ prints from it: "kind through up[parent] through tech_of[tech]" |
Hop |
Lookup |
program.py calls this "a lookup Join"; soundness rests on one row per step. Not Read: _read() exists |
Via alias |
drop, tuple[Lookup, ...] |
one more name for a short tuple |
Hop.columns |
roles |
holds join.dropped, which JoinColumns calls roles; columns already names the JoinColumns on JoinedCondition |
_reads |
_every_atom |
yields every atom, not only reads |
_rows_under |
_rows_holding |
its docstring: "the rows that hold subject's value" |
Subject._own |
_bare |
the label without the chain |
- Why not
byfor the field:- it holds a chain of
by=arguments, not one; "kind by tech_of[tech]" does not read, so field and witness would differ sum(…, by=…)groups many rows; the chain is sound only because each step reads one row
- it holds a chain of
- Kept: the witness wording, the test names.
- Title: "…relation load" reads as a noun until the second pass. Refused by design on
main, sofeat:
feat(language): a case may branch on at(…, by=…)(49 chars)
Generated by Claude Code
This was referenced Nov 16, 2026
… does Subject.via is through, Hop is Lookup with roles, the Via alias is gone, and _reads, _rows_under and _own are _every_atom, _rows_holding and _bare.
Contributor
Author
|
Note The following content was generated by AI.
Generated by Claude Code |
# Conflicts: # CHANGELOG.md
`from_region: { alias: region }` has the labels, dtype and order of
`region` under a second name, so an entry can be over one set twice, as
TIMES' IRE_FLO is over two regions. The alias implies the relation
`from_region`, keyed by the alias with the value column `region`, read
`from_region[region]`, from each label to itself. It prints as the
primed index of `region` over the same set.
Ported onto main from #1020, where the identity read was a mapping of
#1015. A relation the file declares under the alias's name is refused
with the rewrite that deletes it.
(cherry picked from commit d924d66)
A reduction over a dimension primed its dummy once per enclosing use,
so inside an entry over an alias of that dimension it took the alias's
own index and printed `w_{g',g'}`. The dummy now primes past every index
another dimension prints with.
(cherry picked from commit 29973cd)
`exchanged` sums over `bus` inside a sum over its alias `from_bus`, so the golden model reaches the line that primes a dummy past the alias. (cherry picked from commit 84ba347)
IRE_FLO reads each region and commodity twice. With an alias for each, the spec states it over the regions and commodities themselves, and the workaround through an invented trade_link dimension goes. Ported from #1020; top_ire is keyed by its five columns on main.
The relation an alias implies has a column over the alias and one over the dimension it aliases, so it counted as a use of both, and an alias no entry is over drew no never-an-axis advice. An implied relation now reaches no dimension, and an alias in use reaches the dimension whose labels it has.
Program.relations names the implied relation beside the declared ones, and that a tool takes its rows from the labels of the alias.
`where: "from_g[g] == 'a'"` was refused as a column of a dimension, since a side named after a dimension never reached the relation the alias implies. A side that reads a column now reads the relation of that name, as #1020 read its mapping.
…e-exclusivity-at # Conflicts: # CHANGELOG.md
Under an entry over [from_g, g], sum(sum(w, over=g), over=from_g) printed both dummies as g'': the inner dummy primed past every dimension's index but not past the dummy of the sum around it. A dummy now also skips each index an enclosing reduction or lookup prints. The goldens do not change.
Along an alias of an unordered dimension, shift, sum_back, position, a type 2 set and a piecewise curve said to declare the alias ordered, and a label outside one_of said to add it to the alias's one_of. An alias may carry neither, so both now name the dimension it aliases. A relation declared under an alias's name is told to be deleted only where it restates the implied relation; any other collides with the dimension as usual.
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.
Two cases whose
when:read a condition through the sameby=are told apart by what they read, so the entry loads.Base: the alias PR #1029, merged into this branch; GitHub's stack blocks the retarget, so the base still reads
mainuntil the stack is updated.tech_of[tech]vsbackup_of[tech]), overlapping inner conditions, one parameter read at the coordinate's tech and through the row, a nested read vs its inner read alone.feat, notfix:mainrefuses this read by design.atin bounds) and the tuple-dimension PR stack on this branch.Method, gate output, alternatives
atnames value columns and groups by the whole key, so a coordinate reads one row. Same relation + same named columns → same row → same label. Atoms under a read become subjects tagged with the chain of reads (kind through up[parent] through tech_of[tech]). Different relations, or the same parameter outside the read, stay separate subjects: over-approximation, never a hidden witness.TestAConditionReadThroughARelation: 5 apart, 5 still refused, incl. a nested read on both sides and a nested read vs its inner read.FLEETgains a self-mapup: {key: tech, values: {parent: tech}}.test_a_read_through_a_relation_proved_apart_stays_apart_in_every_fleet: ground truth is each atom read off 2592 concrete fleets (one unit, techs t1/t2, each row oftech_of/backup_of/uppresent or not,kinda/b/c/absent), not the prover's_evaluate. Atoms cover nested reads,tech == 't1'under a read,is_aunder a read, relation columns. 2 seeds × 2000 pairs, ~1.3 s each._every_atom,_atom) → 3 fail (fuzz ×2,a-read-inside-another-and-the-inner-read-alone); passed every test before this revisiona-read-and-the-missing-row)id(node)alone → 3 fail (fuzz ×2,one-condition-at-the-coordinate-and-through-a-row)_rows_readinto_atom, so_subject_ofkeeps itsJoinedConditioncase (dropping that one instead needs a narrower type forassert_never, and more lines).test_validation.py::test_a_read_through_a_relation_is_undecidable_in_a_case_whenasserted the old refusal. Now two tests: the read and its negation load; the read besidec > 0is a true overlap with a witness.tests/test_pypsa_references.pybuilds a grid by hand: key changed to((), id(atom)).Subject.through,Lookup.roles,_every_atom,_rows_holding,_bare; witness wording unchanged.named.md#refused-cases.pixi run lintandpixi run cipass (4210 passed, 1 skipped; docs-build strict; compile-tex 59 documents).at(kind, by=r[c]) == 'a'. Astrparameter cannot sit in an expression, so it is refused before exclusivity, as onmain. A numericat(x, by=…) > 3is a comparison of expressions, so still refused as undecidable.countandshiftin awhen:unchanged.Generated by Claude Code