Documentation

CslibFrontier.DataStructure.Queue.WordRAM.RegisterMetadata

A physical transfer step with explicit queue count words #

The input words are front count, rear count, base, capacity and payload. The source step reads one rear-array cell, writes the next front cell, and returns updated counts as values. No count is stored in physical memory. The shared realization judgment certifies every native arithmetic and staging instruction while retaining literal whole-memory semantics.

Main definitions #

Main results #

References #

The queue and its algorithmic references are in Cslib.DataStructure.Queue.Spec.

@[reducible, inline]

Five live input words: front count, rear count, base, capacity, reserved payload.

Resident stack element counts (front and rear) threaded as register values.

  • front : ℕ

    Number of live elements in the front stack array.

  • rear : ℕ

    Number of live elements in the rear stack array.

Instances For

    Equivalence between Counts and the ordered pair (front, rear) of count words.

    One exact source transfer step; the counts are values, not cells.

    The old capacity and allocation envelope, without extra count cells or zero memory.

    @[reducible, inline]

    The two returned count words (front at 0, rear at 1), preserving the exact word layout of ℕ × ℕ.

    One emitter precedes every count, layout, width and initial memory. All native arithmetic and vector staging are charged by the memory-query budget; the body performs two queries.

    theorem Cslib.DataStructure.Queue.WordRAM.RegisterMetadata.runClient_move (w : ℕ) (d : Input) (s : Memory.State) :
    (Memory.spec w).runClient s (move d) = ({ front := d 0 + 1, rear := d 1 - 1 }, { mem := Function.update s.mem (d 2 + d 0) (s.mem (d 2 + d 3 + (d 1 - 1))), frontier := s.frontier }, [Memory.Op.read (d 2 + d 3 + (d 1 - 1)), Memory.Op.write (d 2 + d 0) (s.mem (d 2 + d 3 + (d 1 - 1)))])

    The exact source history, including the physical read and write.

    Every access is within the original two arrays, including the written value's fit.

    The literal physical-memory frame remains the old 2*C block.