Documentation

MIPRE.Foundations.Tsirelson.CodedPoly

Coded polynomials and the upper-bound certificate check #

The coded layer of the upper semidecision of the commuting-operator value (planning/tsirelson-campaign.md, §3.5–§3.6). Everything here is a finite list computation on naturals, primitive recursive, and independent of the algebra NCPoly that gives it meaning; the semantic layer decodes it.

Coded polynomials. A letter (Letter) is inl (x, a), the first player's effect e_xa, or inr (y, b), the second player's f_yb; a word is a List Letter. A coded polynomial (CPoly) is a list of monomials (w, c), a word and a coded Gaussian integer (GInt), and it denotes Σ c·w; the list is not normalized, so a word may occur several times. The operations are the list-level ones: cadd concatenates, cneg and cscale c act on the coefficients, cmul multiplies every monomial of one factor by every monomial of the other, cstar reverses the words and conjugates the coefficients (the letters are self-adjoint), and cconst c, cword w, cletter l are the one-monomial polynomials.

Merged coefficients and dominance. The coefficient of a word w in l is the sum of the coefficients of the monomials of l with word w (coeffRaw). The distinct words of l are words l = (l.map Prod.fst).dedup, and the off-diagonal mass offMass l is the sum, over the nonempty distinct words, of the taxicab norm taxi of the merged coefficient, where taxi z = |Re z| + |Im z| is computed on naturals (taxi_eq). A coded polynomial is dominant (IsDominant) if the real part of its merged constant coefficient strictly exceeds its off-diagonal mass. isDominant_iff_sum restates this over any finite set of words containing those of l: Σ_{w ≠ ∅} (|Re l_w| + |Im l_w|) < Re l_∅.

Relations and the game polynomial. A relation index (RelIdx) is inl x (the first player's normalization Σ_{a ≤ nA} e_xa − 1), inr (inl y) (the second player's, Σ_{b ≤ nA} f_yb − 1), or inr (inr (x, y, a, b)) (the commutator e_xa f_yb − f_yb e_xa); relPoly nA gives the polynomial. For a game description d, Wint d is the integer game polynomial Σ_{x, y ≤ nX} Σ_{a, b ≤ nA} wt(x, y) [Draw(x, y, a, b)] e_xa f_yb, which is W d times the game polynomial of d.game. Letters and relation indices are validated against the alphabets of d.game (questions ≤ nX, answers ≤ nA, for both players): ValidLetter, ValidWord, ValidCPoly, ValidRel, and every construction here preserves validity (validCPoly_certR).

Certificates. A certificate (Cert) is a triple (N, sos, ideal): a natural N, a list of sum-of-squares terms (g, s) standing for s⋆ g s (with g = none read as 1), and a list of ideal monomials (c, w, ρ, w') standing for c · w · relPoly ρ · w'. With D = N², the residual is certR d p q (N, sos, ideal) = D·(p·W d·1 − q·Wint d) − Σ s⋆ g s − Σ c·w·ρ·w', and CheckUpper (d, p, q) cert accepts iff q > 0, N ≥ 1, all letters and relation indices of the certificate are valid, and the hermitian residual certRh = certR + certR⋆ is dominant. The test q > 0 is essential: p / 0 = 0 in the consumer CommutingUpperRE. The test runs on merged coefficients, without which it would be sound but never complete.

The main result is primrecRel_checkUpper : PrimrecRel CheckUpper, which with MIPRE.ValueApprox.REPred.of_primrecRel_exists makes the set of accepted (d, p, q) recursively enumerable.

Main declarations #

Coded Gaussian integers: negation and the taxicab norm #

The negation of a coded Gaussian integer.

Equations
Instances For
    @[simp]

    Negation of coded Gaussian integers is negation of their complex values.

    The absolute value of a coded integer a - b, as the natural number (a - b) + (b - a) (truncated subtraction).

    Equations
    Instances For

      ptaxi x is the absolute value of the integer coded by x.

      The taxicab norm |Re z| + |Im z| of a coded Gaussian integer, as a natural number.

      Equations
      Instances For

        The taxicab norm computed on naturals is |Re z| + |Im z|.

        @[simp]

        The coded zero has taxicab norm 0.

        Coded polynomials #

        @[reducible, inline]

        A letter: inl (x, a) is the first player's effect e_xa, inr (y, b) the second player's effect f_yb.

        Equations
        Instances For
          @[reducible, inline]

          A coded polynomial: a list of monomials (w, c), a word and a coded Gaussian coefficient, denoting Σ c·w. The list is not normalized: a word may occur several times.

          Equations
          Instances For

            The sum of coded polynomials: concatenation.

            Equations
            Instances For

              The multiple c • p of a coded polynomial.

              Equations
              Instances For

                The product of coded polynomials: every monomial of p times every monomial of q.

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

                  The star of a coded polynomial: reverse the words and conjugate the coefficients (the letters are self-adjoint).

                  Equations
                  Instances For

                    The constant polynomial c.

                    Equations
                    Instances For

                      The word w, as a monomial with coefficient 1.

                      Equations
                      Instances For

                        The letter l, as a polynomial.

                        Equations
                        Instances For

                          Merged coefficients and dominance #

                          The merged coefficient of the word w in l: the sum of the coefficients of the monomials of l with word w.

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

                            The distinct words of l.

                            Equations
                            Instances For

                              The off-diagonal mass of l: the sum of the taxicab norms of the merged coefficients of the distinct nonempty words of l.

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

                                Dominance: the real part of the merged constant coefficient of l strictly exceeds its off-diagonal mass.

                                Equations
                                Instances For
                                  @[instance_reducible]

                                  Dominance is decidable: it compares two coded integers.

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

                                  Validation, relations and the game polynomial #

                                  The question index of a letter.

                                  Equations
                                  Instances For

                                    The answer index of a letter.

                                    Equations
                                    Instances For

                                      A letter is valid for questions ≤ nX and answers ≤ nA, the alphabets Fin (nX + 1) and Fin (nA + 1) of both players in GameData.game.

                                      Equations
                                      Instances For
                                        @[instance_reducible]

                                        Validity of a letter is decidable.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        @[simp]
                                        theorem MIPRE.Tsirelson.Coded.validLetter_inl (nX nA x a : ℕ) :
                                        ValidLetter nX nA (Sum.inl (x, a)) ↔ x ≤ nX ∧ a ≤ nA

                                        A first-player letter e_xa is valid iff x ≤ nX and a ≤ nA.

                                        @[simp]
                                        theorem MIPRE.Tsirelson.Coded.validLetter_inr (nX nA y b : ℕ) :
                                        ValidLetter nX nA (Sum.inr (y, b)) ↔ y ≤ nX ∧ b ≤ nA

                                        A second-player letter f_yb is valid iff y ≤ nX and b ≤ nA.

                                        Every letter of the word is valid.

                                        Equations
                                        Instances For

                                          Every word of the coded polynomial is valid.

                                          Equations
                                          Instances For
                                            @[instance_reducible]

                                            Validity of a coded polynomial is decidable.

                                            Equations

                                            An optional letter is valid if it is absent or valid.

                                            Equations
                                            Instances For
                                              @[instance_reducible]

                                              Validity of an optional letter is decidable.

                                              Equations
                                              @[reducible, inline]

                                              A relation index: inl x is the first player's normalization at question x, inr (inl y) the second player's at y, and inr (inr (x, y, a, b)) the commutator of e_xa and f_yb.

                                              Equations
                                              Instances For

                                                A relation index is valid if its questions are ≤ nX and its answers ≤ nA.

                                                Equations
                                                Instances For
                                                  @[instance_reducible]

                                                  Validity of a relation index is decidable.

                                                  Equations

                                                  The first player's normalization at x: Σ_{a ≤ nA} e_xa − 1.

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

                                                    The second player's normalization at y: Σ_{b ≤ nA} f_yb − 1.

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

                                                      The commutator e_xa f_yb − f_yb e_xa at t = (x, y, a, b).

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

                                                        The integer game polynomial of a description: Σ_{x, y ≤ nX} Σ_{a, b ≤ nA} wt(x, y) [Draw(x, y, a, b)] e_xa f_yb, which is W d times the game polynomial of d.game.

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

                                                          Certificates and the check #

                                                          @[reducible, inline]

                                                          A certificate (N, sos, ideal): the scale N (with D = N²), the sum-of-squares terms (g, s) standing for s⋆ g s (g = none is 1), and the ideal monomials (c, w, ρ, w') standing for c · w · relPoly ρ · w'.

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

                                                            The sum of squares Σ s⋆ g s of a list of terms (g, s).

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

                                                              The ideal element Σ c · w · relPoly ρ · w' of a list of monomials (c, w, ρ, w').

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

                                                                The residual of a certificate for the bound p / q on the description d: N²·(p·W d·1 − q·Wint d) − Σ s⋆ g s − Σ c·w·ρ·w'.

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

                                                                  The hermitian residual R + R⋆.

                                                                  Equations
                                                                  Instances For

                                                                    Every letter and relation index of the certificate is valid.

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

                                                                      Validity of a certificate is decidable.

                                                                      Equations

                                                                      The upper certificate check: cert certifies val_co(d.game) < p / q for x = (d, p, q). It requires q > 0, N ≥ 1, a valid certificate, and a dominant hermitian residual.

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

                                                                        The upper certificate check is decidable.

                                                                        Equations

                                                                        Merged coefficients #

                                                                        The empty coded polynomial has merged coefficient zero at every word.

                                                                        The merged coefficient of m :: l adds the coefficient of m when its word is w.

                                                                        The merged coefficient of a word that does not occur in l is zero.

                                                                        Distinct words and dominance #

                                                                        theorem MIPRE.Tsirelson.Coded.dedup_eq_foldr {β : Type u_1} [DecidableEq β] (l : List β) :
                                                                        l.dedup = List.foldr (fun (a : β) (acc : List β) => if a ∈ acc then acc else a :: acc) [] l

                                                                        List.dedup as a right fold that keeps an element when it does not occur later.

                                                                        The distinct words of l are the words of its monomials.

                                                                        The distinct words of l have no duplicates.

                                                                        The off-diagonal mass as a finite sum over the nonempty words of l.

                                                                        theorem MIPRE.Tsirelson.Coded.offMass_eq_sum_of_subset (l : CPoly) {S : Finset (List Letter)} (hS : ∀ m ∈ l, m.1 ∈ S) :
                                                                        offMass l = ∑ w ∈ S.erase [], taxi (coeffRaw l w)

                                                                        The off-diagonal mass as a finite sum over the nonempty words of any set containing the words of l.

                                                                        Dominance in real numbers.

                                                                        theorem MIPRE.Tsirelson.Coded.isDominant_iff_sum (l : CPoly) {S : Finset (List Letter)} (hS : ∀ m ∈ l, m.1 ∈ S) :
                                                                        IsDominant l ↔ ∑ w ∈ S.erase [], (|(coeffRaw l w).toC.re| + |(coeffRaw l w).toC.im|) < (coeffRaw l []).toC.re

                                                                        Dominance as the strict inequality Σ_{w ≠ ∅} (|Re l_w| + |Im l_w|) < Re l_∅, the sum over the nonempty words of any set containing the words of l.

                                                                        Validity #

                                                                        theorem MIPRE.Tsirelson.Coded.validWord_append {nX nA : ℕ} {w w' : List Letter} :
                                                                        ValidWord nX nA (w ++ w') ↔ ValidWord nX nA w ∧ ValidWord nX nA w'

                                                                        A concatenation of words is valid iff both words are.

                                                                        A reversed word is valid iff the word is.

                                                                        theorem MIPRE.Tsirelson.Coded.validCPoly_append {nX nA : ℕ} {p q : CPoly} :
                                                                        ValidCPoly nX nA (p ++ q) ↔ ValidCPoly nX nA p ∧ ValidCPoly nX nA q

                                                                        A concatenation of coded polynomials is valid iff both are.

                                                                        theorem MIPRE.Tsirelson.Coded.validCPoly_cneg {nX nA : ℕ} {p : CPoly} :
                                                                        ValidCPoly nX nA (cneg p) ↔ ValidCPoly nX nA p

                                                                        Negation preserves and reflects validity.

                                                                        Scaling preserves and reflects validity.

                                                                        The star preserves and reflects validity.

                                                                        theorem MIPRE.Tsirelson.Coded.validCPoly_cmul {nX nA : ℕ} {p q : CPoly} (hp : ValidCPoly nX nA p) (hq : ValidCPoly nX nA q) :
                                                                        ValidCPoly nX nA (cmul p q)

                                                                        A product of valid coded polynomials is valid.

                                                                        A coded constant is valid.

                                                                        theorem MIPRE.Tsirelson.Coded.validCPoly_cword {nX nA : ℕ} {w : List Letter} (h : ValidWord nX nA w) :
                                                                        ValidCPoly nX nA (cword w)

                                                                        The monomial of a valid word is valid.

                                                                        theorem MIPRE.Tsirelson.Coded.validCPoly_cletter {nX nA : ℕ} {l : Letter} (h : ValidLetter nX nA l) :

                                                                        The polynomial of a valid letter is valid.

                                                                        theorem MIPRE.Tsirelson.Coded.validCPoly_relPoly {nX nA : ℕ} {ρ : RelIdx} (h : ValidRel nX nA ρ) :
                                                                        ValidCPoly nX nA (relPoly nA ρ)

                                                                        The relation polynomial of a valid relation index is valid.

                                                                        The integer game polynomial of a description is valid for its alphabets.

                                                                        The polynomial of a valid optional letter is valid.

                                                                        theorem MIPRE.Tsirelson.Coded.validCPoly_sosSum {nX nA : ℕ} {sos : List (Option Letter × CPoly)} (h : ∀ t ∈ sos, ValidOptLetter nX nA t.1 ∧ ValidCPoly nX nA t.2) :
                                                                        ValidCPoly nX nA (sosSum sos)

                                                                        A sum of squares with valid terms is valid.

                                                                        theorem MIPRE.Tsirelson.Coded.validCPoly_idealSum {nX nA : ℕ} {ideal : List (ValueApprox.GInt × List Letter × RelIdx × List Letter)} (h : ∀ t ∈ ideal, ValidWord nX nA t.2.1 ∧ ValidRel nX nA t.2.2.1 ∧ ValidWord nX nA t.2.2.2) :
                                                                        ValidCPoly nX nA (idealSum nA ideal)

                                                                        An ideal element with valid monomials is valid.

                                                                        theorem MIPRE.Tsirelson.Coded.validCPoly_certR {d : HaltingGameValue.GameData} {cert : Cert} (h : ValidCert d.nX d.nA cert) (p q : ℕ) :
                                                                        ValidCPoly d.nX d.nA (certR d p q cert)

                                                                        The residual of a valid certificate is valid.

                                                                        theorem MIPRE.Tsirelson.Coded.validCPoly_certRh {d : HaltingGameValue.GameData} {cert : Cert} (h : ValidCert d.nX d.nA cert) (p q : ℕ) :
                                                                        ValidCPoly d.nX d.nA (certRh d p q cert)

                                                                        The hermitian residual of a valid certificate is valid.

                                                                        Primitive recursiveness: coefficients and operations #

                                                                        Negation of coded Gaussian integers is primitive recursive.

                                                                        The absolute value ptaxi of a coded integer is primitive recursive.

                                                                        The taxicab norm is primitive recursive.

                                                                        The negation of coded polynomials is primitive recursive.

                                                                        The multiple of a coded polynomial is primitive recursive.

                                                                        The product of coded polynomials is primitive recursive.

                                                                        The star of coded polynomials is primitive recursive.

                                                                        The monomial of a word is primitive recursive.

                                                                        The polynomial of a letter is primitive recursive.

                                                                        The merged coefficient is primitive recursive.

                                                                        The distinct words of a coded polynomial are primitive recursive.

                                                                        The off-diagonal mass is primitive recursive.

                                                                        Dominance is a primitive recursive predicate.

                                                                        Primitive recursiveness: validation #

                                                                        The question index of a letter is primitive recursive.

                                                                        The answer index of a letter is primitive recursive.

                                                                        Validity of a letter is primitive recursive in the letter and the bounds (nX, nA).

                                                                        Validity of a word is primitive recursive in the word and the bounds.

                                                                        Validity of a coded polynomial is primitive recursive.

                                                                        Validity of an optional letter is primitive recursive.

                                                                        Validity of a relation index is primitive recursive.

                                                                        theorem MIPRE.Tsirelson.Coded.primrecRel_validCert :
                                                                        PrimrecRel fun (cert : Cert) (n : ℕ × ℕ) => ValidCert n.1 n.2 cert

                                                                        Validity of a certificate is primitive recursive.

                                                                        Primitive recursiveness: relations and the game polynomial #

                                                                        The first player's coded normalization is primitive recursive.

                                                                        The second player's coded normalization is primitive recursive.

                                                                        The coded commutator is primitive recursive.

                                                                        The relation polynomial is primitive recursive.

                                                                        @[reducible, inline]

                                                                        The contexts of Wint, from the innermost level ((((d, x), y), a), b) out.

                                                                        Equations
                                                                        Instances For
                                                                          @[reducible, inline]

                                                                          The context (((d, x), y), a) of the map over b in Wint.

                                                                          Equations
                                                                          Instances For
                                                                            @[reducible, inline]

                                                                            The context ((d, x), y) of the map over a in Wint.

                                                                            Equations
                                                                            Instances For
                                                                              theorem MIPRE.Tsirelson.Coded.primrec_WintBody :
                                                                              Primrec fun (z : WCtx4) => ([Sum.inl (z.1.1.1.2, z.1.2), Sum.inr (z.1.1.2, z.2)], ValueApprox.GInt.ofNat (ValueApprox.wt z.1.1.1.1 z.1.1.1.2 z.1.1.2 * if ValueApprox.Draw z.1.1.1.1 z.1.1.1.2 z.1.1.2 z.1.2 z.2 = true then 1 else 0))

                                                                              The innermost term of Wint.

                                                                              theorem MIPRE.Tsirelson.Coded.primrec_Wint3 :
                                                                              Primrec fun (z : WCtx3) => List.map (fun (b : ℕ) => ([Sum.inl (z.1.1.2, z.2), Sum.inr (z.1.2, b)], ValueApprox.GInt.ofNat (ValueApprox.wt z.1.1.1 z.1.1.2 z.1.2 * if ValueApprox.Draw z.1.1.1 z.1.1.2 z.1.2 z.2 b = true then 1 else 0))) (List.range (z.1.1.1.nA + 1))

                                                                              The map over b in Wint, in the context (((d, x), y), a), is primitive recursive.

                                                                              theorem MIPRE.Tsirelson.Coded.primrec_Wint2 :
                                                                              Primrec fun (z : WCtx2) => List.flatMap (fun (a : ℕ) => List.map (fun (b : ℕ) => ([Sum.inl (z.1.2, a), Sum.inr (z.2, b)], ValueApprox.GInt.ofNat (ValueApprox.wt z.1.1 z.1.2 z.2 * if ValueApprox.Draw z.1.1 z.1.2 z.2 a b = true then 1 else 0))) (List.range (z.1.1.nA + 1))) (List.range (z.1.1.nA + 1))

                                                                              The map over a in Wint, in the context ((d, x), y), is primitive recursive.

                                                                              theorem MIPRE.Tsirelson.Coded.primrec_Wint1 :
                                                                              Primrec fun (z : HaltingGameValue.GameData × ℕ) => List.flatMap (fun (y : ℕ) => List.flatMap (fun (a : ℕ) => List.map (fun (b : ℕ) => ([Sum.inl (z.2, a), Sum.inr (y, b)], ValueApprox.GInt.ofNat (ValueApprox.wt z.1 z.2 y * if ValueApprox.Draw z.1 z.2 y a b = true then 1 else 0))) (List.range (z.1.nA + 1))) (List.range (z.1.nA + 1))) (List.range (z.1.nX + 1))

                                                                              The map over y in Wint, in the context (d, x), is primitive recursive.

                                                                              The integer game polynomial is primitive recursive.

                                                                              Primitive recursiveness: certificates and the check #

                                                                              The polynomial of an optional letter is primitive recursive.

                                                                              The sum of squares of a list of terms is primitive recursive.

                                                                              The ideal element of a list of monomials is primitive recursive.

                                                                              theorem MIPRE.Tsirelson.Coded.primrec_certR :
                                                                              Primrec fun (x : (HaltingGameValue.GameData × ℕ × ℕ) × Cert) => certR x.1.1 x.1.2.1 x.1.2.2 x.2

                                                                              The residual of a certificate is primitive recursive.

                                                                              The hermitian residual of a certificate is primitive recursive.

                                                                              The upper certificate check is primitive recursive.