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 (Std.Do-inspired) #
⌜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 Std.Do's ⌜P⌝ : SPred.
Instances For
Notation #
Prop indicator: ⌜P⌝ = 1 if P holds, 0 otherwise.
Mirrors Std.Do's ⌜P⌝ : SPred but targets ℝ≥0∞.
Instances For
Quantitative WP: wp⟦c⟧ post or just wp⟦c⟧ for partial application.
Instances For
Quantitative Hoare triple: ⦃P⦄ c ⦃Q⦄ means P ≤ wp c Q.
Uses syntax + macro_rules (not notation) because ⦃⦄ overlaps
with Lean's strict-implicit binder syntax.
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 eRelTriple f c₁ c₂ g.
Instances For
Bridge lemmas: ⌜⌝ and existing API #
probEvent equals WP of propInd postcondition.
Almost-sure correctness: ⦃⌜True⌝⦄ c ⦃fun x => ⌜p x⌝⦄ iff Pr[ p | c] = 1.
Lower-bound event goals are exactly quantitative triples with ⌜p⌝ 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.