Documentation

MIPRE.Tailored.Intro.FormProg

The constraint forms of the introspection processor, in polynomial time #

The linear-constraints processor of the tailored introspection verifier writes its constraints through a handful of forms (Forms.lean, RegCons.lean, SourceCons.lean, AuxCons.lean). This file builds each of them as a Cost.PolyTimeFun from already computed data: lengths and offsets in unary, so that the output, of about Q constraints of about 2Q + 2R bits, is polynomial in the size of the input; readable conditions as Booleans; coordinate sets S ⊆ Fin s as their bit masks maskOf S; vectors of 𝔽₂^s as their bits CL.toBits.

Each comes with its _apply lemma on arbitrary inputs, and the _spec lemma stating that on the encoding of the semantic data it outputs the semantic list.

Pieces on a generic input #

noncomputable def MIPRE.Tailored.Intro.catF {ι : Type} [Cost.SizedEncoding ι] {α : Type} [Cost.SizedEncoding α] (F G : Cost.PolyTimeFun ι (List α)) :

Concatenation of two computed lists.

Equations
Instances For
    @[simp]
    theorem MIPRE.Tailored.Intro.catF_apply {ι : Type} [Cost.SizedEncoding ι] {α : Type} [Cost.SizedEncoding α] (F G : Cost.PolyTimeFun ι (List α)) (a : ι) :
    (catF F G).toFun a = F.toFun a ++ G.toFun a

    Truncated subtraction of unary numbers.

    Equations
    Instances For

      The length of a computed list, in unary.

      Equations
      Instances For

        The placed vector place n off w.

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

          Conjunction of two computed Booleans.

          Equations
          Instances For
            @[simp]
            theorem MIPRE.Tailored.Intro.andOf_apply {ι : Type} [Cost.SizedEncoding ι] (b c : Cost.PolyTimeFun ι Bool) (a : ι) :
            (andOf b c).toFun a = (b.toFun a && c.toFun a)

            Unit vectors #

            The shift: a zero in front, the last bit dropped.

            Equations
            Instances For

              The shift in polynomial time.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                theorem MIPRE.Tailored.Intro.shift_unit {m i : ℕ} (h : i + 1 < m) :
                shift (unit m i) = unit m (i + 1)
                theorem MIPRE.Tailored.Intro.iterate_shift_unit {m : ℕ} (i : ℕ) :
                i < m → shift^[i] (unit m 0) = unit m i

                The unit vectors of length m, in order.

                Equations
                Instances For

                  The unit vectors, as the orbit of the first under the shift.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    theorem MIPRE.Tailored.Intro.unit_eq_ofFn {m i : ℕ} (hi : i < m) :
                    unit m i = List.ofFn fun (j : Fin m) => decide (↑j = i)

                    The two-sided form #

                    @[reducible, inline]

                    The layout of a two-sided form: the lengths and offsets ((la, oa), (lb, ob)).

                    Equations
                    Instances For
                      def MIPRE.Tailored.Intro.lay (la oa lb ob : ℕ) :

                      The layout of (la, oa, lb, ob).

                      Equations
                      Instances For

                        The constraint ⟨e, a_{oa..}⟩ + ⟨e, b_{ob..}⟩ = 0.

                        Equations
                        Instances For

                          The two-sided form in polynomial time, on (e, layout).

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

                            Equality of windows #

                            theorem MIPRE.Tailored.Intro.eqCons_eq_units (la lb oa ob m : ℕ) :
                            eqCons la lb oa ob m = List.map (pairForm la oa lb ob) (units m)
                            theorem MIPRE.Tailored.Intro.eqConsF_spec (la lb oa ob m : ℕ) :
                            eqConsF.toFun (lay la oa lb ob, Cost.unary m) = eqCons la lb oa ob m

                            Readable guards #

                            The readable guard guardCons, on (b, d).

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

                              Equality on a coordinate set #

                              The bit mask of a coordinate set.

                              Equations
                              Instances For
                                def MIPRE.Tailored.Intro.selectL {α : Type} (l : List α) (m : Cost.BitStr) :
                                List α

                                The entries of l selected by the mask m.

                                Equations
                                Instances For
                                  theorem MIPRE.Tailored.Intro.selectL_map {α β : Type} (f : β → α) (p : β → Bool) (l : List β) :

                                  The selection by a mask in polynomial time, on (l, m).

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    theorem MIPRE.Tailored.Intro.projEqCons_eq_select {s : ℕ} (la lb oa ob : ℕ) (S : Finset (Fin s)) :
                                    projEqCons la lb oa ob S = List.map (pairForm la oa lb ob) (selectL (units s) (maskOf S))

                                    The coordinate-set equality constraints projEqCons, on (layout, mask).

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      theorem MIPRE.Tailored.Intro.projEqConsF_spec {s : ℕ} (la lb oa ob : ℕ) (S : Finset (Fin s)) :
                                      projEqConsF.toFun (lay la oa lb ob, maskOf S) = projEqCons la lb oa ob S

                                      Equality of duals #

                                      The bits of g masked by m.

                                      Equations
                                      Instances For
                                        theorem MIPRE.Tailored.Intro.dualCons_eq_map {s : ℕ} (la lb oa ob : ℕ) (S : Finset (Fin s)) (gens : List (Fin s → CL.𝔽₂)) :
                                        dualCons la lb oa ob S gens = List.map (pairForm la oa lb ob) (List.map (fun (g : Cost.BitStr) => andMask g (maskOf S)) (List.map CL.toBits gens))

                                        The dual equality constraints dualCons, on (layout, mask, generators).

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          theorem MIPRE.Tailored.Intro.dualConsF_spec {s : ℕ} (la lb oa ob : ℕ) (S : Finset (Fin s)) (gens : List (Fin s → CL.𝔽₂)) :
                                          dualConsF.toFun (lay la oa lb ob, maskOf S, List.map CL.toBits gens) = dualCons la lb oa ob S gens

                                          Re-indexed input constraints #

                                          @[reducible, inline]

                                          The parameters of a re-indexing: ((Q, R), ((lRa, lLa), (lRb, lLb)), (la, lb)).

                                          Equations
                                          Instances For
                                            def MIPRE.Tailored.Intro.rparams (Q R lRa lLa lRb lLb la lb : ℕ) :

                                            The parameters of reindex Q R lRa lLa lRb lLb la lb.

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

                                              The vector place2 n o₁ w₁ o₂ w₂.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                @[simp]
                                                theorem MIPRE.Tailored.Intro.place2Of_apply {ι : Type} [Cost.SizedEncoding ι] (n o₁ : Cost.PolyTimeFun ι Cost.Unary) (w₁ : Cost.PolyTimeFun ι Cost.BitStr) (o₂ : Cost.PolyTimeFun ι Cost.Unary) (w₂ : Cost.PolyTimeFun ι Cost.BitStr) (a : ι) :
                                                (place2Of n o₁ w₁ o₂ w₂).toFun a = place2 (List.length (n.toFun a)) (List.length (o₁.toFun a)) (w₁.toFun a) (List.length (o₂.toFun a)) (w₂.toFun a)

                                                The re-indexing reindex, on (c, params).

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  @[simp]
                                                  theorem MIPRE.Tailored.Intro.reindexF_apply (c : Cost.BitStr) (P : RParams) :
                                                  reindexF.toFun (c, P) = reindex (List.length P.1.1) (List.length P.1.2) (List.length P.2.1.1.1) (List.length P.2.1.1.2) (List.length P.2.1.2.1) (List.length P.2.1.2.2) (List.length P.2.2.1) (List.length P.2.2.2) c
                                                  theorem MIPRE.Tailored.Intro.reindexF_spec (Q R lRa lLa lRb lLb la lb : ℕ) (c : Cost.BitStr) :
                                                  reindexF.toFun (c, rparams Q R lRa lLa lRb lLb la lb) = reindex Q R lRa lLa lRb lLb la lb c

                                                  The other orientation #

                                                  The swapped constraint swapCon, on (c, (la, lb)).

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