Documentation

CslibFrontier.Crypto.Computational.OneTimeSignature.ContainmentFree

Containment-free encodings #

This module formalizes containment-free subset encodings used for one-time signatures ([BS23], Sections 14.2 and 14.4). No cryptographic primitives or security experiments are defined here.

A map P : M → Finset α is containment free (ContainmentFree P) when no image P m is a subset of another image P m' for distinct m ≠ m' (Definition 14.3). Equivalently, P is injective and its range is an antichain under ⊆ (containmentFree_iff). Any injective map into constant-size subsets is containment free (containmentFree_of_injective_of_card_eq). By the finite-cardinality form of Sperner's theorem (card_le_choose_half_of_containmentFree, proved from Mathlib's IsAntichain.sperner, underlying the n_min ≈ v + (log₂ v) / 2 estimate in Section 14.2.1, which is not formalized here), Fintype.card M ≤ Nat.choose n (n / 2) where n = Fintype.card α; conversely, any finite message space satisfying that bound admits a containment-free encoding via unrankCombination (exists_containmentFree_of_card_le, existence only with no polynomial-time claim; not stated in the book).

Two explicit computable encodings are provided:

Main definitions #

Main results #

References #

def Cslib.Crypto.OneTimeSignature.ContainmentFree {M : Type u_1} {α : Type u_2} (P : M → Finset α) :

Definition 14.3 ([BS23], Section 14.2, p. 587): a map P : M → Finset α is containment free if no image is a subset of the image of a distinct message.

theorem Cslib.Crypto.OneTimeSignature.containmentFree_iff {M : Type u_1} {α : Type u_2} (P : M → Finset α) :
ContainmentFree P ↔ Function.Injective P ∧ IsAntichain (fun (x1 x2 : Finset α) => x1 ⊆ x2) (Set.range P)

A subset encoding is containment free if and only if it is injective and its range is an antichain under subset inclusion.

theorem Cslib.Crypto.OneTimeSignature.containmentFree_of_injective_of_card_eq {M : Type u_1} {α : Type u_2} {P : M → Finset α} {ℓ : ℕ} (hinj : Function.Injective P) (hcard : ∀ (m : M), (P m).card = ℓ) :

Any injective map into subsets of a common cardinality ℓ is containment free.

Finite-cardinality form of Sperner's theorem, proved from Mathlib's IsAntichain.sperner: any containment-free family into Finset α has message space cardinality at most (Fintype.card α).choose (Fintype.card α / 2). ([BS23], Section 14.2.1, p. 588, invokes Sperner's theorem only for the n_min ≈ v + (log₂ v) / 2 estimate, which is not formalized here.)

The word construction underlying P_opt ([BS23], Section 14.2.1, pp. 588–589): appends the w-bit little-endian (lowBits, LSB-first) binary encoding of m.count false (v - weight m on v-bit messages) to m. Unlike Figure 14.2 (p. 589), which prints the checksum MSB-first, checksum bits are appended LSB-first here.

The set-valued P_opt encoding on v-bit strings with w-bit checksum.

Membership in the message coordinates of optSet v w m.

Membership in the checksum coordinates of optSet v w m.

Lemma 14.3 ([BS23], Section 14.2.1, pp. 588–589): P_opt is containment free whenever v < 2 ^ w (in particular for the book's choice w = 1 + Nat.clog 2 v).

A fixed-size subset word encoding ([BS23], Section 14.4, p. 593): maps a bitstring message via its big-endian binary value into unrankCombination n ℓ. This uses the library's unranking order (false before true) rather than the loop of Exercise 14.3.

The subset encoding on v-bit strings derived from horsWord; its image has constant cardinality ℓ (card_horsSet) and is containment free (horsSet_containmentFree) whenever 2 ^ v ≤ n.choose ℓ.

theorem Cslib.Crypto.OneTimeSignature.card_horsSet {n ℓ v : ℕ} (hbound : 2 ^ v ≤ n.choose ℓ) (m : BitString v) :
(horsSet n ℓ m).card = ℓ

Under 2 ^ v ≤ n.choose ℓ, horsSet n ℓ produces subsets of cardinality ℓ ([BS23], Section 14.4, p. 593).

Any bitstring message space with 2 ^ v ≤ n.choose ℓ admits a containment-free encoding into ℓ-element subsets of Fin n via horsSet ([BS23], Section 14.4, p. 593).

Converse to the finite-cardinality form of Sperner's theorem (not stated in [BS23]): any finite message space with cardinality at most n.choose (n / 2) admits a containment-free encoding into Finset (Fin n). This is a pure existence result and makes no polynomial-time claim.