The abstract call rule for expectations (supermartingales) #
An adversary that cannot touch an oracle's state L, run with oracles that do not increase the
expectation of a potential φ of that state, does not increase it either. This is the unary,
quantitative counterpart of the relational abstract call rule (Logic/AbstractCall.lean), and
what EasyCrypt's failure event lemma (fel) rests on: with φ the indicator of the bad event plus
the bound still to be paid for the remaining oracle calls, Pr[bad] ≤ φ(initial state).
The proof is an induction over the adversary's statement (ConfinedP, from its footprint): code
without holes keeps the content of L (inFootprint_preserves_touched, L lifted is a lens
region), an oracle call is the hypothesis, sequences compose by monotonicity, and loops are
Stmt.ewp_while_le with φ as the invariant.
A program confined outside L (lifted through the globals) keeps L's value.
A statement confined outside L does not increase the expectation of a function of L.
The body induction: an adversary statement confined outside L, its holes filled with
oracles that do not increase φ in expectation, does not increase it.
The abstract call rule for expectations (a procedure with holes): an adversary that cannot
touch L (FVP.fvP_proc A ≤ L.footprintᶜ), its holes filled with oracles that do not increase the
expectation of φ ∘ L, does not increase it.
The abstract call rule for expectations, for a module (EasyCrypt's declare module D <: T {-O}): D applied to oracles that do not increase the expectation of φ ∘ L, L outside D,
does not increase it (exception E2 for the representation).