Documentation

MIPRE.Tailored.Repeat.LenProg

The repeated answer-length calculator #

The answer-length calculator of the repeated tailored verifier (issue #280, P2b), on (n, x, κ), with the input sampler S̄ and calculator L̄ and the parameters (λ, τ) stored:

  1. ask S̄ for the dimension s = s(n), and put it in unary;
  2. compute k = k(n) = Repetition.reps λ τ n in unary (dimProg on 1, then to unary);
  3. cut x into its k blocks of s bits, and run L̄ on (n, xᵢ, κ') for every block and both kinds κ';
  4. output the concatenation of the outputs at the kind κ, whose length is the sum of the coordinates' lengths.

It runs L̄ on both kinds so that it halts only where every coordinate has both its lengths (RepSpec.good_of_len). Every stage between the calls is a PolyTimeFun; the calls go through Calls.mapCall.

The stages #

@[reducible, inline]

The stored data of the calculator: (S̄, L̄, λ, τ).

Equations
Instances For
    @[reducible, inline]

    The input of the core: the stored data and (n, d).

    Equations
    Instances For

      Stage 1: the call to S̄ on the dimension query.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Stage 3: the input of dimProg computing k = 2^{τ(|λ| + |n|)} · 1.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[simp]
          theorem MIPRE.Tailored.RepProg.lenC_apply (a : LenIn) (us : Cost.Unary) :
          lenC.toFun (a, us) = ((a, us), 1, a.1.2.2.1, a.2.1, a.1.2.2.2)

          The queries to L̄: every block at false, then every block at true.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            The question and the kind read off the datum d = (x, κ).

            Equations
            Instances For

              Stage 4: the blocks of x and the queries to L̄; the context is (κ, k).

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                @[simp]
                theorem MIPRE.Tailored.RepProg.lenD_apply (p : (LenIn × Cost.Unary) × Cost.Unary) :
                lenD.toFun p = ((readK p.1.1.2.2, p.2), p.1.1.1.2.1, lenQueries p.1.1.2.1 (blocks (readQ p.1.1.2.2) (List.length p.1.2) (List.length p.2)))

                The output: the concatenation of the outputs at the kind κ.

                Equations
                Instances For

                  Stage 5: the output.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    The program #

                    The core of the repeated answer-length calculator, on ((S̄, L̄, λ, τ), (n, d)).

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      The run #

                      noncomputable def MIPRE.Tailored.RepProg.lenQs (n : ℕ) (d : Cost.Data) (s k : ℕ) :

                      The queries of the calculator to L̄ at (n, d), with dimension s and k coordinates.

                      Equations
                      Instances For
                        noncomputable def MIPRE.Tailored.RepProg.lenCoreCost (sp lp : Cost.Prog) (lam tau n : ℕ) (d : Cost.Data) (s k Td T Z : ℕ) (rs : List Cost.Data) :

                        The cost of the core, stage by stage, with the dimension query of cost at most Td, the calls to L̄ of cost at most T, and Z bounding the queries and results of the last loop.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          theorem MIPRE.Tailored.RepProg.lenCore_runsLe {univ : Cost.Prog} (hU : Cost.Prog.WellScoped 1 univ) (sp lp : Cost.Prog) (lam tau n : ℕ) (d : Cost.Data) (s : ℕ) {Td : ℕ} (hdim : Calls.RunsLe univ ((Cost.encode sp).cons (Cost.encode (n, CL.Sampler.Query.dimension))) (Cost.encode s) Td) (f : Cost.Data → Cost.Data) (T Z : ℕ) (hf : ∀ q ∈ lenQs n d s (Repetition.reps lam tau n), Calls.RunsLe univ ((Cost.encode lp).cons q) (f q) T) (hZ : (Cost.Data.list (lenQs n d s (Repetition.reps lam tau n))).size + (Cost.Data.list (List.map f (lenQs n d s (Repetition.reps lam tau n)))).size + 1 ≤ Z) :
                          Calls.RunsLe (lenCore univ) (Cost.encode ((sp, lp, lam, tau), n, d)) (Cost.encode (lenOut (readK d) (Repetition.reps lam tau n) (List.map f (lenQs n d s (Repetition.reps lam tau n))))) (lenCoreCost sp lp lam tau n d s (Repetition.reps lam tau n) Td T Z (List.map f (lenQs n d s (Repetition.reps lam tau n))))

                          The run of the core, from runs of the calls: the dimension query answered by s, and the calls to L̄ answered by f.

                          theorem MIPRE.Tailored.RepProg.lenCore_inv {univ : Cost.Prog} (hU : Cost.Prog.WellScoped 1 univ) (sp lp : Cost.Prog) (lam tau n : ℕ) (d : Cost.Data) (s : ℕ) {td : ℕ} (hdim : univ.Runs ((Cost.encode sp).cons (Cost.encode (n, CL.Sampler.Query.dimension))) (Cost.encode s) td) {r : Cost.Data} {t : ℕ} (h : (lenCore univ).Runs (Cost.encode ((sp, lp, lam, tau), n, d)) r t) :
                          ∃ (rs : List Cost.Data), List.Forall₂ (fun (q r : Cost.Data) => ∃ (t' : ℕ), univ.Runs ((Cost.encode lp).cons q) r t') (lenQs n d s (Repetition.reps lam tau n)) rs ∧ r = Cost.encode (lenOut (readK d) (Repetition.reps lam tau n) rs)

                          Inversion of the core: when the dimension query is answered by s, a halting run ran L̄ on every query, and output the concatenation of the results at the kind κ.

                          The calculator #

                          noncomputable def MIPRE.Tailored.RepProg.repLenProg (sp lp : Cost.Prog) (lam tau : ℕ) :

                          The program of the repeated answer-length calculator: the core with (S̄, L̄, λ, τ) stored.

                          Equations
                          Instances For
                            noncomputable def MIPRE.Tailored.RepProg.repLen {ℓ : ℕ} (S : CL.Sampler ℓ) (L : Decider) (lam tau : ℕ) :

                            The repeated answer-length calculator.

                            Equations
                            Instances For

                              The i-th block of a question of 𝔽₂^{k s} is the i-th chunk of its bit string.

                              theorem MIPRE.Tailored.RepProg.exists_of_forall₂ {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {l₁ : List α} {l₂ : List β} :
                              List.Forall₂ R l₁ l₂ → ∀ a ∈ l₁, ∃ (b : β), R a b
                              theorem MIPRE.Tailored.RepProg.lenOut_lenQueries (n : ℕ) (bl : List Cost.BitStr) (κ : Bool) (f : Cost.Data → Cost.Data) {k : ℕ} (hk : bl.length = k) :

                              The output at the queries of a list of blocks: the concatenation of the results at the kind κ.

                              theorem MIPRE.Tailored.RepProg.length_flatten_map_ofFn {α : Type u_1} {k : ℕ} (g : Fin k → Cost.BitStr) (F : Cost.BitStr → List α) :
                              (List.map F (List.ofFn g)).flatten.length = ∑ i : Fin k, (F (g i)).length

                              The length of a list concatenated over the coordinates.

                              theorem MIPRE.Tailored.RepProg.lenQs_toBits {ℓ : ℕ} (V : TailoredVerifier ℓ) (lam tau n : ℕ) (x : Fin (TailoredVerifier.K lam tau n * V.sampler.dim n) → CL.𝔽₂) (κ : Bool) :
                              lenQs n (Cost.encode (CL.toBits x, κ)) (V.sampler.dim n) (TailoredVerifier.K lam tau n) = lenQueries n (List.ofFn fun (i : Fin (TailoredVerifier.K lam tau n)) => CL.toBits (V.qc lam tau n x i))

                              The queries at a question of the repeated verifier are those of its coordinates.

                              The dimension query, through the universal machine.

                              theorem MIPRE.Tailored.RepProg.repLen_runs_of {ℓ : ℕ} (V : TailoredVerifier ℓ) (lam tau : ℕ) {n : ℕ} {d r : Cost.Data} {t : ℕ} (h : (lenCore Cost.selfUniversal.univ).Runs (Cost.encode ((V.sampler.prog, V.len.prog, lam, tau), n, d)) r t) :
                              ∃ (t' : ℕ), (repLen V.sampler V.len lam tau).prog.Runs ((Cost.encode n).cons d) r t'

                              The run of the calculator from a run of its core.

                              theorem MIPRE.Tailored.RepProg.repLen_lenIs {ℓ : ℕ} (V : TailoredVerifier ℓ) (lam tau n : ℕ) (x : Fin (TailoredVerifier.K lam tau n * V.sampler.dim n) → CL.𝔽₂) (hx : ∀ (i : Fin (TailoredVerifier.K lam tau n)), V.LenDefined n (CL.toBits (V.qc lam tau n x i))) (κ : Bool) :
                              LenIs (repLen V.sampler V.len lam tau) n (CL.toBits x) κ (∑ i : Fin (TailoredVerifier.K lam tau n), V.lenOf n (CL.toBits (V.qc lam tau n x i)) κ)

                              RepSpec.len_eq: at a question all of whose coordinates have their lengths, the calculator outputs the sum of the coordinates' lengths.

                              theorem MIPRE.Tailored.RepProg.good_of_repLen {ℓ : ℕ} (V : TailoredVerifier ℓ) (lam tau n : ℕ) (x : Fin (TailoredVerifier.K lam tau n * V.sampler.dim n) → CL.𝔽₂) (κ : Bool) (m : ℕ) (h : LenIs (repLen V.sampler V.len lam tau) n (CL.toBits x) κ m) (i : Fin (TailoredVerifier.K lam tau n)) :
                              V.LenDefined n (CL.toBits (V.qc lam tau n x i))

                              RepSpec.good_of_len: the calculator halts only at questions all of whose coordinates have their lengths.

                              theorem MIPRE.Tailored.RepProg.repLen_lenBound {ℓ : ℕ} (S : CL.Sampler ℓ) (L : Decider) (lam tau n B : ℕ) (hB : LenBound L n B) :
                              LenBound (repLen S L lam tau) n (Repetition.reps lam tau n * B)

                              The lengths of the repeated calculator are at most k(n) times the input's.