Conversation
…ntraction Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SWBcNGLjNH2i4AqRsfyxaN
…on and groups by The program's `Direction` is now `Join`, with `joined` and `grouped` roles in place of `consumed`, `produced` and `joined`; `Pullback` is `Lookup`, a join with no group-by; a partition's `group` is `grouped`. Every refusal, docstring and page says join and group-by in place of consume, produce and land on. The YAML surface is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SWBcNGLjNH2i4AqRsfyxaN
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SWBcNGLjNH2i4AqRsfyxaN
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SWBcNGLjNH2i4AqRsfyxaN
Documentation build overview
16 files changed ·
|
Main's new uses of Direction, Pullback and a partition's group take the renamed names. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SWBcNGLjNH2i4AqRsfyxaN
`GroupSum` and `Lookup` are one node, `Join`, and `sum(by=)` lowers to the existing `Sum` over it, its `over` the dims the join drops; `at` lowers to the bare `Join`. The columns a call names move to `JoinColumns`. The YAML surface is unchanged. Claude-Session: https://claude.ai/code/session_01SWBcNGLjNH2i4AqRsfyxaN Co-authored-by: Claude <noreply@anthropic.com>
FabianHofmann
left a comment
There was a problem hiding this comment.
@FBumann thanks for tackling this. this logic is indeed much more aligned to what happens. the process essentially is joining and summing. good that we reflect it now
|
Yes. Very sharp of @coroa to press on it! I would leave this here until he has time next week. If you want, we could discuss syntax based on this better internal implementation. The neat thing here is that joining and suming is now essentially just chained operations. So we can also joind and then do a mean (if we impement mean). This could enable a different syntax naturally. Maybe sth in the direction of Maybe its not a good idea, but the Architecture would enable it now I think. Just a first idea. |
|
Superseded by #641 |
Note
The following content was generated by AI.
What this changes
Every relation call is described by two questions per column, joined on and grouped by, and the program has one relation node,
Join.at(x, by=R, over=a, into=b)lowers toJoin(x, columns).sum(x, by=R, over=a, into=b)lowers toSum(Join(x, columns), over=<the dims the join drops>), theSumnode that already exists. The YAML surface is unchanged. #607 landed here, so this is the vocabulary and the refactor it points at in one PR.The break, for a consumer of
math_spec.program.Direction,GroupSumandPullbackare gone.Joinis the one relation node, withoperandandcolumns.JoinColumnsholds what a call named:joinedandgroupedroles, withdropped,addedandkeptderived, each with a_dimsform.Partition.groupisPartition.grouped. The parser nodeDirectionNodeisJoinNode, withcolumns.fan_inreportsJoinas one-to-one and theSumover it as many-to-one, as before.mainis merged in at alpha.111; its new uses of the relation nodes inProgram.names_read, the typesetter andtest_loweringtake the oneJoin.Where the words changed
(operand − joined) ∪ groupedin_join_dims;_directionin resolution is_join, and the single-valued test isone_row_per_group.tests/test_validation.pyandtests/test_dimensions.pyassert the new wording in place.docs/about/relations-as-linear-maps.md, states what a relation is as an indicator, why the join and group-by are one contraction, and where the built model departs from the matrix. Its argument was checked numerically in the session: rows built by lpspec throughsum(by=)equal the indicator matrix from the data, and theatrows equal its transpose.Why one node is the same model
The absence page already describes the composition. Out of a
Sum, an absent summand is one term fewer and the row stands; out of a bare join, absence spreads. Those are today'ssum(by=)andatsemantics, so nothing on that page moves. The frame rule composes the same way: the join adds the grouped dims and keeps the joined ones, the sum drops the dimsover=named. The dim checker and the typesetter read the resolved AST, not the program, so neither changed beyond the names.Separability keeps its verdicts: a
Sumwhose operand is aJoinreports the grouping message for the dims it drops, and thatJoinis not also reported as an undecided coordinate read.tests/test_separability.pypasses unchanged.Coverage that moved
test_lowering.py: the lowering cases andtest_a_relation_lowers_with_the_join_each_call_namesassertSum(Join(...), over)andJoin(...); the fan-in table has the same two rows in the new shape;test_a_divisor_under_a_join_is_still_nameddescends throughJoin.tests/fixtures/every_program_node.yamlis unchanged:groupedandlooked_upboth reachJoin, andreducedreachesSum, sotest_every_program_node_is_one_some_file_lowers_toholds with two nodes fewer.test_golden.CARRIERSnamesJoinColumnsin place ofDirection.Gates
pixi is unavailable here, so the gates ran from a uv venv on Python 3.12, on the head with
mainmerged.pytestruff check,ruff format --checkmkdocs build --strictdocs.python.orginventory dropped for the run;tests/test_docs.pyholds every generated page current after itprettier --checktools.schema,tests.typesetting.golden, the four page generators.outfiles by the three renamed constraintscompile-tex,typos,reuse lint,pyreflyWhy
The three roles, consumed, produced and joined on, were bookkeeping that hid the mechanism. Each column of a relation is either joined on or not, and either grouped by or not, and every rule on the relations page falls out of that:
over=is joined on and not grouped by,into=is grouped by and not joined on, an unnamed key column is both, an unnamed value column is neither and so is not read. Asumwhose grouped columns hold the whole key groups nothing, which is whatatis.Two nodes that carried the same columns and differed only in whether a group-by followed welded the join and the sum into a third kind of reduction. With the join as its own node, the program is the relational algebra the words describe: one join, and the sum you already have over it. lpspec already computes it that way, one join with no aggregate and a drop of dims, both collapsing in the terminal group-by, so its engine loses a branch rather than gaining one.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SWBcNGLjNH2i4AqRsfyxaN