Documentation

MIPRE.Tailored.AnsRed.Linear

Linear systems over F₂: purification, triangulation and decoupling #

Slice P4a of the Aldous–Lyons track (planning/aldous-lyons-track.md, §5 "Phase 4 slices"): the transformations of a system of linear equations that paper II's answer reduction applies before its PCP (II:7751–8316). The output indicator L* (II:8381) computes them from the constraints of the input game, and the PCP checks the result.

Bits as elements of F₂ #

The bit of s at i as an element of F₂, 0 past the end.

Equations
Instances For
    @[simp]
    theorem MIPRE.Tailored.AnsRed.bitAt_cons_succ (x : Bool) (s : Cost.BitStr) (i : ℕ) :
    bitAt (x :: s) (i + 1) = bitAt s i

    The F₂ inner product of two strings of the same length, as a sum.

    theorem MIPRE.Tailored.AnsRed.sum_map_filter_range (k : ℕ) (p : ℕ → Bool) (g : ℕ → ZMod 2) :
    (List.map g (List.filter p (List.range k))).sum = ∑ j ∈ Finset.range k, if p j = true then g j else 0

    A sum over the positions of a filtered range.

    Equations #

    A linear equation over F₂, ∑_{v ∈ vars} X_v = rhs, on variables indexed by ℕ.

    • vars : List ℕ

      The variables with coefficient 1 (with multiplicity, which is counted mod 2).

    • rhs : ZMod 2

      The right-hand side.

    Instances For

      An assignment satisfies the equation.

      Equations
      Instances For

        The equation mentions only variables below N.

        Equations
        Instances For
          theorem MIPRE.Tailored.AnsRed.Eqn.holds_congr {e : Eqn} {N : ℕ} (he : e.Below N) {f g : ℕ → ZMod 2} (hfg : ∀ v < N, f v = g v) :
          e.Holds f ↔ e.Holds g

          An equation below N holds of two assignments that agree below N together.

          Purification #

          The positions j < k at which c has a one at o + j.

          Equations
          Instances For
            theorem MIPRE.Tailored.AnsRed.mem_onesFrom {c : Cost.BitStr} {o k j : ℕ} (h : j ∈ onesFrom c o k) :
            j < k
            theorem MIPRE.Tailored.AnsRed.sum_map_onesFrom (c : Cost.BitStr) (o k : ℕ) (g : ℕ → ZMod 2) :
            (List.map g (onesFrom c o k)).sum = ∑ j ∈ Finset.range k, bitAt c (o + j) * g j
            def MIPRE.Tailored.AnsRed.tbl (L : ℕ) (aL bL : Cost.BitStr) (v : ℕ) :

            The linear answers placed in a table of 2L entries: a^L at 0, b^L at L.

            Equations
            Instances For
              def MIPRE.Tailored.AnsRed.pureEqn (lRx lLx lRy lLy L : ℕ) (aR bR c : Cost.BitStr) :

              The purified equation of a constraint c (eq:purified_equation): the constraint on the answers a^R a^L (lengths lRx, lLx) and b^R b^L (lengths lRy, lLy) and the affine coordinate becomes an equation on the table tbl L a^L b^L of the linear answers, the readable answers a^R, b^R entering the right-hand side. A constraint of the wrong length, which the canonical decider rejects, becomes 0 = 1.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                theorem MIPRE.Tailored.AnsRed.mem_pureEqn_vars {lRx lLx lRy lLy L : ℕ} {aR bR c : Cost.BitStr} {v : ℕ} (hv : v ∈ (pureEqn lRx lLx lRy lLy L aR bR c).vars) :
                v < lLx ∨ L ≤ v ∧ v - L < lLy

                The purified equation mentions only the positions of the two linear answers in the table.

                theorem MIPRE.Tailored.AnsRed.pureEqn_below {lRx lLx lRy lLy L : ℕ} (hx : lLx ≤ L) (hy : lLy ≤ L) (aR bR c : Cost.BitStr) :
                (pureEqn lRx lLx lRy lLy L aR bR c).Below (2 * L)
                theorem MIPRE.Tailored.AnsRed.length_pureEqn_le {lRx lLx lRy lLy L : ℕ} (hx : lLx ≤ L) (hy : lLy ≤ L) (aR bR c : Cost.BitStr) :
                (pureEqn lRx lLx lRy lLy L aR bR c).vars.length ≤ 2 * L
                theorem MIPRE.Tailored.AnsRed.satisfies_iff_pureEqn {lRx lLx lRy lLy L : ℕ} {aR aL bR bL : Cost.BitStr} (haR : List.length aR = lRx) (haL : List.length aL = lLx) (hbR : List.length bR = lRy) (hbL : List.length bL = lLy) (hx : lLx ≤ L) (c : Cost.BitStr) :
                Satisfies c (aR ++ aL ++ (bR ++ bL) ++ [true]) ↔ (pureEqn lRx lLx lRy lLy L aR bR c).Holds (tbl L aL bL)

                Purification is exact (fact:completeness_and_soundness_purification, at one pair of answers): the constraint holds of the answers exactly when its purified equation holds of the table of their linear parts.

                theorem MIPRE.Tailored.AnsRed.accepts_iff_pure {X : Type u_1} [Fintype X] (G : TailoredGame X) (x y : X) {aR aL bR bL : Cost.BitStr} (haR : List.length aR = G.lenR x) (haL : List.length aL = G.lenL x) (hbR : List.length bR = G.lenR y) (hbL : List.length bL = G.lenL y) {L : ℕ} (hx : G.lenL x ≤ L) :
                G.Accepts x y (aR ++ aL) (bR ++ bL) ↔ ∀ e ∈ List.map (pureEqn (G.lenR x) (G.lenL x) (G.lenR y) (G.lenL y) L aR bR) (G.cons x y aR bR), e.Holds (tbl L aL bL)

                The canonical decider, purified: a tailored game accepts answers a^R a^L, b^R b^L of the right lengths exactly when the purified equations of its constraints hold of the table of the linear answers.

                Triangulation #

                A triangulated equation a₁ X_{v₁} + a₂ X_{v₂} + a₃ X_{v₃} = b: at most three variables, in three slots, which the decoupling sends to three different copies of the variables. A slot with coefficient 0 is unused, whatever its index.

                Instances For
                  def MIPRE.Tailored.AnsRed.Tri.Holds3 (t : Tri) (f₁ f₂ f₃ : ℕ → ZMod 2) :

                  The equation holds of three assignments, one per slot.

                  Equations
                  Instances For

                    The equation holds of one assignment.

                    Equations
                    Instances For

                      The variables of the used slots are below ℓ.

                      Equations
                      Instances For
                        theorem MIPRE.Tailored.AnsRed.Tri.holds3_iff_holds {t : Tri} {ℓ : ℕ} (ht : t.Below ℓ) {f₁ f₂ f₃ : ℕ → ZMod 2} (h₁₂ : ∀ j < ℓ, f₁ j = f₂ j) (h₂₃ : ∀ j < ℓ, f₂ j = f₃ j) :
                        t.Holds3 f₁ f₂ f₃ ↔ t.Holds f₁

                        On three assignments that agree below ℓ, an equation below ℓ holds of all three iff it holds of the first.

                        The fresh variable Y_{r,i} of the triangulation: rows of stride N after the N original variables.

                        Equations
                        Instances For
                          theorem MIPRE.Tailored.AnsRed.yv_sub_div {N r i : ℕ} (hi : i < N) :
                          (yv N r i - N) / N = r
                          theorem MIPRE.Tailored.AnsRed.yv_sub_mod {N r i : ℕ} (hi : i < N) :
                          (yv N r i - N) % N = i
                          theorem MIPRE.Tailored.AnsRed.le_yv (N r i : ℕ) :
                          N ≤ yv N r i

                          The triangulation of the equation e, the r-th row: the step equations X_{xᵢ} + Y_{r,i-1} + Y_{r,i} = 0 (no Y_{r,-1} at i = 0), then Y_{r,k-1} = rhs (just 0 = rhs when k = 0).

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

                            The triangulated system (II:7952): the rows triangulated one by one.

                            Equations
                            Instances For
                              theorem MIPRE.Tailored.AnsRed.mem_triangle {N : ℕ} {rows : List Eqn} {t : Tri} :
                              t ∈ triangle N rows ↔ ∃ (r : ℕ) (h : r < rows.length), t ∈ triRow N r rows[r]

                              The variables whose sum is the extended assignment at v: v itself below N, the prefix x₀, …, xᵢ of the r-th row at Y_{r,i}, nothing elsewhere.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                def MIPRE.Tailored.AnsRed.ext (N : ℕ) (rows : List Eqn) (f : ℕ → ZMod 2) (v : ℕ) :

                                The extension of an assignment to the triangulation variables (rem:prop_triangulated_system, item 1): the partial sums along each row. It is linear, being a sum over extVars.

                                Equations
                                Instances For
                                  theorem MIPRE.Tailored.AnsRed.extVars_below {N : ℕ} {rows : List Eqn} (hbel : ∀ e ∈ rows, e.Below N) (v u : ℕ) :
                                  u ∈ extVars N rows v → u < N

                                  The extension reads only the original variables.

                                  theorem MIPRE.Tailored.AnsRed.ext_of_lt {N : ℕ} {rows : List Eqn} {v : ℕ} (hv : v < N) (f : ℕ → ZMod 2) :
                                  ext N rows f v = f v
                                  theorem MIPRE.Tailored.AnsRed.ext_yv {N : ℕ} {rows : List Eqn} {r i : ℕ} (hr : r < rows.length) (hi : i < N) (hk : i < rows[r].vars.length) (f : ℕ → ZMod 2) :
                                  ext N rows f (yv N r i) = (List.map f (List.take (i + 1) rows[r].vars)).sum
                                  theorem MIPRE.Tailored.AnsRed.triangle_complete {N : ℕ} {rows : List Eqn} (hlen : ∀ e ∈ rows, e.vars.length ≤ N) (hbel : ∀ e ∈ rows, e.Below N) {f : ℕ → ZMod 2} (hf : ∀ e ∈ rows, e.Holds f) (t : Tri) :
                                  t ∈ triangle N rows → t.Holds (ext N rows f)

                                  Triangulation is complete: the extension of a solution solves the triangulated system, when the rows have at most N variables, all below N.

                                  theorem MIPRE.Tailored.AnsRed.triangle_sound {N : ℕ} {rows : List Eqn} {g : ℕ → ZMod 2} (hg : ∀ t ∈ triangle N rows, t.Holds g) (e : Eqn) :
                                  e ∈ rows → e.Holds g

                                  Triangulation is sound: a solution of the triangulated system solves every row.

                                  theorem MIPRE.Tailored.AnsRed.triangle_below {N Δ : ℕ} {rows : List Eqn} (hlen : ∀ e ∈ rows, e.vars.length ≤ N) (hbel : ∀ e ∈ rows, e.Below N) (hΔ : rows.length * N ≤ Δ) (t : Tri) :
                                  t ∈ triangle N rows → t.Below (N + Δ)

                                  Every equation of the triangulated system of R rows of at most N variables, all below N, is below N + Δ when R N ≤ Δ.

                                  Decoupling #

                                  def MIPRE.Tailored.AnsRed.decInd (ℓA ℓB ℓ : ℕ) (tris : List Tri) (uA uB u₁ u₂ u₃ : ℕ) (εA εB ε₁ ε₂ ε₃ ε₀ : ZMod 2) :

                                  The indicator of the 5-decoupled system (II:8193, encoded as in II:8128): whether the equation ε_A X_A(u_A) + ε_B X_B(u_B) + ε₁ X¹(u₁) + ε₂ X²(u₂) + ε₃ X³(u₃) = ε₀ is in the system on the blocks S_A = [ℓ_A], S_B = [ℓ_B] and three copies S₁, S₂, S₃ of [ℓ], whose equations are X_A = X¹ on S_A, X_B = X¹(ℓ_A + ·) on S_B, X¹ = X² and X² = X³ on [ℓ], and each triangulated equation of tris on the three copies. A block whose sign is 0 takes any index.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    @[instance_reducible]
                                    instance MIPRE.Tailored.AnsRed.instDecidableDecInd (ℓA ℓB ℓ : ℕ) (tris : List Tri) (uA uB u₁ u₂ u₃ : ℕ) (εA εB ε₁ ε₂ ε₃ ε₀ : ZMod 2) :
                                    Decidable (decInd ℓA ℓB ℓ tris uA uB u₁ u₂ u₃ εA εB ε₁ ε₂ ε₃ ε₀)
                                    Equations
                                    def MIPRE.Tailored.AnsRed.DecSat (ℓA ℓB ℓ : ℕ) (tris : List Tri) (fA fB f₁ f₂ f₃ : ℕ → ZMod 2) :

                                    Five assignments satisfy the decoupled system (fact:polynomial_condition_for_satisfiability): every equation of the indicator holds.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      theorem MIPRE.Tailored.AnsRed.decSat_iff {ℓA ℓB ℓ : ℕ} {tris : List Tri} {fA fB f₁ f₂ f₃ : ℕ → ZMod 2} :
                                      DecSat ℓA ℓB ℓ tris fA fB f₁ f₂ f₃ ↔ (∀ j < ℓA, fA j = f₁ j) ∧ (∀ j < ℓB, fB j = f₁ (ℓA + j)) ∧ (∀ j < ℓ, f₁ j = f₂ j) ∧ (∀ j < ℓ, f₂ j = f₃ j) ∧ ∀ t ∈ tris, t.Holds3 f₁ f₂ f₃

                                      What a solution of the decoupled system is: the copy equations and the triangulated equations on the three copies.

                                      Triangulation and decoupling together #

                                      def MIPRE.Tailored.AnsRed.glue (ℓA : ℕ) (fA fB : ℕ → ZMod 2) (v : ℕ) :

                                      The two first blocks glued into one assignment of the original variables: f_A below ℓ_A, f_B shifted above.

                                      Equations
                                      Instances For
                                        theorem MIPRE.Tailored.AnsRed.extend_complete {ℓA ℓB Δ : ℕ} {rows : List Eqn} (hlen : ∀ e ∈ rows, e.vars.length ≤ ℓA + ℓB) (hbel : ∀ e ∈ rows, e.Below (ℓA + ℓB)) {f : ℕ → ZMod 2} (hf : ∀ e ∈ rows, e.Holds f) :
                                        DecSat ℓA ℓB (ℓA + ℓB + Δ) (triangle (ℓA + ℓB) rows) f (fun (j : ℕ) => f (ℓA + j)) (ext (ℓA + ℓB) rows f) (ext (ℓA + ℓB) rows f) (ext (ℓA + ℓB) rows f)

                                        Extend is complete (cor:triang_and_decoupling_extend): a solution f of R rows of at most N = ℓ_A + ℓ_B variables, all below N, gives the solution (f, f(ℓ_A + ·), ext f, ext f, ext f) of the decoupled triangulated system with Δ ≥ R N triangulation variables. The last three blocks are linear in f (ext).

                                        theorem MIPRE.Tailored.AnsRed.decSat_sound {ℓA ℓB Δ : ℕ} {rows : List Eqn} (hlen : ∀ e ∈ rows, e.vars.length ≤ ℓA + ℓB) (hbel : ∀ e ∈ rows, e.Below (ℓA + ℓB)) (hΔ : rows.length * (ℓA + ℓB) ≤ Δ) {fA fB f₁ f₂ f₃ : ℕ → ZMod 2} (h : DecSat ℓA ℓB (ℓA + ℓB + Δ) (triangle (ℓA + ℓB) rows) fA fB f₁ f₂ f₃) (e : Eqn) :
                                        e ∈ rows → e.Holds (glue ℓA fA fB)

                                        Every solution of the decoupled triangulated system comes from a solution of the original (cor:triang_and_decoupling_extend): its first two blocks, glued, solve the rows.

                                        The canonical decider, decoupled #

                                        def MIPRE.Tailored.AnsRed.pureRows {X : Type u_1} [Fintype X] (G : TailoredGame X) (L : ℕ) (x y : X) (aR bR : Cost.BitStr) :

                                        The purified equations of a pair of questions, with the linear answers in tables of L entries.

                                        Equations
                                        Instances For
                                          theorem MIPRE.Tailored.AnsRed.pureRows_len {X : Type u_1} [Fintype X] (G : TailoredGame X) {L : ℕ} {x y : X} (hx : G.lenL x ≤ L) (hy : G.lenL y ≤ L) (aR bR : Cost.BitStr) (e : Eqn) :
                                          e ∈ pureRows G L x y aR bR → e.vars.length ≤ L + L
                                          theorem MIPRE.Tailored.AnsRed.pureRows_below {X : Type u_1} [Fintype X] (G : TailoredGame X) {L : ℕ} {x y : X} (hx : G.lenL x ≤ L) (hy : G.lenL y ≤ L) (aR bR : Cost.BitStr) (e : Eqn) :
                                          e ∈ pureRows G L x y aR bR → e.Below (L + L)
                                          theorem MIPRE.Tailored.AnsRed.decSat_of_accepts {X : Type u_1} [Fintype X] (G : TailoredGame X) {x y : X} {aR aL bR bL : Cost.BitStr} (haR : List.length aR = G.lenR x) (haL : List.length aL = G.lenL x) (hbR : List.length bR = G.lenR y) (hbL : List.length bL = G.lenL y) {L Δ : ℕ} (hx : G.lenL x ≤ L) (hy : G.lenL y ≤ L) (hacc : G.Accepts x y (aR ++ aL) (bR ++ bL)) :
                                          DecSat L L (L + L + Δ) (triangle (L + L) (pureRows G L x y aR bR)) (tbl L aL bL) (fun (j : ℕ) => tbl L aL bL (L + j)) (ext (L + L) (pureRows G L x y aR bR) (tbl L aL bL)) (ext (L + L) (pureRows G L x y aR bR) (tbl L aL bL)) (ext (L + L) (pureRows G L x y aR bR) (tbl L aL bL))

                                          The canonical decider, triangulated and decoupled (claim:properties_of_L*, item 2, one direction): answers of the right lengths that the game accepts give the solution Extend of the table of their linear parts of the decoupled triangulated purified system, with Δ at least the number of constraints times 2L.

                                          The linear answer of length k read from a block.

                                          Equations
                                          Instances For
                                            theorem MIPRE.Tailored.AnsRed.bitAt_readBlock {k : ℕ} {f : ℕ → ZMod 2} {j : ℕ} (hj : j < k) :
                                            bitAt (readBlock k f) j = f j
                                            theorem MIPRE.Tailored.AnsRed.accepts_of_decSat {X : Type u_1} [Fintype X] (G : TailoredGame X) {x y : X} {aR bR : Cost.BitStr} (haR : List.length aR = G.lenR x) (hbR : List.length bR = G.lenR y) {L Δ : ℕ} (hx : G.lenL x ≤ L) (hy : G.lenL y ≤ L) (hΔ : (G.cons x y aR bR).length * (L + L) ≤ Δ) {fA fB f₁ f₂ f₃ : ℕ → ZMod 2} (h : DecSat L L (L + L + Δ) (triangle (L + L) (pureRows G L x y aR bR)) fA fB f₁ f₂ f₃) :
                                            G.Accepts x y (aR ++ readBlock (G.lenL x) fA) (bR ++ readBlock (G.lenL y) fB)

                                            The canonical decider from a solution of the decoupled system (claim:properties_of_L*, item 2, the other direction): if five assignments solve the decoupled triangulated purified system of the readable answers, with Δ at least the number of constraints times 2L, the game accepts the readable answers completed by the first two blocks, read at the linear lengths.