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.
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
Instances For
Preserved canonical copy of the store cardinality.
Equations
- tapes.countSource = tapes.idx 10
Instances For
Canonical address supplied to this lookup.
Equations
- tapes.querySource = tapes.idx 11
Instances For
Canonical destination receiving the looked-up register value.
Equations
- tapes.destination = tapes.idx 12
Instances For
Preserved zero tape used by width-linear binary copying.
Equations
- tapes.copyScratch = tapes.idx 13
Instances For
Inequality of logical slots gives inequality of physical tapes.
Logical parent slots reset after one lookup.
Equations
- Complexity.RAM.RegisterStore.Machine.EntryLookupRestoreTapes.resetSlot slot = match ↑slot with | 0 => 1 | 1 => 2 | 2 => 3 | 3 => 4 | 4 => 5 | 5 => 6 | 6 => 8 | 7 => 7 | x => 9
Instances For
Physical reset target selected by a finite logical slot.
Equations
- tapes.resetIdx slot = tapes.idx (Complexity.RAM.RegisterStore.Machine.EntryLookupRestoreTapes.resetSlot slot)
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
- Complexity.RAM.RegisterStore.Machine.entryLookupResetWidth store address = max (List.length store).bits.length (Complexity.RAM.RegisterStore.Machine.entryLookupStoreWidth address store)
Instances For
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
Uniform scanner-head bound from a canonical cell-one start.
Equations
- Complexity.RAM.RegisterStore.Machine.entryLookupRestoreHeadBound tapes store address = 1 + Complexity.RAM.RegisterStore.Machine.entryLookupTime tapes.scan address store
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
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
Canonical precondition for one reusable loaded lookup.
- scanner : EntryScanReady tapes.scan.entry (List.flatMap Entry.encode store) [] work work
- count : (work tapes.scan.count).HasBinaryNat (List.length store)
- countSource : (work tapes.countSource).HasBinaryNat (List.length store)
- querySource : (work tapes.querySource).HasBinaryNat address
- destination : (work tapes.destination).HasBinaryNat 0
- copyScratch : (work tapes.copyScratch).HasBinaryNat 0
Instances For
Canonical precondition for a fixed-address lookup whose query source starts at zero and is restored to zero.
- scanner : EntryScanReady tapes.scan.entry (List.flatMap Entry.encode store) [] work work
- count : (work tapes.scan.count).HasBinaryNat (List.length store)
- countSource : (work tapes.countSource).HasBinaryNat (List.length store)
- querySource : (work tapes.querySource).HasBinaryNat 0
- destination : (work tapes.destination).HasBinaryNat 0
- copyScratch : (work tapes.copyScratch).HasBinaryNat 0
Instances For
Boundary after the external query has been copied into scanner storage.
- scanner : EntryScanReady tapes.scan.entry (List.flatMap Entry.encode store) address.bits work work
- count : (work tapes.scan.count).HasBinaryNat (List.length store)
- countSourceNat : (work tapes.countSource).HasBinaryNat (List.length store)
- querySourceNat : (work tapes.querySource).HasBinaryNat address
- destination : (work tapes.destination).HasBinaryNat 0
- copyScratch : (work tapes.copyScratch).HasBinaryNat 0
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
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.
- result : EntryLookupResult tapes.scan store address preparedWork work
- resetReady : EntryLookupResetReady tapes store address work
- resetHeadBound (i : Fin n) : i ∈ entryLookupResetTargets tapes → (work i).head ≤ entryLookupRestoreHeadBound tapes store address
Instances For
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
Stable semantic state carried through value rewind, value copy, scratch reset, source rewind, and count restoration.
- resetReady : EntryLookupResetReady tapes store address work
- resetHeadBound (i : Fin n) : i ∈ entryLookupResetTargets tapes → (work i).head ≤ entryLookupRestoreHeadBound tapes store address
- countSourceNat : (work tapes.countSource).HasBinaryNat (List.length store)
- querySourceNat : (work tapes.querySource).HasBinaryNat address
- copyScratchNat : (work tapes.copyScratch).HasBinaryNat 0
Instances For
The decoded value has been rewound to the canonical read boundary.
- restore : EntryLookupRestoreInvariant tapes store address initialWork work
- value : (work tapes.scan.entry.value).HasBinaryNat (read store address)
- destination : (work tapes.destination).HasBinaryNat 0
Instances For
The decoded value has been copied to the instruction operand tape while all scanner restoration data remains available.
- restore : EntryLookupRestoreInvariant tapes store address initialWork work
- value : (work tapes.scan.entry.value).HasBinaryNat (read store address)
- destination : (work tapes.destination).HasBinaryNat (read store address)
Instances For
Exact boundary after all nine scanner-owned binary tapes have been reset.
- copied : EntryLookupCopied tapes store address initialWork copiedWork
Instances For
Semantic form of the reset endpoint, stable while the encoded source is rewound.
- targetsBlank (i : Fin n) : i ∈ entryLookupResetTargets tapes → work i = TM.resetBinaryBlank
- countSourceNat : (work tapes.countSource).HasBinaryNat (List.length store)
- querySourceNat : (work tapes.querySource).HasBinaryNat address
- destination : (work tapes.destination).HasBinaryNat (read store address)
- copyScratchNat : (work tapes.copyScratch).HasBinaryNat 0
Instances For
Boundary after scanner reset and encoded-source rewind, immediately before the runtime entry count is copied back.
- scanner : EntryScanReady tapes.scan.entry (List.flatMap Entry.encode store) [] work work
- countZero : (work tapes.scan.count).HasBinaryNat 0
- countSourceNat : (work tapes.countSource).HasBinaryNat (List.length store)
- destination : (work tapes.destination).HasBinaryNat (read store address)
- copyScratchNat : (work tapes.copyScratch).HasBinaryNat 0
Instances For
Reusable endpoint after one loaded sparse-register read.
- scanner : EntryScanReady tapes.scan.entry (List.flatMap Entry.encode store) [] finalWork finalWork
- count : (finalWork tapes.scan.count).HasBinaryNat (List.length store)
- value : (finalWork tapes.destination).HasBinaryNat (read store address)
- copyScratch : (finalWork tapes.copyScratch).HasBinaryNat 0
Instances For
Reusable endpoint after reading through a tagged mutable overlay into the immutable public-input bank.
- scanner : EntryScanReady tapes.scan.entry (List.flatMap Entry.encode overlay) [] finalWork finalWork
- count : (finalWork tapes.scan.count).HasBinaryNat (List.length overlay)
- value : (finalWork tapes.destination).HasBinaryNat (DenseOverlay.read input overlay address)
- copyScratch : (finalWork tapes.copyScratch).HasBinaryNat 0
Instances For
Reusable fixed-address dense-overlay endpoint. The destination contains the decoded register value and the temporary query source is zero again.
- scanner : EntryScanReady tapes.scan.entry (List.flatMap Entry.encode overlay) [] finalWork finalWork
- count : (finalWork tapes.scan.count).HasBinaryNat (List.length overlay)
- querySource : (finalWork tapes.querySource).HasBinaryNat 0
- destination : (finalWork tapes.destination).HasBinaryNat (DenseOverlay.read input overlay address)
- copyScratch : (finalWork tapes.copyScratch).HasBinaryNat 0
Instances For
Reusable fixed-address endpoint. The destination holds the semantic read, the scanner is restored, and the fixed query source is zero again.
- scanner : EntryScanReady tapes.scan.entry (List.flatMap Entry.encode store) [] finalWork finalWork
- count : (finalWork tapes.scan.count).HasBinaryNat (List.length store)
- querySource : (finalWork tapes.querySource).HasBinaryNat 0
- destination : (finalWork tapes.destination).HasBinaryNat (read store address)
- copyScratch : (finalWork tapes.copyScratch).HasBinaryNat 0