Documentation

CslibFrontier.Crypto.Protocols.PIR.Basic

Private information retrieval #

A database x : ι → β of entries in β (by default single bits β = Bool) is replicated on the servers S. A user who wants the entry x i sends each server one query and reconstructs x i from the answers. The scheme is private when no single server learns anything about i from its query Chor, Goldreich, Kushilevitz and Sudan, Definition 1.

A one-round scheme P : PIR.Scheme ι S R Q A β (β defaults to Bool) consists of

P.run x i is the user's output. P.IsCorrect says that this output is x i with probability one, for every database and index; P.IsPrivate says that for every server s, the distribution of the query P.serverQuery s i is the same for all indices i. Both are exact equalities of distributions, as in the information-theoretic setting of the source. The randomness is a ProbComp program, so its coins are uniform choices from finite ranges; the source's uniformly random string r ∈ {0,1}^ℓ is the special case of ProbComp.uniform (Fin ℓ → Bool), and its retained state is the random string itself. Privacy here (IsPrivate) is against each single server; coalitions of servers (IsTPrivate) are covered in PIR.Collusion, and block-retrieval transformations (β = κ → Bool) in PIR.Block. Machine running time of the user and servers (CGKS, Section 2.4, p. 6) is not modelled here.

The communication cost PIR.communication S Q A counts the bits of a fixed-length binary encoding of every query and answer: |S| · (⌈log₂ |Q|⌉ + ⌈log₂ |A|⌉). For Q = Fin ℓq → Bool and A = Fin ℓa → Bool this is the source's k · (ℓq + ℓa).

Two transformations build schemes from schemes. Scheme.rows is the generic transformation of CGKS, Section 3.4, restated as Proposition 4 in Section 4.1: a database indexed by ρ × ι is a matrix with rows indexed by ρ, the user sends the query for the column i, and each server answers it once for every row. Its communication is computed for one-bit answers (PIR.communication_rows), the case that Section 3.4 uses. Scheme.comap restricts a scheme along an embedding of indices, padding the database outside the image with a supplied default entry pad : β; it turns a scheme for a grid or a cube into one for Fin n. Both keep the queries of P up to reindexing, so IsPrivate.of_query_eq transfers privacy to them and to the transformations of PIR.Block.

The existence statement PIR.HasScheme ι k c β (some correct, private k-server scheme for databases ι → β communicating at most c bits) is the t = 1 case of PIR.HasTPrivateScheme and lives in PIR.Collusion.

Main definitions #

Main results #

References #

structure Cslib.Crypto.Protocols.PIR.Scheme (ι S R Q A : Type) (β : Type := Bool) :

A one-round private information retrieval scheme for databases x : ι → β (by default single bits β = Bool, or blocks in Section 4) held by the servers S, with user state R, queries Q and answers A CGKS, Definition 1 and Section 4.

  • query : ι → ProbComp (R × (S → Q))

    The user's query generator: for the index i, a retained state and one query per server.

  • answer : S → (ι → β) → Q → A

    The answer of the server s, holding the database x, to a query.

  • reconstruct : ι → R → (S → A) → β

    The user's reconstruction of the entry x i from the retained state and the answers.

The communication cost of a one-round scheme with servers S, queries Q and answers A: the number of bits sent and received when each query and each answer is written in a fixed-length binary encoding, |S| · (⌈log₂ |Q|⌉ + ⌈log₂ |A|⌉).

With 2 ^ ℓ answers, the answers carry ℓ bits.

Communication is bounded by any per-server bounds on the query and answer lengths.

A κ-tuple of symbols is encoded in at most |κ| times the bits of one symbol.

def Cslib.Crypto.Protocols.PIR.Scheme.run {ι S R Q A β : Type} (P : Scheme ι S R Q A β) (x : ι → β) (i : ι) :

The user's output on the database x and the index i: draw the state and the queries, ask each server, and reconstruct from the answers.

def Cslib.Crypto.Protocols.PIR.Scheme.serverQuery {ι S R Q A β : Type} (P : Scheme ι S R Q A β) (s : S) (i : ι) :

The query that the server s receives when the user wants the entry i.

def Cslib.Crypto.Protocols.PIR.Scheme.IsCorrect {ι S R Q A β : Type} (P : Scheme ι S R Q A β) :

Perfect correctness: on every database, the user outputs the entry it asks for with probability one.

def Cslib.Crypto.Protocols.PIR.Scheme.IsPrivate {ι S R Q A β : Type} (P : Scheme ι S R Q A β) :

Perfect privacy: for every server, the distribution of its query does not depend on the index that the user asks for.

theorem Cslib.Crypto.Protocols.PIR.Scheme.serverQuery_eq {ι S R Q A β : Type} (P : Scheme ι S R Q A β) (s : S) (i : ι) :
P.serverQuery s i = (fun (x : R × (S → Q)) => match x with | (fst, q) => q s) <$> P.query i
theorem Cslib.Crypto.Protocols.PIR.Scheme.eval_run {ι S R Q A β : Type} (P : Scheme ι S R Q A β) (x : ι → β) (i : ι) :
(P.run x i).eval = PMF.map (fun (rq : R × (S → Q)) => P.reconstruct i rq.1 fun (s : S) => P.answer s x (rq.2 s)) (P.query i).eval
theorem Cslib.Crypto.Protocols.PIR.Scheme.eval_serverQuery {ι S R Q A β : Type} (P : Scheme ι S R Q A β) (s : S) (i : ι) :
(P.serverQuery s i).eval = PMF.map (fun (rq : R × (S → Q)) => rq.2 s) (P.query i).eval
theorem Cslib.Crypto.Protocols.PIR.Scheme.isCorrect_iff_eval_run {ι S R Q A β : Type} (P : Scheme ι S R Q A β) :
P.IsCorrect ↔ ∀ (x : ι → β) (i : ι), (P.run x i).eval = PMF.pure (x i)
theorem Cslib.Crypto.Protocols.PIR.Scheme.isCorrect_iff {ι S R Q A β : Type} (P : Scheme ι S R Q A β) :
P.IsCorrect ↔ ∀ (x : ι → β) (i : ι) (r : R) (q : S → Q), (r, q) ∈ (P.query i).eval.support → (P.reconstruct i r fun (s : S) => P.answer s x (q s)) = x i

Perfect correctness holds exactly when every state and every queries that the user can draw reconstruct the right entry.

theorem Cslib.Crypto.Protocols.PIR.Scheme.isPrivate_iff {ι S R Q A β : Type} (P : Scheme ι S R Q A β) :
P.IsPrivate ↔ ∀ (s : S) (i i' : ι), (P.serverQuery s i).eval = (P.serverQuery s i').eval
theorem Cslib.Crypto.Protocols.PIR.Scheme.IsCorrect.reconstruct_eq {ι S R Q A β : Type} {P : Scheme ι S R Q A β} (h : P.IsCorrect) (x : ι → β) (i : ι) {r : R} {q : S → Q} (hrq : (r, q) ∈ (P.query i).eval.support) :
(P.reconstruct i r fun (s : S) => P.answer s x (q s)) = x i

A correct scheme reconstructs the right entry from every state and queries the user can draw.

theorem Cslib.Crypto.Protocols.PIR.Scheme.IsPrivate.eval_serverQuery_eq {ι S R Q A β : Type} {P : Scheme ι S R Q A β} (h : P.IsPrivate) (s : S) (i i' : ι) :
(P.serverQuery s i).eval = (P.serverQuery s i').eval

In a private scheme, each server's query has the same distribution for all indices.

theorem Cslib.Crypto.Protocols.PIR.Scheme.IsPrivate.of_query_eq {ι S R Q A β : Type} {P : Scheme ι S R Q A β} {ι' R' A' β' : Type} {P' : Scheme ι' S R' Q A' β'} (h : P.IsPrivate) (f : ι' → ι) (hq : ∀ (i : ι'), (Prod.snd <$> P'.query i).eval = (Prod.snd <$> P.query (f i)).eval) :

Privacy transfer. If the queries that P' sends for i have the law of the queries that the private scheme P sends for f i, then P' is private. The retained states, answers and reconstructions of the two schemes are unconstrained.

The rows transformation #

def Cslib.Crypto.Protocols.PIR.Scheme.rows {ι S R Q A β : Type} (ρ : Type) (P : Scheme ι S R Q A β) :
Scheme (ρ × ι) S R Q (ρ → A) β

The rows transformation CGKS, Section 3.4: a database indexed by ρ × ι is a matrix whose rows j ↦ x (j, ·) are databases indexed by ι. To read x (j, i), the user sends the queries of P for the column i, each server answers them for every row, and the user reconstructs from the answers for the row j.

theorem Cslib.Crypto.Protocols.PIR.Scheme.query_rows {ι S R Q A β : Type} (ρ : Type) (P : Scheme ι S R Q A β) (ji : ρ × ι) :
(rows ρ P).query ji = P.query ji.2
theorem Cslib.Crypto.Protocols.PIR.Scheme.answer_rows {ι S R Q A β : Type} (ρ : Type) (P : Scheme ι S R Q A β) (s : S) (x : ρ × ι → β) (q : Q) (j : ρ) :
(rows ρ P).answer s x q j = P.answer s (fun (i : ι) => x (j, i)) q
theorem Cslib.Crypto.Protocols.PIR.Scheme.reconstruct_rows {ι S R Q A β : Type} (ρ : Type) (P : Scheme ι S R Q A β) (ji : ρ × ι) (r : R) (a : S → ρ → A) :
(rows ρ P).reconstruct ji r a = P.reconstruct ji.2 r fun (s : S) => a s ji.1
theorem Cslib.Crypto.Protocols.PIR.Scheme.run_rows {ι S R Q A β : Type} (ρ : Type) (P : Scheme ι S R Q A β) (x : ρ × ι → β) (j : ρ) (i : ι) :
(rows ρ P).run x (j, i) = P.run (fun (i' : ι) => x (j, i')) i
theorem Cslib.Crypto.Protocols.PIR.Scheme.IsCorrect.rows {ι S R Q A β : Type} {P : Scheme ι S R Q A β} (ρ : Type) (h : P.IsCorrect) :
theorem Cslib.Crypto.Protocols.PIR.Scheme.IsPrivate.rows {ι S R Q A β : Type} {P : Scheme ι S R Q A β} (ρ : Type) (h : P.IsPrivate) :

Restriction along an embedding #

noncomputable def Cslib.Crypto.Protocols.PIR.Scheme.comap {ι S R Q A β ι' : Type} (P : Scheme ι' S R Q A β) (e : ι ↪ ι') (pad : β) :
Scheme ι S R Q A β

The scheme P for databases indexed by ι', used on databases indexed by ι through an embedding e : ι ↪ ι': the user asks for e i, and the servers pad the database with pad outside the image of e.

theorem Cslib.Crypto.Protocols.PIR.Scheme.query_comap {ι S R Q A β ι' : Type} (P : Scheme ι' S R Q A β) (e : ι ↪ ι') (pad : β) (i : ι) :
(P.comap e pad).query i = P.query (e i)
theorem Cslib.Crypto.Protocols.PIR.Scheme.IsCorrect.comap {ι S R Q A β ι' : Type} {P : Scheme ι' S R Q A β} (h : P.IsCorrect) (e : ι ↪ ι') (pad : β) :
(P.comap e pad).IsCorrect
theorem Cslib.Crypto.Protocols.PIR.Scheme.IsPrivate.comap {ι S R Q A β ι' : Type} {P : Scheme ι' S R Q A β} (h : P.IsPrivate) (e : ι ↪ ι') (pad : β) :
(P.comap e pad).IsPrivate

The rows transformation keeps the queries and multiplies the length of each one-bit answer by the number of rows CGKS, Section 3.4; this is the one-bit answer case of the accounting in Proposition 4 (Section 4.1).