Skip to content

fix(ecPhlEqobs): eqobs_in must not assume an abstract call preserves glob A for distinct oracles - #1143

Open
namasikanam wants to merge 1 commit into
mainfrom
fix/eqobs-abs-oracle-glob
Open

namasikanam wants to merge 1 commit into
mainfrom
fix/eqobs-abs-oracle-glob

Conversation

@namasikanam

@namasikanam namasikanam commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

sim or outline (via f_eqobs_in) infers a false equivalence between two abstract-function calls
A(O1).main ~ A(O2).main when the two oracles differ and one of them writes a global that
belongs to glob A. This yields a proof of false with no axioms/admits/clones.

Proof of false

require import AllCore.
module Shared = { var g : int }.
module type O = { proc f() : unit }.
module type Adv (M : O) = { proc main() : int }.
module O1 : O = { proc f() : unit = { } }.
module O2 : O = { proc f() : unit = { Shared.g <- Shared.g + 1; } }.

section.
declare module A <: Adv.
(* Accepted, but FALSE: O2 writes Shared.g, which is in glob A. *)
lemma bad : equiv[ A(O1).main ~ A(O2).main : ={glob A} ==> ={res} ].
proof. proc*. sim. qed.
end section.

module C (M : O) = { proc main() : int = { M.f(); return Shared.g; } }.
module GL = { proc run() : int = { var r; Shared.g <- 5; r <@ C(O1).main(); return r; } }.
module GR = { proc run() : int = { var r; Shared.g <- 5; r <@ C(O2).main(); return r; } }.

lemma eqrun : equiv[ GL.run ~ GR.run : true ==> ={res} ].
proof. proc. call (bad C). auto. qed.

lemma contradiction &m : false.
proof.
have h1 : Pr[GL.run() @ &m : res = 5] = 1%r by byphoare => //; proc; inline*; auto.
have h0 : Pr[GR.run() @ &m : res = 5] = 0%r by byphoare => //; hoare; proc; inline*; auto.
have heq : Pr[GL.run() @ &m : res = 5] = Pr[GR.run() @ &m : res = 5] by byequiv eqrun => //.
smt().
qed.

Instantiating A with C (which returns Shared.g) and running from Shared.g = 5, the left
side returns 5 and the right returns 6, so the results genuinely differ; the false equiv
equates their probabilities, giving 1 = 0.

@namasikanam
namasikanam force-pushed the fix/eqobs-abs-oracle-glob branch 2 times, most recently from 4d1e492 to 41b98f8 Compare September 25, 2026 18:35
Comment thread tests/eqobs-abs-oracle-glob.ec Resolved
@namasikanam
namasikanam force-pushed the fix/eqobs-abs-oracle-glob branch from 41b98f8 to b6112cf Compare October 29, 2026 10:51
@namasikanam
namasikanam force-pushed the fix/eqobs-abs-oracle-glob branch 2 times, most recently from d30c717 to 8232f7c Compare November 6, 2026 19:17
@namasikanam namasikanam changed the title fix(sim): eqobs_in must not assume an abstract call preserves glob A for distinct oracles fix(phl): eqobs_in must not assume an abstract call preserves glob A for distinct oracles Nov 6, 2026
@namasikanam
namasikanam force-pushed the fix/eqobs-abs-oracle-glob branch from 8232f7c to 8c8a113 Compare November 6, 2026 19:51
@namasikanam namasikanam changed the title fix(phl): eqobs_in must not assume an abstract call preserves glob A for distinct oracles fix(ecPhlEqobs): eqobs_in must not assume an abstract call preserves glob A for distinct oracles Nov 13, 2026
…b A for distinct oracles

`f_eqobs_in` (FBabs case, ecPhlEqobs.ml) unconditionally added `={glob A}` to
the invariant inferred for an abstract call `A(O_l) ~ A(O_r)` (`Mpv2.add_glob
top top eqi`), asserting the call preserves the adversary's globals without
checking the oracle pair. With two distinct oracles where the right one writes
a global belonging to `glob A`, `={glob A}` is not actually preserved, so every
tactic built on eqobs_in (`sim`, `outline`) via could infer a false judgment

    equiv[ A(O1).main ~ A(O2).main : ={glob A} ==> ={res} ]

Only add `={glob top}` when, for every oracle pair, the two oracles are the
same procedure (same code => mirrored writes to `glob top`) or neither
modifies `glob top`; otherwise the simulation cannot be inferred and eqobs_in
falls back to requiring a user-supplied specification.

Regression: tests/eqobs-abs-oracle-glob.ec

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2EwSUFcCYEqEHao9gpBur
@namasikanam
namasikanam force-pushed the fix/eqobs-abs-oracle-glob branch from 8c8a113 to d1cf445 Compare November 13, 2026 14:15
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