Documentation

CslibFrontier.Crypto.Computational.PseudorandomFunction.PrefixFreePair

Common block extensions for flat queries #

These are query preparation steps of [BS23], v0.6, Theorems 7.3 and 7.4 (printed pp. 258–260). For a pair, the choice uses the first block after the shorter word. For a batch, it searches for a block absent from the complete rows of all words.

Main definitions #

Main results #

Choose a common extension block from the all-zero and all-one blocks for two flat queries. Only the complete input blocks inform the choice.

@[simp]

The result has the declared width on every input.

theorem Cslib.Crypto.PRF.separatingWordBlock_prefix_incomparable {width : ℕ} (hwidth : 0 < width) {u v : List Bool} (hu : width ∣ u.length) (hv : width ∣ v.length) (hne : u ≠ v) :
have c := separatingWordBlock width u v; ¬u ++ c <+: v ++ c ∧ ¬v ++ c <+: u ++ c

The common extension makes two distinct, block-aligned queries prefix-incomparable as bit lists.

The input is a framed unary width, the framed first raw word, and the second raw word. The common block is returned as a raw word in deterministic polynomial time.

Find a fresh block for a batch of flat messages, reading only complete blocks. The bounded search uses the little-endian order of BitString.equivFin.

theorem Cslib.Crypto.PRF.length_freshBatchWordBlock_of_eq_some {width : ℕ} {messages : List (List Bool)} {block : List Bool} (hblock : freshBatchWordBlock width messages = some block) :
block.length = width

A block returned by the flat search has exactly the requested width.

theorem Cslib.Crypto.PRF.isPrefixFree_append_of_freshBatchWordBlock_eq_some {width : ℕ} {messages : List (List Bool)} {block : List Bool} (hwidth : 0 < width) (haligned : ∀ word ∈ messages, width ∣ word.length) (hblock : freshBatchWordBlock width messages = some block) :
InformationTheory.IsPrefixFree ((fun (msg : List Bool) => msg ++ block) '' {msg : List Bool | msg ∈ messages})

Appending a block returned by the flat search makes the batch prefix-free at positive width, provided each original word consists of complete blocks.

theorem Cslib.Crypto.PRF.freshBatchWordBlock_eq_map_freshBatchBlock (width : ℕ) (messages : List (List Bool)) :
freshBatchWordBlock width messages = Option.map List.ofFn (freshBatchBlock (List.map (fun (word : List Bool) => List.map (BitString.ofList width) (BitString.listRows (word.length / width) width word)) messages))

The word search returns the bit list of the same block as the indexed search, after splitting each input into complete blocks. For aligned inputs this splitting represents the entire word.

theorem Cslib.Crypto.PRF.freshBatchWordBlock_isSome_of_sum_div_lt {width : ℕ} {messages : List (List Bool)} (hsize : (List.map (fun (word : List Bool) => word.length / width) messages).sum < 2 ^ width) :
(freshBatchWordBlock width messages).isSome = true

With more alphabet elements than complete block occurrences, the flat search succeeds.

The flat-word search runs in deterministic polynomial time. The input is a framed unary width followed by a framed list of raw words, and the output is an option containing a raw word.