Documentation

MIPRE.Tailored.AnsRed.IndicatorProg

The output indicator, as a program #

The triangulated output indicator L* (Definition defn:decider-read, II:8381) of MIPRE.Tailored.AnsRed.Indicator, written as a program of the ambient model: the four runs of the answer-length calculator and the run of the processor of the canonical decider (MIPRE.Tailored.canonProg, whose input builders it reuses), followed by a polynomial-time check that decides LstarOK at the parameters prm n of the index.

Helpers #

noncomputable def MIPRE.Tailored.AnsRed.mapR {ι : Type u_1} {α : Type u_2} {γ : Type u_3} [Cost.SizedEncoding ι] [Cost.SizedEncoding α] [Cost.SizedEncoding γ] (F : Cost.PolyTimeFun (α × ι) γ) (l : Cost.PolyTimeFun ι (List α)) :

Map over a list computed from the input, the input as the context.

Equations
Instances For
    @[simp]
    theorem MIPRE.Tailored.AnsRed.mapR_apply {ι : Type u_1} {α : Type u_2} {γ : Type u_3} [Cost.SizedEncoding ι] [Cost.SizedEncoding α] [Cost.SizedEncoding γ] (F : Cost.PolyTimeFun (α × ι) γ) (l : Cost.PolyTimeFun ι (List α)) (i : ι) :
    (mapR F l).toFun i = List.map (fun (a : α) => F.toFun (a, i)) (l.toFun i)
    noncomputable def MIPRE.Tailored.AnsRed.flatMapR {ι : Type u_1} {α : Type u_2} {γ : Type u_3} [Cost.SizedEncoding ι] [Cost.SizedEncoding α] [Cost.SizedEncoding γ] (F : Cost.PolyTimeFun (α × ι) (List γ)) (l : Cost.PolyTimeFun ι (List α)) :

    flatMap over a list computed from the input, the input as the context.

    Equations
    Instances For
      @[simp]
      theorem MIPRE.Tailored.AnsRed.flatMapR_apply {ι : Type u_1} {α : Type u_2} {γ : Type u_3} [Cost.SizedEncoding ι] [Cost.SizedEncoding α] [Cost.SizedEncoding γ] (F : Cost.PolyTimeFun (α × ι) (List γ)) (l : Cost.PolyTimeFun ι (List α)) (i : ι) :
      (flatMapR F l).toFun i = List.flatMap (fun (a : α) => F.toFun (a, i)) (l.toFun i)
      @[simp]

      ||.

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

        Exclusive or.

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

          The bit of a string at a unary position, false past the end.

          Equations
          Instances For
            theorem MIPRE.Tailored.AnsRed.headD_drop {α : Type u_1} (l : List α) (n : ℕ) (d : α) :
            (List.drop n l).headD d = l.getD n d

            A unary list is the unary numeral of its length.

            The purified equation, in unary #

            The positions j < k, in unary, at which c has a one at o + j: onesFrom in unary.

            Equations
            Instances For
              theorem MIPRE.Tailored.AnsRed.flatMap_filter_eq {β : Type u_1} (l : List ℕ) (p : ℕ → Bool) (f : ℕ → β) :
              List.flatMap (fun (j : ℕ) => if p j = true then [f j] else []) l = List.map f (List.filter p l)
              def MIPRE.Tailored.AnsRed.pureEqnU (lRx lLx lRy lLy N : ℕ) (aR bR c : Cost.BitStr) :

              The purified equation (pureEqn) with its variables in unary and its right-hand side a bit: the positions of the ones of the two linear windows, those of y shifted by N, and the parity of the affine coordinate and the two readable inner products.

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

                An equation with its variables in unary, read.

                Equations
                Instances For

                  The inner product of a window of c with v, as a sum, when the window lies in c.

                  theorem MIPRE.Tailored.AnsRed.toEqn_pureEqnU (lRx lLx lRy lLy N : ℕ) (aR bR c : Cost.BitStr) :
                  toEqn (pureEqnU lRx lLx lRy lLy N aR bR c) = pureEqn lRx lLx lRy lLy N aR bR c
                  def MIPRE.Tailored.AnsRed.rowsU (N lRx lLx lRy lLy : ℕ) (aR bR : Cost.BitStr) (cs : List Cost.BitStr) :

                  The rows the indicator decouples, in unary.

                  Equations
                  Instances For
                    theorem MIPRE.Tailored.AnsRed.map_toEqn_rowsU (N lRx lLx lRy lLy : ℕ) (aR bR : Cost.BitStr) (cs : List Cost.BitStr) :
                    List.map toEqn (rowsU N lRx lLx lRy lLy aR bR cs) = lsRows N lRx lLx lRy lLy aR bR cs

                    The triangulation, in unary #

                    @[reducible, inline]

                    A triangulated equation with its variables in unary, and its coefficients as the signature word [0, 0, a₁, a₂, a₃, b] with which the table compares its signs.

                    Equations
                    Instances For

                      A triangulated equation in unary, read.

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

                        The signature word is [0, 0, a₁, a₂, a₃, b].

                        Equations
                        Instances For

                          yv N r i = N + r N + i, in unary.

                          Equations
                          Instances For

                            The triangulation of one row in unary (triRow), the row's index r in unary.

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

                              The triangulation in unary (triangle).

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                theorem MIPRE.Tailored.AnsRed.mapIdx_eq_zip_range {α : Type u_1} {β : Type u_2} (l : List α) (f : ℕ → α → β) :
                                List.mapIdx f l = List.map (fun (p : α × ℕ) => f p.2 p.1) (l.zip (List.range l.length))

                                The table, in unary #

                                The six signs held by the last coordinate s, as a word [ε_A, ε_B, ε₁, ε₂, ε₃, ε₀].

                                Equations
                                Instances For

                                  The 64 sign words, in the order of the last coordinate.

                                  Equations
                                  Instances For
                                    def MIPRE.Tailored.AnsRed.triMatch (u₁ u₂ u₃ : Cost.Unary) (w : Cost.BitStr) (t : TriU) :

                                    A triangulated equation matches the signs w and the three copy coordinates.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      def MIPRE.Tailored.AnsRed.decIndU (uA uB u₁ u₂ u₃ : Cost.Unary) (w : Cost.BitStr) (N : Cost.Unary) (tris : List TriU) :

                                      The indicator at given coordinates and signs, in unary: decInd inside the loops, whose ranges make its range conditions true.

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

                                        The table, loop by loop, in unary.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          theorem MIPRE.Tailored.AnsRed.decIndU_eq {N D uA uB u₁ u₂ u₃ s : ℕ} {tris : List TriU} (hwf : ∀ t ∈ tris, t.WF) (hA : uA < N) (hB : uB < N) (h₁ : u₁ < D) (h₂ : u₂ < D) :
                                          decIndU (Cost.unary uA) (Cost.unary uB) (Cost.unary u₁) (Cost.unary u₂) (Cost.unary u₃) (signWord s) (Cost.unary N) tris = decide (decInd N N D (List.map toTri tris) uA uB u₁ u₂ u₃ (sgn s 0) (sgn s 1) (sgn s 2) (sgn s 3) (sgn s 4) (sgn s 5))

                                          The indicator in unary is decInd inside the loops.

                                          theorem MIPRE.Tailored.AnsRed.flatMap_congr_mem {α : Type u_1} {β : Type u_2} {l : List α} {f g : α → List β} (h : ∀ a ∈ l, f a = g a) :
                                          theorem MIPRE.Tailored.AnsRed.tableU_eq (N D : ℕ) {tris : List TriU} (hwf : ∀ t ∈ tris, t.WF) :

                                          The table in unary is the table, on well-formed equations.

                                          The programs of the pieces #

                                          onesU, as a program on (c, o, k).

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            @[reducible, inline]

                                            The context of a purified equation: the four lengths, the table size, the readable answers.

                                            Equations
                                            Instances For

                                              The program computing pureEqnU on a constraint and its context.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                theorem MIPRE.Tailored.AnsRed.pureEqnRaw_apply (p : Cost.BitStr × PCtx) :
                                                pureEqnRaw.toFun p = pureEqnU (List.length p.2.1) (List.length p.2.2.1) (List.length p.2.2.2.1) (List.length p.2.2.2.2.1) (List.length p.2.2.2.2.2.1) p.2.2.2.2.2.2.1 p.2.2.2.2.2.2.2 p.1

                                                pureEqnU, as a program on a constraint and its context.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  @[simp]
                                                  theorem MIPRE.Tailored.AnsRed.pureEqnUF_apply (c : Cost.BitStr) (lRx lLx lRy lLy N : Cost.Unary) (aR bR : Cost.BitStr) :
                                                  pureEqnUF.toFun (c, lRx, lLx, lRy, lLy, N, aR, bR) = pureEqnU (List.length lRx) (List.length lLx) (List.length lRy) (List.length lLy) (List.length N) aR bR c

                                                  The rows, as a program on the constraints and the context.

                                                  Equations
                                                  Instances For
                                                    @[simp]
                                                    theorem MIPRE.Tailored.AnsRed.rowsUF_apply (cs : List Cost.BitStr) (lRx lLx lRy lLy N : Cost.Unary) (aR bR : Cost.BitStr) :
                                                    rowsUF.toFun (cs, lRx, lLx, lRy, lLy, N, aR, bR) = rowsU (List.length N) (List.length lRx) (List.length lLx) (List.length lRy) (List.length lLy) aR bR cs

                                                    yvU, as a program on (N, r, i).

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

                                                      The program computing triRowU on (e, r, N).

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

                                                        triRowU, as a program on (e, r, N).

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

                                                          triangleU, as a program on (rows, N).

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

                                                            triMatch, as a program on (t, u₁, u₂, u₃, w).

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

                                                              triMatch, as a program.

                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                @[reducible, inline]

                                                                The input of the indicator in the loops: the five coordinates, the signs, N, D and the triangulated equations.

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

                                                                  decIndU, as a program.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    theorem MIPRE.Tailored.AnsRed.decIndRaw_apply (p : IIn) :
                                                                    decIndRaw.toFun p = decIndU p.1 p.2.1 p.2.2.1 p.2.2.2.1 p.2.2.2.2.1 p.2.2.2.2.2.1 p.2.2.2.2.2.2.1 p.2.2.2.2.2.2.2.2

                                                                    decIndU, as a program.

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

                                                                      The table program, loop by loop, on (N, D, tris).

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

                                                                        tableU, as a program.

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For
                                                                          @[simp]
                                                                          theorem MIPRE.Tailored.AnsRed.tableF_apply (N D : Cost.Unary) (tris : List TriU) :
                                                                          tableF.toFun (N, D, tris) = tableU N D tris

                                                                          Powers of two, capped #

                                                                          The step of pow2CapF: double the accumulator, capped at the length of the cap.

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

                                                                            min(2^k, m) in unary, on (k, m): never more than m, so polynomial in the input.

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

                                                                              The number of indices of the table, tableSize, in unary.

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

                                                                                The check #

                                                                                @[reducible, inline]

                                                                                The input of the check: the output of the processor, the four lengths ((n, y, true) first) and the decider's input (n, x, y, a, b), as the canonical decider stacks them.

                                                                                Equations
                                                                                Instances For
                                                                                  @[reducible, inline]

                                                                                  The input of the parameter-free check: the input of the check and the parameters (ℓ, ◇) in unary.

                                                                                  Equations
                                                                                  Instances For

                                                                                    The check, parameter-free: on the input of the check and parameters (ℓ, ◇) in unary, it decides LstarOK (2^ℓ) (2^◇) (lstarCore_apply). The parameter program enters the check only through lstarRaw.

                                                                                    Equations
                                                                                    • One or more equations did not get rendered due to their size.
                                                                                    Instances For
                                                                                      theorem MIPRE.Tailored.AnsRed.lstarCore_apply (r₀ r₁ r₂ r₃ r₄ : Cost.Data) (i : DIn) (ℓ dm : Cost.Unary) :
                                                                                      lstarCore.toFun ((r₀, r₁, r₂, r₃, r₄, i), ℓ, dm) = lstarCheck (List.length ℓ) (List.length dm) r₄.spineList.length r₃.spineList.length r₂.spineList.length r₁.spineList.length r₀.bitsListD i.2.2.2.1 i.2.2.2.2

                                                                                      The index n of the input of the check.

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

                                                                                        The program of the check, at the parameter program prm of the index: the parameter-free check lstarCore, on the input and the parameters prm n of its index.

                                                                                        Equations
                                                                                        Instances For
                                                                                          theorem MIPRE.Tailored.AnsRed.lstarRaw_apply (prm : Cost.PolyTimeFun ℕ (Cost.Unary × Cost.Unary)) (r₀ r₁ r₂ r₃ r₄ : Cost.Data) (i : DIn) :
                                                                                          (lstarRaw prm).toFun (r₀, r₁, r₂, r₃, r₄, i) = lstarCheck (List.length (prm.toFun i.1).1) (List.length (prm.toFun i.1).2) r₄.spineList.length r₃.spineList.length r₂.spineList.length r₁.spineList.length r₀.bitsListD i.2.2.2.1 i.2.2.2.2

                                                                                          The check of the output indicator, as a program: it decides LstarOK at the table size 2^ℓ and the copy size 2^◇ that prm gives the index (lstarFinal_apply).

                                                                                          Equations
                                                                                          • One or more equations did not get rendered due to their size.
                                                                                          Instances For
                                                                                            theorem MIPRE.Tailored.AnsRed.lstarFinal_apply (prm : Cost.PolyTimeFun ℕ (Cost.Unary × Cost.Unary)) (r₀ r₁ r₂ r₃ r₄ : Cost.Data) (i : DIn) :
                                                                                            (lstarFinal prm).toFun (r₀, r₁, r₂, r₃, r₄, i) = decide (LstarOK (2 ^ List.length (prm.toFun i.1).1) (2 ^ List.length (prm.toFun i.1).2) r₄.spineList.length r₃.spineList.length r₂.spineList.length r₁.spineList.length r₀.bitsListD i.2.2.2.1 i.2.2.2.2)

                                                                                            The output indicator #

                                                                                            After the fourth run of the answer-length calculator: run the processor, then check.

                                                                                            Equations
                                                                                            Instances For

                                                                                              The output indicator L* of a tailored verifier with answer-length calculator L and processor P (Definition defn:decider-read), at the parameter program prm: on encode (n, x, y, a, b), the four runs of L and the run of P of the canonical decider, then the check.

                                                                                              Equations
                                                                                              Instances For
                                                                                                theorem MIPRE.Tailored.AnsRed.lstarProg_accepts (prm : Cost.PolyTimeFun ℕ (Cost.Unary × Cost.Unary)) {L P : Cost.Prog} (hL : Cost.Prog.WellScoped 1 L) (hP : Cost.Prog.WellScoped 1 P) (i : DIn) :
                                                                                                (∃ (t : ℕ), (lstarProg prm L P).Runs (Cost.encode i) (Cost.encode true) t) ↔ ∃ (r₁ : Cost.Data) (r₂ : Cost.Data) (r₃ : Cost.Data) (r₄ : Cost.Data) (r₀ : Cost.Data), (∃ (t : ℕ), L.Runs (Cost.encode (i.1, i.2.1, false)) r₁ t) ∧ (∃ (t : ℕ), L.Runs (Cost.encode (i.1, i.2.1, true)) r₂ t) ∧ (∃ (t : ℕ), L.Runs (Cost.encode (i.1, i.2.2.1, false)) r₃ t) ∧ (∃ (t : ℕ), L.Runs (Cost.encode (i.1, i.2.2.1, true)) r₄ t) ∧ (∃ (t : ℕ), P.Runs (Cost.encode (i.1, i.2.1, i.2.2.1, List.take r₁.spineList.length i.2.2.2.1, List.take r₃.spineList.length i.2.2.2.2)) r₀ t) ∧ LstarOK (2 ^ List.length (prm.toFun i.1).1) (2 ^ List.length (prm.toFun i.1).2) r₁.spineList.length r₂.spineList.length r₃.spineList.length r₄.spineList.length r₀.bitsListD i.2.2.2.1 i.2.2.2.2

                                                                                                The output indicator accepts exactly when the five runs halt and the check passes.

                                                                                                The output indicator of a tailored verifier, at the parameter program prm, as a decider on (n, x, y, a, b).

                                                                                                Equations
                                                                                                Instances For
                                                                                                  theorem MIPRE.Tailored.AnsRed.lstar_accepts_iff (prm : Cost.PolyTimeFun ℕ (Cost.Unary × Cost.Unary)) {ℓ : ℕ} (V : TailoredVerifier ℓ) (n : ℕ) (x y a b : Cost.BitStr) :
                                                                                                  (lstar prm V).Accepts n x y a b ↔ ∃ (lRx : ℕ) (lLx : ℕ) (lRy : ℕ) (lLy : ℕ) (cs : List Cost.BitStr), LenIs V.len n x false lRx ∧ LenIs V.len n x true lLx ∧ LenIs V.len n y false lRy ∧ LenIs V.len n y true lLy ∧ LpIs V.lp n x y (List.take lRx a) (List.take lRy b) cs ∧ LstarOK (2 ^ List.length (prm.toFun n).1) (2 ^ List.length (prm.toFun n).2) lRx lLx lRy lLy cs a b

                                                                                                  What the output indicator accepts (claim:properties_of_L*): (n, x, y, a, b) such that the answer-length calculator gives the four lengths, the processor gives the constraints cs on the readable answers cut at the readable lengths, and the check passes at the parameters of the index.