Documentation

Complexitylib.Models.RandomAccessMachine.Simulation.RegisterStore.Machine.WordDecode.Defs

RAM snapshot word-width decoder — definitions #

RAM.RegisterStore.Machine.wordWidthTM is the first concrete Turing-machine phase of the reverse RAM simulation. It scans the unary-width prefix of one self-delimiting snapshot word and increments a canonical binary counter once per 1. The source head stops on the zero separator, ready for the payload copy phase.

def Complexity.RAM.RegisterStore.Machine.wordWidthTM {n : } (sourceIdx widthIdx : Fin n) :
TM n

Scan the unary prefix on work tape sourceIdx and store its length in canonical little-endian binary on work tape widthIdx. The two indices must be distinct for the semantic theorem.

Equations
Instances For

    Exact transition count for decoding a unary prefix of length width.

    Equations
    Instances For

      Control states for copying one fixed-width payload bit.

      Instances For
        @[implicit_reducible]

        PayloadBitPhase has exactly two states.

        Equations
        • One or more equations did not get rendered due to their size.
        def Complexity.RAM.RegisterStore.Machine.payloadBitTM {n : } (sourceIdx targetIdx : Fin n) :
        TM n

        Copy the bit under sourceIdx to the append position on targetIdx, advancing both heads once. The semantic theorem assumes distinct indices and that the source reads a bit.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          structure Complexity.RAM.RegisterStore.Machine.PayloadLoopDistinct {n : } (sourceIdx targetIdx counterIdx widthIdx : Fin n) :

          Pairwise distinct work tapes used by the bounded payload decoder.

          • source_target : sourceIdx targetIdx

            Source and target tapes are distinct.

          • source_counter : sourceIdx counterIdx

            Source and loop-counter tapes are distinct.

          • source_width : sourceIdx widthIdx

            Source and width-limit tapes are distinct.

          • target_counter : targetIdx counterIdx

            Target and loop-counter tapes are distinct.

          • target_width : targetIdx widthIdx

            Target and width-limit tapes are distinct.

          • counter_width : counterIdx widthIdx

            Counter and width-limit tapes are distinct.

          Instances For
            def Complexity.RAM.RegisterStore.Machine.wordPayloadTM {n : } (sourceIdx targetIdx counterIdx widthIdx : Fin n) :
            TM n

            Copy exactly the number of payload bits recorded on widthIdx. counterIdx is the canonical binary loop counter and targetIdx is an appendable binary prefix.

            Equations
            Instances For

              Exact transition count for a complete fixed-width payload copy.

              Equations
              Instances For

                Control states for consuming the zero separator between a word's unary width and fixed-width payload.

                Instances For
                  @[implicit_reducible]

                  WordSeparatorPhase has exactly two states.

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

                  Consume exactly one zero separator on the selected source work tape.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    def Complexity.RAM.RegisterStore.Machine.wordDecodeTM {n : } (sourceIdx targetIdx counterIdx widthIdx : Fin n) :
                    TM n

                    Decode one complete self-delimiting word by scanning its unary width, consuming the separator, and copying exactly that many payload bits.

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

                      Exact transition count for complete word decoding, including both sequential-composition seams.

                      Equations
                      Instances For

                        Linear unary-marker decoder #

                        structure Complexity.RAM.RegisterStore.Machine.LinearWordDistinct {n : } (sourceIdx targetIdx markerIdx : Fin n) :

                        Pairwise-distinct source, target, and unary-marker tapes for the optimized word decoder.

                        • source_target : sourceIdx targetIdx

                          Source and target tapes are distinct.

                        • source_marker : sourceIdx markerIdx

                          Source and marker tapes are distinct.

                        • target_marker : targetIdx markerIdx

                          Target and marker tapes are distinct.

                        Instances For

                          Control phases of the optimized self-delimiting word decoder.

                          Instances For
                            @[implicit_reducible]

                            LinearWordPhase has exactly four states.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            def Complexity.RAM.RegisterStore.Machine.wordDecodeLinearTM {n : } (sourceIdx targetIdx markerIdx : Fin n) :
                            TM n

                            Decode one unary-width/fixed-payload word in a single linear pass.

                            The prefix pass copies one unary marker per width bit. After rewinding that marker tape, the payload pass advances source, target, and marker together. This removes the old payload loop's repeated full binary-counter comparison. The marker tape starts as an empty appendable prefix and finishes containing width ones with its head on the following blank.

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

                              Exact transition count of the optimized decoder on a well-formed width width word.

                              Equations
                              Instances For