Wire weighted path selection as a grounded sink - #101
Open
MesTTo wants to merge 4 commits into
Open
Conversation
Exposes the WeightedPathIndex select_by_offset primitive as a grounded sink `(wselect <offset> <item> <weight>)`, behind a default-off `weighted_select` feature, instead of leaving it as an un-wired island. Each matched fact contributes (item, weight); weights accumulate into the signed index via apply_delta, and at finalize the item at cumulative-weight <offset> (deterministic inverse-CDF selection) is written back as a `(wselected <item>)` atom that ordinary queries read. Numbers are decimal-digit symbols parsed as SumSink parses its weights; modeled on the write-back sinks, nothing reimplemented. Feature-gated so the default build is unchanged (0 regressions). Two end-to-end tests cover the cumulative-offset selection and the out-of-range guard; runnable resources/weighted_select.mm2. Soundness of the partition is modeled in Alloy (fac24_weighted_select in MesTTo/alloy-mork).
MesTTo
force-pushed
the
pr/mork-weighted-selection-tree
branch
from
July 3, 2026 21:16
d590652 to
c86debc
Compare
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.
Exposes the weighted-path
select_by_offsetprimitive as a grounded sink(wselect <offset> <item> <weight>)behind a default-offweighted_selectfeature, rather than leaving it an un-wired module. Each matched fact contributes (item, weight); weights accumulate into the signed index, and at finalize the item at cumulative-weight<offset>(deterministic inverse-CDF selection) is written back as a(wselected <item>)atom that ordinary queries read. Numbers are decimal symbols parsed the way SumSink parses its weights; modeled on the write-back sinks.Feature-gated (default build unchanged, 0 regressions). Two end-to-end tests (cumulative-offset selection + out-of-range guard) and a runnable
resources/weighted_select.mm2; the selection-partition soundness is modeled in Alloy (github.com/MesTTo/alloy-mork: fac24).