Documentation

CslibFrontier.Tactic.GameHop

Tactics for cryptographic game hops and shared random draws #

Cryptographic security proofs repeatedly step across explicit sequences of hybrid games and couple shared leading PMF.bind (or Game.runStatelessOracle) stages while retaining support membership. This module provides two focused, deterministic tactics that keep intermediate games and variable couplings explicit in the proof script while removing routine triangle, symmetry, coercion, and bind-coupling plumbing:

Main definitions #

Main results #

theorem Cslib.Crypto.Game.coe_advantage_triangle_add (g₀ g₁ g₂ : Game) {ε₁ ε₂ : ℝ} (h₁ : ↑(g₀.advantage g₁) ≤ ε₁) (h₂ : ↑(g₁.advantage g₂) ≤ ε₂) :
↑(g₀.advantage g₂) ≤ ε₁ + ε₂

Combine two real-valued game-hop bounds across an intermediate game.

Bounding advantage g₀ (PMF.pure false) ≤ B bounds succProbability g₀ ≤ B.

theorem Cslib.Crypto.Game.coe_advantage_bind_le_of_support {α : Type u_1} (μ : PMF α) (game1 game2 : α → Game) {ε : ℝ} (h : ∀ a ∈ μ.support, ↑((game1 a).advantage (game2 a)) ≤ ε) :
↑(advantage (μ.bind game1) (μ.bind game2)) ≤ ε

Support-restricted real-valued PMF.bind advantage bound.

theorem Cslib.Crypto.Game.coe_advantage_runStatelessOracle_le_of_support {α : Type} (o : List Bool → List Bool) (prog : Probability.WordOracleComp Unit α) (next₁ next₂ : α → Game) {ε : ℝ} (h : ∀ out ∈ ((ProbOracleComp.runState prog fun (req : Unit × List Bool) (s : Unit) => pure (o req.2, s)).run ()).eval.support, ↑((next₁ out.1).advantage (next₂ out.1)) ≤ ε) :
↑((runStatelessOracle o prog next₁).advantage (runStatelessOracle o prog next₂)) ≤ ε

Support-restricted real-valued continuation bound for runStatelessOracle.

theorem Cslib.Crypto.Game.closeTo_runStatelessOracle {α : Type} (o : List Bool → List Bool) (prog : Probability.WordOracleComp Unit α) (next₁ next₂ : α → Game) {ε : ENNReal} (h : ∀ out ∈ ((ProbOracleComp.runState prog fun (req : Unit × List Bool) (s : Unit) => pure (o req.2, s)).run ()).eval.support, Probability.CloseTo (next₁ out.1) (next₂ out.1) ε) :
Probability.CloseTo (runStatelessOracle o prog next₁) (runStatelessOracle o prog next₂) ε

Support-restricted CloseTo continuation bound for runStatelessOracle.

theorem Cslib.Crypto.Game.runStatelessOracle_congr_on_support {α : Type} (o : List Bool → List Bool) (prog : Probability.WordOracleComp Unit α) (next₁ next₂ : α → Game) (h : ∀ out ∈ ((ProbOracleComp.runState prog fun (req : Unit × List Bool) (s : Unit) => pure (o req.2, s)).run ()).eval.support, next₁ out.1 = next₂ out.1) :
runStatelessOracle o prog next₁ = runStatelessOracle o prog next₂

Support-restricted continuation congruence for runStatelessOracle.

theorem Cslib.Crypto.Game.runStatelessOracle_comm {α β : Type} (o₁ : List Bool → List Bool) (prog₁ : Probability.WordOracleComp Unit α) (o₂ : List Bool → List Bool) (prog₂ : Probability.WordOracleComp Unit β) (next : α → β → Game) :
(runStatelessOracle o₁ prog₁ fun (a : α) => runStatelessOracle o₂ prog₂ (next a)) = runStatelessOracle o₂ prog₂ fun (b : β) => runStatelessOracle o₁ prog₁ fun (a : α) => next a b

Commute two independent runStatelessOracle stages.

Bind-stage representation and independent-stage commutation #

Target decomposition for relational PMF / Game goals #

peel_binds syntax and elaborator #

Binder name or _ placeholder accepted by peel_binds.

Peel shared leading PMF.bind and Game.runStatelessOracle stages on Game.advantage, Encryption.advantage, CloseTo, or PMF equality goals, introducing each draw x and its support witness x_mem : x ∈ μ.support.

  • peel_binds peels all shared leading stages. When they differ, it brings a matching independent stage to the front from anywhere in the opposite sampling chain. Matching leading draws keep their original order, including repeated draws of the same distribution.
  • peel_binds x₁ x₂ ... peels exactly those stages using the given binder names (_ names the draw x and leaves its support witness inaccessible).

Normalization follows the alignment path. An unmatched continuation stays in its original form so that a supplied continuation bound still applies directly.

game_trans syntax and elaborator #

Bracketed or comma-separated list of intermediate games or distributions for game_trans.

Bracketed list or single hop proof term for game_trans ... using ....

Step a Game.advantage, (Game.advantage : ℝ), Encryption.advantage, Game.succProbability, (Game.succProbability : ℝ), or CloseTo goal across an explicit list of intermediate games or distributions:

  • game_trans [g₁, g₂, ...] (or game_trans g₁, g₂, ...) creates one hop subgoal per step (G₀ → g₁, g₁ → g₂, ..., gₘ → Gₖ) followed by a trailing bound subgoal ?ε₀ + ?ε₁ + ... + ?εₘ ≤ B. One-sided Game.succProbability G₀ ≤ B goals (when B does not already add Game.succProbability G₁) hop from G₀ to PMF.pure false and accept Game.succProbability gₘ ≤ ε hop proofs at PMF.pure false.
  • game_trans [g₁, g₂] using [h₀, h₁, h₂] discharges hop subgoals directly (use _ to leave a hop open), automatically orienting reversed Game.advantage_comm / CloseTo.symm bounds, lifting ℝ≥0 advantage bounds to ℝ, turning equalities A = B into 0 error, and closing the trailing sum bound when it holds by rfl, ac_rfl, or ring.
  • game_trans (with no intermediates) unfolds Encryption.advantage, reduces Game.succProbability G₀ ≤ Game.succProbability G₁ + B to Game.advantage G₀ G₁ ≤ B, or reduces Game.succProbability G₀ ≤ B to Game.advantage G₀ (PMF.pure false) ≤ B (game_trans using [h] also closes a single hop up to symmetry).