Decoding indexed priority-queue answers #
These equations apply the existing PQCode.decode to actual output-register values. Presence
flags may be any nonzero word; keys and handles are unshifted, and extraction retains the
decoder's handle-range check. These generic decoding equations alone imply no execution or word
bounds. For native typed calls, nativeResultCode_spec certifies an actual paid suffix that
normalizes flags and copies lookup keys to one fixed canonical result bank.
Main results #
PQCode.decode_isEmpty: decode a Boolean flag.PQCode.decode_getKey_none,PQCode.decode_getKey_some: decode an optional key.PQCode.decode_extractMin_none,PQCode.decode_extractMin_some: decode an optional typed entry.PQCode.nativeResultCode_spec: native conversion, canonical parsing, and register/memory framing.PQCode.nativeResultRecoding: preserve a checked implementation's representation and potential.
A canonical Boolean output flag decodes to that Boolean.
A zero flag decodes to an absent key, regardless of the unused key register.
A zero flag decodes to no extracted entry, even when no handle exists.
A nonzero flag with an actual in-range handle and key decodes to that typed entry.
Canonical structural result format for indexed queues. Its layout depends only on the result type: flag, then optional handle and key words.
The indexed queue's explicit canonical result type agrees definitionally with its result.
One fixed output bank: tag, handle (or the copied lookup key), and extraction key.
The original dispatch tag bits identify the completed operation. The paid conversion reads these machine words; the operation parameter only states the required precondition.
Paid result conversion: lookup copies its key to the common first payload slot, and every presence/Boolean flag is reduced to exactly zero or one by native control.
The conversion runs within eight instructions, produces the canonical observation, and preserves all memory and all registers except the two result slots it writes.
Convert a checked indexed-queue implementation to canonical native observations. The caller supplies its zero register and verifies that both output slots are outside persistent state.