Documentation

CslibFrontier.Computability.LocallyDecodable.Smoothing

Locally decodable codes are smooth #

Katz and Trevisan [KatzTrevisan2000, Theorem 1] observed that a local decoder can be made smooth: a (q, δ, ε) local decoder yields a (q, q / δ, ε) smooth decoder (restated as Kerenidis and de Wolf, Theorem 9, arXiv:quant-ph/0208062v2, for non-adaptive decoders). The decoder reads at most q positions in expectation, so at most δ |P| positions are heavy, read more than q / (δ |P|) times in expectation (Code.card_heavyPositions_le). The smooth decoder runs the local decoder but answers the queries to heavy positions itself, from a fixed word z, without reading them (Code.mask). Run on the codeword C x, it behaves as the local decoder run on the word that agrees with z on the heavy positions and with C x elsewhere, which differs from C x on at most δ |P| positions, so it still outputs each bit with probability 1 / 2 + ε; and it reads no heavy position, while it reads every other position as often as the local decoder, whose reads do not depend on the word, does against z.

For decoders with oblivious reads (Code.HasObliviousReads)—which includes every non-adaptive decoder (Code.hasObliviousReads_nonadaptive, Code.hasObliviousReads_nonadaptivePlan) and every one-query decoder (Code.hasObliviousReads_of_isQueryBounded_one)—smoothing incurs no loss in advantage (Code.isSmoothDecoder_mask_heavyPositions).

For an arbitrary adaptive q-query decoder over a finite nonempty alphabet Γ, guessing the answers to the first q - 1 queries uniformly at random (aborting to a fair coin flip on any mismatch, and padding early stops to match the attenuation factor) yields an explicit non-adaptive query plan (Code.NonadaptivePlan, Code.nonadaptivize) whose output bias is scaled by exactly |Γ| ^ -(q - 1) (Code.toReal_decodeLaw_nonadaptivize) [Yek12]. Masking its heavy positions therefore smooths any adaptive (q, δ, ε) local decoder into a non-adaptive (q, q / δ, ε / |Γ| ^ (q - 1)) smooth decoder (Code.IsLocalDecoder.isSmoothDecoder_adaptive, Code.IsLocallyDecodable.isSmoothCode). Smoothness is measured here by expected reads, which bounds the probability of reading each position.

Main definitions #

Main results #

References #

noncomputable def Cslib.Code.mask {P Γ α : Type} [DecidableEq P] (H : Finset P) (z : P → Γ) (program : ProbOracleComp (fun (x : P) => Γ) α) :
ProbOracleComp (fun (x : P) => Γ) α

Run program, answering its queries to the positions of H from the word z instead of querying them.

def Cslib.Code.splice {P Γ : Type} [DecidableEq P] (H : Finset P) (z y : P → Γ) :
P → Γ

The word that agrees with z on H and with y elsewhere.

theorem Cslib.Code.isQueryBounded_mask {P Γ α : Type} [DecidableEq P] (H : Finset P) (z : P → Γ) {program : ProbOracleComp (fun (x : P) => Γ) α} {q : ℕ} (hq : program.IsQueryBounded q) :
(mask H z program).IsQueryBounded q

Masking makes no more queries.

theorem Cslib.Code.decodeLaw_mask {P Γ α : Type} [DecidableEq P] (H : Finset P) (z : P → Γ) (program : ProbOracleComp (fun (x : P) => Γ) α) (y : P → Γ) :
decodeLaw (mask H z program) y = decodeLaw program (splice H z y)

The masked program run against y is the program run against y spliced with z on H.

theorem Cslib.Code.expectedReads_mask {P Γ α : Type} [DecidableEq P] (H : Finset P) (z : P → Γ) (program : ProbOracleComp (fun (x : P) => Γ) α) (y : P → Γ) (j : P) :
expectedReads (mask H z program) y j = if j ∈ H then 0 else expectedReads program (splice H z y) j

The masked program reads no position of H, and reads every other position as often as the program run against the spliced word.

theorem Cslib.Code.hammingDist_splice_le {P Γ : Type} [DecidableEq P] (H : Finset P) (z : P → Γ) [Fintype P] [DecidableEq Γ] (y : P → Γ) :

The spliced word differs from y only on H.

Heavy positions #

noncomputable def Cslib.Code.heavyPositions {P Γ α : Type} [DecidableEq P] [Fintype P] (program : ProbOracleComp (fun (x : P) => Γ) α) (z : P → Γ) (c : ℝ) :

The positions that program, run against z, reads more than c / |P| times in expectation.

theorem Cslib.Code.card_heavyPositions_le {P Γ α : Type} [DecidableEq P] [Fintype P] {program : ProbOracleComp (fun (x : P) => Γ) α} {q : ℕ} (hq : program.IsQueryBounded q) (z : P → Γ) {δ : ℝ} (hδ : 0 < δ) :
↑(heavyPositions program z (↑q / δ)).card ≤ δ * ↑(Fintype.card P)

Few positions are heavy: a program making at most q queries reads more than q / (δ |P|) times in expectation at most δ |P| positions.

Smoothing #

theorem Cslib.Code.isSmoothDecoder_mask_heavyPositions {ι P Γ : Type} [DecidableEq P] [Fintype P] [DecidableEq Γ] {C : (ι → Bool) → P → Γ} {q : ℕ} {δ ε : ℝ} {A : LocalDecoder ι P Γ} (hA : IsLocalDecoder C q δ ε A) (hobl : ∀ (i : ι), HasObliviousReads (A i)) (hδ : 0 < δ) (z : P → Γ) :
IsSmoothDecoder C q (↑q / δ) ε fun (i : ι) => mask (heavyPositions (A i) z (↑q / δ)) z (A i)

Katz–Trevisan smoothing [KatzTrevisan2000, Theorem 1], as restated in Kerenidis and de Wolf, Theorem 9 (arXiv:quant-ph/0208062v2): a (q, δ, ε) local decoder whose reads do not depend on the received word becomes a (q, q / δ, ε) smooth decoder when the queries to its heavy positions are answered from a fixed word z instead.

Source mapping. The source states that every (q, δ, ε) locally decodable code is a (q, q / δ, ε) smooth code, for non-adaptive decoders (Definitions 1 and 3 there), with smoothness bounding the probability of querying each position. Here the hypothesis is that the reads are oblivious (HasObliviousReads), which holds for every non-adaptive decoder (hasObliviousReads_nonadaptive) and for every one-query decoder, adaptive or not (hasObliviousReads_of_isQueryBounded_one); general adaptive decoders are not covered. The conclusion bounds expected reads, which is at least as strong as the source's read-probability bound.

theorem Cslib.Code.IsLocalDecoder.isSmoothCode {ι P Γ : Type} [DecidableEq P] [Fintype P] [DecidableEq Γ] {C : (ι → Bool) → P → Γ} {q : ℕ} {δ ε : ℝ} {A : LocalDecoder ι P Γ} (hA : IsLocalDecoder C q δ ε A) (hobl : ∀ (i : ι), HasObliviousReads (A i)) (hδ : 0 < δ) :
IsSmoothCode C q (↑q / δ) ε

A locally decodable code with an oblivious-read decoder is smooth.

Decoders making one query #

theorem Cslib.Code.expectedReads_eq_zero_of_isQueryBounded_zero {P Γ α : Type} [DecidableEq P] {program : ProbOracleComp (fun (x : P) => Γ) α} (hq : program.IsQueryBounded 0) (y : P → Γ) (j : P) :
expectedReads program y j = 0

A program making no query reads no position.

theorem Cslib.Code.decodeLaw_eq_of_isQueryBounded_zero {P Γ α : Type} {program : ProbOracleComp (fun (x : P) => Γ) α} (hq : program.IsQueryBounded 0) (y y' : P → Γ) :
decodeLaw program y = decodeLaw program y'

A program making no query has the same output law against every word.

theorem Cslib.Code.hasObliviousReads_of_isQueryBounded_one {P Γ α : Type} [DecidableEq P] {program : ProbOracleComp (fun (x : P) => Γ) α} (hq : program.IsQueryBounded 1) :

A decoder making one query has oblivious reads: the position it reads is chosen before it reads anything.

theorem Cslib.Code.IsLocalDecoder.isSmoothCode_of_one {ι P Γ : Type} [DecidableEq P] [Fintype P] [DecidableEq Γ] {C : (ι → Bool) → P → Γ} {δ ε : ℝ} {A : LocalDecoder ι P Γ} (hA : IsLocalDecoder C 1 δ ε A) (hδ : 0 < δ) :
IsSmoothCode C 1 (1 / δ) ε

One-query locally decodable codes are smooth, the case q = 1 of [KatzTrevisan2000, Theorem 1] (see isSmoothDecoder_mask_heavyPositions): a (1, δ, ε) local decoder, adaptive or not, yields a (1, 1 / δ, ε) smooth decoder.

Non-adaptive query plans #

structure Cslib.Code.NonadaptivePlan (P Γ : Type) (q : ℕ) :

A deterministic non-adaptive query plan making at most q queries: slot k queries j when queries k = some j and is skipped when queries k = none, and decide computes the output bit from the symbols read.

  • queries : Fin q → Option P

    Position queried in each of the q slots, or none to skip the slot.

  • decide : (Fin q → Option Γ) → Bool

    Deterministic decision rule applied to the symbols read.

Instances For
    def Cslib.Code.NonadaptivePlan.eval {P Γ : Type} {q : ℕ} (plan : NonadaptivePlan P Γ q) (y : P → Γ) :

    Evaluate a non-adaptive query plan against a received word y.

    The set of positions queried by a non-adaptive query plan.

    theorem Cslib.Code.NonadaptivePlan.mem_querySet_iff {P Γ : Type} {q : ℕ} [DecidableEq P] (plan : NonadaptivePlan P Γ q) (j : P) :
    j ∈ plan.querySet ↔ ∃ (k : Fin q), plan.queries k = some j
    theorem Cslib.Code.NonadaptivePlan.eval_eq_of_eqOn {P Γ : Type} {q : ℕ} [DecidableEq P] (plan : NonadaptivePlan P Γ q) {y y' : P → Γ} (h : ∀ j ∈ plan.querySet, y j = y' j) :
    plan.eval y = plan.eval y'

    The output of a non-adaptive plan depends only on the received word on its query set.

    def Cslib.Code.NonadaptivePlan.restrictEval {P Γ : Type} {q : ℕ} [DecidableEq P] (plan : NonadaptivePlan P Γ q) (w : ↥plan.querySet → Γ) :

    Evaluate a non-adaptive plan given only the symbols on its query set.

    theorem Cslib.Code.NonadaptivePlan.restrictEval_restrict {P Γ : Type} {q : ℕ} [DecidableEq P] (plan : NonadaptivePlan P Γ q) (y : P → Γ) :
    plan.restrictEval (plan.querySet.restrict y) = plan.eval y
    def Cslib.Code.NonadaptivePlan.mask {P Γ : Type} {q : ℕ} [DecidableEq P] (H : Finset P) (z : P → Γ) (plan : NonadaptivePlan P Γ q) :

    Mask the positions in H using the fixed word z: queries to H are skipped and answered directly from z.

    theorem Cslib.Code.NonadaptivePlan.eval_mask {P Γ : Type} {q : ℕ} [DecidableEq P] (H : Finset P) (z : P → Γ) (plan : NonadaptivePlan P Γ q) (y : P → Γ) :
    (mask H z plan).eval y = plan.eval (splice H z y)
    theorem Cslib.Code.NonadaptivePlan.querySet_mask {P Γ : Type} {q : ℕ} [DecidableEq P] (H : Finset P) (z : P → Γ) (plan : NonadaptivePlan P Γ q) :
    (mask H z plan).querySet = plan.querySet \ H
    noncomputable def Cslib.Code.NonadaptivePlan.ofTuple {P Γ : Type} {q : ℕ} [Nonempty Γ] (Q : Fin q → P) (output : (Fin q → Γ) → Bool) :

    Convert a fixed-tuple non-adaptive decision (Q, output) into a NonadaptivePlan.

    theorem Cslib.Code.NonadaptivePlan.eval_ofTuple {P Γ : Type} {q : ℕ} [Nonempty Γ] (Q : Fin q → P) (output : (Fin q → Γ) → Bool) (y : P → Γ) :
    (ofTuple Q output).eval y = output (y ∘ Q)
    def Cslib.Code.nonadaptivePlan {P Γ : Type} {q : ℕ} (planLaw : ProbComp (NonadaptivePlan P Γ q)) :
    ProbOracleComp (fun (x : P) => Γ) Bool

    Run a distribution over non-adaptive query plans as a local-decoder program.

    theorem Cslib.Code.decodeLaw_nonadaptivePlan {P Γ : Type} {q : ℕ} (planLaw : ProbComp (NonadaptivePlan P Γ q)) (y : P → Γ) :
    decodeLaw (nonadaptivePlan planLaw) y = PMF.map (fun (plan : NonadaptivePlan P Γ q) => plan.eval y) planLaw.eval
    theorem Cslib.Code.expectedReads_nonadaptivePlan {P Γ : Type} {q : ℕ} [DecidableEq P] (planLaw : ProbComp (NonadaptivePlan P Γ q)) (y : P → Γ) (j : P) :
    expectedReads (nonadaptivePlan planLaw) y j = ∑' (plan : NonadaptivePlan P Γ q), planLaw.eval plan * ∑ k : Fin q, if plan.queries k = some j then 1 else 0
    theorem Cslib.Code.decodeLaw_nonadaptivePlan_mask {P Γ : Type} {q : ℕ} [DecidableEq P] (H : Finset P) (z : P → Γ) (planLaw : ProbComp (NonadaptivePlan P Γ q)) (y : P → Γ) :
    theorem Cslib.Code.expectedReads_nonadaptivePlan_mask {P Γ : Type} {q : ℕ} [DecidableEq P] (H : Finset P) (z : P → Γ) (planLaw : ProbComp (NonadaptivePlan P Γ q)) (y : P → Γ) (j : P) :
    noncomputable def Cslib.Code.nonadaptivePlanOf {P Γ : Type} {q : ℕ} {R : Type} [Nonempty Γ] (coins : ProbComp R) (Q : R → Fin q → P) (output : R → (Fin q → Γ) → Bool) :

    Convert a Code.nonadaptive decoder into an equivalent NonadaptivePlan sampler.

    theorem Cslib.Code.decodeLaw_nonadaptivePlanOf {P Γ : Type} {q : ℕ} {R : Type} [Nonempty Γ] (coins : ProbComp R) (Q : R → Fin q → P) (output : R → (Fin q → Γ) → Bool) (y : P → Γ) :
    decodeLaw (nonadaptivePlan (nonadaptivePlanOf coins Q output)) y = decodeLaw (nonadaptive coins Q output) y
    theorem Cslib.Code.expectedReads_nonadaptivePlanOf {P Γ : Type} {q : ℕ} [DecidableEq P] {R : Type} [Nonempty Γ] (coins : ProbComp R) (Q : R → Fin q → P) (output : R → (Fin q → Γ) → Bool) (y : P → Γ) (j : P) :
    expectedReads (nonadaptivePlan (nonadaptivePlanOf coins Q output)) y j = expectedReads (nonadaptive coins Q output) y j

    Adaptive-to-non-adaptive reduction and general smoothing #

    noncomputable def Cslib.Code.nonadaptivizePlan {P Γ : Type} [Fintype Γ] [Nonempty Γ] [DecidableEq Γ] (q : ℕ) (prog : ProbOracleComp (fun (x : P) => Γ) Bool) :

    Convert any q-query adaptive decoder program into a non-adaptive query-plan sampler by guessing the answers to the first q - 1 queries uniformly at random, outputting a fair coin on any mismatch, and matching the attenuation factor on early stops [Yek12].

    noncomputable def Cslib.Code.nonadaptivize {P Γ : Type} [Fintype Γ] [Nonempty Γ] [DecidableEq Γ] (q : ℕ) (prog : ProbOracleComp (fun (x : P) => Γ) Bool) (hq : prog.IsQueryBounded q) :
    ProbOracleComp (fun (x : P) => Γ) Bool

    The non-adaptive decoder program obtained from an adaptive q-query program by guessing the first q - 1 answers.

    theorem Cslib.Code.toReal_decodeLaw_nonadaptivize {P Γ : Type} [Fintype Γ] [Nonempty Γ] [DecidableEq Γ] {q : ℕ} {prog : ProbOracleComp (fun (x : P) => Γ) Bool} (hq : prog.IsQueryBounded q) (y : P → Γ) (b : Bool) :
    ((decodeLaw (nonadaptivize q prog hq) y) b).toReal = 1 / 2 + (((decodeLaw prog y) b).toReal - 1 / 2) / ↑(Fintype.card Γ) ^ (q - 1)

    Exact output law of the adaptive-to-non-adaptive reduction: nonadaptivize scales the deviation of every output probability from 1 / 2 by |Γ| ^ -(q - 1). In particular, q ≤ 1 incurs no loss.

    theorem Cslib.Code.IsLocalDecoder.nonadaptivize {ι P Γ : Type} [Fintype P] [Fintype Γ] [Nonempty Γ] [DecidableEq Γ] {C : (ι → Bool) → P → Γ} {q : ℕ} {δ ε : ℝ} {A : LocalDecoder ι P Γ} (hA : IsLocalDecoder C q δ ε A) :
    IsLocalDecoder C q δ (ε / ↑(Fintype.card Γ) ^ (q - 1)) fun (i : ι) => Code.nonadaptivize q (A i) ⋯

    Adaptive-to-non-adaptive reduction for local decoders [Yek12]: every (q, δ, ε) local decoder (adaptive or not) yields a non-adaptive (q, δ, ε / |Γ| ^ (q - 1)) local decoder.

    theorem Cslib.Code.isSmoothDecoder_mask_nonadaptivePlan {ι P Γ : Type} [Fintype P] [DecidableEq P] [DecidableEq Γ] {C : (ι → Bool) → P → Γ} {q : ℕ} {δ ε : ℝ} {planLaw : ι → ProbComp (NonadaptivePlan P Γ q)} (hA : IsLocalDecoder C q δ ε fun (i : ι) => nonadaptivePlan (planLaw i)) (hδ : 0 < δ) (z : P → Γ) :
    IsSmoothDecoder C q (↑q / δ) ε fun (i : ι) => nonadaptivePlan (NonadaptivePlan.mask (heavyPositions (nonadaptivePlan (planLaw i)) z (↑q / δ)) z <$> planLaw i)

    Masking the heavy positions of a non-adaptive local decoder produces an explicit non-adaptive (q, q / δ, ε) smooth decoder with no loss in advantage [KatzTrevisan2000, Theorem 1].

    theorem Cslib.Code.IsLocalDecoder.isSmoothDecoder_adaptive {ι P Γ : Type} [Fintype P] [DecidableEq P] [Fintype Γ] [Nonempty Γ] [DecidableEq Γ] {C : (ι → Bool) → P → Γ} {q : ℕ} {δ ε : ℝ} {A : LocalDecoder ι P Γ} (hA : IsLocalDecoder C q δ ε A) (hδ : 0 < δ) (z : P → Γ) :
    IsSmoothDecoder C q (↑q / δ) (ε / ↑(Fintype.card Γ) ^ (q - 1)) fun (i : ι) => nonadaptivePlan (NonadaptivePlan.mask (heavyPositions (Code.nonadaptivize q (A i) ⋯) z (↑q / δ)) z <$> nonadaptivizePlan q (A i) ⋯)

    Adaptive Katz–Trevisan smoothing: every (q, δ, ε) local decoder (adaptive or not) over a finite nonempty alphabet Γ yields an explicit non-adaptive (q, q / δ, ε / |Γ| ^ (q - 1)) smooth decoder, combining the adaptive-to-non-adaptive reduction [Yek12] with heavy-position masking [KatzTrevisan2000, Theorem 1].

    theorem Cslib.Code.IsLocallyDecodable.isSmoothCode {ι P Γ : Type} [Fintype P] [DecidableEq P] [Fintype Γ] [Nonempty Γ] [DecidableEq Γ] {C : (ι → Bool) → P → Γ} {q : ℕ} {δ ε : ℝ} (hC : IsLocallyDecodable C q δ ε) (hδ : 0 < δ) :
    IsSmoothCode C q (↑q / δ) (ε / ↑(Fintype.card Γ) ^ (q - 1))

    Every locally decodable code is smooth: an arbitrary (possibly adaptive) (q, δ, ε) locally decodable code over a finite nonempty alphabet Γ is a (q, q / δ, ε / |Γ| ^ (q - 1)) smooth code.