fix(ehoare): reject negative probability bound in byehoare deno - #1095
Merged
Conversation
namasikanam
force-pushed
the
fix/byehoare-neg-bound
branch
3 times, most recently
from
August 24, 2026 10:02
0bbdf64 to
228a3b8
Compare
strub
force-pushed
the
fix/byehoare-neg-bound
branch
from
August 26, 2026 08:19
228a3b8 to
8cbaed6
Compare
bgregoir
requested changes
Sep 4, 2026
bgregoir
reviewed
Sep 4, 2026
bgregoir
left a comment
Contributor
There was a problem hiding this comment.
I forgot to say thank you for the fix.
Collaborator
Author
The credit should go to Claude Code. It was discovered and fixed automatically by Claude Code :) |
namasikanam
force-pushed
the
fix/byehoare-neg-bound
branch
from
September 4, 2026 15:23
8cbaed6 to
ef6dcc0
Compare
The ehoare-deno rule (`t_ehoare_deno_r`) coerces the real bound `bd` into a non-negative extended real via `f_r2xr`, which clamps any `bd < 0` to `0`. The non-negativity side-condition on `bd` was therefore never enforced, so `byehoare` accepted an absurd negative bound and could "prove" `Pr[M.f() @ &m : false] <= -1%r` (hence `false`). The low-level rule now always emits the extra real goal `0%r <= bd` as a fourth conclusion `[concl_e; concl_pr; concl_po; concl_nn]`, and the high-level tactic `process_ehoare_deno` runs `t_trivial` on it so trivially non-negative bounds stay effort-free; a genuinely negative bound is left as an unprovable goal. `examples/ehoare/adversary.ec` (the only ehoare-deno user) discharges the non-trivial symbolic bound from `eps_ge0`, `Q_nneg`, `0 < p`. Regression: tests/byehoare-neg-bound.ec. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fdupress
force-pushed
the
fix/byehoare-neg-bound
branch
from
September 5, 2026 12:27
ef6dcc0 to
05d9f0f
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
byehoare/ the ehoare-deno path accepts a negative probability bound, which isunsound: it lets one derive
Pr[M.f() @ &m : false] <= -1%r, and hencefalse.Root cause
The real bound supplied to the deno rule is coerced into a non-negative extended real
(
xreal) and negative values are silently clamped to0. The side-condition that thebound is non-negative (
0%r <= bd) is never emitted, so a user-supplied negative literalis accepted as if it were
0.Fix (
src/phl/ecPhlDeno.ml)Emit the real side-goal
0%r <= bdfor concrete/literal bounds instead of relying on theclamping coercion. A genuinely non-negative bound discharges trivially (
f_real_le_simpl);a negative one now produces an open, unprovable obligation.
Test
tests/ko/byehoare-neg-bound.ec(must-fail): the previously-accepted negative-boundjudgment is now rejected.