Give CompactType's refinement slot the None sentinel its shape slots carry - #115
Open
dpmills wants to merge 2 commits into
Open
Give CompactType's refinement slot the None sentinel its shape slots carry#115dpmills wants to merge 2 commits into
CompactType's refinement slot the None sentinel its shape slots carry#115dpmills wants to merge 2 commits into
Conversation
Contributor
Author
|
This change is part of the following stack:
Change managed by git-spice. |
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 20, 2026 20:51
b188b46 to
693f95d
Compare
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 20, 2026 23:24
693f95d to
e7ce9db
Compare
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 21, 2026 04:29
e7ce9db to
97b813f
Compare
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 21, 2026 04:39
97b813f to
e54152e
Compare
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 21, 2026 04:55
e54152e to
64bd663
Compare
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 21, 2026 05:47
64bd663 to
ffceb03
Compare
This was referenced Aug 21, 2026
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 21, 2026 18:41
ffceb03 to
2dceea3
Compare
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 21, 2026 19:42
2dceea3 to
456fae2
Compare
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 21, 2026 20:45
456fae2 to
0131efc
Compare
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 21, 2026 22:23
0131efc to
01f4c60
Compare
CompactType's claim slot the None sentinel its shape slots carryCompactType's refinement slot the None sentinel its shape slots carry
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 22, 2026 00:08
01f4c60 to
fe7fee9
Compare
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 22, 2026 00:22
fe7fee9 to
5282a5a
Compare
dpmills
force-pushed
the
dmills/not-a-value
branch
2 times, most recently
from
August 22, 2026 00:46
53e8425 to
7638303
Compare
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 22, 2026 01:06
7638303 to
063e13a
Compare
…ots carry `CompactType::merge` could not tell "no refinement contribution here" from "a value that guarantees nothing": both were the empty `RefinementSet`, and an empty set is absorbing under the positive intersect, so a bare variable's contribution erased refinements a sibling bound established. Three places worked around that — `merge`'s `imposes_nothing` guard, the bound fold keeping the variable out until the end, and the opposite-polarity fallback's refinement union. `refinements` becomes `Option<RefinementSet>`, the sentinel `rec`, `var`, and `fun` already carry, with `None` as the merge identity; a hole and a bare variable are the only contributions that are not values and keep it, and `CompactType::value` builds the rest. `dissolve_read_feeds`' reconstructed channel now imposes nothing rather than an empty refinement set — it re-expresses content already at the position rather than arriving as a second bound — so a refined feed read keeps its refinements. Nothing else changes behavior: the suite passes forward, under `DEEP_TYPECHECK=1`, and under `CAMBRA_REFINEMENT_ORDER=reverse`.
`CompactType::refinements` documents that `None` is the merge identity and belongs to exactly the two contributions that are not values — a hole and a bare variable — while `Some(empty)` is a value guaranteeing nothing. Nothing in the type system says so: every value-shaped arm has to be built from `CompactType::value`, across a dozen construction sites, and a position that carried content with the slot absent would absorb a sibling bound's refinements instead of intersecting with none of its own, so `Int` joined with `{Int | p}` would keep `p`.
`refinement_slot_present` is that post-condition, checked on `compact_type_with`'s output and on every recursive-variable bound it recorded. Variable contributions are not content: a bare variable's whole content is its identity, so `vars` is the one populated field the slot may accompany as `None`.
Three tests keep the checker from being vacuous — it accepts the hole and the bare variable, and rejects content with the slot absent both at the root and below it. The whole suite passes with the assert live, so the invariant holds on every program the corpus compiles.
dpmills
force-pushed
the
dmills/not-a-value
branch
from
August 22, 2026 03:43
063e13a to
fcfc727
Compare
dpmills
marked this pull request as ready for review
August 22, 2026 03:49
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.
CompactType::mergecould not tell "no refinement contribution here" from "a value that guarantees nothing": both were the emptyRefinementSet, and an empty set is absorbing under the positive intersect, so a bare variable's contribution erased refinements a sibling bound established. Three places worked around that —merge'simposes_nothingguard, the bound fold keeping the variable out until the end, and the opposite-polarity fallback's refinement union.refinementsbecomesOption<RefinementSet>, the sentinelrec,var, andfunalready carry, withNoneas the merge identity; a hole and a bare variable are the only contributions that are not values and keep it, andCompactType::valuebuilds the rest.dissolve_read_feeds' reconstructed channel now imposes nothing rather than an empty refinement set — it re-expresses content already at the position rather than arriving as a second bound — so a refined feed read keeps its refinements. Nothing else changes behavior: the suite passes forward, underDEEP_TYPECHECK=1, and underCAMBRA_REFINEMENT_ORDER=reverse.Asserting it
CompactType::refinementsdocuments thatNoneis the merge identity and belongs to exactly the two contributions that are not values — a hole and a bare variable — whileSome(empty)is a value guaranteeing nothing. Nothing in the type system says so: every value-shaped arm has to be built fromCompactType::value, across a dozen construction sites, and a position that carried content with the slot absent would absorb a sibling bound's refinements instead of intersecting with none of its own, soIntjoined with{Int | p}would keepp.refinement_slot_presentis that post-condition, checked oncompact_type_with's output and on every recursive-variable bound it recorded. Variable contributions are not content: a bare variable's whole content is its identity, sovarsis the one populated field the slot may accompany asNone.Three tests keep the checker from being vacuous — it accepts the hole and the bare variable, and rejects content with the slot absent both at the root and below it. The whole suite passes with the assert live, so the invariant holds on every program the corpus compiles.