Ergonomic Notation and Convenience Layer for Program Logic #
This file provides the lightweight user-facing notation and convenience predicates for game-hopping proofs. It intentionally depends only on the core quantitative definitions, not on the full eRHL theorem development.
The canonical proof mode lives in VCVio/ProgramLogic/Tactics.lean.
Notation (activate with open scoped OracleComp.ProgramLogic) #
Prop indicator #
𝟙⟦P⟧— injectPropintoℝ≥0∞(1 if true, 0 if false)
Unary (Std.Do-inspired) #
wp⟦c⟧— quantitative WP (partial application, use aswp⟦c⟧ post)⦃P⦄ c ⦃Q⦄— quantitative Hoare triple (P ≤ wp c Q)
Game-level #
Relational (EasyCrypt-inspired) #
⟪c₁ ~ c₂ | R⟫— pRHL coupling triple⟪c₁ ≈[ε] c₂ | R⟫— approximate coupling triple⦃f⦄ c₁ ≈ₑ c₂ ⦃g⦄— eRHL quantitative relational triple
Convenience predicates #
Convenience predicates #
Two games have the same output distribution.
Instances For
Advantage of a Boolean game is at most ε (measured as deviation from 1/2).
Instances For
Prop-to-ℝ≥0∞ indicator #
Indicator embedding: lifts P : Prop into ℝ≥0∞ as 1 (true) or 0 (false).
This is the quantitative analogue of Loom's pure proposition assertion, but
targets the expectation carrier rather than the current assertion lattice.
Instances For
Notation #
Numeric proposition indicator: 𝟙⟦P⟧ = 1 if P holds, 0 otherwise.
This is deliberately distinct from Loom's ⌜P⌝, which embeds propositions as
top/bottom in the active assertion lattice.
Instances For
Quantitative WP notation. wp⟦c⟧ post directly elaborates to
wp c post; wp⟦c⟧ standalone elaborates to
the lambda fun post => wp c post for partial
application sites (e.g. change wp⟦c⟧ or composition with ≤).
Instances For
Raw relational WP notation.
rwp⟦c₁ ~ c₂ | post; epost₁, epost₂⟧ elaborates to Std.Do'.rwp.
The normal assertion carrier and both exception-post carriers are inferred from
post, epost₁, and epost₂, so this notation also works for stateful and
exception-aware RelWP instances.
Instances For
pRHL coupling: ⟪c₁ ~ c₂ | R⟫ means RelTriple c₁ c₂ R.
Instances For
Approximate coupling: ⟪c₁ ≈[ε] c₂ | R⟫ means ApproxRelTriple ε c₁ c₂ R.
Instances For
eRHL quantitative relational triple:
⦃f⦄ c₁ ≈ₑ c₂ ⦃g⦄ means the quantitative Std.Do'.RelTriple form.
Instances For
Bridge lemmas: numeric indicators and existing API #
probEvent equals WP of propInd postcondition.
Almost-sure correctness: Triple 𝟙⟦True⟧ c (fun x => 𝟙⟦p x⟧) iff
Pr[ p | c] = 1.
Lower-bound event goals are exactly quantitative triples with indicator postconditions.
Expectation-level bridge lemmas #
WP of a disjunction indicator is bounded by the sum of individual WP indicators.
Monotonicity for event probabilities, exposed through the program-logic namespace.
Markov inequality: if a ≤ f x whenever p x, then a * Pr[ p | oa] ≤ E[f | oa].
Triple with precondition 1 and indicator postcondition when the event is almost sure.
Bridge lemmas: game equivalence and advantage #
Game equivalence from basic pRHL equality coupling.
A bijection on a uniform sample is still uniform. This is the key lemma behind OTP-style perfect secrecy proofs.
Game equivalence is a congruence for bind.
Game equivalence is a congruence for map.
Advantage bound via TV distance.
Transfer advantage bounds across equivalent games.