Queue transfer with explicit register metadata #
Both stack counts are explicit input and result words. The source uses the existing memory programs and bounded while, writes only the original two physical arrays, and neither allocates count cells nor changes unallocated memory. The remaining rear count is the loop rank.
Main definitions #
transfer: the remaining-count loop over the shared physical transfer step.transferDomain: the old combined-capacity and physical frontier envelope.
Main results #
realizes_transfer: one native emitter before every count, layout, width and memory.realizes_transfer_standard: the same semantics on the original standard word-RAM basis.transfer_invariant: valid histories, exact two-query-per-item cost, count and memory frame.transfer_contents: the physical arrays have exactly the original reversal semantics.
References #
The queue and its algorithmic references are in Cslib.DataStructure.Queue.Spec.
Reuse the shared physical step with the current two count words.
Move the whole rear, using the explicit rear count as a sufficient ghost cutoff.
Both arrays use the old 2*C physical room; the two counts occupy registers.
The canonical tactic certifies the actual memory-query loop. Every guard and count-copy instruction is paid through the existing realization factor.
The existing defined-evaluation simulation gives the same literal memory semantics on the standard word-RAM basis used by the original queue. No overflow/underflow behavior is weakened.
Transfer is valid on arbitrary well-formed physical memory under the original room
envelope. It performs exactly two memory queries per moved element and preserves the entire
memory outside the old 2*C block. The two returned counts are the actual final counts.
The physical arrays have exactly the original transfer semantics: the reversed rear is placed on top of the front. This proof reuses the generic list-array append, prefix and frame lemmas; no machine step table or count-cell representation is introduced.