Documentation

Complexitylib.Classes.Containments.Internal.PHLayout

The witness enumerator's tape layout #

⚠️ Unreviewed by Bolton

Two placements fix where every tape sits, and they have to agree. The pair emitter is TM.pairInputWorkTM on one work tape — the copy of the real input — wrapped so that it reads the witness as a virtual input and writes onto a work tape; those wrappers append their tapes, so the witness lands at index one and the emitted pair at index two. The matrix machine is TM.applyTM placed by TM.placeWorkTM 3 _, which puts its own k scratch tapes at 3 … k + 2, the input it reads at k + 3, and the verdict it writes at k + 4.

The emitted pair and the input the matrix machine reads are therefore different tapes — the two placements cannot be made to share one — and TM.copyToVirtualInputTM moves the pair from the first to the second, which is exactly the shape TM.retargetInputStartedCfg demands anyway.

Seven registers follow: the counter, the horizon it is compared against, scratch for that comparison, the two tallies the counting loop's state carries, a permanently blank tape to blank slots from, and the unary register that drives the wipe.

Main results #

@[reducible, inline]

The enumerator's tape count: three for the emitter, the matrix machine's k + 2, and six registers.

Equations
Instances For

    The copy of the real input, which the emitter reads as the pair's first component.

    Equations
    Instances For

      The witness, which the emitter reads as the pair's second component.

      Equations
      Instances For

        The tape the emitter writes the pair onto.

        Equations
        Instances For

          The tape the matrix machine reads its input from.

          Equations
          Instances For

            The tape the matrix machine's verdict is redirected to.

            Equations
            Instances For

              The counter, whose value denotes the witness.

              Equations
              Instances For

                The horizon the counter is compared against.

                Equations
                Instances For

                  Scratch space for that comparison.

                  Equations
                  Instances For

                    The latched answer: 1 once some witness has been accepted.

                    Equations
                    Instances For

                      A permanently blank tape, read whenever a slot must be blanked.

                      Equations
                      Instances For

                        The unary register that drives the wipe.

                        Equations
                        Instances For

                          The count of witnesses that failed, which the counting loop's state carries alongside the count of those that succeeded.

                          Equations
                          Instances For

                            The matrix machine's own scratch tapes: the block TM.placeWorkTM 3 _ puts them in.

                            Equations
                            Instances For
                              @[simp]
                              theorem Complexity.PolyExists.mem_matrixTapes_iff (k : ) (j : Fin (enumTapes k)) :
                              j matrixTapes k 3 j j < 3 + k

                              The tapes one pass of the body leaves dirty, and must blank before the next: the emitted pair, the matrix machine's scratch and its two placed tapes, and the verdict slot.

                              Equations
                              Instances For

                                The scratch block has no repeats, which the wipe requires of its targets.

                                theorem Complexity.PolyExists.scratchTargets_val (k : ) (j : Fin (enumTapes k)) (h : j scratchTargets k) :
                                2 j j < 3 + k + 2

                                Every tape the body wipes lies in the block between the emitter's target and the verdict tape — which is exactly the part of the layout that rests blank.

                                The named indices are pairwise distinct. Every frame lemma the assembly uses asks for some of these disequalities; this states all of them at once.

                                The registers and the input copy are outside the scratch block, so the wipe leaves them alone.