Documentation

CslibFrontier.Crypto.Computational.InaccessibleEntropy.Basic

Real sample entropy and accessible average max-entropy #

For a deterministic function $F : \alpha \to \beta$ on a finite uniform domain $X \leftarrow \alpha$, the real sample entropy of $x \in \alpha$ (realSampleEntropy F x) is $\log_2 |F^{-1}(F(x))|$ ([HHRVW2020], Definition 3.1, p. 11); its expectation over uniform $X \leftarrow \alpha$ equals the conditional Shannon entropy $H(X \mid F(X))$ (expected_realSampleEntropy_eq_conditionalEntropy).

An $F$-collision-finder (IsCollisionFinder F A) is a randomized mapping supported on the preimage fiber $F^{-1}(F(x))$ ([HHRVW2020], Definition 3.3, p. 12); any randomized mapping is canonically sanitized to an $F$-collision-finder by falling back to $x$ on non-colliding outputs (sanitizeCollisionFinder, [HHRVW2020], Definition 3.3 and fallback discussion, p. 12).

A family of subsets $L(x) \subseteq F^{-1}(F(x))$ with $x \in L(x)$ witnesses accessible average max-entropy at most $\mathbb{E}_{X}[\log_2 |L(X)|]$ (accessibleSetExpectation L). AdversaryInaccessibleEntropyFamily formalizes [HHRVW2020], Definition 3.9 (p. 15) directly, quantifying an adversary-dependent family $L_A$ after each uniform strict-PPT collision-finder $A$ (IsWordCollisionFinder, IsAccessibleEntropyWitness); word-level fallback sanitization (sanitizeWordCollisionFinder) lifts this guarantee to arbitrary uniform strict-PPT adversaries (AdversaryInaccessibleEntropyFamily.exists_accessibleSet). InaccessibleEntropyFamily packages the stronger adversary-independent witness produced by Theorem 4.5 (one accSet against all adversaries) and coerces to AdversaryInaccessibleEntropyFamily (InaccessibleEntropyFamily.toAdversaryInaccessibleEntropyFamily). The elementary inequality $-\log_2(1 - \alpha) \ge \alpha$ for $\alpha \in [0, 1)$ lower-bounds the entropy gap $H(X \mid F(X)) - \mathbb{E}[\log_2 |L(X)|]$ by the expected fraction of fiber elements outside $L(X)$ (conditionalEntropy_sub_accessibleSetExpectation_ge, [HHRVW2020], Section 4.2, p. 24).

Main definitions #

Main results #

References #

Preimage fibers and real sample entropy #

def Cslib.Crypto.fiberSet {α : Type u_1} {β : Type u_2} [Fintype α] [DecidableEq β] (F : α → β) (y : β) :

Preimage fiber $F^{-1}(y) = \{x \in \alpha \mid F(x) = y\}$ of a finite-domain map.

@[simp]
theorem Cslib.Crypto.mem_fiberSet {α : Type u_1} {β : Type u_2} [Fintype α] [DecidableEq β] (F : α → β) (y : β) (x : α) :
x ∈ fiberSet F y ↔ F x = y
theorem Cslib.Crypto.self_mem_fiberSet {α : Type u_1} {β : Type u_2} [Fintype α] [DecidableEq β] (F : α → β) (x : α) :
x ∈ fiberSet F (F x)
theorem Cslib.Crypto.card_fiberSet_pos {α : Type u_1} {β : Type u_2} [Fintype α] [DecidableEq β] (F : α → β) (x : α) :
0 < (fiberSet F (F x)).card
theorem Cslib.Crypto.card_fiberSet_eq_fintypeCard {α : Type u_1} {β : Type u_2} [Fintype α] [DecidableEq β] (F : α → β) (y : β) :
(fiberSet F y).card = Fintype.card { x : α // F x = y }
noncomputable def Cslib.Crypto.realSampleEntropy {α : Type u_1} {β : Type u_2} [Fintype α] [DecidableEq β] (F : α → β) (x : α) :

Real sample entropy $\log_2 |F^{-1}(F(x))|$ of an input $x$ under uniform sampling on $\alpha$ ([HHRVW2020], Section 3.1, Definition 3.1, p. 11).

theorem Cslib.Crypto.realSampleEntropy_nonneg {α : Type u_1} {β : Type u_2} [Fintype α] [DecidableEq β] (F : α → β) (x : α) :
theorem Cslib.Crypto.realSampleEntropy_le_log_card {α : Type u_1} {β : Type u_2} [Fintype α] [DecidableEq β] (F : α → β) (x : α) :

Averaging realSampleEntropy F over a uniform input recovers the Shannon conditional entropy $H(X \mid F(X))$ ([HHRVW2020], Section 3.1, p. 11).

Collision-finding adversaries and canonical sanitization #

def Cslib.Crypto.IsCollisionFinder {α : Type u_1} {β : Type u_2} (F : α → β) (A : α → PMF α) :

An $F$-collision-finder is a randomized mapping that always outputs a preimage in the fiber $F^{-1}(F(x))$ ([HHRVW2020], Section 3.2, Definition 3.3, p. 12).

noncomputable def Cslib.Crypto.sanitizeCollisionFinder {α : Type u_1} {β : Type u_2} [DecidableEq β] (F : α → β) (A : α → PMF α) (x : α) :
PMF α

Canonical fallback sanitization replacing any non-colliding output of A x by x itself ([HHRVW2020], Section 3.2, Definition 3.3 and fallback discussion, p. 12).

theorem Cslib.Crypto.isCollisionFinder_sanitizeCollisionFinder {α : Type u_1} {β : Type u_2} [DecidableEq β] (F : α → β) (A : α → PMF α) :

Accessible set expectation and the fiber-escape entropy gap #

noncomputable def Cslib.Crypto.accessibleSetExpectation {α : Type u_1} [Fintype α] [Nonempty α] (L : α → Finset α) :

Expected base-$2$ log-cardinality $\mathbb{E}_{X \leftarrow \alpha}[\log_2 |L(X)|]$ of a family of accessible preimage sets ([HHRVW2020], Section 3.2, Definition 3.9, p. 15).

theorem Cslib.Crypto.expected_realSampleEntropy_sub_accessibleSetExpectation_ge {α : Type u_1} {β : Type u_2} [Fintype α] [Nonempty α] [DecidableEq α] [DecidableEq β] (F : α → β) (L : α → Finset α) (hself : ∀ (x : α), x ∈ L x) (hsub : ∀ (x : α), L x ⊆ fiberSet F (F x)) :

Pointwise bound behind [HHRVW2020], Claim 4.7 (p. 24): when $x \in L(x) \subseteq F^{-1}(F(x))$, the gap $\log_2 |F^{-1}(F(x))| - \log_2 |L(x)|$ is at least $|F^{-1}(F(x)) \setminus L(x)| / |F^{-1}(F(x))|$.

theorem Cslib.Crypto.conditionalEntropy_sub_accessibleSetExpectation_ge {α : Type u_1} {β : Type u_2} [Fintype α] [Nonempty α] [DecidableEq α] [Finite β] [DecidableEq β] (F : α → β) (L : α → Finset α) (hself : ∀ (x : α), x ∈ L x) (hsub : ∀ (x : α), L x ⊆ fiberSet F (F x)) :

Conditional-entropy form of expected_realSampleEntropy_sub_accessibleSetExpectation_ge ([HHRVW2020], Section 4.2, p. 24).

Computational accessible-escape game and family interface #

def Cslib.Crypto.wordToFinMap (inLen outLen : ℕ) (f : List Bool → List Bool) (z : BitString inLen) :
BitString outLen

Fixed-width BitString view of a word function on inLen-bit inputs, truncated or zero-padded to outLen output bits.

noncomputable def Cslib.Crypto.accessibleEscapeGame (evalWord : ℕ → List Bool → List Bool) (inLen : ℕ → ℕ) (accSet : (n : ℕ) → BitString (inLen n) → Finset (BitString (inLen n))) (A : ℕ → List Bool → ProbComp (List Bool)) (n : ℕ) :

Security experiment testing whether an adversary A outputs an (inLen n)-bit colliding preimage of evalWord n outside the accessible set accSet n.

def Cslib.Crypto.IsWordCollisionFinder (inLen : ℕ → ℕ) (evalWord : ℕ → List Bool → List Bool) (A : ℕ → List Bool → ProbComp (List Bool)) :

Word-level parameterized $F$-collision-finder ([HHRVW2020], Section 3.2, Definition 3.3, p. 12): on every security parameter n and (inLen n)-bit input zWord, A n zWord is supported on (inLen n)-bit preimages in the fiber of evalWord n zWord.

theorem Cslib.Crypto.IsWordCollisionFinder.isCollisionFinder {inLen outLen : ℕ → ℕ} {evalWord : ℕ → List Bool → List Bool} {A : ℕ → List Bool → ProbComp (List Bool)} (hA : IsWordCollisionFinder inLen evalWord A) (n : ℕ) :
IsCollisionFinder (wordToFinMap (inLen n) (outLen n) (evalWord n)) fun (z : BitString (inLen n)) => PMF.map (BitString.ofList (inLen n)) (A n (List.ofFn z)).eval

Every IsWordCollisionFinder induces a finite-domain IsCollisionFinder on BitString (inLen n).

def Cslib.Crypto.sanitizeWordCollisionFinder (inLen : ℕ → ℕ) (evalWord : ℕ → List Bool → List Bool) (A : ℕ → List Bool → ProbComp (List Bool)) (n : ℕ) (zWord : List Bool) :

Canonical word-level fallback sanitization ([HHRVW2020], Section 3.2, Definition 3.3 and fallback discussion, p. 12): runs A n zWord and falls back to zWord whenever the output does not have length inLen n or fails to collide under evalWord n.

theorem Cslib.Crypto.accessibleEscapeGame_sanitizeWordCollisionFinder (evalWord : ℕ → List Bool → List Bool) (inLen : ℕ → ℕ) (accSet : (n : ℕ) → BitString (inLen n) → Finset (BitString (inLen n))) (A : ℕ → List Bool → ProbComp (List Bool)) (n : ℕ) (hself : ∀ (z : BitString (inLen n)), z ∈ accSet n z) :
accessibleEscapeGame evalWord inLen accSet (sanitizeWordCollisionFinder inLen evalWord A) n = accessibleEscapeGame evalWord inLen accSet A n

Because z ∈ accSet n z, falling back to zWord on non-colliding outputs leaves accessibleEscapeGame identical as a ProbComp Bool program.

def Cslib.Crypto.IsAccessibleEntropyWitness (inLen outLen denom : ℕ → ℕ) (evalWord : ℕ → List Bool → List Bool) (A : ℕ → List Bool → ProbComp (List Bool)) (accSet : (n : ℕ) → BitString (inLen n) → Finset (BitString (inLen n))) :

accSet witnesses an eventual 1 / denom n gap between real Shannon conditional entropy and accessible average max-entropy against adversary A ([HHRVW2020], Section 3.2, Definition 3.9, p. 15).

[HHRVW2020], Section 3.2, Definition 3.9 (p. 15): a uniform polynomial-time fixed-width function family whose accessible average max-entropy is eventually at most $H(Z \mid F_0(Z)) - 1 / \mathrm{denom}(n)$ against adversary-dependent accessible preimage sets ($\forall$ uniform strict-PPT collision-finder $A$, $\exists L_A$).

Sanitization lifts Definition 3.9 from strict-PPT collision finders to arbitrary uniform strict-PPT adversaries.

A uniform polynomial-time fixed-width function family with one adversary-independent accessible-set family accSet n exhibiting an eventual 1 / denom n gap between real conditional Shannon entropy $H(Z \mid F(Z))$ and $\mathbb{E}[\log_2 |L(Z)|]$ against all uniform strict-PPT adversaries (cf. [HHRVW2020], Section 3.2, Definition 3.9, p. 15).

Every InaccessibleEntropyFamily ($\exists L\;\forall A$) satisfies Definition 3.9's adversary-dependent specification AdversaryInaccessibleEntropyFamily ($\forall A\;\exists L_A$), witnessed by the fixed family F.accSet for every adversary.