Native realizations of the memory-oracle stack #
The certificates consume the existing Stack.Memory methods unchanged. Every field of the
runtime layout has a faithful word encoding, so the emitter is chosen before the layout's
allocation addresses and all operation arguments. The fixed public local-work allowances are
retained; realize certifies arithmetic, copies and control through shared closure rules and
a uniform native exchange factor in addition to the actual memory history.
Main definitions #
layoutWords,pushWords: faithful encodings of the complete layout and push arguments.
Main results #
realizes_size,realizes_push,realizes_pop: uniform native realizations of the existing stack methods.
The tuple word encoding of the fields of layoutWords.
All four layout fields are retained: count base/length, then items base/length.
Push arguments append the unshifted value to the complete runtime layout.
Size uses the existing count query with no additional local computation.
Push works uniformly for every runtime layout and value. The visible invariant and spare capacity discharge the address and increment fit obligations. The fixed local-work allowance remains ten; the tactic certifies all glue and control with one uniform exchange factor.
Pop returns a presence tag and unshifted payload. Its positive branch uses defined exact subtraction and performs the existing memory reads/write. All copies and branch/bind overhead are charged; the local-work allowance is 19 for either path, including the shorter empty path.
The push's explicit local work is dominated by its actual three-query memory charge.
Even the empty pop has a memory query. This domination uses the actual method history, after separately certifying all 19 units of local work, and is not a general query-only rule.