Skip to content

samples: require the selected value in match providers and pin the joined wording - #8512

Merged
Smotto merged 6 commits into
mainfrom
claude/project-thread-wxvuj1
Dec 4, 2026
Merged

Smotto merged 6 commits into
mainfrom
claude/project-thread-wxvuj1

Conversation

@Smotto

@Smotto Smotto commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Jarod · project thread

A helper that reads the value a match selected was refused with "cannot prove requires contract for call" even where the program establishes the fact the read needs. While this PR was open, main landed the same three checker changes it made (#8472 crosses a referenced scalar into a private helper and gives a provider's witness the helper's inferred inputs; #8454 drops a join arm a literal subject rules out). This PR now keeps main's code and adds the tests, sample fixes and expectation updates that finish the four families. All 74 samples in them now pass.

Sample changes

  • match_primitive_local_origin/target_body and match_join_place_read/target_body (and their twins) declared a provider trait and implementations with no requires, then read a value that only one caller makes 17. The spec says an implementation checked against a declared requirement never gets inferred narrowing, so the checker is right to refuse them. I added requires chosen == 17 (and requires chosen.kept == 17) to the requirement and both implementations, as match_reference_referent/target_body already does. This edits the sample programs, not only their expectations. The twins still differ from the positives in the same one place.
  • The nine match_reference_referent reject twins pinned the retired wording match choose() { ... } == 17. They now pin $joined == 17 and the fact $place == 17. The nested twin names pick and entry, the machine and state that make the call.
  • READMEs of the four families describe the current verdicts.

Tests

Three accept/refuse pairs in lowered-program-to-checked-program: a_private_helper_learns_the_scalar_behind_a_reference_argument, a_join_ignores_the_arm_a_literal_subject_rules_out, and a_provider_passes_its_requirement_to_a_private_helper (a shared-reference case beside main's @mutable provider test). The entry_inputs.rs header now says a referenced scalar crosses.

TASKS.md: the requires-contract sector drops from 40 to 14 samples.

Gate: RC-SOURCE-SEMANTICS | a helper can read a match-selected value when its caller, its provider's requirement, or a literal match subject establishes the required fact
Spec: wiki/spec/language/state_contracts.md#private-entry-inference, wiki/spec/language/state_contracts.md#unreachable-branches, wiki/spec/terminal-psi/fact_validity.md
Proof: omega --check --target linux_x86_64 on all 74 samples of the four families after merging main at 6ade312: every positive accepted and every twin refused with its pinned text; the four new or touched tests pass | the full lowered-program-to-checked-program lib run was killed for memory on this host, and five tests that touch none of this PR's files failed in it (this PR changes no non-test code there beyond a doc comment)

Agent: Claude Code | Model: claude-fable-5-2 | Effort: low | Tokens: unavailable in (unavailable cached), unavailable out | Steps: unavailable | Time: unavailable | Steers: 0


Generated by Claude Code

A helper that reads the value a match selected was refused with "cannot
prove requires contract for call" in three situations where the fact it
needs is established. The checker now carries that fact in each of them,
and the twin programs that select the other value are still refused.

A private helper that omits `requires` may rely on what every caller
proves. The checker already told such a helper what a record field behind
a reference holds. It now also tells it what a reference to one scalar
holds, so `apply(chosen: @i64, ...)` called with a reference to 17 can
pass that reference to a reader that requires `$place == 17`.

A provider's conformance witness reads the bodies of the helpers the
provider calls. It checked them for every possible input, while the root
checked them under the conditions their callers establish, so a helper the
root accepted was refused in the witness. The witness now treats a helper
as private when the root did, and stage 06 infers its inputs from the calls
the witness contains.

A join's predicate lists what each arriving edge knows. An edge whose own
facts contradict each other, such as the `false` arm of a match on a local
bound to `true`, used to stay in that list without its contradiction, so
the join could not rule the arm's value out. Such an edge now adds no
alternative. Its arrival must still prove the predicate from the same
contradiction.

Samples: the `target_body` programs of match_primitive_local_origin and
match_join_place_read now state the requirement on the provider trait and
its implementations, as the spec requires of an implementation and as
match_reference_referent already does. Eighteen reject twins pin the
wording the compiler prints today.

Agent: Claude Code | Model: claude-fable-5-2 | Effort: low | Tokens: unavailable in (unavailable cached), unavailable out | Steps: unavailable | Time: unavailable | Steers: 0
…-wxvuj1

# Conflicts:
#	source-rust/subsystems/compiler/source-to-psi/pipeline/06_lowered-program-to-checked-program/src/control_flow/joins/description.rs
Agent: Claude Code | Model: claude-fable-5-2 | Effort: low | Tokens: unavailable in (unavailable cached), unavailable out | Steps: unavailable | Time: unavailable | Steers: 0
@Smotto Smotto self-assigned this Dec 4, 2026
…-wxvuj1

# Conflicts:
#	TASKS.md
#	source-rust/subsystems/compiler/source-to-psi/pipeline/06_lowered-program-to-checked-program/src/control_flow/joins/description.rs
…-wxvuj1

# Conflicts:
#	TASKS.md
#	source-rust/subsystems/compiler/source-to-psi/pipeline/05_prepared-typed-trees-to-lowered-program/src/read/bodies/machine/components.rs
#	source-rust/subsystems/compiler/source-to-psi/pipeline/06_lowered-program-to-checked-program/src/storage/places/bindings/call_observations.rs
#	source-rust/subsystems/compiler/source-to-psi/pipeline/06_lowered-program-to-checked-program/src/tests/calls/boundaries/provider_supplies.rs
…-wxvuj1

# Conflicts:
#	TASKS.md
#	source-rust/subsystems/compiler/source-to-psi/pipeline/06_lowered-program-to-checked-program/src/calls/entry_inputs/entry_inputs.rs
#	source-rust/subsystems/compiler/source-to-psi/pipeline/06_lowered-program-to-checked-program/src/tests/calls/inputs/entry_inputs.rs
@Smotto Smotto changed the title psi: carry caller facts into helpers that read a match-selected value samples: require the selected value in match providers and pin the joined wording Dec 4, 2026
@Smotto
Smotto merged commit 228bbd8 into main Dec 4, 2026
1 check passed
@Smotto
Smotto deleted the claude/project-thread-wxvuj1 branch December 4, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants