Documentation

CslibFrontier.Crypto.Game.Concrete

Resource-indexed concrete security of Boolean experiments #

Cslib.Crypto.Game.Indistinguishable quantifies asymptotically over admissible adversaries. Concrete security theorems instead bound distinguishing advantage or success probability as an explicit function ε n r of the security parameter n and adversary resource budget r (such as query count q, halting machine steps t, or the pair (t, q)), and compose reductions by mapping target resource budgets r to source resource budgets mapRes n r.

This module provides:

Main definitions #

Main results #

References #

theorem Cslib.Probability.IsOraclePPT.exists_computable_queryBound {Operation β : Type} [DecidableEq Operation] {output : β ↪ List Bool} {program : ℕ → List Bool → WordOracleComp Operation β} (h : IsOraclePPT output program) :
∃ (Q : ℕ → ℕ), Turing.MultiTapeTM.ComputableInPolyTime Q Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary ∧ PolynomiallyBounded Q ∧ ∀ (n : ℕ) (aux : List Bool), ProbOracleComp.IsQueryBounded (program n aux) (Q (n + aux.length)) ∧ ProbOracleComp.QueriesSatisfy (fun (request : Operation × List Bool) => request.2.length ≤ Q (n + aux.length)) (program n aux)

Extract an explicit unary polynomial-time computable, polynomially bounded schedule Q : ℕ → ℕ bounding both external query counts and request lengths of an IsOraclePPT program at n + aux.length.

Concrete advantage and success predicates #

def Cslib.Crypto.Game.IndistinguishableWithin {Adversary : Type u_1} {Resource : Type u_2} (game1 game2 : Adversary → ℕ → Game) (Within : ℕ → Resource → Adversary → Prop) (ε : ℕ → Resource → NNReal) :

Two families of games are concretely (Within, ε)-indistinguishable when at every security parameter n and resource budget r, every adversary satisfying Within n r adversary has distinguishing advantage at most ε n r.

def Cslib.Crypto.Game.SuccWithin {Adversary : Type u_1} {Resource : Type u_2} (game : Adversary → ℕ → Game) (Within : ℕ → Resource → Adversary → Prop) (ε : ℕ → Resource → NNReal) :

A family of one-sided search or forgery games is concretely (Within, ε)-secure when at every security parameter n and resource budget r, every adversary satisfying Within n r adversary succeeds with probability at most ε n r.

theorem Cslib.Crypto.Game.indistinguishableWithin_pure_false_iff {Adversary : Type u_1} {Resource : Type u_2} (game : Adversary → ℕ → Game) (Within : ℕ → Resource → Adversary → Prop) (ε : ℕ → Resource → NNReal) :
IndistinguishableWithin game (fun (x : Adversary) (x_1 : ℕ) => PMF.pure false) Within ε ↔ SuccWithin game Within ε

Concrete indistinguishability from PMF.pure false is concrete one-sided SuccWithin security.

theorem Cslib.Crypto.Game.pure_false_indistinguishableWithin_iff {Adversary : Type u_1} {Resource : Type u_2} (game : Adversary → ℕ → Game) (Within : ℕ → Resource → Adversary → Prop) (ε : ℕ → Resource → NNReal) :
IndistinguishableWithin (fun (x : Adversary) (x_1 : ℕ) => PMF.pure false) game Within ε ↔ SuccWithin game Within ε

Concrete indistinguishability with PMF.pure false on the left is concrete SuccWithin security.

Algebra, hopping, and reductions for IndistinguishableWithin and SuccWithin #

theorem Cslib.Crypto.Game.IndistinguishableWithin.refl {Adversary : Type u_1} {Resource : Type u_2} (game : Adversary → ℕ → Game) (Within : ℕ → Resource → Adversary → Prop) :
IndistinguishableWithin game game Within fun (x : ℕ) (x_1 : Resource) => 0

Every family of games is within zero error of itself.

theorem Cslib.Crypto.Game.IndistinguishableWithin.symm {Adversary : Type u_1} {Resource : Type u_2} {game1 game2 : Adversary → ℕ → Game} {Within : ℕ → Resource → Adversary → Prop} {ε : ℕ → Resource → NNReal} (h : IndistinguishableWithin game1 game2 Within ε) :
IndistinguishableWithin game2 game1 Within ε

Swapping the two games preserves any concrete error bound.

theorem Cslib.Crypto.Game.IndistinguishableWithin.trans {Adversary : Type u_1} {Resource : Type u_2} {first middle last : Adversary → ℕ → Game} {Within : ℕ → Resource → Adversary → Prop} {ε₁ ε₂ : ℕ → Resource → NNReal} (h₁ : IndistinguishableWithin first middle Within ε₁) (h₂ : IndistinguishableWithin middle last Within ε₂) :
IndistinguishableWithin first last Within fun (n : ℕ) (r : Resource) => ε₁ n r + ε₂ n r

Concrete error bounds add across an intermediate game hop.

theorem Cslib.Crypto.Game.IndistinguishableWithin.mono {Adversary : Type u_1} {Resource : Type u_2} {game1 game2 : Adversary → ℕ → Game} {Within : ℕ → Resource → Adversary → Prop} {ε₁ ε₂ : ℕ → Resource → NNReal} (h : IndistinguishableWithin game1 game2 Within ε₁) (hle : ∀ (n : ℕ) (r : Resource), ε₁ n r ≤ ε₂ n r) :
IndistinguishableWithin game1 game2 Within ε₂

Enlarging the concrete error surface preserves the bound.

theorem Cslib.Crypto.Game.IndistinguishableWithin.of_within {Adversary : Type u_1} {SourceResource : Type u_2} {TargetResource : Type u_3} {game1 game2 : Adversary → ℕ → Game} {SourceWithin : ℕ → SourceResource → Adversary → Prop} {TargetWithin : ℕ → TargetResource → Adversary → Prop} {ε : ℕ → SourceResource → NNReal} (h : IndistinguishableWithin game1 game2 SourceWithin ε) (mapRes : ℕ → TargetResource → SourceResource) (hsub : ∀ (n : ℕ) (r : TargetResource) (adversary : Adversary), TargetWithin n r adversary → SourceWithin n (mapRes n r) adversary) :
IndistinguishableWithin game1 game2 TargetWithin fun (n : ℕ) (r : TargetResource) => ε n (mapRes n r)

Contravariantly refine the resource type and admissibility predicate through mapRes.

theorem Cslib.Crypto.Game.IndistinguishableWithin.hybrid {Adversary : Type u_1} {Resource : Type u_2} (hyb : ℕ → Adversary → ℕ → Game) (hops : ℕ → ℕ) {Within : ℕ → Resource → Adversary → Prop} {stepErr : ℕ → Resource → ℕ → NNReal} (hstep : ∀ (n : ℕ) (r : Resource), ∀ i < hops n, ∀ (adversary : Adversary), Within n r adversary → (hyb i adversary n).advantage (hyb (i + 1) adversary n) ≤ stepErr n r i) :
IndistinguishableWithin (hyb 0) (fun (adversary : Adversary) (n : ℕ) => hyb (hops n) adversary n) Within fun (n : ℕ) (r : Resource) => ∑ i ∈ Finset.range (hops n), stepErr n r i

Sum concrete errors across hops n adjacent hybrids hyb 0, …, hyb (hops n).

theorem Cslib.Crypto.Game.IndistinguishableWithin.hybrid_const {Adversary : Type u_1} {Resource : Type u_2} (hyb : ℕ → Adversary → ℕ → Game) (hops : ℕ → ℕ) {Within : ℕ → Resource → Adversary → Prop} {δ : ℕ → Resource → NNReal} (hstep : ∀ (n : ℕ) (r : Resource), ∀ i < hops n, ∀ (adversary : Adversary), Within n r adversary → (hyb i adversary n).advantage (hyb (i + 1) adversary n) ≤ δ n r) :
IndistinguishableWithin (hyb 0) (fun (adversary : Adversary) (n : ℕ) => hyb (hops n) adversary n) Within fun (n : ℕ) (r : Resource) => ↑(hops n) * δ n r

Concrete hops n-step hybrid argument with a uniform per-hop error δ n r.

theorem Cslib.Crypto.Game.IndistinguishableWithin.of_reduction {SourceAdversary : Type u_1} {TargetAdversary : Type u_2} {SourceResource : Type u_3} {TargetResource : Type u_4} {source1 source2 : SourceAdversary → ℕ → Game} {target1 target2 : TargetAdversary → ℕ → Game} {SourceWithin : ℕ → SourceResource → SourceAdversary → Prop} {TargetWithin : ℕ → TargetResource → TargetAdversary → Prop} {ε : ℕ → SourceResource → NNReal} (hsource : IndistinguishableWithin source1 source2 SourceWithin ε) (reduce : TargetAdversary → SourceAdversary) (mapRes : ℕ → TargetResource → SourceResource) (loss err : ℕ → TargetResource → NNReal) (hwithin : ∀ (n : ℕ) (r : TargetResource) (adversary : TargetAdversary), TargetWithin n r adversary → SourceWithin n (mapRes n r) (reduce adversary)) (hbound : ∀ (n : ℕ) (r : TargetResource) (adversary : TargetAdversary), TargetWithin n r adversary → (target1 adversary n).advantage (target2 adversary n) ≤ loss n r * (source1 (reduce adversary) n).advantage (source2 (reduce adversary) n) + err n r) :
IndistinguishableWithin target1 target2 TargetWithin fun (n : ℕ) (r : TargetResource) => loss n r * ε n (mapRes n r) + err n r

Concrete security reduction. If reduce maps every target adversary within budget r at parameter n to a source adversary within budget mapRes n r, and bounds target advantage by loss n r times source advantage plus err n r, then source (SourceWithin, ε)-security implies target (TargetWithin, fun n r => loss n r * ε n (mapRes n r) + err n r)-security.

theorem Cslib.Crypto.Game.IndistinguishableWithin.indistinguishable {Adversary : Type u_1} {Resource : Type u_2} {game1 game2 : Adversary → ℕ → Game} {Within : ℕ → Resource → Adversary → Prop} {ε : ℕ → Resource → NNReal} {Admissible : Adversary → Prop} (PolyResource : (ℕ → Resource) → Prop) (h : IndistinguishableWithin game1 game2 Within ε) (hsched : ∀ (adversary : Adversary), Admissible adversary → ∃ (r : ℕ → Resource), PolyResource r ∧ ∀ (n : ℕ), Within n (r n) adversary) (hneg : ∀ (r : ℕ → Resource), PolyResource r → Negligible fun (n : ℕ) => ε n (r n)) :
Indistinguishable game1 game2 Admissible

General concrete-to-asymptotic bridge. If every Admissible adversary admits a resource schedule r : ℕ → Resource in PolyResource, and ε is negligible along every schedule in PolyResource, then IndistinguishableWithin implies asymptotic Game.Indistinguishable.

theorem Cslib.Crypto.Game.SuccWithin.mono {Adversary : Type u_1} {Resource : Type u_2} {game : Adversary → ℕ → Game} {Within : ℕ → Resource → Adversary → Prop} {ε₁ ε₂ : ℕ → Resource → NNReal} (h : SuccWithin game Within ε₁) (hle : ∀ (n : ℕ) (r : Resource), ε₁ n r ≤ ε₂ n r) :
SuccWithin game Within ε₂

Enlarging the concrete success bound preserves SuccWithin.

theorem Cslib.Crypto.Game.SuccWithin.of_within {Adversary : Type u_1} {SourceResource : Type u_2} {TargetResource : Type u_3} {game : Adversary → ℕ → Game} {SourceWithin : ℕ → SourceResource → Adversary → Prop} {TargetWithin : ℕ → TargetResource → Adversary → Prop} {ε : ℕ → SourceResource → NNReal} (h : SuccWithin game SourceWithin ε) (mapRes : ℕ → TargetResource → SourceResource) (hsub : ∀ (n : ℕ) (r : TargetResource) (adversary : Adversary), TargetWithin n r adversary → SourceWithin n (mapRes n r) adversary) :
SuccWithin game TargetWithin fun (n : ℕ) (r : TargetResource) => ε n (mapRes n r)

Contravariantly refine the resource type and admissibility predicate of a SuccWithin bound.

theorem Cslib.Crypto.Game.SuccWithin.of_reduction {SourceAdversary : Type u_1} {TargetAdversary : Type u_2} {SourceResource : Type u_3} {TargetResource : Type u_4} {source : SourceAdversary → ℕ → Game} {target : TargetAdversary → ℕ → Game} {SourceWithin : ℕ → SourceResource → SourceAdversary → Prop} {TargetWithin : ℕ → TargetResource → TargetAdversary → Prop} {ε : ℕ → SourceResource → NNReal} (hsource : SuccWithin source SourceWithin ε) (reduce : TargetAdversary → SourceAdversary) (mapRes : ℕ → TargetResource → SourceResource) (loss err : ℕ → TargetResource → NNReal) (hwithin : ∀ (n : ℕ) (r : TargetResource) (adversary : TargetAdversary), TargetWithin n r adversary → SourceWithin n (mapRes n r) (reduce adversary)) (hbound : ∀ (n : ℕ) (r : TargetResource) (adversary : TargetAdversary), TargetWithin n r adversary → (target adversary n).succProbability ≤ loss n r * (source (reduce adversary) n).succProbability + err n r) :
SuccWithin target TargetWithin fun (n : ℕ) (r : TargetResource) => loss n r * ε n (mapRes n r) + err n r

One-sided concrete security reduction. Transfer SuccWithin across a resource-mapping reduction with multiplicative loss and additive err.

theorem Cslib.Crypto.Game.SuccWithin.indistinguishable_pure_false {Adversary : Type u_1} {Resource : Type u_2} {game : Adversary → ℕ → Game} {Within : ℕ → Resource → Adversary → Prop} {ε : ℕ → Resource → NNReal} {Admissible : Adversary → Prop} (PolyResource : (ℕ → Resource) → Prop) (h : SuccWithin game Within ε) (hsched : ∀ (adversary : Adversary), Admissible adversary → ∃ (r : ℕ → Resource), PolyResource r ∧ ∀ (n : ℕ), Within n (r n) adversary) (hneg : ∀ (r : ℕ → Resource), PolyResource r → Negligible fun (n : ℕ) => ε n (r n)) :
Indistinguishable game (fun (x : Adversary) (x_1 : ℕ) => PMF.pure false) Admissible

Bridge SuccWithin to asymptotic indistinguishability from PMF.pure false along polynomial resource schedules.

Standard query, time, and (t, q) concrete resource predicates #

def Cslib.Crypto.Game.WithinQueries {Query α : Type} {spec : Query → Type} (n q : ℕ) (adversary : ℕ → List Bool → ProbOracleComp spec α) :

At parameter n, the empty-auxiliary execution adversary n [] makes at most q external queries on every path.

def Cslib.Crypto.Game.WithinTimeUpTo {β : Type} (output : β ↪ List Bool) (auxLen : ℕ → ℕ) (n t : ℕ) (adversary : ℕ → List Bool → ProbComp β) :

At parameter n, adversary is realized by a uniform halting fair-coin machine taking at most t steps on all auxiliary inputs of length at most auxLen n.

@[reducible, inline]
abbrev Cslib.Crypto.Game.WithinTime {β : Type} (output : β ↪ List Bool) :
ℕ → ℕ → (ℕ → List Bool → ProbComp β) → Prop

At parameter n on empty auxiliary input [], adversary is realized by a uniform halting fair-coin machine taking at most t steps.

theorem Cslib.Crypto.Game.withinTime_iff {β : Type} {output : β ↪ List Bool} {n t : ℕ} {adversary : ℕ → List Bool → ProbComp β} :
WithinTime output n t adversary ↔ ∃ (T : ℕ → ℕ → ℕ), T n 0 ≤ t ∧ Probability.ComputesInTime output T adversary

WithinTime unpacks to T n 0 ≤ t for a uniform halting schedule T.

def Cslib.Crypto.Game.WithinOracleTimeUpTo {Operation β : Type} [DecidableEq Operation] (output : β ↪ List Bool) (auxLen : ℕ → ℕ) (n t : ℕ) (adversary : ℕ → List Bool → Probability.WordOracleComp Operation β) :

At parameter n, adversary is realized by a uniform halting oracle machine taking at most t steps on all auxiliary inputs of length at most auxLen n.

@[reducible, inline]
abbrev Cslib.Crypto.Game.WithinOracleTime {Operation β : Type} [DecidableEq Operation] (output : β ↪ List Bool) :
ℕ → ℕ → (ℕ → List Bool → Probability.WordOracleComp Operation β) → Prop

At parameter n on empty auxiliary input [], adversary is realized by a uniform halting oracle machine taking at most t steps.

theorem Cslib.Crypto.Game.withinOracleTime_iff {Operation β : Type} [DecidableEq Operation] {output : β ↪ List Bool} {n t : ℕ} {adversary : ℕ → List Bool → Probability.WordOracleComp Operation β} :
WithinOracleTime output n t adversary ↔ ∃ (T : ℕ → ℕ → ℕ), T n 0 ≤ t ∧ Probability.ComputesOracleInTime output T adversary

WithinOracleTime unpacks to T n 0 ≤ t for a uniform halting oracle schedule T.

def Cslib.Crypto.Game.WithinTimeAndQueries {Operation β : Type} [DecidableEq Operation] (output : β ↪ List Bool) (n : ℕ) (r : ℕ × ℕ) (adversary : ℕ → List Bool → Probability.WordOracleComp Operation β) :

Joint (t, q) concrete adversary predicate at parameter n: adversary is realized by a uniform halting oracle machine within t steps on (n, []) and makes at most q external queries on (n, []).

theorem Cslib.Crypto.Game.indistinguishableWithin_withinTime_iff {β : Type} (output : β ↪ List Bool) (game1 game2 : (ℕ → List Bool → ProbComp β) → ℕ → Game) (ε : ℕ → ℕ → NNReal) :
IndistinguishableWithin game1 game2 (WithinTime output) ε ↔ ∀ (T : ℕ → ℕ → ℕ) (adversary : ℕ → List Bool → ProbComp β), Probability.ComputesInTime output T adversary → ∀ (n : ℕ), (game1 adversary n).advantage (game2 adversary n) ≤ ε n (T n 0)

Because ComputesInTime.mono holds unconditionally without computability of the padded schedule, concrete (WithinTime, ε)-security is equivalent to bounding advantage at T n 0 for every ComputesInTime schedule T.

theorem Cslib.Crypto.Game.indistinguishableWithin_withinTimeAndQueries_iff {Operation β : Type} [DecidableEq Operation] (output : β ↪ List Bool) (game1 game2 : (ℕ → List Bool → Probability.WordOracleComp Operation β) → ℕ → Game) (ε : ℕ → ℕ × ℕ → NNReal) :
IndistinguishableWithin game1 game2 (WithinTimeAndQueries output) ε ↔ ∀ (T : ℕ → ℕ → ℕ) (Q : ℕ → ℕ) (adversary : ℕ → List Bool → Probability.WordOracleComp Operation β), Probability.ComputesOracleInTime output T adversary → (∀ (n : ℕ), ProbOracleComp.IsQueryBounded (adversary n []) (Q n)) → ∀ (n : ℕ), (game1 adversary n).advantage (game2 adversary n) ≤ ε n (T n 0, Q n)

Concrete (WithinTimeAndQueries, ε)-security is equivalent to bounding advantage at (T n 0, Q n) for every ComputesOracleInTime schedule T and query schedule Q.

Direct concrete-to-asymptotic bridges for IsOraclePPT and IsPPT #

theorem Cslib.Crypto.Game.Indistinguishable.of_queryBounded {Operation β : Type} [DecidableEq Operation] {output : β ↪ List Bool} {game1 game2 : (ℕ → List Bool → Probability.WordOracleComp Operation β) → ℕ → Game} (ε : ℕ → ℕ → NNReal) (hbound : ∀ (n Q : ℕ) (adversary : ℕ → List Bool → Probability.WordOracleComp Operation β), ProbOracleComp.IsQueryBounded (adversary n []) Q → (game1 adversary n).advantage (game2 adversary n) ≤ ε n Q) (hneg : ∀ (Q : ℕ → ℕ), PolynomiallyBounded Q → Negligible fun (n : ℕ) => ε n (Q n)) :

Query-bounded concrete-to-asymptotic bridge. If every Q-query execution adversary n [] has advantage at most ε n Q and n ↦ ε n (Q n) is negligible along every polynomially bounded schedule Q, then game1 and game2 are asymptotically indistinguishable against IsOraclePPT.

theorem Cslib.Crypto.Game.Indistinguishable.of_queryBounded_real {Operation β : Type} [DecidableEq Operation] {output : β ↪ List Bool} {game1 game2 : (ℕ → List Bool → Probability.WordOracleComp Operation β) → ℕ → Game} (ε : ℕ → ℕ → NNReal) (hbound : ∀ (n Q : ℕ) (adversary : ℕ → List Bool → Probability.WordOracleComp Operation β), ProbOracleComp.IsQueryBounded (adversary n []) Q → ↑((game1 adversary n).advantage (game2 adversary n)) ≤ ↑(ε n Q)) (hneg : ∀ (Q : ℕ → ℕ), PolynomiallyBounded Q → Negligible fun (n : ℕ) => ε n (Q n)) :

Real-valued variant of Game.Indistinguishable.of_queryBounded, directly accepting switching and collision lemmas stated as (Game.advantage … : ℝ) ≤ ε n Q.

theorem Cslib.Crypto.Game.Indistinguishable.of_birthday_queryBounded_real {Operation β : Type} [DecidableEq Operation] {output : β ↪ List Bool} {game1 game2 : (ℕ → List Bool → Probability.WordOracleComp Operation β) → ℕ → Game} (k : ℕ) {base : ℕ → NNReal} (hbase : Negligible base) (hbound : ∀ (n Q : ℕ) (adversary : ℕ → List Bool → Probability.WordOracleComp Operation β), ProbOracleComp.IsQueryBounded (adversary n []) Q → ↑((game1 adversary n).advantage (game2 adversary n)) ≤ ↑(↑k * ↑(Q.choose 2) * base n)) :

Birthday-collision specialization of Game.Indistinguishable.of_queryBounded_real for concrete switching bounds of the form k * (Q.choose 2 : ℝ≥0) * base n with Negligible base (for example PRP–PRF switching with k = 1 and Luby–Rackoff with k = 3 or 4).

theorem Cslib.Crypto.Game.Indistinguishable.of_queryBounded_aux {Operation β : Type} [DecidableEq Operation] {output : β ↪ List Bool} {game1 game2 : (ℕ → List Bool → Probability.WordOracleComp Operation β) → ℕ → Game} (aux : ℕ → List Bool) (haux : PolynomiallyBounded fun (n : ℕ) => (aux n).length) (ε : ℕ → ℕ → NNReal) (hbound : ∀ (n Q : ℕ) (adversary : ℕ → List Bool → Probability.WordOracleComp Operation β), ProbOracleComp.IsQueryBounded (adversary n (aux n)) Q → (game1 adversary n).advantage (game2 adversary n) ≤ ε n Q) (hneg : ∀ (Q : ℕ → ℕ), PolynomiallyBounded Q → Negligible fun (n : ℕ) => ε n (Q n)) :

General auxiliary-input variant of Game.Indistinguishable.of_queryBounded for games invoking adversary n (aux n) along a polynomially bounded auxiliary word length.

theorem Cslib.Crypto.Game.Indistinguishable.of_succProbability_queryBounded {Operation β : Type} [DecidableEq Operation] {output : β ↪ List Bool} {game : (ℕ → List Bool → Probability.WordOracleComp Operation β) → ℕ → Game} (ε : ℕ → ℕ → NNReal) (hbound : ∀ (n Q : ℕ) (adversary : ℕ → List Bool → Probability.WordOracleComp Operation β), ProbOracleComp.IsQueryBounded (adversary n []) Q → (game adversary n).succProbability ≤ ε n Q) (hneg : ∀ (Q : ℕ → ℕ), PolynomiallyBounded Q → Negligible fun (n : ℕ) => ε n (Q n)) :
Indistinguishable game (fun (x : ℕ → List Bool → Probability.WordOracleComp Operation β) (x_1 : ℕ) => PMF.pure false) (Probability.IsOraclePPT output)

One-sided search/forgery variant of Game.Indistinguishable.of_queryBounded against PMF.pure false.

theorem Cslib.Crypto.Game.Indistinguishable.of_costBounded {Operation β : Type} [DecidableEq Operation] {output : β ↪ List Bool} {game1 game2 : (ℕ → List Bool → Probability.WordOracleComp Operation β) → ℕ → Game} (cost : Operation × List Bool → ℕ) (B : ℕ) (hcost : ∀ (req : Operation × List Bool), cost req ≤ B) (ε : ℕ → ℕ → NNReal) (hbound : ∀ (n K : ℕ) (adversary : ℕ → List Bool → Probability.WordOracleComp Operation β), OracleComp.IsCostBounded (Sum.elim (fun (x : ℕ) => 0) cost) (adversary n []) K → (game1 adversary n).advantage (game2 adversary n) ≤ ε n K) (hneg : ∀ (K : ℕ → ℕ), PolynomiallyBounded K → Negligible fun (n : ℕ) => ε n (K n)) :

Cost-bounded variant of Game.Indistinguishable.of_queryBounded for any per-request cost bound cost op ≤ B (for instance charging 1 on signing calls and 0 on hash calls).

theorem Cslib.Crypto.Game.Indistinguishable.of_queryBounded_reduction {SourceAdversary Operation β : Type} [DecidableEq Operation] {output : β ↪ List Bool} {source1 source2 : SourceAdversary → ℕ → Game} {target1 target2 : (ℕ → List Bool → Probability.WordOracleComp Operation β) → ℕ → Game} {SourceAdmissible : SourceAdversary → Prop} (hsource : Indistinguishable source1 source2 SourceAdmissible) (reduce : (ℕ → List Bool → Probability.WordOracleComp Operation β) → (ℕ → ℕ) → SourceAdversary) (loss : ℕ → ℕ → ℕ) (err : ℕ → ℕ → NNReal) (hadmissible : ∀ (adversary : ℕ → List Bool → Probability.WordOracleComp Operation β) (Q : ℕ → ℕ), Probability.IsOraclePPT output adversary → Turing.MultiTapeTM.ComputableInPolyTime Q Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary → PolynomiallyBounded Q → SourceAdmissible (reduce adversary Q)) (hloss : ∀ (Q : ℕ → ℕ), PolynomiallyBounded Q → PolynomiallyBounded fun (n : ℕ) => loss n (Q n)) (herr : ∀ (Q : ℕ → ℕ), PolynomiallyBounded Q → Negligible fun (n : ℕ) => err n (Q n)) (hbound : ∀ (adversary : ℕ → List Bool → Probability.WordOracleComp Operation β) (Q : ℕ → ℕ) (n : ℕ), ProbOracleComp.IsQueryBounded (adversary n []) (Q n) → (target1 adversary n).advantage (target2 adversary n) ≤ ↑(loss n (Q n)) * (source1 (reduce adversary Q) n).advantage (source2 (reduce adversary Q) n) + err n (Q n)) :

Query-schedule-parameterized reduction to asymptotic security. Covers hybrid and tree reductions (such as GGM) whose reduction algorithm reduce adversary Q takes an explicit unary polynomial-time computable query bound Q : ℕ → ℕ for adversary.

theorem Cslib.Crypto.Game.Indistinguishable.of_timeBounded_upTo {β : Type} {output : β ↪ List Bool} {game1 game2 : (ℕ → List Bool → ProbComp β) → ℕ → Game} (auxLen : ℕ → ℕ) (haux : PolynomiallyBounded auxLen) (ε : ℕ → ℕ → NNReal) (h : IndistinguishableWithin game1 game2 (WithinTimeUpTo output auxLen) ε) (hneg : ∀ (T : ℕ → ℕ), PolynomiallyBounded T → Negligible fun (n : ℕ) => ε n (T n)) :

Concrete (t, ε) security implies asymptotic IsPPT security on bounded-length auxiliary inputs (auxLen : ℕ → ℕ polynomially bounded).

theorem Cslib.Crypto.Game.Indistinguishable.of_timeBounded {β : Type} {output : β ↪ List Bool} {game1 game2 : (ℕ → List Bool → ProbComp β) → ℕ → Game} (ε : ℕ → ℕ → NNReal) (h : IndistinguishableWithin game1 game2 (WithinTime output) ε) (hneg : ∀ (T : ℕ → ℕ), PolynomiallyBounded T → Negligible fun (n : ℕ) => ε n (T n)) :

Concrete (t, ε) security implies asymptotic IsPPT security on empty auxiliary input.

theorem Cslib.Crypto.Game.Indistinguishable.of_timeAndQueryBounded {Operation β : Type} [DecidableEq Operation] {output : β ↪ List Bool} {game1 game2 : (ℕ → List Bool → Probability.WordOracleComp Operation β) → ℕ → Game} (ε : ℕ → ℕ × ℕ → NNReal) (h : IndistinguishableWithin game1 game2 (WithinTimeAndQueries output) ε) (hneg : ∀ (T Q : ℕ → ℕ), PolynomiallyBounded T → PolynomiallyBounded Q → Negligible fun (n : ℕ) => ε n (T n, Q n)) :

Concrete (t, q, ε) security implies asymptotic IsOraclePPT security.