fix(fel): require per-step weights non-negative over the counter range - #1096
Open
namasikanam wants to merge 1 commit into
Open
fix(fel): require per-step weights non-negative over the counter range#1096namasikanam wants to merge 1 commit into
namasikanam wants to merge 1 commit into
Conversation
The failure-event lemma tactic summed the per-step weights only over the counter values actually visited and never required `0%r <= ash i` on the whole range `0 <= i < q`. A counter that jumps (e.g. 0 -> 2) with a negative weight at a skipped index makes the full-range sum smaller than the visited sum, so `fel` "proves" `Pr[bad] <= 0` while the true probability is 1 (hence `false`). Emit the side-condition `forall i, 0 <= i < q => 0%r <= ash i` (as the last goal, so existing scripts keep their sub-goal positions). Existing library and `examples` uses of `fel` discharge it trivially (their weights are already non-negative). Regression: tests/fel-counter-jump.ec (asserts the buggy 0 -> 2 counter jump with a negative weight no longer closes, via the `fail` idiom). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
namasikanam
force-pushed
the
fix/fel-counter-weight
branch
from
August 24, 2026 10:02
ffffb12 to
bc3b89e
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.
Summary
The failure-event lemma tactic (
fel) is unsound: it enforces neither that the counterincrements by exactly 1 per bad event, nor that each per-step weight is non-negative at the
indices it skips. A counter that jumps
0 -> 2with weights(1, -1)sums to0, sofel"proves"
Pr[bad] <= 0while the true probability is1— hencefalse.Root cause
t_failure_event_rsums the per-step weights only over the indices the counter actuallyvisits, and never requires
0%r <= ash ion the whole range0 <= i < q. Negative weightsat skipped indices are therefore uncounted.
Fix (
src/phl/ecPhlFel.ml)Add the side-condition
forall i, 0 <= i < q => 0%r <= ash i(emitted as the last goal).Existing library/
examplesuses offelare updated to discharge this trivially-trueobligation (all standard weights are already non-negative).
Test
tests/ko/fel-counter-jump.ec(must-fail): the0 -> 2counter jump with a negativeweight is now rejected.