fix(ehoare): reject negative probability bound in byehoare deno - #1095
Open
namasikanam wants to merge 1 commit into
Open
fix(ehoare): reject negative probability bound in byehoare deno#1095namasikanam wants to merge 1 commit into
namasikanam wants to merge 1 commit into
Conversation
namasikanam
force-pushed
the
fix/byehoare-neg-bound
branch
2 times, most recently
from
August 24, 2026 09:49
8efb727 to
0bbdf64
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`). Emit the real side-goal `0%r <= bd`. When `bd` is a concrete non-negative literal it is discharged in the rule (`f_real_le_simpl`) so common uses stay effort-free; for a symbolic bound the goal is surfaced (and is unprovable for a genuinely negative bound). `examples/ehoare/adversary.ec` (the only ehoare-deno user) discharges the new goal from `eps_ge0`, `Q_nneg`, `0 < p`. Regression: tests/byehoare-neg-bound.ec (asserts the buggy proof no longer closes, via the `fail` idiom). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
namasikanam
force-pushed
the
fix/byehoare-neg-bound
branch
from
August 24, 2026 10:02
0bbdf64 to
228a3b8
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.