Queue methods with resident register metadata #
Both methods consume the same five live words: the two stack counts, base, capacity and the
delivered payload. Their returned vectors begin with the two updated counts. Enqueue has no
logical answer word; dequeue appends the faithful option encoding, including a distinct tag for
some 0. The memory programs write only the original two physical arrays.
Main definitions #
enqueue,popFront,dequeue: memory programs with explicit count inputs and results.enqueueDomain: spare capacity, physical room and a word-sized delivered value.
Main results #
realizes_enqueue,realizes_popFront,realizes_dequeue: uniform native method bodies.
References #
The queue and its algorithmic references are in Cslib.DataStructure.Queue.Spec.
Write the rear's next physical cell and return the two new count words. There is no echo of the delivered payload in the result.
The original queue enqueue domain, with the physical room unchanged.
An empty front returns none without a memory query. A nonempty front reads its top and returns a decremented count; the unused physical cell is retained.
The front-empty path transfers the rear before performing the original front pop.
One uniform enqueue body, with all address arithmetic, result copies and control charged.
A uniform typed pop body; the option tag is separate from its full-range word payload.
Dequeue reuses the shared remaining-count transfer and preserves the exact old room. Both
called methods enter through their own certificates, realizes_transfer and realizes_popFront.
The original standard word-RAM basis has the same checked method behavior.
Standard-basis dequeue keeps both counts and the faithful option result.
Enqueue issues exactly the physical rear write, retaining the frontier.
The spare-capacity domain admits the one physical write, including the delivered value.
Enqueue uses one memory query, independently of the capacity and existing contents.
The rear write remains inside the original two-array footprint.
Pop never changes any memory cell or the frontier, including its empty path.
Both returned counts are exact even when the unused physical top cell remains dirty.
A nonempty front performs one read; an empty front performs no memory operation.
Every nonempty front read lies in the old physical region.
Dequeue's source summary retains the actual final counts, valid physical history and frontier. The fallback performs exactly two queries per transferred element and one final read when the queue was nonempty.
At the source-memory boundary, one enqueue pays for its write and the added rear credit. Native glue and the final halt are accounted for separately by the realized dispatcher.
The actual transfer queries are paid by the initial rear credit, including a final nonempty pop. This is a source-memory bound, not a claim that native glue is free.