Repository navigation
Preserve match-refined Data views in copyable lets - #1369
Conversation
|
Joint verification with #1368, #1370 and #1371 now passes on upstream #1368 and this PR touch the same let block. The resolved version opens All 93 existing proof fixtures have identical result classifications before/after the combined fixes: 58 successful, 35 unsuccessful, no new regressions or timeouts. The unchanged repository gate passes 50/50. The deep Array round trip prints |
# Conflicts: # bend2/safe.ts
|
Updated the PR itself after #1368 merged: merged |
… a let The let_term special case only covered `+copy = proof`. The root cause is tree() deciding a doubly-used λ variable's kind from its declared type instead of the reduced one: when a match refines it to Eql or Data, it is copyable (q=2), so copy it there. This also covers the self-call copy, which the let_term special case still rejected (test added).
Lorenzobattistela
left a comment
There was a problem hiding this comment.
Thanks! Your fix was sound and fixed #1349. I pushed one commit on top (7b69f1f) that moves the fix to its root cause, and I updated the description to match.
The cause was in tree(): it chose rebuild from the declared kind of the type's head (AtEnd -> Type), not from the type it reduces to. Now a binder whose type reduces to an equality or Data goes to the existing q=2 copy path, which the kernel already checks. This also fixes a case the let_term version missed: a refined copy passed to a self-call. After #1368 that let is rebuilt at each use and loses the view. I added that case (walk) to your test. It is also smaller (safe.ts +58 tokens vs +153).
Gates on main f1a69ec: repo 50/50, ping 47/47, test 1583/1583, safe gate +1 agree (the new test) and otherwise the same as main, perf the same as main, and the corpus .bendtt are byte-identical except the new test. let_put_depth and the #1326 repros still pass. Approving.
|
Thanks for moving the fix to |
|
Thanks for moving the correction to the root cause in tree() and extending the regression to the refined self-call case. Keeping your follow-up commit intact. |
Closes #1349.
A
+binder whose type is a match-refined view (for exampleproof: AtEnd(rest, b)refined to an equality in a match arm) was left out of the kernel text when used twice.tree()inbend2/safe.tschose how to handle a binder used twice from the declared kind of its type's head (AtEnd ... -> Type), not from the type it reduces to. So it sent the binder torebuild, which can't rebuild an equality, and--verdictsaid SOME PROOFS FAIL even though bend2 accepted the program.Fix: in
tree(), reduce the binder's type first. If it reduces to an equality or to Data, the binder copies it (q=2) instead of rebuilding it. This uses the existing q=2 path, and the kernel already checks that a q=2 binder's type is Data, so no new trust is added. There is no special case inlet_term.duplicatenow goes out asλ+x1 => (x1, x1).This also covers a refined copy passed to a self-call. After #1368 such a let is rebuilt at each use, so a fix at the let site loses the view there.
Test:
tests/proof/refined_proof_copy.bendcovers the reported equality pair, the helper call, the consumed-once boundary, a Bool refinement, and the self-call case (walk). It fails on main and checks with this change.Verification (main f1a69ec, BendTT kernel b9f3e025):
tests/check/let_put_depth.bendstill passNo changes to the kernel,
bend2/bend.ts, gates/caps, GUIDE, or CHANGELOG. No GPU cluster run (safe.ts doesn't affect runtime).