Triangle Inequality Tactic #
This file provides the ssprove_triangle tactic for game-hopping proofs.
Main definitions #
advantage_sum- Recursive sum of pairwise advantages for a chain of gamesAdvantage_triangle_chain- Triangle inequality for chains of gamesssprove_triangle- Tactic to introduce a triangle inequality bound
Usage #
The tactic ssprove_triangle G₀ [G₁, G₂, G₃] G₄ produces:
ineq : Advantage G₀ G₄ ≤
Advantage G₀ G₁ + Advantage G₁ G₂ +
Advantage G₂ G₃ + Advantage G₃ G₄
This is essential for game-hopping proofs where we transition through a sequence of hybrid games.
References #
- SSProve: theories/Crypt/package/pkg_advantage.v
- Larsen and Schürmann, Nominal State-Separating Proofs
Advantage Sum #
Recursive sum of pairwise advantages for a chain of games.
advantage_sum G₀ [G₁, G₂] G₃ = Advantage G₀ G₁ + Advantage G₁ G₂ + Advantage G₂ G₃
The base case advantage_sum G₀ [] G₁ = Advantage G₀ G₁.
Equations
- CatCrypt.Crypto.advantage_sum G₀ [] Gn = CatCrypt.Crypto.Advantage G₀ Gn
- CatCrypt.Crypto.advantage_sum G₀ (G₁ :: rest) Gn = CatCrypt.Crypto.Advantage G₀ G₁ + CatCrypt.Crypto.advantage_sum G₁ rest Gn
Instances For
Triangle inequality for chains of games.
For any sequence of games G₀, G₁, ..., Gₙ:
Advantage G₀ Gₙ ≤ Advantage G₀ G₁ + Advantage G₁ G₂ + ... + Advantage Gₙ₋₁ Gₙ
AdvantageA Sum #
Recursive sum of pairwise advantages with explicit adversary.
Equations
- CatCrypt.Crypto.advantageA_sum G₀ [] Gn A = CatCrypt.Crypto.AdvantageA G₀ Gn A
- CatCrypt.Crypto.advantageA_sum G₀ (G₁ :: rest) Gn A = CatCrypt.Crypto.AdvantageA G₀ G₁ A + CatCrypt.Crypto.advantageA_sum G₁ rest Gn A
Instances For
Triangle inequality for AdvantageA.
Triangle inequality for chains with explicit adversary.
Convenience Lemmas for Simplification #
Simplification lemma: expand advantage_sum for the empty list case
Simplification lemma: expand advantage_sum for the cons case
Simplification lemma: expand advantageA_sum for the empty list case
Simplification lemma: expand advantageA_sum for the cons case
Triangle Tactic Implementation #
The ssprove_triangle tactic automates the application of triangle inequality
for game-hopping proofs.
Syntax #
ssprove_triangle G₀ [G₁, G₂, G₃] G₄
This introduces a hypothesis ineq with type:
Advantage G₀ G₄ ≤ Advantage G₀ G₁ + Advantage G₁ G₂ + Advantage G₂ G₃ + Advantage G₃ G₄
After introduction, use simp only [advantage_sum_nil, advantage_sum_cons] at ineq
to expand the sum into individual advantage terms.
Variants #
ssprove_triangle_A- For games with explicit adversaryAdvantageA
ssprove_triangle G₀ gs Gₙ introduces a hypothesis
ineq : Advantage G₀ Gₙ ≤ advantage_sum G₀ gs Gₙ
Where gs is a list of intermediate games.
After introducing the hypothesis, use:
simp only [advantage_sum_nil, advantage_sum_cons] at ineq
to expand the sum into individual pairwise advantages.
This is the main tactic for game-hopping proofs where we need to bound the advantage through a sequence of hybrid games.
Equations
- One or more equations did not get rendered due to their size.
Instances For
ssprove_triangle_A G₀ gs Gₙ A for AdvantageA.
Produces: ineq : AdvantageA G₀ Gₙ A ≤ advantageA_sum G₀ gs Gₙ A
Equations
- One or more equations did not get rendered due to their size.
Instances For
ssprove_triangle_simpl simplifies advantage_sum expressions.
After ssprove_triangle, the bound is in terms of advantage_sum.
This tactic expands it into explicit pairwise advantages.
Usage: ssprove_triangle_simpl or ssprove_triangle_simpl at h
Equations
- CatCrypt.Tactics.tacticSsprove_triangle_simpl = Lean.ParserDescr.node `CatCrypt.Tactics.tacticSsprove_triangle_simpl 1024 (Lean.ParserDescr.nonReservedSymbol "ssprove_triangle_simpl" false)
Instances For
ssprove_triangle_simpl at h simplifies advantage_sum in hypothesis h.
Equations
- One or more equations did not get rendered due to their size.
Instances For
adv_game_hop [G₁, …, Gₙ₋₁] — the n-ary shallow game-hopping tactic. On a goal
AdvantageA G₀ Gₙ A ≤ ε₁ + … + εₙ, insert the intermediate games and reduce to
one per-hop subgoal AdvantageA Gᵢ Gᵢ₊₁ A ≤ εᵢ₊₁ each. Each hop is then typically
a reduction, discharged by ShallowModule.advantageA_absorb down to a component
advantage. The advantage-level analog of game_hop (which is sdist-level and
stays in the dev UC layer).
Equations
- One or more equations did not get rendered due to their size.