Documentation

Complexitylib.Classes.PCP.Internal.ConsistencyLang

Checking that a witness is consistent #

A witness records an answer for every query slot. It comes from an actual proof only if slots reading the same proof position carry the same answer, and that is what this module checks: four nested loops over a pair of coin strings and a pair of query indices.

The check never looks at a position as a number. posAt returns each query position as its own serialization, so slots reading the same position are recognised by comparing strings — and a slot past the end of a query list is recognised by that string being empty.

Main definitions #

Main results #

Reading the nested loop input #

The innermost input is pair (pair (pair (pair (pair x w) ρ) ρ') i) i', with the four loop indices in unary.

Strip the last two indices.

Equations
Instances For

    Strip the last three indices.

    Equations
    Instances For

      The original pair x w.

      Equations
      Instances For

        The witness.

        Equations
        Instances For

          The first coin index.

          Equations
          Instances For

            The second coin index.

            Equations
            Instances For

              The first query index.

              Equations
              Instances For

                The second query index.

                Equations
                Instances For

                  The check #

                  noncomputable def Complexity.conRho (r : ) (y : List Bool) :

                  The first coin string.

                  Equations
                  Instances For
                    noncomputable def Complexity.conRho' (r : ) (y : List Bool) :

                    The second coin string.

                    Equations
                    Instances For
                      noncomputable def Complexity.conP (f : List BoolList Bool) (r : ) (y : List Bool) :

                      The position the first slot queries, as a string.

                      Equations
                      Instances For
                        noncomputable def Complexity.conP' (f : List BoolList Bool) (r : ) (y : List Bool) :

                        The position the second slot queries, as a string.

                        Equations
                        Instances For

                          The answer recorded in the first slot.

                          Equations
                          Instances For

                            The answer recorded in the second slot.

                            Equations
                            Instances For
                              noncomputable def Complexity.conChk (f : List BoolList Bool) (r : ) (Q : ) (y : List Bool) :

                              The verdict of one iteration: when both slots are real and query the same position, their answers must agree.

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

                                Polynomial time #

                                theorem Complexity.conRho_mem_FP (r : ) (hr : (fun (x : List Bool) => List.replicate (r x.length) true) FP) :
                                theorem Complexity.conRho'_mem_FP (r : ) (hr : (fun (x : List Bool) => List.replicate (r x.length) true) FP) :
                                theorem Complexity.conP_mem_FP (f : List BoolList Bool) (r : ) (hf : f FP) (hr : (fun (x : List Bool) => List.replicate (r x.length) true) FP) :
                                conP f r FP
                                theorem Complexity.conP'_mem_FP (f : List BoolList Bool) (r : ) (hf : f FP) (hr : (fun (x : List Bool) => List.replicate (r x.length) true) FP) :
                                theorem Complexity.offset_mem_FP (Q : ) {c d : List Bool} (hc : (fun (y : List Bool) => List.replicate (c y) true) FP) (hd : (fun (y : List Bool) => List.replicate (d y) true) FP) :
                                (fun (y : List Bool) => List.replicate (c y * Q + d y) false) FP

                                The offset of a slot in the witness, in unary.

                                theorem Complexity.conChk_mem_FP (f : List BoolList Bool) (r : ) (Q : ) (hf : f FP) (hr : (fun (x : List Bool) => List.replicate (r x.length) true) FP) :
                                conChk f r Q FP
                                noncomputable def Complexity.consInner (f : List BoolList Bool) (r : ) (Q : ) :

                                One iteration of the consistency check.

                                Equations
                                Instances For
                                  theorem Complexity.consInner_mem_P (f : List BoolList Bool) (r : ) (Q : ) (hf : f FP) (hr : (fun (x : List Bool) => List.replicate (r x.length) true) FP) :
                                  noncomputable def Complexity.consL3 (f : List BoolList Bool) (r : ) (Q : ) :

                                  The two inner loops, over the pair of query indices.

                                  Equations
                                  Instances For
                                    noncomputable def Complexity.consL2 (f : List BoolList Bool) (r : ) (Q : ) :

                                    The outer of the two query-index loops.

                                    Equations
                                    Instances For
                                      noncomputable def Complexity.consL1 (f : List BoolList Bool) (r : ) (Q : ) :

                                      The outer loop over the second coin string.

                                      Equations
                                      Instances For
                                        noncomputable def Complexity.consLang (f : List BoolList Bool) (r : ) (Q : ) :

                                        The consistency check, as a language of pair x w.

                                        Equations
                                        Instances For
                                          theorem Complexity.consLang_mem_P (f : List BoolList Bool) (r : ) (Q : ) (hf : f FP) (hr : (fun (x : List Bool) => List.replicate (r x.length) true) FP) (hrlog : BigO r fun (n : ) => Nat.log 2 n) :
                                          consLang f r Q P

                                          What one iteration says #

                                          theorem Complexity.exists_eqFlag_iff (a b : List Bool) :
                                          (∃ zCobham.eqFlag a b, z = true) a = b
                                          theorem Complexity.mem_consInner_iff (f : List BoolList Bool) (r : ) (Q : ) (y : List Bool) :
                                          y consInner f r Q conP f r y = conP' f r y conP f r y []conB Q y = conB' Q y
                                          def Complexity.conArg (x w : List Bool) (c c' i i' : ) :

                                          The packed input of one iteration.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            @[simp]
                                            theorem Complexity.conX_arg (x w : List Bool) (c c' i i' : ) :
                                            conX (conArg x w c c' i i') = x
                                            @[simp]
                                            theorem Complexity.conW_arg (x w : List Bool) (c c' i i' : ) :
                                            conW (conArg x w c c' i i') = w
                                            @[simp]
                                            theorem Complexity.conC1_arg (x w : List Bool) (c c' i i' : ) :
                                            conC1 (conArg x w c c' i i') = c
                                            @[simp]
                                            theorem Complexity.conC2_arg (x w : List Bool) (c c' i i' : ) :
                                            conC2 (conArg x w c c' i i') = c'
                                            @[simp]
                                            theorem Complexity.conC3_arg (x w : List Bool) (c c' i i' : ) :
                                            conC3 (conArg x w c c' i i') = i
                                            @[simp]
                                            theorem Complexity.conC4_arg (x w : List Bool) (c c' i i' : ) :
                                            conC4 (conArg x w c c' i i') = i'

                                            The pieces on a packed argument #

                                            theorem Complexity.conRho_arg (r : ) {x w : List Bool} {c c' i i' : } (hc : c < 2 ^ r x.length) :
                                            theorem Complexity.conRho'_arg (r : ) {x w : List Bool} {c c' i i' : } (hc' : c' < 2 ^ r x.length) :
                                            theorem Complexity.conP_arg (V : PCPVerifier) (f : List BoolList Bool) (r : ) (hfspec : ∀ (x rr : List Bool), f (pair x rr) = DataEncode.bitstringEncode (V.positions x rr)) {x w : List Bool} {c c' i i' : } (hc : c < 2 ^ r x.length) :
                                            theorem Complexity.conP'_arg (V : PCPVerifier) (f : List BoolList Bool) (r : ) (hfspec : ∀ (x rr : List Bool), f (pair x rr) = DataEncode.bitstringEncode (V.positions x rr)) {x w : List Bool} {c c' i i' : } (hc' : c' < 2 ^ r x.length) :
                                            theorem Complexity.conB_arg (Q : ) {x w : List Bool} {c c' i i' : } (hk : c * Q + i < w.length) :
                                            conB Q (conArg x w c c' i i') = [w.getD (c * Q + i) false]
                                            theorem Complexity.conB'_arg (Q : ) {x w : List Bool} {c c' i i' : } (hk : c' * Q + i' < w.length) :
                                            conB' Q (conArg x w c c' i i') = [w.getD (c' * Q + i') false]

                                            Unfolding the loops #

                                            theorem Complexity.mem_consLang_iff_forall (f : List BoolList Bool) (r : ) (Q : ) (x w : List Bool) :
                                            pair x w consLang f r Q c < 2 ^ r x.length, c' < 2 ^ r x.length, i < Q, i' < Q, conArg x w c c' i i' consInner f r Q

                                            The check is consistency #

                                            theorem Complexity.mem_consLang_iff (V : PCPVerifier) (f : List BoolList Bool) (r : ) (Q : ) (hfspec : ∀ (x rr : List Bool), f (pair x rr) = DataEncode.bitstringEncode (V.positions x rr)) {x w : List Bool} (hw : w.length = 2 ^ r x.length * Q) (hQ : ∀ (rr : List Bool), (V.positions x rr).length Q) :
                                            pair x w consLang f r Q V.Consistent (r x.length) x (V.tableOf (r x.length) Q x w)

                                            The consistency check says exactly what it should.