feat(program): a where leaf carries the dims it is read through, so any predicate answers its own questions - #324
Closed
FBumann wants to merge 7 commits into
Closed
Conversation
FBumann
force-pushed
the
feat/leaf-dims
branch
from
September 1, 2026 14:36
1dacaa5 to
412e132
Compare
Documentation build overview
7 files changed ·
|
…ny predicate answers its own questions Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D59sEp5d7CecJAwrzACbRh
FBumann
force-pushed
the
feat/leaf-dims
branch
from
September 1, 2026 14:42
412e132 to
de8f76d
Compare
… root, and the remainder folds to the empty mask Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D59sEp5d7CecJAwrzACbRh
…o a derived mask keeps the literal at its root or nowhere Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D59sEp5d7CecJAwrzACbRh
…symmetric with a declaration's Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D59sEp5d7CecJAwrzACbRh
… and a mask folds itself at construction Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D59sEp5d7CecJAwrzACbRh
…rator, rather than an unused twin Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D59sEp5d7CecJAwrzACbRh
…d travels only as a Mask, negated by ~ Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D59sEp5d7CecJAwrzACbRh
This was referenced Sep 1, 2026
Contributor
Author
|
Note The following content was generated by AI. Superseded by #327, which combines the reviewed stack into a single diff on the maintainer's call. The review history — two consumer reviews and one consolidated agent review, with mutation tables — lives in this stack's bodies; the tree at #327 is byte-identical to the stack's top. |
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.
The three leaf classes that name a parameter or variable —
ParameterComparisonNode,ParameterDefinedNode,VariableDefinedNode— carrydims: tuple[str, ...], stamped by resolution off the declaration, exactly as a lookup leaf carriesover. Everything downstream of the old name→dims mapping then falls:Maskis root-only again —dimsbecomes a derived property likeconjuncts, the one denormalized field in the vocabulary is gone, and a hand-builtMask(root, wrong_dims)stops being expressible.Mask(NotNode(root))andMask(a) & Mask(b)answerdimscorrectly with no mapping — the consumer's region complements and conjunctions stay in-language.Mask.negated()carries the double-negation fold (previously private inlowering._negated, re-derived without the fold downstream — one rule, two homes, one wrong) and&the conjunction.NameDims,dims_read,dimensions._name_dims,_Lowering.name_dimsall die, and freeatoms/names_readfollowconjunctsinto privacy —Maskis now actually the one public door, closing the asymmetry the review named.Namespacegains the name→dims map resolution stamps from — the fact's one home, beside the dtypes it already carries.What lpspec removes or changes
PolarsCompiler.name_dimsand everydims_read(root, mapping)call site collapse toMask(root).dims;NotNode(r.when)for complements becomesr.when.negated()and gains the fold it was missing;both_regions'AndNode(a, b)can stay or becomeMask &. Nothing keeps a name→dims copy anywhere.Verified
pixi run ciexit 0: lint clean, 938 passed (931 + synthetic-predicate dims, the fold and algebra tests, the unresolved-refusal pin, the load-refusal cases, and a double-negation case on the load path),mkdocs build --strictbuilds, 27 TeX documents compile.schema/and golden outputs byte-identical.The literal invariant, after the consolidated review — one fold, applied at the door, with the crashing shape refused at load:
Truemakes every other arm unreachable,Falsenever applies, and the typesetter has no region to draw for either (itsassert not node.valuecrashed on the shape before). The refusal names the rewrite; the crash class predates the stack._foldhas one home (program, beside the vocabulary), now cancels a double negation, and is applied inMask.__post_init__— soMask(OrNode(True, x)), the composition the docs invite, folds at the door,negated/&shrink to one-liners, and__or__completes the algebra. Resolution imports the same fold forwhere_ofand case arms (via an_arm_maskhelper whose docstring carries the kept-literal reason).Mask.__post_init__exhausts_atoms, soMask(parse_where(...))raises at construction —conjuncts,negatedand&can never see an unresolved leaf a raisingatomswould have caught later.node.dims), retiring its three schema re-derivations — the second home this PR exists to delete.Mutation table
Each guard deleted in turn on the committed tree, restored with
git checkout --:()on parameter comparisons_atoms' unresolved arm deleted_fold's double-negation cancel droppedTrade named: resolved trees are now spec-bound — a leaf embeds its declaration's dims — which they already were in substance, being typed against the namespace. A hand-built leaf with wrong dims is still expressible; the trust boundary moves to resolution, where it already lives for
over.Stack: fifth, on #323 → #321 → #319. Supersedes the stored-
dimsdesign #319 introduced and retracts #321's "free question functions stay public" line — with the resolution the same reviewer proposed in its place.