Documentation

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

Reusable sparse-register operand lookup -- definitions #

One RAM instruction may need several direct or indirect register reads. This module gives lookup a reusable phase boundary: it loads a query from a canonical source, scans the encoded store, copies out the decoded value, resets all scanner scratch, rewinds the source, and restores the runtime entry count.

Fourteen pairwise-distinct tapes for a reusable sparse operand lookup. Slots 0..9 are the bounded scanner; the final four slots preserve the entry count, supply the query, receive the value, and provide zero copy scratch.

  • idx : Fin 14Fin n

    Physical work tape assigned to each logical lookup role.

  • injective : Function.Injective self.idx

    Distinct logical lookup roles occupy distinct physical tapes.

Instances For

    Bounded scanner view of the reusable lookup assignment.

    Equations
    • tapes.scan = { entry := { idx := fun (i : Fin 9) => tapes.idx i, , injective := }, count := tapes.idx 9, count_ne := }
    Instances For

      Preserved canonical copy of the store cardinality.

      Equations
      Instances For

        Canonical address supplied to this lookup.

        Equations
        Instances For

          Canonical destination receiving the looked-up register value.

          Equations
          Instances For

            Preserved zero tape used by width-linear binary copying.

            Equations
            Instances For
              theorem Complexity.RAM.RegisterStore.Machine.EntryLookupRestoreTapes.ne {n : } (tapes : EntryLookupRestoreTapes n) {i j : Fin 14} (hne : i j) :
              tapes.idx i tapes.idx j

              Inequality of logical slots gives inequality of physical tapes.

              theorem Complexity.RAM.RegisterStore.Machine.EntryLookupRestoreTapes.scan_ne_external {n : } (tapes : EntryLookupRestoreTapes n) (slot : Fin 10) (external : Fin 4) :
              tapes.idx slot, tapes.idx external + 10,

              Every scanner tape is distinct from an external reusable-lookup role.

              Logical parent slots reset after one lookup.

              Equations
              Instances For

                Physical reset target selected by a finite logical slot.

                Equations
                Instances For

                  Scanner-owned tapes reset after copying out a lookup result. The encoded source is deliberately excluded because it is read-only and merely rewound.

                  Equations
                  Instances For

                    Width envelope for every binary scratch value at a successful hit on one entry.

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

                      Width envelope contributed by possible hit entries in a complete store.

                      Equations
                      Instances For

                        Width envelope for every hit or miss reset target in a complete store.

                        Equations
                        Instances For
                          def Complexity.RAM.RegisterStore.Machine.entryLookupFoundBits {n : } (tapes : EntryLookupRestoreTapes n) (entry : Entry) (remaining address : ) (i : Fin n) :

                          Exact reset contents at a successful lookup endpoint.

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

                            Exact reset contents at an unsuccessful lookup endpoint.

                            Equations
                            Instances For
                              @[simp]
                              theorem Complexity.RAM.RegisterStore.Machine.entryLookupFoundBits_zero {n : } (tapes : EntryLookupRestoreTapes n) (entry : Entry) (remaining address : ) :
                              entryLookupFoundBits tapes entry remaining address tapes.scan.entry.address = entry.1.bits
                              @[simp]
                              theorem Complexity.RAM.RegisterStore.Machine.entryLookupFoundBits_one {n : } (tapes : EntryLookupRestoreTapes n) (entry : Entry) (remaining address : ) :
                              entryLookupFoundBits tapes entry remaining address tapes.scan.entry.value = entry.2.bits
                              @[simp]
                              theorem Complexity.RAM.RegisterStore.Machine.entryLookupFoundBits_two {n : } (tapes : EntryLookupRestoreTapes n) (entry : Entry) (remaining address : ) :
                              entryLookupFoundBits tapes entry remaining address tapes.scan.entry.addressCounter = List.replicate (bitlen entry.1) true
                              @[simp]
                              theorem Complexity.RAM.RegisterStore.Machine.entryLookupFoundBits_three {n : } (tapes : EntryLookupRestoreTapes n) (entry : Entry) (remaining address : ) :
                              entryLookupFoundBits tapes entry remaining address tapes.scan.entry.addressWidth = []
                              @[simp]
                              theorem Complexity.RAM.RegisterStore.Machine.entryLookupFoundBits_four {n : } (tapes : EntryLookupRestoreTapes n) (entry : Entry) (remaining address : ) :
                              entryLookupFoundBits tapes entry remaining address tapes.scan.entry.valueCounter = List.replicate (bitlen entry.2) true
                              @[simp]
                              theorem Complexity.RAM.RegisterStore.Machine.entryLookupFoundBits_five {n : } (tapes : EntryLookupRestoreTapes n) (entry : Entry) (remaining address : ) :
                              entryLookupFoundBits tapes entry remaining address tapes.scan.entry.valueWidth = []
                              @[simp]
                              theorem Complexity.RAM.RegisterStore.Machine.entryLookupFoundBits_six {n : } (tapes : EntryLookupRestoreTapes n) (entry : Entry) (remaining address : ) :
                              entryLookupFoundBits tapes entry remaining address tapes.scan.entry.result = [decide (entry.1.bits = address.bits)]
                              @[simp]
                              theorem Complexity.RAM.RegisterStore.Machine.entryLookupFoundBits_seven {n : } (tapes : EntryLookupRestoreTapes n) (entry : Entry) (remaining address : ) :
                              entryLookupFoundBits tapes entry remaining address tapes.scan.entry.query = address.bits
                              @[simp]
                              theorem Complexity.RAM.RegisterStore.Machine.entryLookupFoundBits_eight {n : } (tapes : EntryLookupRestoreTapes n) (entry : Entry) (remaining address : ) :
                              entryLookupFoundBits tapes entry remaining address (tapes.idx 9) = remaining.bits
                              @[simp]
                              theorem Complexity.RAM.RegisterStore.Machine.entryLookupMissBits_other {n : } (tapes : EntryLookupRestoreTapes n) (address : ) (slot : Fin 9) (hslot : slot 7) :
                              entryLookupMissBits tapes address (tapes.resetIdx slot) = []

                              Uniform scanner-head bound from a canonical cell-one start.

                              Equations
                              Instances For

                                Reset budget obtained from the nine fixed owned targets and the common head/width envelopes.

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

                                  Restore scanner scratch, source cursor, and runtime count after a completed lookup whose value has already been copied out.

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

                                    Copy out a lookup result, then restore the complete reusable scanner ABI.

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

                                      Load the supplied query, perform one sparse lookup, copy out its value, and return to the same reusable blank-query scanner boundary.

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

                                        Time bound for scanner reset, source rewind, and count restoration.

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

                                          Time bound after the query has been prepared.

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

                                            Complete reusable loaded-lookup time bound.

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

                                              Read a positive-tag sparse overlay and either decode the tag or fall back to the immutable public-input bank on a sparse miss.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                def Complexity.RAM.RegisterStore.Machine.denseOverlayLookupTime {n : } (tapes : EntryLookupRestoreTapes n) (inputLength : ) (overlay : Store) (address : ) :

                                                Complete reusable dense-overlay lookup budget.

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

                                                  Load one fixed address from canonical zero, read through the dense input and sparse overlay, then clear the fixed-address source back to zero.

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

                                                    Complete fixed-address dense-overlay lookup budget.

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

                                                      Load one fixed address from canonical zero, run a reusable lookup, then clear the fixed-address source back to zero.

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

                                                        Complete fixed-address lookup budget.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          structure Complexity.RAM.RegisterStore.Machine.EntryLookupRestoreReady {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (work : Fin nTape) :

                                                          Canonical precondition for one reusable loaded lookup.

                                                          Instances For

                                                            Canonical precondition for a fixed-address lookup whose query source starts at zero and is restored to zero.

                                                            Instances For
                                                              structure Complexity.RAM.RegisterStore.Machine.EntryLookupPrepared {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (initialWork work : Fin nTape) :

                                                              Boundary after the external query has been copied into scanner storage.

                                                              Instances For

                                                                Uniform cleanup certificate extracted from either scanner outcome.

                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  structure Complexity.RAM.RegisterStore.Machine.EntryLookupScanned {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (initialWork preparedWork work : Fin nTape) :

                                                                  Boundary after the bounded scanner has produced a semantic lookup result. It retains the exact cleanup certificate, the read-only source image, a uniform cursor bound, and the complete external frame needed by restoration.

                                                                  Instances For
                                                                    def Complexity.RAM.RegisterStore.Machine.EntryLookupScannedReady {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (initialWork work : Fin nTape) :

                                                                    Existentially packages the concrete prepared work family between query copying and scanning, so subsequent phases can use a semantic Hoare boundary.

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For
                                                                      structure Complexity.RAM.RegisterStore.Machine.EntryLookupRestoreInvariant {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (initialWork work : Fin nTape) :

                                                                      Stable semantic state carried through value rewind, value copy, scratch reset, source rewind, and count restoration.

                                                                      Instances For
                                                                        structure Complexity.RAM.RegisterStore.Machine.EntryLookupValueReady {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (initialWork work : Fin nTape) :

                                                                        The decoded value has been rewound to the canonical read boundary.

                                                                        Instances For
                                                                          structure Complexity.RAM.RegisterStore.Machine.EntryLookupCopied {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (initialWork work : Fin nTape) :

                                                                          The decoded value has been copied to the instruction operand tape while all scanner restoration data remains available.

                                                                          Instances For
                                                                            structure Complexity.RAM.RegisterStore.Machine.EntryLookupResetDone {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (initialWork copiedWork work : Fin nTape) :

                                                                            Exact boundary after all nine scanner-owned binary tapes have been reset.

                                                                            Instances For
                                                                              structure Complexity.RAM.RegisterStore.Machine.EntryLookupScratchReset {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (initialWork work : Fin nTape) :

                                                                              Semantic form of the reset endpoint, stable while the encoded source is rewound.

                                                                              Instances For
                                                                                structure Complexity.RAM.RegisterStore.Machine.EntryLookupSourceReady {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (initialWork work : Fin nTape) :

                                                                                Boundary after scanner reset and encoded-source rewind, immediately before the runtime entry count is copied back.

                                                                                Instances For
                                                                                  structure Complexity.RAM.RegisterStore.Machine.EntryLookupRestoreResult {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (initialWork finalWork : Fin nTape) :

                                                                                  Reusable endpoint after one loaded sparse-register read.

                                                                                  Instances For
                                                                                    structure Complexity.RAM.RegisterStore.Machine.DenseOverlayLookupResult {n : } (tapes : EntryLookupRestoreTapes n) (input : List Bool) (overlay : Store) (address : ) (initialWork finalWork : Fin nTape) :

                                                                                    Reusable endpoint after reading through a tagged mutable overlay into the immutable public-input bank.

                                                                                    Instances For
                                                                                      structure Complexity.RAM.RegisterStore.Machine.DenseOverlayLookupStaticResult {n : } (tapes : EntryLookupRestoreTapes n) (input : List Bool) (overlay : Store) (address : ) (initialWork finalWork : Fin nTape) :

                                                                                      Reusable fixed-address dense-overlay endpoint. The destination contains the decoded register value and the temporary query source is zero again.

                                                                                      Instances For
                                                                                        structure Complexity.RAM.RegisterStore.Machine.EntryLookupStaticResult {n : } (tapes : EntryLookupRestoreTapes n) (store : Store) (address : ) (initialWork finalWork : Fin nTape) :

                                                                                        Reusable fixed-address endpoint. The destination holds the semantic read, the scanner is restored, and the fixed query source is zero again.

                                                                                        Instances For