Documentation

MIPRE.Tailored.Canonical

The canonical decider, as a program #

Paper II, II:1757–1787: the canonical decider of a tailored normal form verifier, on the questions x, y and the answers a, b of index n, runs the answer-length calculator L on (n, x, κ) and (n, y, κ) for both kinds κ of variables, checks that |a| = ℓ^R(x) + ℓ^L(x) and |b| = ℓ^R(y) + ℓ^L(y), runs the linear-constraints processor LP on the readable parts (n, x, y, a^R, b^R), and accepts when every constraint c it outputs satisfies ⟨c, (a, b, 1)⟩ = 0. This file writes it as a program of the ambient model.

Running programs in sequence #

theorem MIPRE.Cost.seqProg_inv {p q : Prog} (hq : Prog.WellScoped 1 q) {x z : Data} {t : ℕ} (h : (seqProg p q).Runs x z t) :
∃ (y : Data) (s : ℕ) (u : ℕ), p.Runs x y s ∧ q.Runs y z u

Inverting seqProg: a run of p then q is a run of p, and one of q on its output.

From a state s: build the input F s, run the closed program P on it, and push its output onto the state, cons (P (F s)) s.

Equations
Instances For
    theorem MIPRE.Cost.Prog.pushProg_runs {F P : Prog} (hP : WellScoped 1 P) {s v r : Data} {t₁ t₂ : ℕ} (h₁ : F.Runs s v t₁) (h₂ : P.Runs v r t₂) :
    ∃ (t : ℕ), (F.pushProg P).Runs s (r.cons s) t
    theorem MIPRE.Cost.Prog.pushProg_inv {F P : Prog} (hP : WellScoped 1 P) {s out : Data} {t : ℕ} (h : (F.pushProg P).Runs s out t) :
    ∃ (v : Data) (r : Data) (t₁ : ℕ) (t₂ : ℕ), F.Runs s v t₁ ∧ P.Runs v r t₂ ∧ out = r.cons s

    Steps, as polynomial-time functions #

    theorem MIPRE.Cost.PolyTimeFun.pushSeq_iff {σ : Type u_1} {τ : Type u_2} [SizedEncoding σ] [SizedEncoding τ] (F : PolyTimeFun σ τ) {P Q : Prog} (hP : Prog.WellScoped 1 P) (hQ : Prog.WellScoped 1 Q) (s : σ) (out : Data) :
    (∃ (t : ℕ), (seqProg (F.code.pushProg P) Q).Runs (encode s) out t) ↔ ∃ (r : Data), (∃ (t : ℕ), P.Runs (encode (F.toFun s)) r t) ∧ ∃ (t : ℕ), Q.Runs (encode (r, s)) out t

    A step followed by the rest: running pushProg F P and then Q from the state s is running P on F s, to some output r, and Q on the new state (r, s).

    theorem MIPRE.Cost.PolyTimeFun.runs_true_iff {σ : Type u_1} [SizedEncoding σ] (C : PolyTimeFun σ Bool) (s : σ) :
    (∃ (t : ℕ), C.code.Runs (encode s) (encode true) t) ↔ C.toFun s = true

    A polynomial-time decision accepts exactly when it is true.

    Reading data, as programs #

    A datum read as a bit.

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

      A datum read as a length, written as that many falses.

      Equations
      Instances For

        A bit string's length, written as that many falses.

        Equations
        Instances For

          One linear constraint, and all of them #

          theorem MIPRE.Tailored.map_false_eq_iff {α : Type u_1} {β : Type u_2} (a : List α) (b : List β) :
          List.map (fun (x : α) => false) a = List.map (fun (x : β) => false) b ↔ a.length = b.length

          The parity of the number of common ones is the parity dot product of LowDegree.BinaryLinear.

          One constraint: c and v have the same length and ⟨c, v⟩ = 0.

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

            The step of allSatF: conjoin one more constraint, keeping the vector.

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

              All constraints of a list are satisfied by v.

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

                The canonical decider #

                @[reducible, inline]

                The input of a decider, (n, x, y, a, b).

                Equations
                Instances For

                  The input of the second run of L, (n, x, true).

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

                    The input of the third run of L, (n, y, false).

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

                      The input of the fourth run of L, (n, y, true).

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

                        The input of the run of LP: (n, x, y, a^R, b^R), the readable parts cut at the lengths the first and the third run of L wrote.

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

                          The final check, on the five outputs and the input.

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

                            The canonical decider after the fourth run of L: run LP, then check.

                            Equations
                            Instances For
                              noncomputable def MIPRE.Tailored.canonProg (L P : Cost.Prog) :

                              The canonical decider of a tailored verifier with answer-length calculator L and linear-constraints processor P (II:1757–1787), on encode (n, x, y, a, b): four runs of L, one of P, and the final check, in sequence.

                              Equations
                              Instances For
                                @[simp]
                                theorem MIPRE.Tailored.canonIn₃_apply (r r' : Cost.Data) (i : DIn) :
                                canonIn₃.toFun (r, r', i) = (i.1, i.2.2.1, false)
                                @[simp]
                                theorem MIPRE.Tailored.canonIn₄_apply (r r' r'' : Cost.Data) (i : DIn) :
                                canonIn₄.toFun (r, r', r'', i) = (i.1, i.2.2.1, true)
                                @[simp]
                                theorem MIPRE.Tailored.canonIn₅_apply (r₄ r₃ r₂ r₁ : Cost.Data) (i : DIn) :
                                canonIn₅.toFun (r₄, r₃, r₂, r₁, i) = (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)
                                theorem MIPRE.Tailored.canonFinal_apply (r₀ r₁ r₂ r₃ r₄ : Cost.Data) (i : DIn) :
                                canonFinal.toFun (r₀, r₁, r₂, r₃, r₄, i) = (decide (List.length i.2.2.2.1 = r₄.spineList.length + r₃.spineList.length) && (decide (List.length i.2.2.2.2 = r₂.spineList.length + r₁.spineList.length) && decide (∀ c ∈ r₀.bitsListD, Satisfies c (i.2.2.2.1 ++ i.2.2.2.2 ++ [true]))))

                                The final check, read: the two lengths, and every constraint.

                                theorem MIPRE.Tailored.canonProg_accepts {L P : Cost.Prog} (hL : Cost.Prog.WellScoped 1 L) (hP : Cost.Prog.WellScoped 1 P) (i : DIn) :
                                (∃ (t : ℕ), (canonProg 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) ∧ List.length i.2.2.2.1 = r₁.spineList.length + r₂.spineList.length ∧ List.length i.2.2.2.2 = r₃.spineList.length + r₄.spineList.length ∧ ∀ c ∈ r₀.bitsListD, Satisfies c (i.2.2.2.1 ++ i.2.2.2.2 ++ [true])

                                The canonical decider accepts exactly when the five runs halt and the check passes.