Documentation

MIPRE.Foundations.CL.ProductSamplerProg

The product of a typed sampler and a directly answered one: the program #

The program half of MIPRE/Foundations/CL/ProductSampler. A DirectSampler is a family of typed presentations whose queries a total polynomial-time function answers outright, for every level, from parameters a routine computes at the index: the downsized PCP sampler of answer reduction is one. The product TypedSampler.prodDirect A B L of a typed sampler A and a direct sampler B has the types Ta × Tb, the presentations prodCL L (A.cl n w ta) (B.cl n tb) and a program making at most one call, through the universal machine, to A's, after a call to B's parameter routine:

The program is hardcode core (encode (A.prog, ℓa, B.parProg)) for a core depending only on B's two functions: that is what makes a sampler built this way depend only on its input sampler's program and its parameters.

@[reducible, inline]

The input of a direct answer: (p, type, kind, j, u, y), with p the parameters at the index and the query's kind, level and vectors as in Sampler.Query.toTuple.

Equations
Instances For
    structure MIPRE.CL.DirectSampler (ℓ : ℕ) (T : Type u_1) [Cost.SizedEncoding T] :
    Type u_1

    A directly answered typed sampler, the same for both players: a routine computes its parameters pd n at the index n, and a polynomial-time function of the parameters answers its queries, at every level.

    Instances For

      The parameter stage #

      The input is (H, n, q) with H = (A.prog, ℓa, B.parProg) hardcoded. The first stage calls the parameter routine on n and prepends its answer.

      Call the parameter routine on the index, keeping the input.

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

        The core #

        Its input is (p, H, n, q), p the parameters.

        A's level.

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

          B's half of the answer.

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

            A's query at the level j: (n, (ta, (kind, w, j, u_A, y_A))).

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

              A call to A on its typed query at the level j; the context is B's half.

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

                The call for the dimension; the context is B's dimension.

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

                  The direct answer beyond A's level: zero on A's half.

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

                    The router.

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

                      The post-processor: A's bits then B's, or the sum of the dimensions.

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

                        The core of the product sampler: the parameters, then the routed call.

                        Equations
                        Instances For

                          The product sampler's program: the core with (A.prog, ℓa, parProg) hardcoded.

                          Equations
                          Instances For

                            The router on well-formed queries #

                            theorem MIPRE.CL.ProductSampler.take_reverse_reverse {α : Type u_1} (l : List α) {a b : ℕ} (h : l.length = a + b) :
                            theorem MIPRE.CL.ProductSampler.drop_reverse_reverse {α : Type u_1} (l : List α) {a b : ℕ} (h : l.length = a + b) :
                            @[reducible, inline]
                            abbrev MIPRE.CL.ProductSampler.input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (q : TypedSampler.Query (Ta × Tb)) :

                            The input of the routed stage on a typed query.

                            Equations
                            Instances For
                              theorem MIPRE.CL.ProductSampler.parsedQ_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              parsedQ.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = (Cost.encode n, q.toTuple.1, q.toTuple.2.1.toBool, q.toTuple.2.2.1, q.toTuple.2.2.2.1, q.toTuple.2.2.2.2)
                              @[simp]
                              theorem MIPRE.CL.ProductSampler.kind_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              kind.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = q.toTuple.1
                              @[simp]
                              theorem MIPRE.CL.ProductSampler.lev_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              lev.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = q.toTuple.2.2.1
                              @[simp]
                              theorem MIPRE.CL.ProductSampler.uD_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              uD.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = q.toTuple.2.2.2.1
                              @[simp]
                              theorem MIPRE.CL.ProductSampler.yD_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              yD.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = q.toTuple.2.2.2.2
                              @[simp]
                              theorem MIPRE.CL.ProductSampler.levelA_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              levelA.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = ℓa
                              @[simp]
                              theorem MIPRE.CL.ProductSampler.dimB_input (D : Cost.PolyTimeFun Cost.Data Cost.Unary) {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              (dimB D).toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = D.toFun pdn
                              @[simp]
                              theorem MIPRE.CL.ProductSampler.qD_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              qD.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = (Cost.encode (ta, tb)).cons (Cost.encode q)
                              @[simp]
                              theorem MIPRE.CL.ProductSampler.tagD_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              tagD.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = (Cost.encode ta).cons (Cost.encode tb)
                              @[simp]
                              theorem MIPRE.CL.ProductSampler.pdD_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              pdD.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = pdn
                              @[simp]
                              theorem MIPRE.CL.ProductSampler.progD_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              progD.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = Cost.encode ap
                              @[simp]
                              theorem MIPRE.CL.ProductSampler.nD_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              nD.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = Cost.encode n
                              theorem MIPRE.CL.ProductSampler.queryA_input (D : Cost.PolyTimeFun Cost.Data Cost.Unary) {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) (j : Cost.PolyTimeFun Cost.Data ℕ) :
                              theorem MIPRE.CL.ProductSampler.route_atType (B : Cost.PolyTimeFun DirectInput Cost.BitStr) (D : Cost.PolyTimeFun Cost.Data Cost.Unary) {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              (route B D).toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = if q.toTuple.1 = 1 then (request B D levA).toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) else if q.toTuple.2.2.1 ≤ ℓa then (request B D lev).toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) else (direct B D).toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q))
                              theorem MIPRE.CL.ProductSampler.levA_input {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              levA.toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = if q.toTuple.2.2.1 ≤ ℓa then q.toTuple.2.2.1 else ℓa
                              theorem MIPRE.CL.ProductSampler.direct_input (B : Cost.PolyTimeFun DirectInput Cost.BitStr) (D : Cost.PolyTimeFun Cost.Data Cost.Unary) {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (ta : Ta) (tb : Tb) (q : Sampler.Query) :
                              (direct B D).toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q)) = (false, Cost.encode (List.map (fun (x : Bool) => false) (if q.toTuple.1 = 2 then (List.drop (List.length (D.toFun pdn)) (List.reverse q.toTuple.2.2.2.2)).reverse else (List.drop (List.length (D.toFun pdn)) (List.reverse q.toTuple.2.2.2.1)).reverse) ++ (answerB B D).toFun (input ap ℓa pp pdn n (TypedSampler.Query.atType (ta, tb) q))))
                              theorem MIPRE.CL.ProductSampler.route_call_shape (B : Cost.PolyTimeFun DirectInput Cost.BitStr) (D : Cost.PolyTimeFun Cost.Data Cost.Unary) (p H nD' q payload : Cost.Data) (h : (route B D).toFun (p.cons (H.cons (nD'.cons q))) = (true, payload)) :
                              ∃ (d : Cost.Data) (ctx : Cost.Data), payload = ((Cost.PolyTimeFun.treeHead.toFun H).cons (nD'.cons d)).cons ctx

                              Every call the router makes keeps the index.

                              theorem MIPRE.CL.ProductSampler.stage0_runs (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (q : Cost.Data) (t : ℕ) (hpp : pp.Runs (Cost.encode n) pdn t) :
                              ∃ (t' : ℕ), stage0.Runs ((Cost.encode (ap, ℓa, pp)).cons ((Cost.encode n).cons q)) (pdn.cons ((Cost.encode (ap, ℓa, pp)).cons ((Cost.encode n).cons q))) t'

                              The parameter stage prepends the routine's answer.

                              theorem MIPRE.CL.ProductSampler.prog_runs_of_stage (B : Cost.PolyTimeFun DirectInput Cost.BitStr) (D : Cost.PolyTimeFun Cost.Data Cost.Unary) (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (q r : Cost.Data) (t t₁ : ℕ) (hpp : pp.Runs (Cost.encode n) pdn t) (h : (stage B D).Runs (pdn.cons ((Cost.encode (ap, ℓa, pp)).cons ((Cost.encode n).cons q))) r t₁) :
                              ∃ (t' : ℕ), (prog B D ap ℓa pp).Runs ((Cost.encode n).cons q) r t'
                              theorem MIPRE.CL.ProductSampler.prog_runs_call (B : Cost.PolyTimeFun DirectInput Cost.BitStr) (D : Cost.PolyTimeFun Cost.Data Cost.Unary) (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (q a ctx r : Cost.Data) (t₀ t : ℕ) (hpp : pp.Runs (Cost.encode n) pdn t₀) (hroute : (route B D).toFun (pdn.cons ((Cost.encode (ap, ℓa, pp)).cons ((Cost.encode n).cons q))) = (true, ((Cost.encode ap).cons a).cons ctx)) (hr : ap.Runs a r t) :
                              ∃ (t' : ℕ), (prog B D ap ℓa pp).Runs ((Cost.encode n).cons q) (post.toFun (ctx, r)) t'
                              theorem MIPRE.CL.ProductSampler.prog_runs_direct (B : Cost.PolyTimeFun DirectInput Cost.BitStr) (D : Cost.PolyTimeFun Cost.Data Cost.Unary) (ap : Cost.Prog) (ℓa : ℕ) (pp : Cost.Prog) (pdn : Cost.Data) (n : ℕ) (q r : Cost.Data) (t₀ : ℕ) (hpp : pp.Runs (Cost.encode n) pdn t₀) (hroute : (route B D).toFun (pdn.cons ((Cost.encode (ap, ℓa, pp)).cons ((Cost.encode n).cons q))) = (false, r)) :
                              ∃ (t : ℕ), (prog B D ap ℓa pp).Runs ((Cost.encode n).cons q) r t

                              The product sampler #

                              noncomputable def MIPRE.CL.TypedSampler.prodDirect {ℓa ℓb : ℕ} {Ta : Type u_1} {Tb : Type u_2} [Cost.SizedEncoding Ta] [Cost.SizedEncoding Tb] (A : TypedSampler ℓa Ta) (B : DirectSampler ℓb Tb) (L : ℕ) (hA : 1 ≤ ℓa) (ha : ℓa ≤ L) (hb : ℓb ≤ L) :
                              TypedSampler L (Ta × Tb)

                              The product of a typed sampler and a direct sampler: the types are pairs, the presentations prodCL, and the program calls A's at most once.

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