Documentation

CslibFrontier.Crypto.Primitives.Garbling.LabelWord

Garbling labels as words #

At parameter k a garbling label is a (k + 1)-bit key and a colour bit, BitString (k + 1) × Bool. Garbling schemes that work on words, and the circular correlation robustness assumption on word hash families, write a label as its word labelBits: the key's bits followed by the colour, k + 2 bits, which is the reply of labelCodec k. The word of a sum of labels is the XOR of their words (labelBits_add).

This module also reads labels back from words. labelEquiv k identifies (k + 2)-bit strings with labels, splitting off the last bit as the colour, and labelOfWord k word is the label of the first k + 2 bits of word, padded with false. On a word of k + 2 bits, labelBits undoes it (labelBits_labelOfWord).

Main definitions #

Main results #

Words of labels #

The word of a label: the bits of its key, then its colour. It is the reply of labelCodec k, through which a label oracle answers on words; that reply does not depend on the tweak, so labelBits label = (labelCodec k).encodeReply t label by rfl for every tweak t.

theorem Cslib.Crypto.Garbling.labelBits_apply {k : ℕ} (label : BitString (k + 1) × Bool) :
labelBits label = List.ofFn label.1 ++ [label.2]

A label word is the bits of its key followed by its colour.

@[simp]
theorem Cslib.Crypto.Garbling.length_labelBits {k : ℕ} (label : BitString (k + 1) × Bool) :
(labelBits label).length = k + 2

A label word has k + 2 bits.

The word of a sum of labels is the XOR of their words.

theorem Cslib.Crypto.Garbling.getD_labelBits {k : ℕ} (label : BitString (k + 1) × Bool) :
(labelBits label).getD (k + 1) false = label.2

The colour of a label word is its last bit.

@[simp]
theorem Cslib.Crypto.Garbling.take_labelBits {k : ℕ} (label : BitString (k + 1) × Bool) :
List.take (k + 1) (labelBits label) = List.ofFn label.1

The key of a label word is its first k + 1 bits.

Labels of words #

A label as a (k + 2)-bit string: the k + 1 bits of its key, then its colour.

The label of a (k + 2)-bit word.

theorem Cslib.Crypto.Garbling.labelBits_labelOfWord {k : ℕ} {word : List Bool} (hword : word.length = k + 2) :
labelBits (labelOfWord k word) = word

The label of a (k + 2)-bit word has that word.

theorem Cslib.Crypto.Garbling.ofFn_labelOfWord_fst {k : ℕ} {word : List Bool} (hword : word.length = k + 2) :
List.ofFn (labelOfWord k word).1 = List.take (k + 1) word

The key of the label of a (k + 2)-bit word is its first k + 1 bits.

theorem Cslib.Crypto.Garbling.labelOfWord_snd (k : ℕ) (word : List Bool) :
(labelOfWord k word).2 = word.getD (k + 1) false

The colour of the label of a word is its bit k + 1.